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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) N7 ?8 n* _0 L. b2 T
  1. [code]EDMA sample test application
    8 D& V8 p9 T, r0 T
  2. /*
    + S. V9 L. R, @7 v
  3. * edma_test.c1 r; p- J) `3 `8 `' s9 T
  4. *' Z6 f8 ^, g5 I$ ?; b/ K( Z3 X  I: `
  5. * brief  EDMA3 Test Application
    6 ^% D/ ^* A7 O8 n5 }
  6. *5 j/ W7 i4 W6 h& B
  7. *   This file contains EDMA3 Test code./ h" N, b  ]3 D. M0 F
  8. *- }! p, f' N" @9 ]3 w3 w1 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & I* v; _: |+ w: \  S5 `5 i  O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 L& P: W7 {  @8 k. Y% M( k
  11. *         TO CHANGE.9 A& u1 {, G# m8 }5 W! l/ z8 _
  12. *1 }' v3 B8 [  h9 |/ c, u" j$ t- S' i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) ^4 U; ^: e4 E! ~' Z
  14. *& o/ K1 D' C, b3 v' C/ ?
  15. * This program is free software; you can redistribute it and/or" D* O. c$ j3 U" ~" @- m
  16. * modify it under the terms of the GNU General Public License as
    , J/ K* S4 w) k+ y% J+ C- k+ w, {
  17. * published by the Free Software Foundation version 2.- v" f/ s8 |& g: ]
  18. *
    0 d7 s6 w( @! N- R( i/ z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& p; P" y7 ?/ A: }/ L
  20. * kind, whether express or implied; without even the implied warranty
    # d# d1 J3 S. x* @) B3 g# _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. L3 C( Y0 n$ z( F6 ~
  22. * GNU General Public License for more details.: B% a2 g$ Z& Q8 T+ Y! @1 O" D. R5 x
  23. */6 U3 w( _+ @- F2 H6 R

  24. : {$ J# A. e" N
  25. #include <linux/module.h>
    + ^( U& _. q# j, g4 E
  26. #include <linux/init.h>' \, O' G) K7 h) G0 }
  27. #include <linux/errno.h>( }* w6 g7 B/ l$ u
  28. #include <linux/types.h>% @0 p, T& o% B6 E6 A
  29. #include <linux/interrupt.h>
    2 @7 O4 x, }# a0 Z; d/ {; a: t
  30. #include <asm/io.h>' P$ B9 N1 q( d  Y/ H
  31. #include <linux/moduleparam.h>8 |% ~8 Q+ u8 T7 a  \; b) C( [
  32. #include <linux/sysctl.h>: u- Z9 m$ Y  T4 ^
  33. #include <linux/mm.h>
    $ W' s! u* F- }3 z
  34. #include <linux/dma-mapping.h>5 H$ V: u, R3 [$ L. y5 _; Y6 x! Y

  35.   C$ |* e- t' y" d( N2 H
  36. #include <mach/memory.h>
      I4 v+ m$ ^' p5 B' X4 ]
  37. #include <mach/hardware.h>
      n( W6 v( }  p
  38. #include <mach/irqs.h>
    % Q9 x4 b; c. j+ k- y7 m
  39. #include <asm/hardware/edma.h>
    9 [: d; B8 W+ h% X8 K, V

  40. 4 ^# h" U3 u" T2 A0 V4 M+ C4 j
  41. #undef EDMA3_DEBUG
    / O  V. H3 J) {8 A& _5 F2 y- ?, H
  42. /*#define EDMA3_DEBUG*/
    5 H+ _: f% y$ Q  j  l- A/ e

  43. + ^- R: m* R2 l2 K# ~/ M- k& y
  44. #ifdef EDMA3_DEBUG5 w8 N) ]2 e/ A7 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 w( c' I3 g8 Q' o# c4 E) k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  D2 j; M0 G4 R' Z) X* E3 L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 N0 s/ x+ z! z& V( W
  48. #else" z' y8 j0 Z1 Q. }
  49. #define DMA_PRINTK( x... )
    , _9 D/ Q$ B( x' y( s1 ]$ H
  50. #define DMA_FN_IN! i! ]4 Q! T: z# e; j0 K
  51. #define DMA_FN_OUT( P4 n) y! X6 D( S* u! B7 h/ N
  52. #endif& p3 e2 t9 L0 q4 i2 J% r% P

  53. + z+ t2 L2 V( E) Y8 H# c# y' p4 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 Z2 `; ]& c1 C7 T
  55. #define STATIC_SHIFT                34 j# C" E" G  Z# Y4 L
  56. #define TCINTEN_SHIFT               20
    $ ~+ {6 g$ g! r- A; u
  57. #define ITCINTEN_SHIFT              21/ g( o" V0 ^( k. [3 ?6 b
  58. #define TCCHEN_SHIFT                221 p0 Q5 O% ?" P/ C: h: O. ^
  59. #define ITCCHEN_SHIFT               23) j) \9 P; Z6 [0 |7 e

  60. - {( @3 {) o0 n' n( z; K
  61. static volatile int irqraised1 = 0;
    5 r  A( {3 N) D% R% m8 [
  62. static volatile int irqraised2 = 0;
    / ?" [: b4 ?; k/ `

  63. / H9 q; e* P, ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( |! J0 |; M3 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- o: c$ C% n* A* i6 r2 C9 O8 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) u! t5 ?) t5 M; ?$ x

  67. , r4 O4 L8 J) w- q' E
  68. dma_addr_t dmaphyssrc1 = 0;4 v- o0 n8 y9 E" i
  69. dma_addr_t dmaphyssrc2 = 0;# m8 ?: }" N! Q5 l- L3 q
  70. dma_addr_t dmaphysdest1 = 0;
    ! N4 U( O+ O7 ^& E( }( V2 |2 q
  71. dma_addr_t dmaphysdest2 = 0;
    : |9 d4 j6 [/ A" d) C: Q' I* Q

  72. ) j, r- \7 }" s$ h. M7 B2 G+ n
  73. char *dmabufsrc1 = NULL;
    . _$ k% O$ d: b- ~6 S: k
  74. char *dmabufsrc2 = NULL;
    ; ^2 \7 F/ G; B: a9 a
  75. char *dmabufdest1 = NULL;
    ) w" _( `0 h, o  x
  76. char *dmabufdest2 = NULL;, c5 ~: C- v5 \# t9 L/ r" V) j" K

  77. ! O" q6 U8 F+ }9 D. t' y
  78. static int acnt = 512;7 O/ r2 a3 p9 F1 F! T! z
  79. static int bcnt = 8;
    ! B* k5 z" C6 G5 z3 D- N0 `
  80. static int ccnt = 8;% g. o  R# h6 x& E1 Q! q" w

  81. 8 P1 S0 W1 c4 T: V' m
  82. module_param(acnt, int, S_IRUGO);1 }+ ~5 }7 T3 x
  83. module_param(bcnt, int, S_IRUGO);0 S. Z- j) ~8 {/ A+ @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 ^6 u$ {/ L2 J5 A/ h/ D+ k9 `" [5 K+ }% G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& K, f; V/ n1 x5 b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& H% a1 ?; |1 x8 m1 O6 \: t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ ~2 n+ L# W( p6 x, n( w

" D! m% Z& c" p) y& v$ J
2 Y, L) {: [- g. r# p0 o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 01:29 , Processed in 0.039001 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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