OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # }" `$ L9 v* }8 m0 z$ h
  1. [code]EDMA sample test application( N, u$ M+ ?/ E3 u& A+ ^7 b
  2. /*
    * r, E+ o' S( q7 [
  3. * edma_test.c8 V" E9 X2 J- g* @6 {* ~
  4. *8 k& q) t. K9 k  ~$ X
  5. * brief  EDMA3 Test Application+ S- y2 m# O, e) K. W; c" D
  6. *
    ; r2 c% w( Y) M
  7. *   This file contains EDMA3 Test code.
    ( Q" a* U0 e8 j7 V& X
  8. *
    * r5 Z' U8 H* K' n8 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 L8 }2 k! s7 F' f& V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 I3 _. E: k/ D- L* ?' @% o% O
  11. *         TO CHANGE.
    : x% \; @) I9 m- m; n
  12. *8 z, q" O9 Y$ L" Z, _- }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ F$ G! u& x7 D0 M9 o
  14. *' {7 w( R, `& ~/ n
  15. * This program is free software; you can redistribute it and/or! B0 v9 D8 P3 i: S; \% }+ B
  16. * modify it under the terms of the GNU General Public License as
    9 r) K9 h- p7 @
  17. * published by the Free Software Foundation version 2.
    $ o" V2 [; `0 L1 R3 i
  18. *3 c" f: k0 {$ E& y3 D. Y, g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; y/ J( V( K1 V7 U
  20. * kind, whether express or implied; without even the implied warranty
    - s. j" h# n' n& q' \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. X4 ], i. M% [
  22. * GNU General Public License for more details.
    7 w" c' R7 o2 S* U& H6 c. u
  23. */
    + [, c6 D5 A1 G) D0 O: I

  24. + n! @8 n  Q$ l+ E' e
  25. #include <linux/module.h>
    / K0 x* V7 p; K8 q
  26. #include <linux/init.h>  d2 f' I7 z8 H
  27. #include <linux/errno.h>- L/ O$ p9 U, U) W
  28. #include <linux/types.h>
    3 ?* v8 b3 X, L0 t* l$ E/ g. w) S
  29. #include <linux/interrupt.h>: u5 _4 C2 R# g4 l
  30. #include <asm/io.h>) W1 C, U+ n8 x. Z2 f
  31. #include <linux/moduleparam.h>% |: l" D1 y- w8 U6 \
  32. #include <linux/sysctl.h>* Q$ m% D: f; Y" k* t
  33. #include <linux/mm.h>) y5 x2 |* @* t6 m# ?! c
  34. #include <linux/dma-mapping.h>  M, m8 {/ T. ?1 ?: N7 Y# Y! ~
  35. 9 I6 G% l& ]! s3 ]
  36. #include <mach/memory.h>4 r( W: [1 [5 C. l8 Y3 B8 y' h
  37. #include <mach/hardware.h>9 j( @4 S" I, ]& ^* ~. |6 }
  38. #include <mach/irqs.h>
    3 f- B9 ?) }5 b8 D2 _, c) }
  39. #include <asm/hardware/edma.h>8 W3 t1 e) w. U. N; F- `" w

  40. % G/ ]  ?3 r/ D2 D
  41. #undef EDMA3_DEBUG1 l  \3 N$ l+ x# u( J" a) k
  42. /*#define EDMA3_DEBUG*/
    % t" U+ l* m  d9 ~' f9 b9 k  _
  43. ' d0 f: @" }1 F" ?. U
  44. #ifdef EDMA3_DEBUG
    & \0 x$ A, A& J: M- j7 `! Q) L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ f: s9 T9 R, f0 S+ V: a( E# x3 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * h; }! U2 W  E5 X) K  T7 V9 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 C0 I/ Y+ `# L9 P1 ?
  48. #else5 s) a) H# |' o6 |6 R; a
  49. #define DMA_PRINTK( x... )
    ; {2 f+ `4 f) _: E2 j* ]
  50. #define DMA_FN_IN
    7 v0 K/ X* N: c4 G7 {
  51. #define DMA_FN_OUT$ w# b, r# L; y. _( s" ^+ W5 s
  52. #endif
    ' s& M  r3 E9 ], i8 o
  53. ! P1 _* t/ j0 f4 E6 d2 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : i4 ^; c. n1 A
  55. #define STATIC_SHIFT                30 R% x3 o- K# @7 M5 K
  56. #define TCINTEN_SHIFT               206 M6 E. I; P- R# r0 `4 S- U
  57. #define ITCINTEN_SHIFT              21
    ( X2 d; j" R6 K4 ]. a8 Z( \
  58. #define TCCHEN_SHIFT                22
    ( w$ q  `( S- K) N& H
  59. #define ITCCHEN_SHIFT               23
    7 ?* `* [4 X5 o" h+ E

  60. ( z7 Q8 V7 d* H' L( o) m
  61. static volatile int irqraised1 = 0;/ a# u, v2 K# }9 `8 n- q
  62. static volatile int irqraised2 = 0;
    0 S& X  W) C  g2 Z1 w# _& `/ E

  63. # f* l4 ]! ^3 A  `' ~' m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 I( C* w& k( N3 E  U" G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! X0 U9 ^. i4 I+ T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 R4 `5 E  H9 N* a4 }$ J

  67. " m2 s  I0 V( ^$ K5 f
  68. dma_addr_t dmaphyssrc1 = 0;
    4 w) M, R, x* n) z1 {' K0 l) X" W
  69. dma_addr_t dmaphyssrc2 = 0;. u7 q8 R  ]2 ]: b: S' c
  70. dma_addr_t dmaphysdest1 = 0;: G/ v1 N8 `# i6 N3 N
  71. dma_addr_t dmaphysdest2 = 0;
    % k" d% f3 Z4 _3 m
  72. 1 j8 H  J2 {& Z# L* u6 L1 q
  73. char *dmabufsrc1 = NULL;
    ' g- l- ]; b7 n1 T) [
  74. char *dmabufsrc2 = NULL;
    ; R: G: J/ z* z2 X1 v0 f2 A( W
  75. char *dmabufdest1 = NULL;
    " z9 U' Z9 s$ K( o
  76. char *dmabufdest2 = NULL;
    & [# Q1 C* U5 }8 W/ {

  77. " [/ e* x' l& o
  78. static int acnt = 512;
      w  W+ X5 g2 ~! P4 m
  79. static int bcnt = 8;
    % V, Y$ _1 @0 A+ y- s& N' a" V! i
  80. static int ccnt = 8;: h: v4 W& Q0 Z, n) R1 B3 Q* n
  81. % [2 }  \. A0 ]  I
  82. module_param(acnt, int, S_IRUGO);
    & L% m& ^6 `. s  z* N4 P
  83. module_param(bcnt, int, S_IRUGO);% c- b8 Y6 \% c1 ^( I- z6 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) L* |5 u! @) i/ I/ P9 |: Y" x$ N
' j8 P- }) V  R4 Q  Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- W) f$ I/ M5 w* varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 e  E" `( T: S0 W) z* K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' s7 W* C" X) e4 a
/ z, R; v" t9 J( m: y; u
( M8 U0 g  j" N% Y( b( q; f9 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 15:49 , Processed in 0.038306 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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