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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: ~. a; @: e$ ]6 d9 x
  1. [code]EDMA sample test application& b2 l  g7 @7 k4 a! R
  2. /*
    5 w  d$ T* z* K: ?1 [( U" e
  3. * edma_test.c# \/ g. N& ?; {
  4. *
    0 h8 l7 l3 ?( R9 E- F' Z5 H# c* y
  5. * brief  EDMA3 Test Application
    $ m' {. B* F; m' V, P, g+ a, K6 }
  6. *
    4 l& ^* {9 B: L" ]) n9 R
  7. *   This file contains EDMA3 Test code.
      b" ]4 [' z3 }& T
  8. *6 |0 r, U) r4 z, m4 T5 \0 @' H; Y- u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 w9 y8 P$ j  {% t/ x1 j$ t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 V+ r6 Q: T; z% k( ?8 O+ }
  11. *         TO CHANGE.7 K6 B( E* F' R4 U: k. F& N4 [# e8 X
  12. *+ [* x" E8 L' Q" `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - |/ C- v" B; W3 Z! l& z
  14. */ L, t8 k5 P  N9 @/ a1 P
  15. * This program is free software; you can redistribute it and/or
    # x6 z& w9 {, m
  16. * modify it under the terms of the GNU General Public License as8 T! S* w& |! E- v4 G2 }/ x) G
  17. * published by the Free Software Foundation version 2.5 `4 U# {9 A) M, u0 Y
  18. */ |; M& b# }( I2 A' R4 C3 D! r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 S' Z2 [7 |5 E. Z
  20. * kind, whether express or implied; without even the implied warranty
    * Y+ u: h3 |4 W& w! ?$ v4 U; e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 f7 w: m2 H7 s3 ]
  22. * GNU General Public License for more details.6 w" ^) Z* g7 B" I
  23. */9 a# Y! i: i6 f8 ~8 z3 F% D$ w
  24. # {  O! G* f6 T2 A5 p( J
  25. #include <linux/module.h>
    * _  `' `( y( Q' b3 {0 B
  26. #include <linux/init.h>8 s' m6 ~; [; ?2 u
  27. #include <linux/errno.h>
    ) c+ B! [  M, K% ~# `) z  `. D) H) |
  28. #include <linux/types.h>
    . D2 k5 N* C( ]: i+ Y
  29. #include <linux/interrupt.h>
    - ?6 t8 t( t9 ]/ t
  30. #include <asm/io.h>
    7 h! Y. B5 e, H1 Y" {; I5 c* D0 z
  31. #include <linux/moduleparam.h>7 l$ U) l& ~1 ^- ]% o% i
  32. #include <linux/sysctl.h>8 ~" |$ K  ]5 m) \9 a0 I" J
  33. #include <linux/mm.h>+ Q' w( d$ ]5 N+ B$ }" h7 \8 S: ~; ~5 h
  34. #include <linux/dma-mapping.h>( ?  L0 C9 f2 \  e3 |# h+ b4 Q, p
  35. 8 V/ L3 x8 H7 }. O8 Q% Z
  36. #include <mach/memory.h>
    ) l$ J# ]  A3 H
  37. #include <mach/hardware.h>! L" ]- u( W& A$ |6 r+ ^
  38. #include <mach/irqs.h>( C. y* N, d+ l+ D, T  Y
  39. #include <asm/hardware/edma.h>
    % f- h$ a4 q$ a+ J
  40.   h5 X6 a, k% w
  41. #undef EDMA3_DEBUG
    5 V* b" @9 q  L9 e3 Z# _
  42. /*#define EDMA3_DEBUG*/
    / D( R4 U# h. C# [

  43. 0 ~% ]) D7 r/ ^: P6 [2 Y# B4 \" }
  44. #ifdef EDMA3_DEBUG
    ! x% c( Y. l, }3 M3 Q) ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' {  e" [) w+ m8 R1 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- z+ O* i5 A  O6 ]* r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ q' H* o* H2 r+ V& D
  48. #else$ B0 S5 ~9 G" B( j! G
  49. #define DMA_PRINTK( x... ); ^; s* O/ M' w: Q5 t
  50. #define DMA_FN_IN, O& ~: N/ \4 H9 I
  51. #define DMA_FN_OUT1 p7 M1 r7 m8 n  [: G3 k- M
  52. #endif
      v6 Z- a4 v) ]: k( J
  53. - b. E" Z6 L+ Z! G; M  _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 C2 g* C2 k# S; S, x
  55. #define STATIC_SHIFT                3& @; K) J7 i- o# V& R% a
  56. #define TCINTEN_SHIFT               20
    , e: q) t- U% D+ e) x
  57. #define ITCINTEN_SHIFT              21
    0 H$ Q4 q# ?! ?' Q4 f+ ]4 r
  58. #define TCCHEN_SHIFT                22
    * {2 G+ a/ r) S" P
  59. #define ITCCHEN_SHIFT               23
    * w  v0 S5 l# P% ~
  60. $ |9 X1 |  t2 N- ]+ @3 K
  61. static volatile int irqraised1 = 0;. Z: B+ A9 |3 w" H3 z, s
  62. static volatile int irqraised2 = 0;
    " s( b5 r1 p. d$ j, c7 R# d( t
  63. ! k* N$ |" A' R9 Q% L. ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Q+ q' Y- ?0 {  ?( o/ ~) B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( z' v- M  c8 e4 b$ z6 `7 _: g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' F0 e/ k8 z6 |% x

  67. , \4 n' l2 K) q
  68. dma_addr_t dmaphyssrc1 = 0;! s! i0 h6 e! E- ~' O
  69. dma_addr_t dmaphyssrc2 = 0;
    3 B2 E& G; Z4 ?8 d7 q0 p
  70. dma_addr_t dmaphysdest1 = 0;; ?# r) T( \: y) u5 U
  71. dma_addr_t dmaphysdest2 = 0;) j# E- r- V+ @9 X

  72. " v% b  _$ B) q; i
  73. char *dmabufsrc1 = NULL;+ }  B# _0 f: R
  74. char *dmabufsrc2 = NULL;
    & ]( _# k( `: V& w& d
  75. char *dmabufdest1 = NULL;) X+ c8 I( ^, C' O. w
  76. char *dmabufdest2 = NULL;+ m5 H: f/ `, y* Y3 c5 J, w

  77. 2 w& N& k0 _6 W( O
  78. static int acnt = 512;
    ) P+ G, w1 ?" ^8 k6 y: }
  79. static int bcnt = 8;5 }2 s2 r7 N, _6 B! I6 Q
  80. static int ccnt = 8;
    # }5 o" P/ C' N: c' D( W
  81. * |4 T, r4 U& d4 [, A, y
  82. module_param(acnt, int, S_IRUGO);, y7 C3 d/ R, N& }0 Q, h6 c4 T
  83. module_param(bcnt, int, S_IRUGO);
    6 J7 Z+ z6 q( _2 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ J  U" k& `0 F1 }* D
& p2 A( Q# {6 N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 ~1 O" m1 r6 x, |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 R, {) j  X) Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# I7 o" |  D3 |& O( a7 O( K

+ u' u* e: }" P$ E. X. q2 v1 m$ j. e5 v8 D  |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 04:13 , Processed in 0.039915 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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