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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 k+ i7 U% y  W- C" J. Q+ V1 c3 o
  1. [code]EDMA sample test application" W2 M* p4 N" O
  2. /*0 i$ Q9 ?$ v6 T9 D9 {
  3. * edma_test.c
    / V; m+ M$ c! m9 x+ w+ A
  4. *
    , L+ m$ X! e6 D
  5. * brief  EDMA3 Test Application! t. ~3 R9 G8 ~8 _, @
  6. *
    3 P: A2 j7 u' f4 k) C/ I! z9 f4 i$ o
  7. *   This file contains EDMA3 Test code.; A* r* o( J1 J  l1 M
  8. *
    ( q+ \$ Y* F9 I% _* z& t1 B6 ~6 \* I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; Q1 e1 ?: K& K& X& T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! Z4 c$ }' h7 J, e; d; z4 Q* S
  11. *         TO CHANGE.
    ) k& H  y4 z, s. E
  12. *5 @4 Q8 y: T$ X# B$ N1 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 }2 C5 A  V* W! T6 M
  14. *
    , P/ Q) v' Q' Q  f+ z
  15. * This program is free software; you can redistribute it and/or
    4 y0 P$ n3 @3 q" |
  16. * modify it under the terms of the GNU General Public License as
    9 |2 k5 N1 r" t0 A
  17. * published by the Free Software Foundation version 2.
    " W2 p( Y& i+ r3 [3 ?9 d' b
  18. *' |4 A; w7 w; F/ x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 X5 o/ m, F0 z0 U: ]7 K+ ^
  20. * kind, whether express or implied; without even the implied warranty, d2 I( y- _& h2 T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 u5 c; o" P. v7 o7 |3 q
  22. * GNU General Public License for more details.+ ]1 r* l5 p8 U7 r. Z
  23. */
    $ J6 V, Z# Y) S
  24. 2 x5 I8 V7 P  g
  25. #include <linux/module.h>+ x  Y$ G4 H9 {% s$ N" I
  26. #include <linux/init.h>
    . M- v; w" i9 H8 N4 U
  27. #include <linux/errno.h>; E# U4 A* e3 F& h
  28. #include <linux/types.h>7 G2 V# G. q( T2 y' s5 L
  29. #include <linux/interrupt.h>+ m% x* f' D6 [1 b/ E
  30. #include <asm/io.h>
    $ |5 |6 Q$ w+ Z% z5 F
  31. #include <linux/moduleparam.h>- _, i4 U7 g* g$ K0 n: L" S
  32. #include <linux/sysctl.h>
    4 r& g: y9 O' Z% S3 h  P7 r
  33. #include <linux/mm.h>
    / v: R& b. O+ d
  34. #include <linux/dma-mapping.h>
    9 A7 ^8 {6 H9 X; p' J; Z
  35. 2 l" H8 K0 i2 O6 z- R, `
  36. #include <mach/memory.h>) q" O0 C9 b/ O+ e) U, S
  37. #include <mach/hardware.h>
    4 v3 H( y0 w( d3 E* X
  38. #include <mach/irqs.h>! r/ \" R$ H1 D9 U, O7 z6 O
  39. #include <asm/hardware/edma.h>" A. F8 k- {9 R$ j9 p/ h2 Q6 F" u
  40. ( x- X% `+ w6 N  _" H) s
  41. #undef EDMA3_DEBUG
    # U4 I: g+ d7 J9 g, \* ^* R1 y
  42. /*#define EDMA3_DEBUG*/
    " R$ x1 h' G3 t0 g* {/ ~7 O
  43. 1 R2 Q( q: q1 Q1 D# z( Z
  44. #ifdef EDMA3_DEBUG7 w- x/ {1 m7 E9 I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ a  @8 R2 |0 S! l& d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ H' E' p; k/ T) X9 f, e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , f9 k' [  {1 L1 g4 r6 `
  48. #else& U9 ]  \) B  @# A" h) I8 h2 }
  49. #define DMA_PRINTK( x... )
    ' v+ D" D: S( K
  50. #define DMA_FN_IN
    $ m0 K7 _  i0 C1 R0 J
  51. #define DMA_FN_OUT
    - e" Y( S8 X  ]! H# G+ X1 o9 U
  52. #endif  u# H* O1 y5 U9 ?( l- h
  53. ( v6 m1 Z# l# h1 n1 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); M6 M' o& L; S+ K6 D2 }$ V' g( e
  55. #define STATIC_SHIFT                3" M. _: B, l# F) M  W% P! \: c
  56. #define TCINTEN_SHIFT               20
    , N- Y1 U+ `1 Q
  57. #define ITCINTEN_SHIFT              217 f% S" f3 S( P& e
  58. #define TCCHEN_SHIFT                22
    9 t! }- g3 S  J6 ~8 f; M6 v
  59. #define ITCCHEN_SHIFT               23
    & \% R  i: w- |/ o) G3 H1 R+ b( N
  60. , [: O/ J0 n! b* s
  61. static volatile int irqraised1 = 0;
    " x) ]# b* \, \/ [' M
  62. static volatile int irqraised2 = 0;
    # t( e' R0 ?7 B! ^8 ~- U
  63. ( s* K' K; C/ O; B5 w0 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ s' y, j% j6 E( N! J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ k! a; V6 J8 G3 ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 u. {% v: W3 M, V" |/ U: F  u
  67. & Y2 X1 Z  D8 a* d, x4 s
  68. dma_addr_t dmaphyssrc1 = 0;
    & f; d! t+ |% p0 L
  69. dma_addr_t dmaphyssrc2 = 0;
    0 f5 d6 O- V# r6 S6 B' Z
  70. dma_addr_t dmaphysdest1 = 0;' J& l: s, R& j9 @
  71. dma_addr_t dmaphysdest2 = 0;. b) q2 a% L+ l, e

  72. $ c" m- |  \) o( k
  73. char *dmabufsrc1 = NULL;8 I  U; ]& o+ w2 N2 M
  74. char *dmabufsrc2 = NULL;
    8 f" A- X$ h/ u5 d
  75. char *dmabufdest1 = NULL;
    2 L; Q1 P! d1 U* p5 ^! x* @
  76. char *dmabufdest2 = NULL;5 J% r- W5 W! N& s2 O9 s6 C

  77. , G& o) p& B6 k
  78. static int acnt = 512;
    2 M6 s$ H' V  p5 Z
  79. static int bcnt = 8;6 b' a& J: j. D" d- \5 R5 ]/ A& t
  80. static int ccnt = 8;" B& T8 N+ T# u$ _
  81. - k: g7 `# x! W1 y* B9 w! t
  82. module_param(acnt, int, S_IRUGO);
    * ^/ N) l; `. i7 K( N9 ^/ |& N
  83. module_param(bcnt, int, S_IRUGO);
    5 Q8 _6 P1 \- m7 @7 s3 e' @) p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. f. O) Y/ W4 a3 F7 T3 R. c( F% |* }5 H4 D6 l& z% A4 I) y& Q+ ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% q1 ^& O; l: Y# w" V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 F' x% v+ C; o! q, h9 D* [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 J7 ]8 r( ]9 a  b
& ^8 x* s# _: ?# ?
" b  T& Z3 h8 N" Y/ _% J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-11 15:20 , Processed in 0.037048 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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