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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 B7 h4 w5 A" l* G2 m  z/ P
  1. [code]EDMA sample test application, n) D/ x, R( J
  2. /*. E  R0 ]7 U7 C$ T/ s& |% X& \
  3. * edma_test.c* W& w0 s3 R! V& k5 U4 o! r
  4. *
    ; P# o. p; F- q8 W. h* d1 J3 h
  5. * brief  EDMA3 Test Application+ L, R4 d4 r2 F; a/ r
  6. *) G0 U, e, D7 f+ [6 `- T9 f; X
  7. *   This file contains EDMA3 Test code.
    ' ]4 @5 E) o8 R
  8. *  q, G5 F0 J& J) i3 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 x8 r: z9 i3 z3 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : f' v4 k  k9 j4 R4 F% {4 }' O3 {
  11. *         TO CHANGE.
    ) Y: m2 L  o9 [% }0 ]" h# b
  12. *; d  V% K8 s: E/ P5 t3 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * R+ @+ u- {1 v, s
  14. ** Z% i: h$ v! c& j) C- V
  15. * This program is free software; you can redistribute it and/or1 M4 T1 b. a# K0 _0 D
  16. * modify it under the terms of the GNU General Public License as
    ( x1 K6 {1 Q' V8 b0 h& }/ C  Z! ]
  17. * published by the Free Software Foundation version 2.
      _& p4 r8 \1 f9 L" `8 i
  18. *, X6 k$ k8 }) p" h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ |9 n* q& E' m* Z4 z' c
  20. * kind, whether express or implied; without even the implied warranty6 W0 G9 [: J& w6 z0 C" ]5 @9 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ M& {, k  q3 x1 d6 u8 O
  22. * GNU General Public License for more details.
    1 p5 H# f+ s; M2 m$ ]3 [2 I& W
  23. */
    $ g4 U; ~$ z1 ^' }- s4 B
  24. 8 V6 x9 a! N. y. \* ]
  25. #include <linux/module.h>
    # [( ]) h9 Q( U+ i) R
  26. #include <linux/init.h>  V3 t' H. W" K5 ?6 b/ M
  27. #include <linux/errno.h>
    * @0 Q4 Y' g5 R
  28. #include <linux/types.h>
    3 t+ F2 k+ w- ]3 H/ y$ S6 S8 O
  29. #include <linux/interrupt.h>
    % d) Q1 P# {; f
  30. #include <asm/io.h>
    " Y7 t- w# q, i- \% O
  31. #include <linux/moduleparam.h>! y* x9 W" D  v6 y$ }
  32. #include <linux/sysctl.h>
    # r  W- n4 j$ L' s) b5 R1 D0 g
  33. #include <linux/mm.h>
    ; g. h; l1 J+ n
  34. #include <linux/dma-mapping.h>
    : U- L& z5 ?) S
  35. / G0 b' M3 M- ^: U! a" ?
  36. #include <mach/memory.h>8 k8 ~/ V, f0 V
  37. #include <mach/hardware.h>
    ! X3 L2 v) x/ S2 R( P  e
  38. #include <mach/irqs.h># @4 o! _0 R. @. \. q3 `
  39. #include <asm/hardware/edma.h>
    5 A/ q- m$ ^( k& o( b8 Z0 H' [2 Q
  40. $ Y* K+ l* R8 D
  41. #undef EDMA3_DEBUG
    ! H! Q2 ]: V; t% L$ I4 f* t
  42. /*#define EDMA3_DEBUG*/8 x1 P% }6 @7 k- m: a& y4 i/ a$ m! n

  43. % ]- Q- Y7 Z" M" x
  44. #ifdef EDMA3_DEBUG( S* G; r* n( t  T! |: L- r$ w/ v# R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): Z3 L  Y5 i& \! {) K4 j" V2 J4 N4 U  K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) m6 f0 e2 ]; b! ^% c" Q5 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 i$ y% c8 _& h
  48. #else
    * T$ q7 }- K$ y% Z) P; c
  49. #define DMA_PRINTK( x... )
    $ N- F8 g# ^0 K/ ?1 q& X  T2 O
  50. #define DMA_FN_IN
    * M; g0 A/ e  N4 [' ^8 |  |$ X
  51. #define DMA_FN_OUT
    , S; \* r8 e' N3 e6 m
  52. #endif. ~8 B4 d3 O6 B1 w/ G' N
  53. % f; @% ?9 B, _* n: I$ |. c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : P% K0 Q% _( k6 N( ?! s. y
  55. #define STATIC_SHIFT                3
    5 m3 ^! s) D0 Q" L
  56. #define TCINTEN_SHIFT               20
    2 @3 u/ H3 q1 x# e9 k) k1 S' S; Q
  57. #define ITCINTEN_SHIFT              21
    - y1 J+ ?3 F0 `. p4 m% z! ?
  58. #define TCCHEN_SHIFT                22
    ; E7 f& A3 R! L+ W
  59. #define ITCCHEN_SHIFT               23
    ( d2 i" G9 N( T" B1 t

  60. 7 B9 Y& l. |, A* i9 f
  61. static volatile int irqraised1 = 0;
    ( y7 [% G; q5 ?- t, K) G
  62. static volatile int irqraised2 = 0;; K5 }( l; u( K+ {% [- Z5 ^) r
  63. 6 [4 O# D6 Z& a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& x* @, C$ D8 N- g5 f% }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ J. h" Z0 q! k0 j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 m: t# V+ C* x% a! C# ]
  67. 4 }. M; q3 C" m. ]
  68. dma_addr_t dmaphyssrc1 = 0;
    / F" s- j; @) N. Q
  69. dma_addr_t dmaphyssrc2 = 0;& i% s0 L) P" w, x6 t- w4 t! ]# \
  70. dma_addr_t dmaphysdest1 = 0;/ K9 Z2 o9 p) D
  71. dma_addr_t dmaphysdest2 = 0;1 A; |- h' d; S, B3 Q* w
  72. - c/ t& Y: t- e( r# @2 n
  73. char *dmabufsrc1 = NULL;
    " v, P, v1 I: V) H1 k' a" u7 w
  74. char *dmabufsrc2 = NULL;7 a& [4 P  s+ T" W# ~
  75. char *dmabufdest1 = NULL;" ^; z( p$ Y  b" r) y2 {: {7 a
  76. char *dmabufdest2 = NULL;
    8 B. P. p* X$ b5 V
  77. / _. m" E0 P- ]% t" N& s4 B
  78. static int acnt = 512;2 v1 _) ~; F5 ]0 q" y
  79. static int bcnt = 8;
    % A3 O- j" ]- A: f5 a
  80. static int ccnt = 8;5 L" I8 D* o4 o2 L$ }
  81. " \  T* o- x2 Y( ~' Y
  82. module_param(acnt, int, S_IRUGO);
    ' N6 M6 i& j/ Y% C' g5 ~# u
  83. module_param(bcnt, int, S_IRUGO);
    " r  [% B1 @6 ?, A* i( I/ y- C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 N9 m% A4 d9 A5 F
# i# g  v3 j* y0 a$ A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 [; v- M9 p  b! _4 s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& R. h, U" B9 S2 Z0 v  F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 W% ?& [$ q/ Z9 _; a
. `8 T- @! L" S5 |
9 P( @9 }" A( Q' V. l) @" y' C* M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 23:07 , Processed in 0.040789 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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