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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& u' R' u6 X, a- S: R
  1. [code]EDMA sample test application' @8 P. d5 t3 }7 {4 y1 c$ c
  2. /*
    & b8 j" v" E: N* \! A2 |) c3 Q+ X
  3. * edma_test.c& M+ y2 V* s9 i7 p5 W' C, ~
  4. *, N! ^& ?- _2 r3 k2 T* B3 ^
  5. * brief  EDMA3 Test Application
    % U& ~0 A# D" y8 j  F4 N
  6. *
    ) B8 T! U* U' g  @  V
  7. *   This file contains EDMA3 Test code.
    3 v" b( j+ Z1 Y% ~' ]5 Z+ p
  8. */ {: K/ B/ O& {9 @/ W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 A/ t$ Y; N! i! [+ J+ \  ?' e: u: i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % B: l8 n7 a0 p5 ]: s
  11. *         TO CHANGE.# O& Y- v0 h$ {# N1 q4 n, H* w
  12. *$ c1 B: X; y5 v0 w( J2 P/ M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ R. L- K+ X  u2 {$ a4 G2 {
  14. *5 x- r( V: Q6 A% t' E* A
  15. * This program is free software; you can redistribute it and/or, R+ |& G* p& r! W7 l' f1 r
  16. * modify it under the terms of the GNU General Public License as+ J! u: Z4 g( l% y* Y0 s) i4 S" v
  17. * published by the Free Software Foundation version 2.
    9 C- Y; S5 r, c" g) n& J
  18. *- F9 ]1 S8 l0 p6 V9 m# D4 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ F. v& i1 I+ U) ^; g
  20. * kind, whether express or implied; without even the implied warranty
    5 x4 P% C# K6 C* P. x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- F5 t/ w7 c- o' m+ g( x# G
  22. * GNU General Public License for more details.
      A- O* V% m  \. o# x
  23. */
    ) I8 Q& R4 u$ N

  24. 5 I6 H* ^' C/ a. Z$ {, t
  25. #include <linux/module.h>& a, ]$ R: O* z1 z; `' {1 Z
  26. #include <linux/init.h>' Z7 U' K& _# O# ]
  27. #include <linux/errno.h>
    8 F- d/ O+ c+ |; _
  28. #include <linux/types.h>
    ) w% f9 U3 A" K  A* `4 \. L% e# w
  29. #include <linux/interrupt.h>3 R" o1 n, p. O" Y
  30. #include <asm/io.h>; M# T9 W4 W; ?0 h* u
  31. #include <linux/moduleparam.h>3 F/ @; v* l" R5 E; s
  32. #include <linux/sysctl.h>$ ~- g$ p1 f7 b, T6 h5 R  n/ o6 m
  33. #include <linux/mm.h>
    - |% W; e- B& @5 y
  34. #include <linux/dma-mapping.h>
    ' z. M7 e9 @2 o6 D8 ?; I) i

  35. 2 E5 u. L6 O2 e8 G. i6 Y; K+ C+ W
  36. #include <mach/memory.h>$ g6 g' D& j" d1 |; m) {
  37. #include <mach/hardware.h>
    / f; }- |. S, Z1 x
  38. #include <mach/irqs.h>4 u! E$ S! V4 n4 O$ O
  39. #include <asm/hardware/edma.h>
    ' C9 @& k* f2 q1 f

  40. 0 v7 P) I$ o# ?
  41. #undef EDMA3_DEBUG
    9 ?  E. P6 w2 {0 T6 @, Y/ B
  42. /*#define EDMA3_DEBUG*/4 f) G0 C: L6 k0 g" [. J+ Y! N

  43. % }) X8 N$ O1 G( q* H" j4 r1 t
  44. #ifdef EDMA3_DEBUG+ N8 [5 P8 ]1 J+ \2 S% |+ ]; D$ G' V! T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ E& Y5 o" }& }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ _2 I4 ~) z. c' e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! n' O6 v( J$ k' j$ ~$ U" U
  48. #else3 P0 v  q- K" i. u! @5 {
  49. #define DMA_PRINTK( x... )
    * L' |7 B! T: D+ s& t& G6 E$ I
  50. #define DMA_FN_IN
    ' l# s! f/ U7 a4 d' g
  51. #define DMA_FN_OUT
    4 U4 A! A: |7 c$ @
  52. #endif& I, u1 m- x3 m+ z, j1 s$ b4 C
  53. / H# I5 F' C# D( T# j1 A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 X3 s# H& K% `% g
  55. #define STATIC_SHIFT                3
    " a1 l1 H. _$ u2 D. ]
  56. #define TCINTEN_SHIFT               209 Q- P, s3 g- I, X6 O' o
  57. #define ITCINTEN_SHIFT              214 K' s* E8 I9 a( ?1 P; ]( Z1 y
  58. #define TCCHEN_SHIFT                222 y1 P' B, p5 v
  59. #define ITCCHEN_SHIFT               23" f3 x6 i5 W. q* U# d5 O
  60.   F5 ~4 e% [. ^; d: |
  61. static volatile int irqraised1 = 0;
    % K2 c  C8 I0 h2 |; V7 O5 v
  62. static volatile int irqraised2 = 0;
    - x  C; v6 d* ]$ \" b% ]* T3 Q  U  A
  63. $ P8 l$ f. r* R' U) u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 F6 ^- Y+ R& a; |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 H$ U4 q3 h& N0 z+ |2 f/ x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 ~$ S, O7 u' I4 F8 t
  67. : i& ~! e+ M, j3 s, Z$ G
  68. dma_addr_t dmaphyssrc1 = 0;
    . o1 T+ r/ u: u5 ~' v* u
  69. dma_addr_t dmaphyssrc2 = 0;% W; H0 o- E; m) \% D) M3 M
  70. dma_addr_t dmaphysdest1 = 0;
      I2 L: [. a& |
  71. dma_addr_t dmaphysdest2 = 0;
    $ Z" o, i6 L+ Q9 |2 U8 ]6 S

  72. ) z6 y# }' h( C& f
  73. char *dmabufsrc1 = NULL;
    0 s( \! D5 T! x1 |0 i! R
  74. char *dmabufsrc2 = NULL;
    - `" @& J/ p5 b. `% I
  75. char *dmabufdest1 = NULL;0 I4 q' T0 M: K; h
  76. char *dmabufdest2 = NULL;
    2 L, i; f( l/ \) f* G- F
  77. " T* }, L  _. e; y6 R! v
  78. static int acnt = 512;
    ) z9 A/ I' F" m3 U
  79. static int bcnt = 8;: D& C! g+ [! ~: ?" K
  80. static int ccnt = 8;# k  h' |8 A+ j0 h, r

  81. 5 v2 T1 S- O! }% Z0 E
  82. module_param(acnt, int, S_IRUGO);$ D" T6 J1 X' o) A( m7 ~! B4 M
  83. module_param(bcnt, int, S_IRUGO);
    ) e7 [$ M3 s) y+ {! U, G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, M) ~! c+ M, X: d/ l4 j& C0 m8 ]) D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) x; U# O3 h6 u( k1 Garm-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 N: x* d, f% C% r3 T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! R( r- V9 y' J% s+ i
, T# X, ~' q/ p( f: G$ V/ w; P' q. z1 P2 Q: Z% t' B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-10 00:56 , Processed in 0.038309 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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