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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# Y# U9 T$ [) f/ M; Q! E6 b
  1. [code]EDMA sample test application7 N2 i' |1 k% b/ v9 K& Q
  2. /*' v8 h% Z- @5 n' c8 ]0 G
  3. * edma_test.c
    : d  j1 w2 [3 d4 t# i, Q7 C; T
  4. *$ {2 R$ u6 _4 r$ a+ U0 z
  5. * brief  EDMA3 Test Application6 n2 ]' j& q( `' }& ?
  6. *5 X) ?8 H" Q' m4 _7 L3 p0 h( l  C
  7. *   This file contains EDMA3 Test code.
    ) X4 z  b* u  ?, O- m9 E6 E
  8. *
    / g. z# o6 H9 _% u7 [! [+ J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 F" m+ O7 h) Y4 @2 o. k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & j' y7 r+ A# E6 R9 ]0 L1 I
  11. *         TO CHANGE.
    ) ^3 b* y9 }% I" [8 t. F- m) r5 j
  12. *
    # u2 p/ _  Z- W- I3 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # X$ p, ?: p1 v6 F3 k
  14. *4 W; d5 q+ f' }* Y  {* A3 x
  15. * This program is free software; you can redistribute it and/or$ d3 f0 J! }6 ?- b0 F
  16. * modify it under the terms of the GNU General Public License as
    / a9 W" T2 \' S. q: _
  17. * published by the Free Software Foundation version 2.
    , n+ S, \- V' C6 B+ m$ t' W
  18. *: q& _6 p% O9 @6 f0 A+ }; k- J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, v0 P. Y/ ]" ], `
  20. * kind, whether express or implied; without even the implied warranty+ ~  h; c; x# H( Y5 K& P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 k, T" K" S% ?* J# E; D" g
  22. * GNU General Public License for more details.2 H; s$ U2 x2 [* Y$ C
  23. */
    7 @0 E2 \% X; w" K+ k+ D
  24. 4 U- `2 z/ ]) i
  25. #include <linux/module.h>! M  v' x) f1 G7 s" p) L
  26. #include <linux/init.h>* P, L+ G% i  k4 v' \/ J
  27. #include <linux/errno.h>
    6 @- m! s2 {. N- ~, H9 Q
  28. #include <linux/types.h>+ a; a& L; ^3 W( @' {8 n, r
  29. #include <linux/interrupt.h>
    6 q2 ]8 c0 P4 p, m* u  y, y
  30. #include <asm/io.h>
      `8 ~4 W% M7 P% @& L
  31. #include <linux/moduleparam.h>
    8 q) m1 h$ z- _* e2 O. F( X1 J
  32. #include <linux/sysctl.h>1 d3 l+ i6 X; e3 N3 `) m1 O9 ?2 z1 d
  33. #include <linux/mm.h>
    , {$ [+ k- d- ]5 F( Z( q
  34. #include <linux/dma-mapping.h>
    ! j- _9 ^! t+ q& ~- V4 i7 O3 n6 Q* j
  35. ( E, M1 @, b. v" ]/ F
  36. #include <mach/memory.h>! M8 b2 X) f( R& N% _* l# V
  37. #include <mach/hardware.h>
    6 \) f  v; Q9 x: s; O2 P3 G
  38. #include <mach/irqs.h>
    ; R6 f$ @- k5 B( T+ T
  39. #include <asm/hardware/edma.h>
    / s$ M6 r9 [. Z- l$ U
  40. ) P- e; b" r3 P( E! A) R8 K9 B
  41. #undef EDMA3_DEBUG0 T$ B. z% U' n
  42. /*#define EDMA3_DEBUG*/
    7 I7 k% S* Z% {2 P
  43. ! a6 u; O) n! G2 ]6 \  O: L, y5 w8 S
  44. #ifdef EDMA3_DEBUG( j; R1 ~3 S9 p7 I( S' _9 z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 w6 @6 M" I, Y, ~3 S6 L9 ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 F4 R& x" _; t7 c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( ?& Z; [' ?4 b! {8 y4 q$ n7 l# x+ W
  48. #else$ O1 v8 h  S7 u/ }
  49. #define DMA_PRINTK( x... )
    8 W6 r& N, U! A' ]7 \0 I
  50. #define DMA_FN_IN
    # }6 Y( }! |5 j: b
  51. #define DMA_FN_OUT* Z. O+ @! j7 k3 {( s- R  t$ @
  52. #endif# J- y0 a# r# u9 U
  53. ; ^! ^6 o! y% N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . G; P9 _: x5 N$ l
  55. #define STATIC_SHIFT                3
    . p( e5 m; X$ d! c
  56. #define TCINTEN_SHIFT               20/ Z4 f3 m# D! A# ]
  57. #define ITCINTEN_SHIFT              21
    - `/ I: n- c4 j+ _7 r: e9 n5 H" n
  58. #define TCCHEN_SHIFT                22
    , Q6 W$ B9 ]' ^; o
  59. #define ITCCHEN_SHIFT               23
    / U6 t$ {! }2 y0 w9 l
  60. ' c' ~: G: O9 L) Z7 L
  61. static volatile int irqraised1 = 0;
      ~% Q) J" ~. {! X" s! \. O9 P/ i# F- r- h
  62. static volatile int irqraised2 = 0;* ?# X9 x4 U7 i4 X- D6 A( s& w
  63. ' i0 z! y: M1 q. I% }# A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % Q4 Y. O( e' p& S; x* f: U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      w! M4 x& S& T1 [' \) ^% }) h3 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% |; \( q1 d9 q. B: B% i! a( B/ \

  67. / @& b' t% d5 j  _1 j7 G; C& R3 u( e+ \
  68. dma_addr_t dmaphyssrc1 = 0;
    ) U* L4 Y7 M0 k8 x" N! D
  69. dma_addr_t dmaphyssrc2 = 0;# ?6 v/ Z( H' M+ C1 P) m* A
  70. dma_addr_t dmaphysdest1 = 0;( Q& w3 W9 [  E7 [' T) b  v2 t  M! m
  71. dma_addr_t dmaphysdest2 = 0;$ j. s" P6 I# N  r) T' P! @  J

  72. 0 j4 k: x( u) _$ i: K. i
  73. char *dmabufsrc1 = NULL;
    0 I/ G. w# {6 |5 y) E* |
  74. char *dmabufsrc2 = NULL;
    , B5 `. K1 O0 \) G0 H5 }
  75. char *dmabufdest1 = NULL;7 _$ d3 I' D' z; O
  76. char *dmabufdest2 = NULL;
    - N  b$ A) ^3 t& o0 y
  77. 1 }- F" n: p2 W9 _+ ~
  78. static int acnt = 512;, G/ p" d- R8 p. Y) y$ W
  79. static int bcnt = 8;
    3 Q5 N6 i9 v, x  t
  80. static int ccnt = 8;
    , p( Y, z% Q& W. t, i1 X% f
  81. ' e0 Z* a  N4 j; b; l! b9 S+ s. Y
  82. module_param(acnt, int, S_IRUGO);9 {+ W9 ]* c/ b. E! K! O
  83. module_param(bcnt, int, S_IRUGO);
    ' G* p; _! I* K/ C6 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ I  P2 _2 S0 A, _7 ^
" O* A/ T* \" t1 {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( _; S9 ?- l3 w$ X7 Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 G/ R2 T6 Z7 a; |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% b& z% h/ N! U, }% X9 Q, P$ B9 }
5 U! f: r/ D; b: o2 l& m
' @4 j- V9 C; X$ q) Y9 e, h7 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 21:28 , Processed in 0.042171 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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