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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - ?- }; [% w2 I  v8 z/ G
  1. [code]EDMA sample test application
    7 l0 [# _: D# ]
  2. /*
    # Z: H5 \) f" A% @
  3. * edma_test.c
    : r( @" Q9 R2 E
  4. *4 p3 c( Z! o3 i( P0 M
  5. * brief  EDMA3 Test Application. [( N1 K# }1 U  ?
  6. *# q- K+ @3 C1 G  t7 Y
  7. *   This file contains EDMA3 Test code.
    2 |5 J7 I4 _! K' ?; [( D
  8. *9 V+ \- K% f) r# r" `( _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * }: `: h- ]) @! ^) {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - F- c- a9 J3 Q3 D& }( ~3 P
  11. *         TO CHANGE.
    ' ~/ `* S& U4 P% x' x! ?  i
  12. *" \3 l/ A7 L5 v& _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 v  h2 [+ u# V2 u$ L3 y0 C+ a
  14. *) r3 @& u" K4 F  m/ i8 ?$ x
  15. * This program is free software; you can redistribute it and/or! b7 `2 c, h( ^6 l  q% z
  16. * modify it under the terms of the GNU General Public License as9 R2 }' F5 k: I+ M: \6 h0 t
  17. * published by the Free Software Foundation version 2.
    ! X, {# M& o2 b
  18. *1 V- K3 s+ ~; [& C# I, e$ R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " v+ f$ S" i, v3 b6 u  i8 H2 j- Z
  20. * kind, whether express or implied; without even the implied warranty. u, l" N* U- w( d* {+ @" Y1 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 {( J" P8 C8 X
  22. * GNU General Public License for more details.4 f+ N# c) x& w
  23. */
    2 S. T% z3 q7 `: R( B: f# H. V* U; b) ]" y

  24. , ^- r" X/ Y6 L* W  M7 T8 |" g
  25. #include <linux/module.h>4 s* n0 }6 y5 A3 Y% i9 u2 i
  26. #include <linux/init.h>3 ^0 _$ K# R/ L5 n0 G
  27. #include <linux/errno.h>
    0 Y  W" o2 ^4 q* c$ z" d
  28. #include <linux/types.h>" |' a* h& q; X7 T$ k4 J; ?; f
  29. #include <linux/interrupt.h>
    0 y/ ^4 F3 u! ?+ `! D4 ]
  30. #include <asm/io.h>& z; J% I4 ~% y) b& x# K) ^
  31. #include <linux/moduleparam.h>& `! j8 I" @; A( I, s" g
  32. #include <linux/sysctl.h>
    / A* {% c$ U: [: k
  33. #include <linux/mm.h>
    + V0 {1 W0 ]( b! T2 Y/ w3 m* N  y
  34. #include <linux/dma-mapping.h>
    ! r. V2 P4 k9 j3 @/ `
  35. 9 q. I3 G4 l) }$ [; P& `
  36. #include <mach/memory.h>
    8 e- o2 Y& \) x
  37. #include <mach/hardware.h>
    * k- E6 f2 P8 i
  38. #include <mach/irqs.h>1 t( m4 X( _( z" g0 d/ G
  39. #include <asm/hardware/edma.h>
    0 I7 U' X: D2 w2 ^1 A1 c, c
  40. 7 J) B; |9 d9 D, A" f8 A' H& u1 V1 V" }
  41. #undef EDMA3_DEBUG
    - f4 L' T, j7 y
  42. /*#define EDMA3_DEBUG*// ^$ i( t. w: P( H* s% H# b
  43. ; J) ], a) r0 c2 h5 E; c% `) e
  44. #ifdef EDMA3_DEBUG" p3 X# P* n) n0 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 u: s* k- W2 Y( M/ k( r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : G' k3 ~/ v3 N1 X: {* c  {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' e9 F) B9 v* x0 T# k. j) J. z
  48. #else
    7 m+ E' z, J3 G: b# A+ K; c
  49. #define DMA_PRINTK( x... )" D8 s6 k0 b  v) q5 G# c
  50. #define DMA_FN_IN
    6 j& h3 k& G, X+ d
  51. #define DMA_FN_OUT
    & ?$ a2 z7 W' A+ m: u# u: a' x
  52. #endif! y* v; h  u" x9 ~. C: B( c# H2 c+ N

  53. 7 [8 V. C* a' m+ p% U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 [8 u( z' f6 o- O# ^) u
  55. #define STATIC_SHIFT                3- @& {7 D7 G- C& y  o9 x, N
  56. #define TCINTEN_SHIFT               20
    2 ?0 @, n! w/ b# o  u" D: o+ u9 k
  57. #define ITCINTEN_SHIFT              21
    : x% z+ x& f* ^# u$ C6 w( l! w0 J
  58. #define TCCHEN_SHIFT                222 Y+ Z& u7 p$ G% s3 p' v7 X
  59. #define ITCCHEN_SHIFT               23
    6 X! V) L- z, \$ R' p' ~8 M
  60. 6 U$ _+ ^4 g$ f0 J
  61. static volatile int irqraised1 = 0;6 N, t. `! G+ G) V
  62. static volatile int irqraised2 = 0;. x3 L9 ~4 M( N+ _% c9 G8 h  Y
  63. 1 N- |4 A$ I1 B, i! c; K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, |' Y2 q( I  M- R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , {8 t1 E+ O+ Y4 O6 Z9 M! l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; c( c9 N( g; u% K

  67. 0 G, r; @; ?; C0 m
  68. dma_addr_t dmaphyssrc1 = 0;
    $ Y2 h0 s# R& W+ S  R, Z
  69. dma_addr_t dmaphyssrc2 = 0;
    ( B4 F0 l0 d: V7 g9 _2 K
  70. dma_addr_t dmaphysdest1 = 0;
    " W4 S8 j- J$ C) b6 |
  71. dma_addr_t dmaphysdest2 = 0;  H; v4 r1 b, p- f( g; o0 b- P

  72. 1 t1 b) O) e8 x: x  J: n, e  }& H
  73. char *dmabufsrc1 = NULL;! |+ |/ @: a4 ^: m* d! P. O1 f3 K- h
  74. char *dmabufsrc2 = NULL;' \/ A" d& L% ~2 Y- B0 v- a- i, c
  75. char *dmabufdest1 = NULL;
    + S( }- b" X$ v3 Q" j, N3 E7 L
  76. char *dmabufdest2 = NULL;
    / K# s8 q* b8 F# k% E  [

  77. / t; h. x" p0 l
  78. static int acnt = 512;
    . U* l, z+ Q+ q: D/ l" K0 Q* W
  79. static int bcnt = 8;: c9 x+ _. p! I7 M; X5 r) j
  80. static int ccnt = 8;3 f0 G) e5 d; r2 N7 f
  81. ( c  z( H- R! G, V
  82. module_param(acnt, int, S_IRUGO);. ]/ ~: F% \" U3 p
  83. module_param(bcnt, int, S_IRUGO);
    % i8 h' k9 ?9 j9 u  C8 X5 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* d1 k, z# f0 E* S. r2 e3 T+ \

" D! W2 b1 J" \( M! j( K; l- {0 k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! c' ?1 L& t" j) F( S$ \8 o8 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 s. }* }6 w8 L% Q- }3 y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) k: ]  u- ~: R4 Q  A5 j' J

# f7 g. j$ i0 |* ]/ c1 q2 h
0 B8 O0 ]; m! ~6 P( I! [9 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-13 10:54 , Processed in 0.033936 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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