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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 y' X* f. v2 H+ i
  1. [code]EDMA sample test application
    ; t6 L, a  Q( z$ \) n6 {! @
  2. /*
      H# X4 R1 E) X1 U
  3. * edma_test.c1 V8 i9 Q, |5 L/ a
  4. *5 p6 G9 o% ^& w: h* Q0 W
  5. * brief  EDMA3 Test Application% r1 d, Z' V9 ?% h. A9 E; r7 W8 e
  6. *( Z( o# V( E2 V% T
  7. *   This file contains EDMA3 Test code.
    & Q! b' J, S. j2 H0 g. w2 \$ l6 G6 g
  8. *
    : K; U1 B" ~+ B# W$ d8 G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : V/ \0 s1 V5 Y- E0 R  j* c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% N! O9 B: D" D& k" \
  11. *         TO CHANGE.4 C% \) W6 N2 g
  12. *
      L! \+ R5 W3 W! C8 |& U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & ]$ C, K- h- o
  14. *# p/ S0 `8 T8 h3 N5 w
  15. * This program is free software; you can redistribute it and/or
    4 t8 S+ W# g, H$ T( S
  16. * modify it under the terms of the GNU General Public License as4 N# H. w9 f6 p- b, J9 ^- w
  17. * published by the Free Software Foundation version 2.  k7 C& q+ B. m. _
  18. *5 O5 \6 o0 n8 v6 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' t) ?- ^  m6 y% ^8 T
  20. * kind, whether express or implied; without even the implied warranty
    / c; z5 ~( y  }6 w* q2 E: R) Z# z7 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * r3 p. F; b" g" F& Y6 ?  s9 {
  22. * GNU General Public License for more details.
    : l0 h7 g9 M8 M  K8 R! v
  23. */
    . m$ c# n  i$ x
  24. 0 a: f- ]- x) u0 x
  25. #include <linux/module.h>
    3 }  e  n; b$ m1 ]2 [* K
  26. #include <linux/init.h>% @) Q9 }! Q& K
  27. #include <linux/errno.h>
    5 u# F' p2 q1 u# _* ~2 J
  28. #include <linux/types.h>
    % H7 M* {( A" k3 y% ?3 E9 v  C
  29. #include <linux/interrupt.h>
    5 [9 B* ]) H2 W2 g2 {
  30. #include <asm/io.h>
      c6 h+ Q( V9 [8 R$ l
  31. #include <linux/moduleparam.h>
    4 Z( U( V5 m% P2 ~$ Y5 }
  32. #include <linux/sysctl.h>0 K/ `9 \& o* f" E$ O
  33. #include <linux/mm.h>* U1 Q! L1 h4 X
  34. #include <linux/dma-mapping.h># @+ M; R  P6 E
  35. : v2 K0 R$ F: C$ _" ?0 H% [( f. m
  36. #include <mach/memory.h>
    6 A0 v: d5 B8 w: n- O
  37. #include <mach/hardware.h>
    6 h% I  Z; x9 g3 h, V6 {
  38. #include <mach/irqs.h>+ n: t5 B4 }/ V* ^
  39. #include <asm/hardware/edma.h>
    4 @0 N: `' z8 P- x

  40. + Q) c) i- @. o$ h; J
  41. #undef EDMA3_DEBUG- g' D6 G# d- V& E7 U( }9 ]
  42. /*#define EDMA3_DEBUG*/
    ; n% f. V7 A1 {' t
  43. ) Y8 P$ I" x5 t4 X$ G
  44. #ifdef EDMA3_DEBUG1 n, B( d+ n* a7 Y) W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 L! g0 S* s6 G$ f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & g3 _( e1 i, r% A) a& }( d) G6 f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 m: ], o0 O" {4 }& v
  48. #else
    $ P2 g2 M2 j7 P3 I% y
  49. #define DMA_PRINTK( x... )
    $ f% G, ~- H6 h3 P7 A
  50. #define DMA_FN_IN
    % J0 K+ M4 r( P; {. T! D
  51. #define DMA_FN_OUT
      W, u4 |  l. T* G
  52. #endif
    ! m$ L' l5 f( Q- O5 E5 o

  53. 8 F: Y& g6 V9 v6 {6 T2 p% v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( Y* i- @0 F, _% I, P* ]
  55. #define STATIC_SHIFT                3+ n1 }/ k& `2 T( I( a: d
  56. #define TCINTEN_SHIFT               20( D2 `$ F" s* R
  57. #define ITCINTEN_SHIFT              21
    7 d* L: n# W3 X! a+ c, Y
  58. #define TCCHEN_SHIFT                22
    7 n2 y+ t/ N5 w' N7 C/ m" }- P
  59. #define ITCCHEN_SHIFT               236 }8 h; o/ ?9 F
  60. 6 }, r- y1 E/ F
  61. static volatile int irqraised1 = 0;
    % _& W9 G6 t& q( w
  62. static volatile int irqraised2 = 0;* B3 D; Q+ f, n. |! z  t
  63. 8 i. q) m. G4 Q5 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Q8 P& b/ E, [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / x8 R0 ]& C% L) m9 ]: A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! V: J6 |6 S% O: m; P

  67.   _$ U# J! q/ O* b: X- u( N
  68. dma_addr_t dmaphyssrc1 = 0;2 X  Z( ]7 J/ D' c8 D
  69. dma_addr_t dmaphyssrc2 = 0;
      F, F  _+ V- `/ Y
  70. dma_addr_t dmaphysdest1 = 0;- B# L) I: Z& A$ L2 q" L: |
  71. dma_addr_t dmaphysdest2 = 0;2 m2 s8 e) T8 E4 V) |  S
  72. 2 ^% J( Q! E' s3 g
  73. char *dmabufsrc1 = NULL;
    $ ^+ h( o" Y( ?$ C9 j# u
  74. char *dmabufsrc2 = NULL;
    , U6 w0 ]8 B) o! ?/ S
  75. char *dmabufdest1 = NULL;
    . A9 c+ e/ o% Y/ M
  76. char *dmabufdest2 = NULL;
    - ?8 _, T8 t7 R  q) q8 S' Y  R
  77. , w1 V2 S' O6 K2 J0 T4 f
  78. static int acnt = 512;- P% M5 W0 l; \4 Y1 n8 O
  79. static int bcnt = 8;
    6 Y8 v' I3 |* l+ d5 r. }
  80. static int ccnt = 8;
    # B' o+ q$ G+ Q$ @4 K1 }3 L, L/ D! c

  81. ) f& k  l7 L8 H" x/ _, U; @/ p# f
  82. module_param(acnt, int, S_IRUGO);* X' L, k, X& ?' a2 W0 u0 U! p% R
  83. module_param(bcnt, int, S_IRUGO);6 ?4 ~$ H& i/ _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) B- O" v8 \; M) \+ o; H6 P& d+ D* p7 \' F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" e# _3 v9 E7 i5 A" e1 Z1 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. f/ J2 H' s8 s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 F3 `, t) _. R1 X4 d: N* s; j. W
  E7 L: i  Y0 k0 |
" G# f$ k' x# g" W* w; Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 18:04 , Processed in 0.039200 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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