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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; M% n5 O; \0 @" z: {; e
  1. [code]EDMA sample test application: a# s; f2 V, R# c  W' c- V
  2. /*
    ' A3 e$ t" D- J' @0 R, d
  3. * edma_test.c
    2 W, x' @6 ?$ e. w
  4. *2 N! X- F8 U6 g0 y
  5. * brief  EDMA3 Test Application
    / [7 B0 |, A" a- s. ^( W- m
  6. *
    4 k% ?7 T) L( u1 i
  7. *   This file contains EDMA3 Test code.
    1 I3 ?& m0 @$ q
  8. *% ~6 m. {, |4 Z* @! V4 l! n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 M7 Z* c, r9 a- c' N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: q: s* _  a2 o! g1 l
  11. *         TO CHANGE.2 k) h( E7 `6 N. f/ i
  12. *
    # n% r& P+ r5 N! \* T& L; G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: c! O- O! u' W  D/ E' \' W+ I
  14. *
    8 m. F* K  F( K" y& w
  15. * This program is free software; you can redistribute it and/or, d# g; I* S& ]3 x/ G
  16. * modify it under the terms of the GNU General Public License as
    . u7 w1 @6 L9 g5 s! H: r0 l8 Z
  17. * published by the Free Software Foundation version 2.6 T: K+ w- @- [- l3 E
  18. *
    . `, |6 C6 }" O5 r* w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 P$ S, L- O( S2 p
  20. * kind, whether express or implied; without even the implied warranty! f3 m4 Y; R- L; J) E4 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 ?3 g4 J. Z, x( y' E0 o  t
  22. * GNU General Public License for more details.
    6 M2 m0 v* Q9 a5 l1 v+ e0 f' g' E8 |
  23. */
    / p1 \" f; @5 W; [' s, _
  24. 4 R+ n; ~1 L! m8 ~+ q2 `+ \3 g7 W! l
  25. #include <linux/module.h>
    % g+ `+ z9 Z- m3 v
  26. #include <linux/init.h>  S# z# y. _" E  u
  27. #include <linux/errno.h># B- C, `* p% Q, F& N
  28. #include <linux/types.h>. S7 |( [/ g4 N$ k5 \( Z
  29. #include <linux/interrupt.h>; M* N" V: K1 f, x7 z, k
  30. #include <asm/io.h>- O' q2 n( R( I, w7 ~
  31. #include <linux/moduleparam.h>/ E5 ~- @6 E4 q3 w& ^
  32. #include <linux/sysctl.h>
    : B' U+ x# S7 @
  33. #include <linux/mm.h>
    1 X- X; t9 L. F9 D7 z
  34. #include <linux/dma-mapping.h>
    $ @0 U9 L0 X$ v6 [9 b' m

  35. ; F. A$ G$ N, @0 [! X4 m
  36. #include <mach/memory.h>/ }  P  n# a( z& P: w0 c
  37. #include <mach/hardware.h>
    5 }; J* d/ v* S
  38. #include <mach/irqs.h>
    3 y# p, {7 X6 W+ k1 l
  39. #include <asm/hardware/edma.h>
      M2 q6 }: T8 z% J" a; F; t$ O

  40. 4 o  B& M& j- n" F5 z1 e% S. }
  41. #undef EDMA3_DEBUG
    % D' E' L, D5 L; P; s, r
  42. /*#define EDMA3_DEBUG*/% I& N0 \0 g  l

  43.   u! _* P# T, M: Q7 Z
  44. #ifdef EDMA3_DEBUG
    0 o, T! W% _  K: u/ q2 e+ E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - R3 S. ~0 V+ Q1 ]- L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  ~% b6 P( ^+ H) d' X- u. a2 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* I" a! K; Q& f% y5 i3 u! ~& M9 a
  48. #else& c. |  D( @! \3 o/ f2 R
  49. #define DMA_PRINTK( x... )
    , ?9 A5 D$ |$ ?4 Y, l& L/ i
  50. #define DMA_FN_IN
    " T) _, Q! r" K1 v, v( w
  51. #define DMA_FN_OUT! r5 s5 T7 q. f5 n, @# p1 q
  52. #endif
    ! `. q  E; ~7 K2 T
  53. , w2 \( P9 J4 r* W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 q3 {0 y- f7 r2 b
  55. #define STATIC_SHIFT                36 C. g0 S" ?+ D* f
  56. #define TCINTEN_SHIFT               20+ U9 R. ], ~* I- C1 C7 f% z2 j( E
  57. #define ITCINTEN_SHIFT              21$ t# D6 x5 `1 X5 T0 c
  58. #define TCCHEN_SHIFT                227 `6 u7 G* c* ]1 k9 N. q9 H
  59. #define ITCCHEN_SHIFT               23# Y' U& q: v+ R
  60. 4 b: h2 m  e( S! p3 h6 d2 I) A
  61. static volatile int irqraised1 = 0;
    ) R: ~9 A; f/ C( I% U
  62. static volatile int irqraised2 = 0;
    " ~0 F. h* Y& s$ I. j4 K& ^
  63. 0 d6 G- N# X2 o( c# P, o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  ~% p5 o- ?6 _! a6 t! @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 @/ p  S/ n3 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 R" F8 x7 j! p2 w) J

  67. - a4 c( q) J1 D) A& c5 X
  68. dma_addr_t dmaphyssrc1 = 0;9 [4 G% {( ]/ j8 W4 k+ @: O6 r$ c/ T
  69. dma_addr_t dmaphyssrc2 = 0;
    6 r9 a/ J3 e! \! ?) d3 o7 R
  70. dma_addr_t dmaphysdest1 = 0;. M: G+ c8 f( c; u7 _) T& t
  71. dma_addr_t dmaphysdest2 = 0;+ {$ |8 w- K9 Z, y

  72. 1 s- L+ z2 l4 Z5 }8 H  n
  73. char *dmabufsrc1 = NULL;9 \, w' g9 w6 F& e" _, Z! y; z
  74. char *dmabufsrc2 = NULL;$ I0 [+ h7 b" E! ^1 t& K/ s
  75. char *dmabufdest1 = NULL;
    ! H. n& G1 L! S9 z
  76. char *dmabufdest2 = NULL;
    $ N: N  X8 b3 X, Z  ^% e& ?0 f3 l

  77. 9 @6 C" i; X0 c% L5 }
  78. static int acnt = 512;
    , P7 D. Z0 _1 C7 a% \! K: d
  79. static int bcnt = 8;
    4 S8 Y/ R; N, d) y) Q  u2 B9 a
  80. static int ccnt = 8;
      U( U0 ^8 B4 o. u+ Q) l. q5 Z# W" S
  81. : v3 T4 M2 G: k# k# e, l
  82. module_param(acnt, int, S_IRUGO);
    6 O" n# J" m' `1 c/ Y
  83. module_param(bcnt, int, S_IRUGO);
    3 G; f; E! _4 P: I2 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( G' P6 Q$ r- @. O

$ X2 a7 X$ \- y6 X( w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& d  Q) W! ]* M, _. A, c3 O9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  \/ B. J! r7 k1 O  J9 o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 X  {* M  y. ~1 k# G) \+ Z: {

$ B6 Z) N+ U7 g2 y+ }7 E6 [! V- i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 03:15 , Processed in 0.047986 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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