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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * D" w* \% z6 {: C7 Q5 R% y, E6 Z
  1. [code]EDMA sample test application
    " z! C' Y) Y) Z; y, I
  2. /*
    2 j8 R2 ?. \3 L. e* N. F+ r- X- w5 P0 _
  3. * edma_test.c
    4 q1 R# L/ b6 G+ M. ?; [$ j+ f8 f
  4. *
    ' h. s% x: m) U4 U- u* J, I6 U1 @  Y+ n
  5. * brief  EDMA3 Test Application8 Q# u3 J- e3 y! L0 U; [: \
  6. *
    * T  D5 S- y5 Y% Y# A
  7. *   This file contains EDMA3 Test code.0 n$ U" h3 P0 W6 ~. ~
  8. *& S$ q* e$ O! ~( a. [5 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, U  Q1 k8 K( ^  f- ?. U( U. p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 q/ |, x2 G4 T* C3 D3 z
  11. *         TO CHANGE.+ u5 j- Y( y* z5 c
  12. *& g" j4 Y" }3 `* p% [0 x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# l( E& }2 I8 t7 W6 C
  14. *
    2 c8 N+ x7 @7 X) }0 ~' f
  15. * This program is free software; you can redistribute it and/or
    ! H; Y+ `5 Q9 E; Z6 \& m- r  x
  16. * modify it under the terms of the GNU General Public License as
    1 e6 f  ]# {2 ]' X% M# v
  17. * published by the Free Software Foundation version 2.
    ; g* n* |) B+ `* L9 W
  18. *1 s- }* R! m- E; n$ K& u- z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / q: M1 K: s; R
  20. * kind, whether express or implied; without even the implied warranty
    5 D/ Y: u9 {  O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 r! R- V- v% K3 m2 P$ z" G* @% x
  22. * GNU General Public License for more details.9 _# S% E, A* ]: \
  23. */
    8 G" w, `& `; p3 c. }# L$ P

  24. : b# m- @8 {& p4 O2 b. T+ ?8 A
  25. #include <linux/module.h>
    $ ^2 v: @: v1 G8 q
  26. #include <linux/init.h>! Y9 t3 V3 }! c6 Z1 f7 g# c
  27. #include <linux/errno.h>
    , |$ d  i( p$ I3 f
  28. #include <linux/types.h>: y' R- X6 ~1 w$ D6 H: i: x
  29. #include <linux/interrupt.h>% h1 W6 k8 D4 t% S. ]7 r: i/ m0 p
  30. #include <asm/io.h>0 \* K) E5 W8 n7 _9 ]5 [% ?8 S
  31. #include <linux/moduleparam.h>8 H; c7 k% y5 _0 q
  32. #include <linux/sysctl.h>, n2 s( K. ~/ D
  33. #include <linux/mm.h>
    ' k& N2 W# f2 V  z
  34. #include <linux/dma-mapping.h>' Y: U$ I7 a! I3 \& J  F
  35. 4 B4 n6 _: t9 i5 c- B/ H3 h6 D
  36. #include <mach/memory.h>2 H# v5 d8 U2 V9 w$ V
  37. #include <mach/hardware.h>! _" H8 e+ \5 R. Q. y
  38. #include <mach/irqs.h>! o& o4 R* r/ O. A. O; y
  39. #include <asm/hardware/edma.h>
    ; g0 ?0 Z, h; b/ h
  40. : l5 g0 ^6 T/ K+ S5 z+ E: }
  41. #undef EDMA3_DEBUG( F8 d  c7 L0 d- ?8 F+ m1 c# }
  42. /*#define EDMA3_DEBUG*/
    7 }# }8 o; a. @2 @6 `6 w4 z0 L1 L$ G

  43. * f" ]2 Y7 p4 W- r6 H
  44. #ifdef EDMA3_DEBUG) B3 y  D* Q5 B$ I# ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); O- N0 ^, o2 f2 u' X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 l& o6 A0 ~$ J! ]% h4 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) |. d) J4 P* D
  48. #else
    6 u' g) V5 A7 c7 M
  49. #define DMA_PRINTK( x... )
    3 {' e+ |  ^7 }  u
  50. #define DMA_FN_IN
    ) J; a8 V& I5 c6 W# h# M. U' Q
  51. #define DMA_FN_OUT
    2 l" U/ V& I7 j2 ~
  52. #endif
    1 e8 _0 L- y$ j' q+ ^9 r3 p  m
  53. + M8 U9 G2 `  L7 W* V6 ]5 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ r3 p; k8 u4 _! S
  55. #define STATIC_SHIFT                3! i/ k0 s& j6 {  N
  56. #define TCINTEN_SHIFT               20
    / A7 t* P4 O5 L4 V" e6 f7 N7 t
  57. #define ITCINTEN_SHIFT              21% X. i& {* V; T  d/ o* p+ m
  58. #define TCCHEN_SHIFT                22; H" q3 D* }: ?+ Q
  59. #define ITCCHEN_SHIFT               23
    ; F' H" b* ]2 j8 _5 m* H/ Y) v

  60. 4 I; \5 s1 I# b) ~5 M0 F
  61. static volatile int irqraised1 = 0;/ m  x3 c5 ~+ I1 B; A4 t9 A& S# r
  62. static volatile int irqraised2 = 0;
    9 u4 t% {" u- h

  63. + p& M6 \6 Z! E. u: G% o& j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  E" j" @% S( ~0 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " x/ e( m! ?; x! x9 }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& j7 N) |$ J) F* c7 s; |  W( d/ M

  67. + e* H) }- T# z+ t! j8 d; D. F
  68. dma_addr_t dmaphyssrc1 = 0;
    + S5 O8 D  l# v  }' I
  69. dma_addr_t dmaphyssrc2 = 0;
    , {7 N7 C2 o; `/ X
  70. dma_addr_t dmaphysdest1 = 0;
    4 R: @$ x9 p% o7 l6 D0 {
  71. dma_addr_t dmaphysdest2 = 0;8 e0 {& J: {9 \2 \, ~% [& J
  72. , P8 j& O, m* T; F! x0 w9 Z' J% j
  73. char *dmabufsrc1 = NULL;
    " s3 P% P, C9 @  h: q" y4 Y
  74. char *dmabufsrc2 = NULL;
    0 U- _* p( y0 d* U
  75. char *dmabufdest1 = NULL;
    0 H1 f0 R: v' A( T7 Z) r; w
  76. char *dmabufdest2 = NULL;  q, \! l) u, Y# h

  77. + ^: u7 f* \5 i' v9 I
  78. static int acnt = 512;1 A2 @. V) A7 _7 Q
  79. static int bcnt = 8;
    , H2 k3 C8 L3 _1 z2 b2 E
  80. static int ccnt = 8;9 U% H+ d8 E  n; l& f

  81. * J% X$ l& k( }: s
  82. module_param(acnt, int, S_IRUGO);: j7 p7 d" J# f$ ~2 |7 a
  83. module_param(bcnt, int, S_IRUGO);. j* \$ s/ D$ ]5 x% J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# M! h& r, Z# ~" p
7 s$ m, {% C; c, U  I: n  Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( o' {6 i+ n( p; ^' a4 U& [( p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 w4 ?# G- E& n. M; X. @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 c; V5 d  A& G6 H) A- t
6 X. E- S0 N9 L: [5 K7 x# m
0 o8 k* a" N. f" z. n( P; o6 E3 Y/ g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-3 04:54 , Processed in 0.039811 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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