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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # l+ U7 [$ t( c: B" d7 ?: O. G& \
  1. [code]EDMA sample test application  f: x0 X; H( R! ~* \) D& w" ?
  2. /*
    7 Z& R, n7 l8 h! M5 R0 y6 t4 r, r2 c
  3. * edma_test.c# _$ x; U: R. E  P2 |
  4. *
    ! H9 e& `; ]2 t
  5. * brief  EDMA3 Test Application
    4 b  n' {  I- T( \) T) S# Z
  6. *9 _8 }6 u# u; @; H$ X4 j
  7. *   This file contains EDMA3 Test code.0 I; F$ e8 o( O
  8. *+ v/ [( \8 ?! b& [6 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ?  i! S! Y5 E( U/ z5 p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 @/ H' Y7 D6 W: i+ Y8 G& T
  11. *         TO CHANGE.
    * h8 z* j: ]% M7 T3 I, c
  12. *
    + Z1 `: h' D' y7 `  J1 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 O. O( P9 P% f1 F, x* K
  14. *3 _1 k( u( D7 o
  15. * This program is free software; you can redistribute it and/or! u/ x& @5 K3 }& O1 j8 B6 s' }
  16. * modify it under the terms of the GNU General Public License as5 X: s. i" K& Q% K$ j' V
  17. * published by the Free Software Foundation version 2./ V% S& x1 e8 p+ a
  18. *
    ) m& e/ E+ {; m) Z: K% ~$ k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( ~: i4 ^" \6 Q
  20. * kind, whether express or implied; without even the implied warranty' T5 `2 e& E3 m3 i! [( a4 T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " B" _5 ^1 u; [$ c( T
  22. * GNU General Public License for more details.
    ! D0 n8 R; A# f( N
  23. */  i/ P7 P& y: i: d2 y% {8 {
  24. , w/ P9 o" }: a
  25. #include <linux/module.h>
    ( u3 J  X0 u$ N, ~4 G5 ]6 K
  26. #include <linux/init.h>
    7 z; u. l# G7 [7 H8 Y
  27. #include <linux/errno.h>
    ' M9 V- T0 L3 [2 e$ z- A3 I
  28. #include <linux/types.h>8 C" R& m9 S2 [7 ]
  29. #include <linux/interrupt.h>
    8 b' |: g* y) j2 y- v
  30. #include <asm/io.h>
    # p7 @# V* c3 }2 {; b1 j$ }" Z
  31. #include <linux/moduleparam.h>( {, N7 P6 i1 g% ?2 `
  32. #include <linux/sysctl.h>- P* c2 P( c$ G9 k0 b# b- J
  33. #include <linux/mm.h>
    / d% j% X# {. F% p  s6 m
  34. #include <linux/dma-mapping.h>
    " ?' |: F# k( I8 E* T
  35. 8 Z# X: d* G1 S0 z; F$ Q
  36. #include <mach/memory.h>3 {5 B% E- q/ g2 G6 Q; |( n* D
  37. #include <mach/hardware.h>
    * g) s2 t# O  t) `+ a% A
  38. #include <mach/irqs.h>% L- c' F) ?- ^, D% D) Y) T: x* i
  39. #include <asm/hardware/edma.h>
    + V( {0 e! ?$ p5 D7 A

  40. 5 G) Z, E3 ~: Z. J2 j/ }9 z
  41. #undef EDMA3_DEBUG# g  R! E7 M0 }$ \8 R) k( O
  42. /*#define EDMA3_DEBUG*/
    4 H$ Q6 X5 \  `, h! P6 ]

  43. ( Y) q4 h! ^5 C: X1 E1 D5 k
  44. #ifdef EDMA3_DEBUG" F! r. H# U0 \# P( w; k4 O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% `! C5 S( t) {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 T1 p4 Y6 j3 l1 i$ j* c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 O" A+ x" C0 G1 X1 q; ^: j1 T! h
  48. #else. J8 e+ ^- [* ~; v9 k0 b8 A
  49. #define DMA_PRINTK( x... )
    ; E: n8 w: R* {1 }: ^8 h
  50. #define DMA_FN_IN' f* K( t3 O( V, A* Y/ d; L
  51. #define DMA_FN_OUT# K" Z- l: Z9 [+ M* U
  52. #endif
      S; \  W) T7 N) ^8 b3 Y: Q) [9 X

  53. 8 _: L3 E" m; U; }7 S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 W4 N% ^6 |& [: K
  55. #define STATIC_SHIFT                3: u* C% u3 t7 L' W/ S# q6 v
  56. #define TCINTEN_SHIFT               20* U4 D" s2 T4 U$ L  b5 `
  57. #define ITCINTEN_SHIFT              213 B. Q8 [/ H, S3 j
  58. #define TCCHEN_SHIFT                22( ^- k2 O/ d6 E) }6 Z0 z4 v
  59. #define ITCCHEN_SHIFT               23
    $ q8 ^7 y8 D' G) t- u

  60. 0 q6 Z5 L0 r) ^5 V8 y
  61. static volatile int irqraised1 = 0;
    * x% i9 _% _# M
  62. static volatile int irqraised2 = 0;
    . Y, Y' H4 H% w
  63. . o4 U3 B4 W* N6 V* G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 P, O/ _  z$ |& t* Q! ]4 u! ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # L) C! L; k- X( R& D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 e) f" q; {% Z0 U% S( s$ C$ p
  67. - x$ A9 ]! B! o
  68. dma_addr_t dmaphyssrc1 = 0;
    7 q/ A! s9 \7 r8 u% r
  69. dma_addr_t dmaphyssrc2 = 0;
    , n( l/ g1 }% n; Y' ~. T4 N- s
  70. dma_addr_t dmaphysdest1 = 0;
    ( }& ^! K9 y, i+ q$ U; U: b
  71. dma_addr_t dmaphysdest2 = 0;  ]& ]/ g0 l6 A  S$ A

  72. 7 }( P: `% v9 E7 |( d
  73. char *dmabufsrc1 = NULL;
    & ~5 f1 T/ c" ^
  74. char *dmabufsrc2 = NULL;2 D3 W6 E0 B/ h; d
  75. char *dmabufdest1 = NULL;
    - S4 ~+ a" H: F1 p8 `
  76. char *dmabufdest2 = NULL;
    ; e' h1 c6 N* O, M+ p- x* D& P  C& n
  77. ) @+ y9 e5 }6 Q! V1 C. b, y! n
  78. static int acnt = 512;
    % b, h) r0 L7 Y+ A5 u2 _  E& H! q
  79. static int bcnt = 8;: A, ~- B' R( [$ g
  80. static int ccnt = 8;
    4 O* b; c$ Y- e

  81. + ?4 X, ^. S9 _0 C$ d) d
  82. module_param(acnt, int, S_IRUGO);
    $ Y- l& o( F0 j% {8 k$ t
  83. module_param(bcnt, int, S_IRUGO);
    ( v- C" n  i* m2 ^3 x/ a7 q6 ~- w" [7 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ H* n/ A. {+ j" m
& m! D: ^6 ^, }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 W% O  k# ~2 \- ?( zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; ]% E* l; U" r2 o/ V% @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 U$ L& H5 V2 h+ B6 |0 k% Q2 A

4 d6 C- `) H" c/ l" V8 x: z2 z2 ~) I% i6 k+ Q( U( y) _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 17:19 , Processed in 0.040603 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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