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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# M2 \$ Z# v- L( o
  1. [code]EDMA sample test application) Z$ G5 @# E  E2 I& A. C4 @- B9 u/ i! w
  2. /*
      b3 U) c; x3 W3 k  ~( _( F
  3. * edma_test.c7 t$ A9 p  I  O) v$ ~1 G3 M7 P  X
  4. *6 G* m0 G1 ?( C" z
  5. * brief  EDMA3 Test Application- N+ P# b9 O3 v; D1 m: |
  6. *6 [. r( B, A1 L9 O: I
  7. *   This file contains EDMA3 Test code., z8 l* K: _  A6 q3 j( f' ~
  8. ** r& r3 X& n' {1 @. ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 A! ]3 M2 S$ y" k8 S# s6 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; t8 S3 R& r2 H2 ^3 R( d0 h
  11. *         TO CHANGE.3 [' b/ o1 s! m. x$ E+ e& o
  12. *; F5 w7 X; M4 I. s$ Q' ]9 U0 v4 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- I' D5 m# ?0 ?1 z* r9 M
  14. *
    " }% ^2 B' z7 e( c" s" T+ N9 y
  15. * This program is free software; you can redistribute it and/or
    8 ?' x3 S0 u, i7 y+ z
  16. * modify it under the terms of the GNU General Public License as2 o2 w4 h6 C; H* H. x8 t3 V
  17. * published by the Free Software Foundation version 2.
    % I/ z3 u% l% y
  18. *
    & L" q% J) |" D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & i0 D, Y# x0 k* N  K; [0 n
  20. * kind, whether express or implied; without even the implied warranty4 z8 s% W8 b3 n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , }& _! G5 `: K" y- J" s
  22. * GNU General Public License for more details.2 K" e* b5 O0 v  u
  23. */
    9 \0 b1 r3 M& c5 e/ q
  24. 5 t1 J5 Y  G2 m( q& U: ^
  25. #include <linux/module.h>; \/ i" B5 [: j
  26. #include <linux/init.h>: e( T0 }7 M% S( V# e# F
  27. #include <linux/errno.h>; j- I( y7 T+ a' B& }/ Z
  28. #include <linux/types.h>% S; G9 u: C7 N6 U& c. m
  29. #include <linux/interrupt.h>
    6 I( a9 M, ?3 o8 B
  30. #include <asm/io.h>' k7 q# N4 ~2 q) x& B
  31. #include <linux/moduleparam.h>* N  L8 x$ b/ e  b3 R8 i6 w  W; {
  32. #include <linux/sysctl.h>
    ' f5 d( B4 ]) q. Q5 E
  33. #include <linux/mm.h>
    8 j/ w2 g0 L% m/ T2 ~
  34. #include <linux/dma-mapping.h>
    ) [/ O; L+ E/ g# b9 r

  35. 7 w  L, F# ~$ k* |* a/ ^
  36. #include <mach/memory.h>
    $ x& {! ?  i: m- [2 c5 Y7 ~
  37. #include <mach/hardware.h>
    : a+ o( Y9 b# S- I( T0 ^' R
  38. #include <mach/irqs.h>6 }2 s+ p- f6 x  b
  39. #include <asm/hardware/edma.h>
    8 {6 e; p, w8 e! j" P5 J9 v4 Q6 u+ S3 j
  40. 8 C7 t% s7 T  |# i5 x; W) F7 ]
  41. #undef EDMA3_DEBUG
    9 ?7 ]8 a" t. H1 q+ m( }" p
  42. /*#define EDMA3_DEBUG*/
    " ^; J" `& u2 U1 [
  43. 7 Q* r7 Z+ i3 t0 g
  44. #ifdef EDMA3_DEBUG/ E$ U, j6 h, k0 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      u$ L( ]% ?' z! \4 W7 @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : n, q5 T+ h' q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 g, f* b7 d0 G! R. H+ I) r/ \4 P
  48. #else
    $ S2 E: M: G& g6 F4 g6 Y+ z% \) v
  49. #define DMA_PRINTK( x... )
    # j) \  w  B" t, o& X, l: f
  50. #define DMA_FN_IN! R$ J2 s, ?5 d9 j7 r7 I6 z$ ?
  51. #define DMA_FN_OUT6 E: q# f  L4 I" ~: s: ~
  52. #endif; [( Y+ B- K" \4 v  H" X" `
  53. - _7 l( m. m( K# V' C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( k2 Q. h# d9 B) [9 d% G8 Y7 I
  55. #define STATIC_SHIFT                3, I) @) n' s  R8 d4 X4 b
  56. #define TCINTEN_SHIFT               206 m) L0 X( j  f7 f( T! [) }+ R
  57. #define ITCINTEN_SHIFT              21
    8 S/ o' b' i4 H1 m: r0 B  k
  58. #define TCCHEN_SHIFT                22
    7 t) v! u" P' H
  59. #define ITCCHEN_SHIFT               234 u( w, J  n& c9 X) i

  60. 0 t2 ^$ F* C  J. k+ Q  x5 M- [5 C
  61. static volatile int irqraised1 = 0;# y: B! s5 c! p' Y% h+ ~
  62. static volatile int irqraised2 = 0;4 V  K2 R( Y% a/ _- R$ u, b
  63. % @: h" d; y) R+ B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' v! T) A1 a, k9 p/ P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& E. f. @8 M2 V; s& l% a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% i$ w- ~' M8 j- a: p
  67. 3 n6 e- ?' t: S: a; \$ a/ A& J
  68. dma_addr_t dmaphyssrc1 = 0;; o' o/ I& ]( E' y% h4 G+ h3 Q" E
  69. dma_addr_t dmaphyssrc2 = 0;/ B  r% y; E* @8 [( X! E3 C& ~: }
  70. dma_addr_t dmaphysdest1 = 0;
    0 w, n7 I5 n7 h' B) W
  71. dma_addr_t dmaphysdest2 = 0;
    / b5 p  p5 e5 P

  72. 9 c1 M: O- n+ H- {1 @
  73. char *dmabufsrc1 = NULL;9 @, D& m1 Y' a
  74. char *dmabufsrc2 = NULL;
    + w4 n/ B9 c1 ]
  75. char *dmabufdest1 = NULL;
    + @" l* |/ Z0 {3 O8 {1 |
  76. char *dmabufdest2 = NULL;
    / s0 k* j; T  W1 X0 s5 L
  77.   `7 W" q% C( V& S$ P9 t, S5 V. u
  78. static int acnt = 512;
    ( C1 C3 S+ w5 T
  79. static int bcnt = 8;3 i. |; q% T( ?$ l# F
  80. static int ccnt = 8;: X7 f1 K& O, [- W5 w. g% h
  81. 9 |( k$ q* Q, j" q; Z
  82. module_param(acnt, int, S_IRUGO);5 P# E- ~9 a9 B9 u) k& H' f2 Y2 A
  83. module_param(bcnt, int, S_IRUGO);. G+ u: p% K- u% t0 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 m  _7 Z$ `7 k2 K$ Q
4 q# H! A5 V* }" g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( I, G) x7 z& b/ C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 `8 K' X! X9 B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 k7 R0 K6 l2 f4 _1 G
7 y7 N. S  B1 {9 K) V

  t3 o+ M( C6 }) P! L% o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-28 04:25 , Processed in 0.041726 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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