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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# f, j& l" Y; S
  1. [code]EDMA sample test application
    1 ]$ f9 |8 L0 Q  v; A" N8 p' K
  2. /*
    " X! q" Q2 p/ u
  3. * edma_test.c
    $ G3 P0 l; f! c" U  r+ K7 c
  4. *
    * n/ o$ l: Y1 \  k+ @
  5. * brief  EDMA3 Test Application
    : S: M! C0 {: P# X9 S) b
  6. *
    4 g% Q* c9 [0 k" R1 h0 z, p
  7. *   This file contains EDMA3 Test code.
    $ J+ o( E$ Z! h4 {# g, ]! I0 R
  8. *
    2 U) Y2 y/ d- H* ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. @5 x# w! N- B, v' \$ q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 @% T8 O! R1 E) b5 d/ u5 o
  11. *         TO CHANGE.+ q6 i, `5 d* o0 C* S3 l
  12. *9 B8 O& [6 p" ~5 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 j- s6 y( x3 y% o+ b( C, n
  14. *
    0 J* n) w  c* s2 [; f
  15. * This program is free software; you can redistribute it and/or
    - k% {4 L0 z0 K' Y$ b7 h
  16. * modify it under the terms of the GNU General Public License as
    ( K2 r. d3 z9 C0 B
  17. * published by the Free Software Foundation version 2.3 s) g! M+ r! \( h; Y
  18. *
    + \/ S5 ]7 H8 @" w! p# j( E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 {- q/ a) n( |! u+ t
  20. * kind, whether express or implied; without even the implied warranty
    ' Z% u7 J  T- W" l' J6 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. Z8 x3 f$ ^8 @( j3 u  C: C' X# J, l7 N
  22. * GNU General Public License for more details.! @; n+ }2 g- K& m+ K
  23. */
    8 B, v9 Y+ h2 J: n$ D# P. i+ @

  24. , a2 x  b5 C6 b
  25. #include <linux/module.h>
    ( }: d6 p6 C9 c; c$ \6 v
  26. #include <linux/init.h>1 V9 E7 L& x, D7 M5 @  {2 S3 H6 c
  27. #include <linux/errno.h># L% z0 p+ a/ @" C% q1 A9 G+ H* c$ w
  28. #include <linux/types.h>
    7 u5 ~8 c; O" e1 G) I, }
  29. #include <linux/interrupt.h>4 ^* q8 ]- v( P- l, c
  30. #include <asm/io.h>
    9 a) r6 `; S+ C
  31. #include <linux/moduleparam.h>
    9 R$ ?0 I4 t& D2 Q3 a8 D9 a( k/ @; v. Y
  32. #include <linux/sysctl.h>2 u. _+ }- P+ X  B" K' ^
  33. #include <linux/mm.h>, d7 t7 F4 G9 z% ]
  34. #include <linux/dma-mapping.h>
    8 N( r( }$ y) @

  35. % s7 E( i: p) v" @7 M
  36. #include <mach/memory.h>0 n3 O9 _% x1 i0 D! h# o
  37. #include <mach/hardware.h>
    7 @6 U7 B, A/ Z5 V3 T6 s6 @
  38. #include <mach/irqs.h>2 ?" D; @8 p" `0 e* s' g
  39. #include <asm/hardware/edma.h>
    3 E8 \8 Q7 }1 t2 B- h

  40. . }' `3 n6 M+ q# ]; \6 N2 P; @1 M# h
  41. #undef EDMA3_DEBUG9 h$ e& F( R( V9 O- ^# v
  42. /*#define EDMA3_DEBUG*/
    , k7 F- |! q2 R. e0 b" z+ {6 D
  43. * g6 _% \+ C( |6 I1 `; C
  44. #ifdef EDMA3_DEBUG6 D0 A6 d- |  ~& B, t3 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 h* D3 S  H" p& C' G; i$ |6 n; `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( q! l) {$ N' v% F9 [1 S" g% c* E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  c# x2 \+ P7 r+ G
  48. #else+ ^. @1 O$ p8 T( z
  49. #define DMA_PRINTK( x... )
    6 {, t( C4 {1 V! W
  50. #define DMA_FN_IN) K( t0 `6 o( [( ^# d6 W
  51. #define DMA_FN_OUT
    9 J3 J, ^$ E7 \4 x" D1 ~
  52. #endif5 r1 k. L( t" r% I9 P$ T7 R

  53. " I  R6 w0 q! \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! ^% X6 ^- N$ [! \4 B% o
  55. #define STATIC_SHIFT                3! @  d. e( s" ?1 S3 n  U
  56. #define TCINTEN_SHIFT               203 k" Q$ q$ E9 {0 U0 ]
  57. #define ITCINTEN_SHIFT              21. O% j4 v$ K) s( _: |/ R
  58. #define TCCHEN_SHIFT                22
    $ R, o) W  o0 b6 G! ]! z
  59. #define ITCCHEN_SHIFT               23, t  W/ T* a$ t/ X% L# X) v
  60.   i1 `, ~# F5 G' N' l8 N$ H$ {3 e
  61. static volatile int irqraised1 = 0;; _" Q4 Q5 K' X( |2 B( A& \
  62. static volatile int irqraised2 = 0;
    : F8 g  Z% f- U

  63. 7 h( P- H3 k4 T$ d, \4 c2 K( {+ d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 _9 f( h' x" ]1 L( G' e5 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: G; Q' d5 U" b0 t- g! n2 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 D' x/ R8 n" i

  67. + V: P7 T( D) d7 W$ _' F  u/ ?
  68. dma_addr_t dmaphyssrc1 = 0;
    + o% B, c3 G9 B  A, P
  69. dma_addr_t dmaphyssrc2 = 0;
    ; O* X* g1 t# A* S7 T7 _9 L' T6 u: b
  70. dma_addr_t dmaphysdest1 = 0;
    ' `  N# X7 v; F( B
  71. dma_addr_t dmaphysdest2 = 0;
    % B0 F* O9 d6 c# c4 {0 `7 g

  72. 7 n4 d  d' o' I/ M+ Y7 j& E# W
  73. char *dmabufsrc1 = NULL;
    ! ^! f' b( a% z2 a$ n- S8 L
  74. char *dmabufsrc2 = NULL;  K0 |; A. V, ?
  75. char *dmabufdest1 = NULL;
    ! g+ j; R. c& O& o' ^: r6 B
  76. char *dmabufdest2 = NULL;% q+ G9 }  y# M* m

  77. " V' v# ~+ S7 T, Q! y: ~, Z* k
  78. static int acnt = 512;. @3 T+ @; z. {' t* ?% |) R* F
  79. static int bcnt = 8;
    7 D* x4 o- B' ~4 J5 U; c
  80. static int ccnt = 8;
    * i3 l4 i" k" d) ]

  81. & v; b' ]( G" i3 ~
  82. module_param(acnt, int, S_IRUGO);
    - E  g6 v! s; ^+ q3 q1 u
  83. module_param(bcnt, int, S_IRUGO);9 R5 M; q' B" w. W1 ~  S1 u! \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 f, [. Y: J0 o! k* ^, p

- j* W3 q) V1 X9 A6 C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ A" ~: p8 \4 K% E1 u3 S& L; [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 [% {, Y* }7 u2 @7 d- s! W: a+ v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 {5 j, r5 j0 q5 J

# Q- d, U: C# L) E5 j# u6 j9 m% I* c: ?0 J/ E. @/ ~" g3 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 18:15 , Processed in 0.039735 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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