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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' [  ?6 c$ g9 ?3 @/ B. S
  1. [code]EDMA sample test application/ Q, s* T/ W, _, ^- ^! m) S$ O
  2. /*: T: _1 C  p' q# n: i9 f
  3. * edma_test.c
    - ~( u6 n' O' V
  4. *
      y, C1 d& k, X
  5. * brief  EDMA3 Test Application
    - L0 e4 T- I; O8 ]& t
  6. ** t; Q: e- [8 G( `  b& P
  7. *   This file contains EDMA3 Test code.
    9 k' D& _* P6 K! e- L
  8. *
    . b$ `# g7 S- N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - n2 R( ]8 t) I( Y5 l9 g: ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 j. B, W* P/ X0 Z6 o
  11. *         TO CHANGE.
    $ P" U& V, w% C% {5 T* l0 c+ \& ?
  12. */ e) l9 @8 `8 ?4 J$ r) m  P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & B/ X3 Z3 t. H/ l/ K' F
  14. *
    1 E6 C2 p# X3 W
  15. * This program is free software; you can redistribute it and/or
    3 ^/ r# C! r6 V: q! N- ?; ^3 i
  16. * modify it under the terms of the GNU General Public License as
    / d, E, q% {" }
  17. * published by the Free Software Foundation version 2.
    : Y: H3 F& s  S/ u& ]7 G
  18. *
    * Q# H& H7 k9 j/ G/ i* o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* t$ R! a/ y6 L' K
  20. * kind, whether express or implied; without even the implied warranty: t( W4 w( f" n6 G4 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / A& h) ?; [2 F) P7 {
  22. * GNU General Public License for more details.# ?% w" G0 A* S) |6 Y
  23. */3 C( O; G( z7 W4 v
  24. 8 A; K4 T0 H' l; ~% h; [9 D( t: p  ]
  25. #include <linux/module.h>+ @7 z3 Z9 n+ W% k
  26. #include <linux/init.h>
    / e1 n4 j* s1 l
  27. #include <linux/errno.h>8 y0 h% x( `7 e% h$ ?0 s. t
  28. #include <linux/types.h>
    ) @- R( @, C% i! }; b1 v
  29. #include <linux/interrupt.h>
    ) `, R* G0 ~. A1 P- a
  30. #include <asm/io.h>: E" w3 }* k) q" i& J
  31. #include <linux/moduleparam.h>
    6 _+ d: Y. n" _. S# R( Z9 d) _
  32. #include <linux/sysctl.h>% a8 a; w5 V/ @9 v2 P: F) L
  33. #include <linux/mm.h>( W; Q. E' |  E( b0 ~. f
  34. #include <linux/dma-mapping.h>
    % V8 d. A/ P. N7 T6 `

  35. 0 N* {) M2 f' I, j/ v6 G3 N( l
  36. #include <mach/memory.h>9 b# j0 @3 U4 W+ l/ q
  37. #include <mach/hardware.h>
    1 k+ L% Y2 |) }/ I* n6 o. `7 M0 j
  38. #include <mach/irqs.h>
    ) e4 E( |( m. q3 \9 o2 U
  39. #include <asm/hardware/edma.h>& k9 D# p9 S- s# h6 I# k
  40. ( g" d. q3 t9 Y) ]
  41. #undef EDMA3_DEBUG  w% y2 f( x9 j  f; \- M5 K6 Y
  42. /*#define EDMA3_DEBUG*/, Y* S8 T7 {3 {; P+ l
  43. 4 `- ~# K# ~: i- }
  44. #ifdef EDMA3_DEBUG9 ~+ Q4 r) m0 a4 i& o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 k2 u" r4 e$ s$ P' \+ g) f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      ?( }) h4 f+ G, Y, T7 H# V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( L0 ^. y1 ?8 Q/ J8 v0 N
  48. #else
    1 L: {+ m& ]- t4 f# }
  49. #define DMA_PRINTK( x... )
    * Z; l; w) {" v5 h$ h
  50. #define DMA_FN_IN7 b5 m1 |& |8 m6 P0 {
  51. #define DMA_FN_OUT- ?- V7 k; K( r# e) N5 ]; t
  52. #endif
    % f9 W* N7 ~$ @0 K

  53. . E2 F0 V8 `9 S/ p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! o" @3 E" U+ x' V$ T3 c% r  M' j) V
  55. #define STATIC_SHIFT                3; x9 L% M7 Q$ a* g% B
  56. #define TCINTEN_SHIFT               206 z/ T* b  E% v( X9 D& X
  57. #define ITCINTEN_SHIFT              21) V, V! Z; g( a( J4 e% D8 E
  58. #define TCCHEN_SHIFT                22
    $ Q5 U1 l7 N# F2 q
  59. #define ITCCHEN_SHIFT               231 U# w+ t' G2 m& W1 U( ~

  60. , Z7 P! b  ]. ~
  61. static volatile int irqraised1 = 0;! v0 Z' E( e' q, y' c. M
  62. static volatile int irqraised2 = 0;' o7 r2 c( [- ~8 Y7 x) y* ~3 z4 n

  63. 0 S- d" c  ^& U# `7 C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! T, i2 A* ]: `; [8 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! t6 R5 c/ z; @3 [; {$ V% r0 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : @2 B: X2 I3 D
  67. ) V5 g1 R6 P3 t* Z3 w( s# M
  68. dma_addr_t dmaphyssrc1 = 0;4 F3 v8 ~. B! z0 A* U
  69. dma_addr_t dmaphyssrc2 = 0;
    4 _. _% x& b4 S  c# d
  70. dma_addr_t dmaphysdest1 = 0;
    - U$ a7 m$ s% N* A# n0 @% ~" m) @
  71. dma_addr_t dmaphysdest2 = 0;# R: }+ \2 {" [/ \& ]9 P3 F  u0 G

  72. / g4 _/ w2 ?) A% d% D9 K( J% P
  73. char *dmabufsrc1 = NULL;
    + E6 v3 g# W$ L  A# q
  74. char *dmabufsrc2 = NULL;
    $ @  O; H, T  w$ J6 z6 V, W
  75. char *dmabufdest1 = NULL;
    # L8 \0 h' g- O& a
  76. char *dmabufdest2 = NULL;
    4 c/ j& X; v0 O. _% `9 |

  77. 0 }2 i/ L: m+ w' J/ F
  78. static int acnt = 512;
    , H7 c& s" i; i1 {( S
  79. static int bcnt = 8;
    ( K+ E( c9 @& w
  80. static int ccnt = 8;1 m5 s, ?/ L% g, m
  81. % F2 h/ p4 v! ]1 o8 s3 z$ t
  82. module_param(acnt, int, S_IRUGO);
    ) O6 w: d- ~+ W3 y
  83. module_param(bcnt, int, S_IRUGO);" S  `( J, L, t& L+ @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ ~3 C9 D/ T- C$ N

! I6 X; I: E" j$ \. X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 O$ V6 ^$ C" B6 @% d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) m3 P4 S8 \* }$ q6 D8 I/ p: b( h% H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# c$ F! E( |% K) w( z
- r& L8 l1 |$ S8 u+ F) Q3 O
8 P6 I+ B6 A0 @0 p% |, ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 10:16 , Processed in 0.035906 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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