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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 L2 G$ a7 w- h9 h* ?& I
  1. [code]EDMA sample test application: i# P" g3 f4 R- ]- m
  2. /*
    ' B7 e9 `- l% N  N5 E
  3. * edma_test.c- y7 l# e/ X; S" n2 [8 F1 d/ x! V
  4. *
    ! C# H  s6 ^2 o. A: k
  5. * brief  EDMA3 Test Application0 N" N" [! S% D. X# a
  6. *
    / u0 B) _2 e+ U
  7. *   This file contains EDMA3 Test code.+ U! M) ]0 Q: U/ h. O0 ?% A. A
  8. *
    , w4 A$ I  E, v' o3 _1 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 Y2 g% e* n' p5 a5 n1 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- M' a; K( [2 v
  11. *         TO CHANGE.
    3 F5 |2 s0 ~) ^- U# |  p8 B
  12. *' {5 F. U2 F! Q3 z& K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 }! l- S2 I, |* o- _" Z5 m: ?1 _
  14. *! t: R# H7 |: M* @
  15. * This program is free software; you can redistribute it and/or1 ^& {% m6 _+ J' ?" i1 h% Z
  16. * modify it under the terms of the GNU General Public License as3 g, V: N* ]5 d: e$ E
  17. * published by the Free Software Foundation version 2., [0 A* r3 u& p5 n
  18. *
    4 [4 v1 V9 }) C) \( L% c0 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 i. ~1 I7 P, W, w0 p! x
  20. * kind, whether express or implied; without even the implied warranty
    0 t- A: o4 v* X5 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% s& w0 N+ d, t/ Y, s2 u- e
  22. * GNU General Public License for more details.; @7 _+ H  e6 u! d  l2 ]
  23. */
    ' S0 }( Y  E  {0 u7 H' q, }

  24. ! v  i; w3 D! q( i. _
  25. #include <linux/module.h>
    0 ~- Z6 g; T/ ~4 O! R
  26. #include <linux/init.h>6 i/ s, q) Q& v, i; g6 d( y4 _
  27. #include <linux/errno.h>
    ) y* \, h' _9 o0 u# _
  28. #include <linux/types.h>
    + P2 N, t1 V, X. p( p2 a
  29. #include <linux/interrupt.h>
    & Z5 J6 [0 u  h0 b! O$ V( A( q' N
  30. #include <asm/io.h>2 [# _( P- h7 w8 J" t
  31. #include <linux/moduleparam.h>
      W7 ^9 w. }9 k  S. {
  32. #include <linux/sysctl.h>
    ' T7 w  s. e. I3 d6 M5 H
  33. #include <linux/mm.h>
    ) x$ m4 y4 a9 c2 G- j
  34. #include <linux/dma-mapping.h>
    - v+ T3 i5 F% V0 l! N
  35. 3 K  J) G8 q6 R4 `3 w& ?' h
  36. #include <mach/memory.h>( a$ L" H6 @8 N; g+ \
  37. #include <mach/hardware.h>2 g/ f' t* t% a
  38. #include <mach/irqs.h>$ h" x8 H1 B3 B. e
  39. #include <asm/hardware/edma.h>. H" e/ X' x) o7 z7 v, T$ r, ?

  40.   |) W& x: p; Z' q! M" E
  41. #undef EDMA3_DEBUG' e+ ?4 T: L7 c
  42. /*#define EDMA3_DEBUG*/
    7 j& n- f  P6 y

  43. * Z) }/ v- I  z, @5 @! m+ I7 I( W
  44. #ifdef EDMA3_DEBUG" I/ E: z/ c. ~. }  S/ U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): O9 C2 R4 X: B/ N9 {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 O9 G$ G; f; v7 K4 m2 g6 f4 a. t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* x+ i$ _3 o" q* O, ?
  48. #else
    4 K0 U4 {3 V* J/ d, L6 R
  49. #define DMA_PRINTK( x... )
    0 m$ P* \8 Z- V8 B
  50. #define DMA_FN_IN
    + H/ I/ r" i1 }) g" n  o' `
  51. #define DMA_FN_OUT
    * |9 R' z6 u6 c
  52. #endif( q1 X: ^. _$ K1 b

  53. & \" P( A: W+ h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , e( n: O7 k6 N1 U% K1 ?5 T
  55. #define STATIC_SHIFT                3
    $ D+ B; E, E2 `2 {" w* G
  56. #define TCINTEN_SHIFT               202 z% y& r3 C$ f2 G
  57. #define ITCINTEN_SHIFT              213 J. Z$ R+ N0 F6 ?
  58. #define TCCHEN_SHIFT                22! w+ c3 W- N& R" P- [" i
  59. #define ITCCHEN_SHIFT               23
    % B* G1 ]3 {, Q4 P1 V5 s1 T
  60. 3 i& C1 m; P5 L: Z+ y$ ^
  61. static volatile int irqraised1 = 0;3 R+ ?. R- n/ M
  62. static volatile int irqraised2 = 0;
    / V" ]1 t1 N9 F

  63. ' E$ N# O  \+ D/ u1 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 A4 g, O/ B" M. d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' E. T. H2 c0 V  s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, o# j% S' c: l! C/ @. n( c. Q# E

  67. $ ?; d, a" Y# c: t& U. y6 S( O
  68. dma_addr_t dmaphyssrc1 = 0;1 [9 e/ Z. d; O3 x7 X
  69. dma_addr_t dmaphyssrc2 = 0;+ J7 w0 B# c" a4 m' a# E! _" w
  70. dma_addr_t dmaphysdest1 = 0;4 z. J1 _: q4 X' r0 L, b7 |- S
  71. dma_addr_t dmaphysdest2 = 0;
    9 _5 v. Z2 T0 s. P8 d* V# V
  72. 7 a: f& `, _! M- t3 N/ h
  73. char *dmabufsrc1 = NULL;. H: l7 [2 W& U& h+ h& n( e7 b
  74. char *dmabufsrc2 = NULL;8 w* g7 r7 R6 P2 b2 f) v+ d
  75. char *dmabufdest1 = NULL;. x. C/ L. E9 v# V
  76. char *dmabufdest2 = NULL;' t& Y9 H; X8 ]( s. U9 B

  77. + V0 e: |2 B& o  {8 V
  78. static int acnt = 512;
    ( d# u' s( [8 P1 w; T6 R
  79. static int bcnt = 8;0 ~9 u7 ^# l. w( ]' _. W3 E
  80. static int ccnt = 8;0 r7 C5 E) h# H# `/ |5 N) C7 `+ m

  81.   X& z! s5 ]9 w5 J! R0 y
  82. module_param(acnt, int, S_IRUGO);9 }3 K7 [4 S/ \5 ?  C7 |' N& a
  83. module_param(bcnt, int, S_IRUGO);3 K. }! N6 i6 }" v+ C' \; E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( y  Z2 S& U1 S3 Q: y& g
0 m# W5 }% x" u; q/ C0 Q  i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* K6 x# m0 p4 s. B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' M0 y8 O3 {4 L& ]/ Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ E. ?( H! _* Y% ~" m$ G5 q
$ `4 k, B9 |6 x3 U' P/ e6 d
' n6 ?5 S3 g0 _6 o2 N/ D9 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 07:52 , Processed in 0.047503 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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