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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 Z1 F. s: X) D: x
  1. [code]EDMA sample test application
    . I5 k0 \8 u/ e* D0 t
  2. /*5 `2 M0 {- X8 t8 s) R
  3. * edma_test.c2 Q5 y) Y3 V, l, p
  4. *3 h4 a+ r; q5 ^+ R
  5. * brief  EDMA3 Test Application; D/ |/ L& B. c7 K+ c. {
  6. *
    : p% E8 s( }$ Y8 s0 h; y
  7. *   This file contains EDMA3 Test code.5 ?2 {, F2 z. L+ ?  s
  8. *
    1 x2 k  O0 C0 W& S/ Y* x7 i+ `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 {% X' Y% |% g+ j+ U' u" N8 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 w0 L) m/ W, o0 R* l
  11. *         TO CHANGE., _, f# Z0 C4 c2 \- w3 Y) J$ u, {# V
  12. *
    , G, @  t# i4 Y1 W& A* l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 r" a9 }' D- w4 R
  14. *
    1 |& {( u1 j: p5 ^
  15. * This program is free software; you can redistribute it and/or. I( ?- C" N$ Z* f# [
  16. * modify it under the terms of the GNU General Public License as% @  N+ }; ~. u' D9 X( J; `% Q
  17. * published by the Free Software Foundation version 2.2 \  {; K+ V1 p5 M! }6 f" M; d
  18. *
    $ b* t6 o  g, g; p/ ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! Z8 Q, R# I# u1 I$ n
  20. * kind, whether express or implied; without even the implied warranty: V; g, x1 ^/ k4 X4 W! x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( b' k4 A  `( m6 ]) l7 }
  22. * GNU General Public License for more details.* ?5 x% i$ l  m; q* I; V3 b( y6 C
  23. */
    # k. O7 K: ~- Y6 |0 d. }. @
  24. ; V/ v- r0 O6 W" s
  25. #include <linux/module.h>
    2 W9 x) \* Q" Z
  26. #include <linux/init.h>1 M. g& G9 X; R$ e$ v9 E
  27. #include <linux/errno.h>: |7 `7 _1 M% }2 z6 S9 ~9 T/ q
  28. #include <linux/types.h>
      X' a4 V  }+ K: ]
  29. #include <linux/interrupt.h>- j, |5 f# `3 t% Z4 d
  30. #include <asm/io.h>: `1 g7 k8 {$ T' O
  31. #include <linux/moduleparam.h>7 R9 H" x. X1 x
  32. #include <linux/sysctl.h>- O& M2 D( x1 o0 Z+ H; @8 `; y' B
  33. #include <linux/mm.h>+ v) [. S# ~# C2 J" c
  34. #include <linux/dma-mapping.h>' q& {7 \0 i- ?6 h' a

  35. 5 a" x( e& e& Q( c+ i+ ~# D
  36. #include <mach/memory.h>
    2 y8 W5 c2 B2 H' z& P* @
  37. #include <mach/hardware.h>
    0 W+ p7 \. ~. o, _
  38. #include <mach/irqs.h>
    1 B. X& R4 \; z: _$ P6 j
  39. #include <asm/hardware/edma.h>! ^5 ^" B( l0 x

  40. 7 a/ e3 T  q2 a- q% J( `
  41. #undef EDMA3_DEBUG) o9 q! J- ?( D- g& N
  42. /*#define EDMA3_DEBUG*/4 |' C1 E3 d6 l& n9 Z7 @

  43. 5 R" P5 b- W8 D/ h) s
  44. #ifdef EDMA3_DEBUG
    9 q" p2 C+ V* Y# E; P) w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  \& S0 u% J; A8 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 T, l, s4 ?, v4 U* n" ?( Q8 @- Q% e  o2 B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 v3 a' d$ s8 i* R2 O$ A
  48. #else
    7 f! h. M; G9 K2 M3 B9 y8 d
  49. #define DMA_PRINTK( x... )
    / r2 v/ a: Z% J6 i7 f" A; t
  50. #define DMA_FN_IN
    + G, Y4 y- X, p) }& A4 t0 ]
  51. #define DMA_FN_OUT  E2 R7 w* }- r0 ?
  52. #endif* c- d$ ]2 T( O2 I

  53. % t+ ]" F+ ]: M% t) f% Z9 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 X3 D* Q2 d! l3 I
  55. #define STATIC_SHIFT                3+ {+ L3 C4 W1 c  C/ ?$ w) d
  56. #define TCINTEN_SHIFT               20
    " m- D$ P/ h" G# Z+ T
  57. #define ITCINTEN_SHIFT              21  y& d' `* Z2 m' c- \" v9 A
  58. #define TCCHEN_SHIFT                22+ W$ l& Z( L3 r! [
  59. #define ITCCHEN_SHIFT               23
    % K5 K" P3 `6 _$ H& V* x! U$ I/ ?
  60. + ^) X; E" y5 r2 B
  61. static volatile int irqraised1 = 0;: p( i' D9 I  R5 g4 V3 E& M8 j
  62. static volatile int irqraised2 = 0;
    ) J3 S# g3 l( D. w
  63. 6 d$ Y5 G  q! N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 R9 O8 a8 G- q- \$ Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 V  K: n1 T" n! p# I, c# M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % P6 L) W. _* A9 J0 u1 Z* a3 I
  67. - y; m  U0 W. w8 C4 y0 {
  68. dma_addr_t dmaphyssrc1 = 0;. u; |) ?1 u' x% ?
  69. dma_addr_t dmaphyssrc2 = 0;
    4 Z( ^) B- n# ]/ X8 ?9 h6 I
  70. dma_addr_t dmaphysdest1 = 0;& \/ W# L% c* E1 I8 J
  71. dma_addr_t dmaphysdest2 = 0;8 U, C& l/ q1 M3 @" l6 b! a

  72. 1 l% p  |( q0 d( ~1 \' G$ r
  73. char *dmabufsrc1 = NULL;
    + I* r/ y( F( T- |' q2 z! t$ |! h
  74. char *dmabufsrc2 = NULL;
    6 i5 a! @4 H3 V
  75. char *dmabufdest1 = NULL;! a+ t. b- U' q5 v" z
  76. char *dmabufdest2 = NULL;5 I9 T  D( e! ^1 r4 z  v9 c; [; {6 D
  77. + k5 u6 C; h4 [1 R0 W% v6 Q/ L
  78. static int acnt = 512;/ E0 a# w- M8 |
  79. static int bcnt = 8;1 q1 a) X4 q7 `# C* r
  80. static int ccnt = 8;
    - u  U3 @# q. j

  81. - `  ~: R, o  q  z) F
  82. module_param(acnt, int, S_IRUGO);
      w2 ]% H8 c1 N: F  P
  83. module_param(bcnt, int, S_IRUGO);
    3 K& \+ C  f6 d/ |- l5 u# C+ b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 L) W9 H& s/ W- b
% z) Q0 c0 Y5 y0 ^, ~+ x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ Q0 t2 n! V8 K2 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. p7 S  h6 t- ~! b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 m" v# [  x, _5 [6 e8 E

! \' I( y" R7 h# }( a
6 r- [" k0 i, C- c4 C, Q% A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 03:45 , Processed in 0.038093 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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