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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % C' \" G9 T; l- G& c
  1. [code]EDMA sample test application
      V- Z9 x7 _  X* V0 R. `4 U
  2. /*
    + I  a; i) O$ k+ \3 k
  3. * edma_test.c0 m. E8 R8 ]1 x3 j2 X" ^& g% D1 ]. Z0 @
  4. *, @- I3 P2 Z4 N! [* N
  5. * brief  EDMA3 Test Application2 p6 r  ]. L& Q. r/ U
  6. *: ~2 f, Z- _7 L+ q
  7. *   This file contains EDMA3 Test code.
    & U  U9 f3 L% @+ n2 P8 O' `& F
  8. *% c8 F: |) b: D9 s' p2 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! X* j4 J7 G4 h7 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 b2 r& c: Q6 ]. }
  11. *         TO CHANGE./ |0 K4 ?4 ]2 r4 c# y
  12. *2 _" R$ ?8 f. E4 w+ j: U0 ]1 z0 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# Q1 q) V: A4 f5 e+ z5 Z; _$ u) _, h8 Y# a
  14. *
    $ i2 e3 c/ q0 t2 v$ J
  15. * This program is free software; you can redistribute it and/or4 y) j( H9 O' n3 O& f$ C/ }2 f  i
  16. * modify it under the terms of the GNU General Public License as  a1 d4 A' g4 R5 Q% a
  17. * published by the Free Software Foundation version 2.! \2 r+ |, R8 h% C4 Z% [
  18. *
    $ k# j* a  u* ?! z9 u0 {8 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 @9 }9 h$ s% [( w
  20. * kind, whether express or implied; without even the implied warranty
    / U! ~+ G. B" @  y- _# S; b3 ]+ x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 h, W. Q) {, C" W$ p
  22. * GNU General Public License for more details.- ~' ]; z  O. y
  23. */( |' X# u, a& K
  24. 9 F" G' |5 c: l) w
  25. #include <linux/module.h>6 Z2 M6 F" b, |/ Z
  26. #include <linux/init.h>( @4 g1 U! v" ]7 ]7 h
  27. #include <linux/errno.h>
    2 a# r' l% v, _  L
  28. #include <linux/types.h>6 d, Q0 O3 U3 X
  29. #include <linux/interrupt.h>
    8 y0 w+ }  b/ b) M
  30. #include <asm/io.h>
    , e" P' C6 m6 R* X- ^
  31. #include <linux/moduleparam.h>
    / Q; `! P5 ?( ]: C( d; {( O1 h  d
  32. #include <linux/sysctl.h>9 F! j. X3 C5 g3 F. A
  33. #include <linux/mm.h>
    8 Y) F, ?& x  X+ J5 d* f4 z
  34. #include <linux/dma-mapping.h>1 i* O6 i; ^. o3 B
  35. * x3 R4 H9 O! Z3 g" J& g/ h
  36. #include <mach/memory.h>/ g& q. A8 i, K4 W
  37. #include <mach/hardware.h>
      o3 ]) H) S8 a; a
  38. #include <mach/irqs.h>& _0 k- X/ [* P+ X# |
  39. #include <asm/hardware/edma.h>! F9 h" N6 m0 {, L/ A0 t# o: a
  40. $ @6 A0 T9 r' [5 O; x
  41. #undef EDMA3_DEBUG
    + h. g$ U  W# E3 Z9 x
  42. /*#define EDMA3_DEBUG*/! @# J9 T3 K4 `( K

  43. " d4 g( O  a/ d4 z% F, R- U$ q# D0 m
  44. #ifdef EDMA3_DEBUG& t; Q! y8 ]4 d( T& l4 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# P' S  |3 o& l  D. v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 e& [+ Y0 D1 o# W# w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 e5 K% ^' `2 k9 I/ A
  48. #else/ P1 e; V! a* @6 u/ Q
  49. #define DMA_PRINTK( x... )* U; \: k/ B" J2 u9 N
  50. #define DMA_FN_IN
    0 R6 ]3 ]: D& X
  51. #define DMA_FN_OUT
    . D- m1 ?; k9 b; D: a
  52. #endif/ ]. |  x5 J! g! n

  53. 5 t7 j0 T8 u6 ~" f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 `1 e& u4 P* Q6 B- w/ q  ~4 j' }
  55. #define STATIC_SHIFT                3
    . f8 |' L3 G$ e
  56. #define TCINTEN_SHIFT               207 r) k6 d& t1 e8 [& z
  57. #define ITCINTEN_SHIFT              21/ K# u" P8 N: ?2 N1 u8 Q
  58. #define TCCHEN_SHIFT                22
    1 z0 i& e1 N0 |) n6 `
  59. #define ITCCHEN_SHIFT               230 s% w/ s/ z+ ?# R1 y: E
  60. 5 K  y5 G: p" s. y) B7 Y
  61. static volatile int irqraised1 = 0;% ~* v7 W. b& o4 W' s/ }
  62. static volatile int irqraised2 = 0;9 x: o9 {# T) t' |4 e5 @
  63. 8 c0 E/ E/ F% v; q$ T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      I$ Q6 q# V: S4 B. L3 J3 o/ n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % J/ j# a* `) F7 n' f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , m* F2 D, Z' v5 C( v

  67. 6 L3 m% ~9 _$ u2 T: S
  68. dma_addr_t dmaphyssrc1 = 0;$ V0 r- }1 f( p" B: o- L
  69. dma_addr_t dmaphyssrc2 = 0;
    6 `1 B5 N, {9 S, e
  70. dma_addr_t dmaphysdest1 = 0;
    * m7 N& `7 l5 E
  71. dma_addr_t dmaphysdest2 = 0;2 u5 j6 [$ g; R, K( C
  72. - \3 ~- @+ f. x2 ]6 l+ ~7 n
  73. char *dmabufsrc1 = NULL;* A6 |" \( x2 i
  74. char *dmabufsrc2 = NULL;
    & X3 O5 d- |* H: K
  75. char *dmabufdest1 = NULL;
    ' h, E  D8 ~5 \/ @
  76. char *dmabufdest2 = NULL;
    * a6 R/ m7 r0 a
  77. 5 n! K0 _# q6 H4 F
  78. static int acnt = 512;
    6 f* o! a- {9 m" a; z+ M% m' \
  79. static int bcnt = 8;
    ; I& g) }* r% ^  T0 M# z
  80. static int ccnt = 8;
    ( O6 M+ a8 K2 N" h
  81. ; p0 L# N% B! {* `8 t
  82. module_param(acnt, int, S_IRUGO);' x2 U( Y( ]1 N5 Z7 \' {9 k
  83. module_param(bcnt, int, S_IRUGO);/ t6 O0 T4 L  u) r' t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 ~5 [- U9 H' u. J- A7 N( o$ i9 K+ l3 M! z5 Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 c; \$ {" N  s6 Y8 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& i. H* C! G$ \  V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 Y& D1 {2 X+ n+ z

; `! D/ C8 F- w3 z0 u% }& D8 {2 N
6 V9 ~) x* x4 i$ S+ k4 V4 [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-7 18:03 , Processed in 0.040473 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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