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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 }# |& s+ [3 \
  1. [code]EDMA sample test application
    - t3 t4 \; y/ ]0 s7 W6 P1 D2 l
  2. /*
    2 c" L' p9 }& e' a$ F/ a- S
  3. * edma_test.c
      K* B' o3 g+ R* ^" y. Q) e
  4. *' W& `: ]4 A$ M  U# l: `4 w5 l
  5. * brief  EDMA3 Test Application
    3 ~* K* _5 E* M* H4 c, y7 R" F) w
  6. *
    ) f3 F5 p* W7 I" r7 W1 u8 c1 j+ a
  7. *   This file contains EDMA3 Test code.
    1 s8 ?. D. B" O% I7 \. y
  8. *1 i, m/ X5 F% X$ X8 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 w4 ~  X1 J2 S& q% ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ v+ b$ n0 i; e- `
  11. *         TO CHANGE.7 r1 w7 g4 S4 k! |9 ]) q% n4 H
  12. *1 O2 T0 |$ F4 w: z5 D* m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : K) [  C8 w" k# D
  14. *
    : u: D; m8 G  \" o
  15. * This program is free software; you can redistribute it and/or
    5 g# b6 a- Q* l0 M# r1 D
  16. * modify it under the terms of the GNU General Public License as
    6 o$ S. G/ a1 @3 F8 U2 j# Z
  17. * published by the Free Software Foundation version 2.# M# G+ o. ]/ J4 h3 h
  18. *) \1 c# Y/ G: C- s; b- }1 R2 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  l4 [7 C2 p  w, E# U" N3 G6 N
  20. * kind, whether express or implied; without even the implied warranty
    # v: M( A, g( p3 v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : s  s( \$ I6 T
  22. * GNU General Public License for more details.
    ; }3 E3 R; C! ]  O0 q0 [
  23. */
    3 A- F/ ?# Z6 Q* U4 C6 O# A
  24. : e0 Z4 h* }- O* _6 C6 X& @, n
  25. #include <linux/module.h>
    4 t* h: h; @! _- ~( X
  26. #include <linux/init.h>' r. N  o8 m# A4 m) V4 ^$ q
  27. #include <linux/errno.h>% V8 |; \  g3 {3 Y' u: e
  28. #include <linux/types.h>5 R- r5 r% b1 r. Y3 \0 s. m
  29. #include <linux/interrupt.h>$ x' ~' ~: {4 E: y" l: {
  30. #include <asm/io.h>
    5 r+ s- |  I; o8 k. S0 M, U/ N
  31. #include <linux/moduleparam.h>
    * }+ r+ c; \* {; I4 @
  32. #include <linux/sysctl.h>
    ( S: X+ I6 ?8 v1 T+ ^" a1 N
  33. #include <linux/mm.h>
    3 m4 B" O5 e- h$ Z6 A
  34. #include <linux/dma-mapping.h>
    & D/ U& r0 K6 J2 I$ l
  35. + k+ ]" o/ z! ?8 S9 t2 E
  36. #include <mach/memory.h>
    & D) h2 L; i; d; B
  37. #include <mach/hardware.h>
    * P+ n9 C- X: q' ~: _
  38. #include <mach/irqs.h>
    0 S; f0 l+ u! ~3 t! H7 p
  39. #include <asm/hardware/edma.h>
    / G' ^( v% c% ^3 Z# p

  40. 1 {  I2 T3 ]3 _0 x; C$ v
  41. #undef EDMA3_DEBUG
    # L0 W& _9 f% y% u
  42. /*#define EDMA3_DEBUG*/
    % ~& o! b& k/ W8 L0 X; r! j
  43.   u0 s0 }- S9 d- u" P
  44. #ifdef EDMA3_DEBUG  S& o, u% c- e9 A  b) o% N0 s7 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! o) P2 r  w9 K" ]* t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 e1 r; V2 q/ p3 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ X! X- b) ?) x" M2 z% z: H! w" }
  48. #else
    ! G+ Q8 s/ ]. J  G, u0 a" [( v) v$ C
  49. #define DMA_PRINTK( x... )" Z/ ?: a* D7 E# M. k4 p
  50. #define DMA_FN_IN; }- E! Z- Q& x8 ]
  51. #define DMA_FN_OUT
    $ u7 h$ o! l+ N7 r7 ?6 X
  52. #endif6 k" a' d, A7 ^1 Z; o# }

  53. - T8 W# j- }5 H' m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) f! [; w$ O$ _9 N1 M6 }
  55. #define STATIC_SHIFT                3( |, a! A3 j- k0 B0 J* u4 z- n- N# c
  56. #define TCINTEN_SHIFT               20
    , w- n' a0 k& F" X. V1 B  P* v9 m
  57. #define ITCINTEN_SHIFT              21
    & r/ ?$ p3 j# e9 x) i' f
  58. #define TCCHEN_SHIFT                22
    6 D: x/ Z. j; ^% D9 `
  59. #define ITCCHEN_SHIFT               23
    1 [) o5 s5 r5 v7 p1 d

  60. 5 Q! x2 K: E" z! ~" b
  61. static volatile int irqraised1 = 0;
      P5 X0 C( g' t9 W/ _7 l1 g
  62. static volatile int irqraised2 = 0;! K/ p7 ]* h, o8 ]* K  S
  63. - L& D0 i9 i, j) x$ @, a8 @2 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 |9 D; `3 x1 g* Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 Z4 K3 A3 K' v+ S, F$ g6 x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - ~2 Y! Z( P3 q' ~3 e/ ]
  67. / c& l0 Y; q/ C
  68. dma_addr_t dmaphyssrc1 = 0;5 E: ~8 b2 x) j( L" ~& V( z: M
  69. dma_addr_t dmaphyssrc2 = 0;# e2 x& p( Q: r
  70. dma_addr_t dmaphysdest1 = 0;
    + L: B- B$ e. D) u% U) |
  71. dma_addr_t dmaphysdest2 = 0;
    " m" b9 V' J, y4 d0 \* @
  72. , {; x4 v# F+ }* r! Q& F
  73. char *dmabufsrc1 = NULL;
    : b* _2 v& X" n( L
  74. char *dmabufsrc2 = NULL;4 E/ Y% L, m, L7 l6 i; L4 }, G
  75. char *dmabufdest1 = NULL;
    3 ], a& k  U- Y2 n# ?1 o
  76. char *dmabufdest2 = NULL;; ^6 ~- u7 z" z. c
  77. 0 r  z" A6 v4 {; B/ e1 Y7 |9 r! V
  78. static int acnt = 512;, z! S! r; c; D3 W8 n: Y. }
  79. static int bcnt = 8;: G0 A  P- k& C% ?
  80. static int ccnt = 8;
    + z0 O5 E1 J9 p# X
  81. # c# ~9 \' `+ B0 Q
  82. module_param(acnt, int, S_IRUGO);
    # K1 a' C  h  y3 S$ n) m- ~
  83. module_param(bcnt, int, S_IRUGO);
    . T5 C3 t: N. M2 |$ h% x/ a9 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, c6 K4 T- h) f, W8 \: k
" @4 ?- |, u5 ]2 I7 Q. R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, [6 f# H6 P; }! K9 a0 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ B) B( p. v# @0 ^5 u+ g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 j' Z3 `" k) H  }

6 @! L- ^* `0 K( D" E9 z$ ]- X; U$ M# I) m! F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 18:32 , Processed in 0.044843 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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