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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . Q' U+ X4 j2 [# T( `# V% C. M
  1. [code]EDMA sample test application
    4 E6 U+ n  t" C( p( O, I1 Z0 E
  2. /*
    / j1 D+ H) K9 b
  3. * edma_test.c
    4 s( q0 Y6 V1 y6 u
  4. *
    6 |' e+ W9 ~3 O
  5. * brief  EDMA3 Test Application& C" s0 R6 S. c! W
  6. *
    ! s; B+ z' b# d$ l' ^2 _( r
  7. *   This file contains EDMA3 Test code.
    ) `# E$ }8 g) P2 [" T
  8. *
    * U) z' k8 b: ?0 W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 I; }' x; t3 ?- q$ {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * x0 j$ L" _' |3 P& f7 L% ]: ^
  11. *         TO CHANGE.' B9 Z3 [) X" b- n
  12. *- U* o% _& }/ ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! G9 L4 ]8 L, c" R7 V; _/ }  X
  14. *0 m  M) c! m0 N- j% I
  15. * This program is free software; you can redistribute it and/or
    : D; P: p; l# E5 |+ r  E' {7 F
  16. * modify it under the terms of the GNU General Public License as4 h' |7 k4 e) a- E& X
  17. * published by the Free Software Foundation version 2.
    - p, m- d5 F& v+ S/ X9 i+ f0 A2 c
  18. *8 e2 [7 f9 z+ b# g% {2 h* f5 z1 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 e% ^' n* _3 F& D3 @% c% m
  20. * kind, whether express or implied; without even the implied warranty
    ! h- c8 x/ O# ]1 ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& y# ?+ n- c8 j' j( k" L
  22. * GNU General Public License for more details.
    & i: O0 j9 p: E! @1 y
  23. */- F7 {- a$ C" _: L

  24. 5 P2 i5 a0 O7 _0 N; y; I/ [) U! Y
  25. #include <linux/module.h>& K7 o% b; g* M; N/ N9 }) ~
  26. #include <linux/init.h>
    2 k, R( W' r% R6 c/ p  I
  27. #include <linux/errno.h>
    : ~1 h, R9 [, Q' t4 y
  28. #include <linux/types.h>- W! w" Z( _8 L" f
  29. #include <linux/interrupt.h>
    + U& c9 Z+ a6 @$ r3 M2 S
  30. #include <asm/io.h>6 j. K+ {) o0 b1 B! a- A# x$ Z
  31. #include <linux/moduleparam.h>
    0 N3 Z% L. W% k4 L! D- t
  32. #include <linux/sysctl.h>, w- N0 P3 C/ O4 l  E- _! F
  33. #include <linux/mm.h>( o% ^% q6 V3 J0 B2 C7 ?
  34. #include <linux/dma-mapping.h>
    5 \0 n/ s" a7 w3 M$ _- ^& c
  35. 6 Z/ {% W6 J) a+ _# {+ K/ u3 l
  36. #include <mach/memory.h>$ H& c8 t7 u! l9 m
  37. #include <mach/hardware.h>
    . q3 }) \/ q, N: `! O" j
  38. #include <mach/irqs.h>
      T% @% O$ s& E& i! ?
  39. #include <asm/hardware/edma.h>) _3 ]( S2 V! \2 y( D
  40. # G) p; _3 n0 F7 i* N
  41. #undef EDMA3_DEBUG
      ^- {9 J. B3 q
  42. /*#define EDMA3_DEBUG*/7 W" Y- r& h$ T  x$ g' z9 V/ U3 m
  43. - s. f6 {7 |' L6 N. S( |
  44. #ifdef EDMA3_DEBUG+ O  {. x4 I  S! r4 H2 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), q2 {2 _' e# ^& u, E- j6 o- G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( S+ o# S& Y3 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 ^1 H4 D3 Y+ n4 g4 F. i/ n+ ?
  48. #else% y6 h' J' K  r; C5 ^
  49. #define DMA_PRINTK( x... )
    $ M9 W; J- F7 V/ A, \" x9 W5 ^
  50. #define DMA_FN_IN
    % ]  q* |; u  \% |6 s9 f* B. [
  51. #define DMA_FN_OUT; Y" ?) R( Y$ m# V4 h/ J
  52. #endif( F. J: y! X  t' v

  53. / V: O' [- y5 b- v- C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 Y! m8 h% o: ]; c" D8 b1 Q( w
  55. #define STATIC_SHIFT                3
    " u/ x/ R5 y- ?+ `5 ]$ H# Z% ?% y
  56. #define TCINTEN_SHIFT               20
    . v4 H$ c. p% H: w0 Z( U
  57. #define ITCINTEN_SHIFT              21
    . @0 p3 l6 m7 a7 a5 O9 u4 l
  58. #define TCCHEN_SHIFT                220 }) Q" W9 x4 D# L& V9 I/ i
  59. #define ITCCHEN_SHIFT               23
    ( q2 s, N1 F0 h- B
  60. 9 A! V/ `$ J$ V/ S, B
  61. static volatile int irqraised1 = 0;
    ; m4 T1 R' q& @" }2 p! E
  62. static volatile int irqraised2 = 0;7 R7 T/ K4 M( a/ Z6 B

  63. $ A" e( _  g6 O+ `# |1 R& u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* {$ H6 i& d1 ?7 w- K2 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 q5 L6 @7 e, _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% t$ C% u- v0 x& V
  67. " p0 K  O4 _( }, t9 D: _* n
  68. dma_addr_t dmaphyssrc1 = 0;
    7 Y/ O' l: I0 v1 i, v- F
  69. dma_addr_t dmaphyssrc2 = 0;
    8 e8 r( @2 [" r& T1 M6 E
  70. dma_addr_t dmaphysdest1 = 0;
    ' k1 p, x5 j  W0 W/ t
  71. dma_addr_t dmaphysdest2 = 0;
    ! a# X5 R( e+ e6 d" g8 f

  72. + _, Y/ g( F% y1 V. O& _) W
  73. char *dmabufsrc1 = NULL;
    ! D# ?7 P' _( C1 }7 ?4 g' e! d
  74. char *dmabufsrc2 = NULL;
    $ _/ k8 M7 K$ e
  75. char *dmabufdest1 = NULL;
    ) J. X: B9 {. ~: N( V+ u
  76. char *dmabufdest2 = NULL;
    ( ]; }4 p' B9 |) H+ r

  77. & ~: W9 w$ j/ Z- {
  78. static int acnt = 512;9 z% T) D$ k8 @; {2 t8 g
  79. static int bcnt = 8;
    * d3 t  R- }5 G3 D$ p2 u! F
  80. static int ccnt = 8;9 _$ v6 U& d- s" a! i! M

  81. ) m) G! B4 x+ E: p& L8 O
  82. module_param(acnt, int, S_IRUGO);5 T5 u+ \5 c0 z
  83. module_param(bcnt, int, S_IRUGO);
    9 \  ]- M! _0 e+ E) P4 x' l) c4 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 k, p' F5 t& H: n- T8 M5 X4 I+ T% c2 w% ~! y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 |7 W" r1 p/ @0 X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 `& K  W+ q( z4 J/ ?" r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% n$ a4 c/ {' C$ m6 D
  o& L5 l) q+ C* [2 F; m3 x4 f4 s6 q8 h; Q3 Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 15:13 , Processed in 0.042187 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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