OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 11063|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* o. p" e% b& k7 y. w7 O
  1. [code]EDMA sample test application
    6 X# L/ \( S# r; I$ z/ I
  2. /*3 Z6 O; D% d; s
  3. * edma_test.c
    $ U5 H& k, l) y( C2 `; Q
  4. *2 \0 d3 B9 _$ q% I+ v8 M
  5. * brief  EDMA3 Test Application
    1 g/ }7 L: v6 i" N2 o3 F' V
  6. *
    4 c( O# W/ q- w4 o9 a& {& N, Y
  7. *   This file contains EDMA3 Test code.) b& h1 p4 |8 E. t' B; j
  8. *4 e! \6 B+ `( r" n$ h" A- p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( Y$ Q" M3 x' {  K- `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ J4 L$ K! C! a3 K7 f
  11. *         TO CHANGE.- O9 H- e. u3 G
  12. *
    - V5 y% q- X0 m/ S  N4 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' D; q3 L; Y* [
  14. *( {9 Q9 b0 n6 S3 R+ G
  15. * This program is free software; you can redistribute it and/or
    # g' S7 ^1 M4 u! g8 ~  \
  16. * modify it under the terms of the GNU General Public License as
      Y9 ^* U+ r4 q; C6 N
  17. * published by the Free Software Foundation version 2.
    7 {: t9 H4 Z, A1 `9 _
  18. *! B8 i6 n& Y; E- ]6 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , r& [" X7 U7 v2 d+ C, k& u1 S
  20. * kind, whether express or implied; without even the implied warranty  I, N$ a/ x8 j0 ?5 ?' b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% m3 T" ^: e) ^; i6 |4 ]5 C+ Q2 l9 M
  22. * GNU General Public License for more details.
    6 a9 ]: `, V9 J0 J% `5 p' a6 \6 _( k
  23. */
    , M% u! q; p& c) M) l' m! O; v

  24. 7 q* n' U; T: I% Z; I7 P. ?
  25. #include <linux/module.h>
    $ |" b% s. R1 Y; O7 w; o
  26. #include <linux/init.h>& z2 G  A$ B5 P; \
  27. #include <linux/errno.h>
    3 ?# C; a  C. J
  28. #include <linux/types.h>$ V5 o+ m: L2 ~, S3 @4 ^* j. w
  29. #include <linux/interrupt.h>' Z( _  B. q9 {2 a
  30. #include <asm/io.h>1 ~3 Q7 W' |. }" ]  u6 b
  31. #include <linux/moduleparam.h>
    % \) `0 k$ B5 h+ h7 s+ N
  32. #include <linux/sysctl.h>8 O- \2 Q  \8 b3 v; T' F. x
  33. #include <linux/mm.h>
    % C. `& u3 P: |; i4 a2 }4 {
  34. #include <linux/dma-mapping.h>
    5 m* Y; R8 ?* P9 R
  35. + Z  n$ p& U" c7 i" Z7 w* l  q
  36. #include <mach/memory.h>
    ; s9 Z1 a# a* j
  37. #include <mach/hardware.h>9 V# _1 B2 e- w5 r( ^! Y
  38. #include <mach/irqs.h># I. m/ v5 Y* z
  39. #include <asm/hardware/edma.h>$ R; Y# N6 D" s- Z. V8 k

  40. 6 |, d6 g" p: R5 v3 L6 k3 B& c: g* H
  41. #undef EDMA3_DEBUG6 z- F1 ?' G& B  K9 y2 q. u4 V$ y
  42. /*#define EDMA3_DEBUG*/
      h& i4 c% {0 S- r9 e9 u
  43. # J! i1 r( ?6 a- X
  44. #ifdef EDMA3_DEBUG
    4 B1 Y& p$ P' u0 x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 Z* n) G$ @" G' ^6 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 P" K0 R* y$ r! E3 M8 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      Z4 L2 V; J6 W& U
  48. #else
    1 {6 \- ~! {7 B
  49. #define DMA_PRINTK( x... ), J, q; K: f% b
  50. #define DMA_FN_IN
    5 S8 Z9 P; j! a/ [% r# V( B
  51. #define DMA_FN_OUT
    " ~6 T/ `- e& A1 x
  52. #endif
    + N/ A4 Z+ L6 w
  53. 7 [( ~, w) X$ s9 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 w7 ?8 f4 N: j% G* @# R( R
  55. #define STATIC_SHIFT                32 g9 e; T4 S  A) i2 c/ z7 p( {! \
  56. #define TCINTEN_SHIFT               20! e# p+ @! x1 M% `+ P$ E
  57. #define ITCINTEN_SHIFT              21, O1 x0 G) d' C  ]
  58. #define TCCHEN_SHIFT                22! }- W6 b8 ]- j- C( Q
  59. #define ITCCHEN_SHIFT               23
    % B# z+ b' e3 X7 p  B" l
  60. - ?4 i9 {2 p4 X# w( ]! \
  61. static volatile int irqraised1 = 0;/ C" j: m0 a# {* I
  62. static volatile int irqraised2 = 0;1 g) _. r" \& t
  63. 1 C5 R' u+ E, ?# m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 j' W( r9 W# E8 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      k& v* q+ P$ U0 Z8 C4 h, s1 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; o/ h& ^) Q2 ]  O. {6 `7 C# A
  67. 5 A& m" ?3 V! X) ~- l& u
  68. dma_addr_t dmaphyssrc1 = 0;8 X- I# a) N8 |; [/ g
  69. dma_addr_t dmaphyssrc2 = 0;2 ?3 F& c' K1 B' ^: m
  70. dma_addr_t dmaphysdest1 = 0;) `: U# T- _. N/ R( P; F5 q
  71. dma_addr_t dmaphysdest2 = 0;
    ! @0 K& y! l/ g" C; S

  72. & W! q3 ?( W" x5 f9 _. g; ~
  73. char *dmabufsrc1 = NULL;% s/ B: P) Q6 D8 ^
  74. char *dmabufsrc2 = NULL;1 T6 V1 D: r7 u, t4 I
  75. char *dmabufdest1 = NULL;
    2 D) g/ O  i8 O& X, }
  76. char *dmabufdest2 = NULL;
    3 f* \( g  c  W& @& s$ q4 t
  77. , K* A% v- ^* V/ Z3 D
  78. static int acnt = 512;
    7 [% n" {4 F6 P/ d" p# ]! Q
  79. static int bcnt = 8;" l  m, P+ p/ p2 L0 m1 _
  80. static int ccnt = 8;  T# Y9 j- o% h1 X5 D: T& U

  81. 6 l5 U' a9 Y: X2 K
  82. module_param(acnt, int, S_IRUGO);" N( Q3 C9 P' o6 z; j) y, }3 r9 T
  83. module_param(bcnt, int, S_IRUGO);
    - ^3 `2 `6 g. I' }" r8 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 p$ ~  H; g4 i4 |0 Z1 R; f+ P
/ ]% h, o: w1 I1 s2 k" X- q, S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 B6 ^: B9 `% j
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 `9 U1 O/ C+ E3 d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" o. a/ t1 ~# G) U- q* R- P

+ M+ P0 I% E( m( `
; n/ H. G1 A5 d% @* P( G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-2-6 19:45 , Processed in 0.039885 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表