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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) L3 a7 O; a) Z9 H5 e
  1. [code]EDMA sample test application% j, f0 i) m* m5 z2 H
  2. /*/ j4 I: Q8 H8 ]- B, i
  3. * edma_test.c3 b+ O6 _/ P. ~* e- v: k
  4. *' h7 {; F9 V- V, [
  5. * brief  EDMA3 Test Application% }2 `+ L4 m. \) x) A- \
  6. *( W5 q3 V$ E, i6 D! \
  7. *   This file contains EDMA3 Test code.
    + @+ w- u# I/ n  y2 q3 q
  8. *
    ) _, b5 S, a& c+ Z8 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 K* J: F3 E/ a8 @1 v/ P6 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) k: U. R6 w; O% S6 E& p
  11. *         TO CHANGE.
    8 \$ V% G' x9 r. t/ i$ L( R! p. t2 u
  12. *
    * S5 f" |+ m) Z6 `/ n" X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% ?) Y7 D. H- @3 g" ~; W0 A- H
  14. *" T8 q8 T. l5 M3 E0 `  Y
  15. * This program is free software; you can redistribute it and/or
    - x6 ~: Y0 ?, }* e0 B8 O
  16. * modify it under the terms of the GNU General Public License as& `( u& T$ T# g: Q3 m
  17. * published by the Free Software Foundation version 2.
    / f: O! a* @5 o* i9 f' z
  18. *
    2 W% K/ s1 n& B8 c) r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 z0 b2 Q$ N. F3 Q- B% r6 }" y. v
  20. * kind, whether express or implied; without even the implied warranty
    ' Q% \3 q- n* o' N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* ?# d3 M: S& n/ Y' F1 B
  22. * GNU General Public License for more details.
    + V: f3 L7 f5 O( y4 z$ p  V
  23. */, {: B3 A8 K8 b: c. U7 Q% J$ M

  24. " m6 q* C; C4 e$ k1 c8 N/ N
  25. #include <linux/module.h>' b- w6 Z' m( _
  26. #include <linux/init.h>
    + S5 V4 u, E& M2 p3 z  o
  27. #include <linux/errno.h>( _' h) ~, D2 f4 t# Y* E8 \
  28. #include <linux/types.h>
    5 E; V% n, r0 ]2 t, A; Y- @- _
  29. #include <linux/interrupt.h>
    + L7 o3 s0 |; Y8 p
  30. #include <asm/io.h>5 D: H% t8 E8 J/ J
  31. #include <linux/moduleparam.h>9 W/ O* j- ~# k& G/ O: r2 l
  32. #include <linux/sysctl.h>' C$ }, O) O' l" F8 p- |
  33. #include <linux/mm.h>9 Y, i5 R! X" o% m& D) h
  34. #include <linux/dma-mapping.h>) n" P6 C5 @, Z5 J3 ]6 z  _
  35. * e- s" x6 `4 {
  36. #include <mach/memory.h>9 p  x& Y: V+ Y& q5 z1 V) d! v+ }& o' H
  37. #include <mach/hardware.h>6 Y. \7 U3 k1 [9 p! y
  38. #include <mach/irqs.h>
    ) `7 s* t9 k9 G. I* r
  39. #include <asm/hardware/edma.h>  }# r8 F# I% [
  40. 0 h, U* p7 ~& O5 l
  41. #undef EDMA3_DEBUG
    ( S3 L6 Q, ?' D$ J
  42. /*#define EDMA3_DEBUG*/" M7 V& M' Y0 H* U$ w% U

  43. - ^. r+ t6 O# ?/ a
  44. #ifdef EDMA3_DEBUG9 `! T+ {* c( J& r( a, J  M& U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      e3 l, Q$ S+ M( q5 k+ O: L7 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 K! z% F4 \9 q3 M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / @7 e" \5 l+ e4 @) L
  48. #else
    # B( |1 o) x0 ^" @
  49. #define DMA_PRINTK( x... )
    . J7 k; j# f0 X. J  U
  50. #define DMA_FN_IN
    ( j: ^) Z- F, o/ T) ^6 B
  51. #define DMA_FN_OUT
    / D" h/ Q( n% ]9 F7 n8 V! m  Q
  52. #endif
    1 H; M3 J' v! ]; t9 C; a, g
  53. : k1 U/ C+ R, h. m0 A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( u: J8 X9 T8 v" E- m1 [
  55. #define STATIC_SHIFT                3
    - w( m( h3 F9 {5 n
  56. #define TCINTEN_SHIFT               20
    & s; Q3 [8 o- C4 {5 Y3 J
  57. #define ITCINTEN_SHIFT              21
    . [. q: a6 D# x( j0 B
  58. #define TCCHEN_SHIFT                22
    0 b) S2 a4 F6 d4 Q
  59. #define ITCCHEN_SHIFT               23
    2 |& [) \# ^1 x$ a/ c: m
  60. & |# E; C3 s4 Y
  61. static volatile int irqraised1 = 0;
    / q3 t  i8 P. {% Y& ~8 f
  62. static volatile int irqraised2 = 0;" k- W/ @" B: @, i& d! Z
  63. 0 n; x6 K. M, Y2 x4 c# T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 \! Q3 p* J: H  p& U, G3 \2 X8 N  B# J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 L0 m$ _5 A( t& \- \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ }8 V, I7 ]9 u% \- E: K- v+ l
  67. 4 f6 V. z" a& L# T, O+ u
  68. dma_addr_t dmaphyssrc1 = 0;
    4 V3 P9 j$ v' W7 B" D
  69. dma_addr_t dmaphyssrc2 = 0;( v0 z" W* r; g) s! |- R0 p' j
  70. dma_addr_t dmaphysdest1 = 0;
    & O+ H+ Y0 ?! m# @7 a6 A( ^9 F, `
  71. dma_addr_t dmaphysdest2 = 0;
    5 y/ @2 ?- a0 G; k

  72. 7 t: p1 Y% N" K: M# n
  73. char *dmabufsrc1 = NULL;
    1 u: q5 K, Q' {8 l* B
  74. char *dmabufsrc2 = NULL;
    - q8 g# V7 F  h7 A9 V/ w
  75. char *dmabufdest1 = NULL;- J5 i! I3 Z1 J3 [
  76. char *dmabufdest2 = NULL;
    ) b+ d. x8 ?+ S. K+ }* O2 \
  77. 1 V8 j4 R2 n4 t  K1 V6 b8 F
  78. static int acnt = 512;
    0 }* p' g9 D) b/ j; p+ h9 ?
  79. static int bcnt = 8;
    1 ?; ]$ r) |4 P+ e3 [
  80. static int ccnt = 8;
    8 }6 M, q. o# F* K% H- h
  81. 6 R$ C' X: I2 E) \1 G! p
  82. module_param(acnt, int, S_IRUGO);
    5 `8 N8 a% w" C) ?- i
  83. module_param(bcnt, int, S_IRUGO);
      W8 E1 m2 ^; J/ a; `5 a; O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# Y3 V9 S- a8 S

% m7 E) O* n: i8 X: }  U0 v" W+ Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 _/ S  R! C8 N. u+ S" B. {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 Y# V: n  s& j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: A5 o, ~3 e! E+ P  ~
1 g0 h' H- _" h2 {- U9 ]8 `

) Z6 o1 f5 @2 C* J, R$ w& l, N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-13 13:11 , Processed in 0.037615 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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