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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & g' M. m& f3 f5 U, l
  1. [code]EDMA sample test application+ x* d0 |+ D! L& R; G
  2. /*
    . g$ q% n3 h& L' s' p+ H3 L
  3. * edma_test.c
    & W& l8 F3 p$ f( h6 C7 c$ u
  4. *! S% b5 ^2 o9 |; E6 F1 V
  5. * brief  EDMA3 Test Application
    & a2 z2 v: y$ o  J9 |
  6. *6 Y1 T7 J$ {: A: l
  7. *   This file contains EDMA3 Test code.
    * X' O' A% I" a0 O+ U
  8. *
    ' b, K% ^, O: y  L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 V) H1 V" {8 ^. h9 t* [7 l/ b6 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 J& ~+ k( T; F! a
  11. *         TO CHANGE.8 L2 h6 J8 v1 m3 \
  12. *
    ! `2 M2 Z4 }+ O5 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * ~9 y+ u8 Z6 U# B  r; r+ ]5 U
  14. *
    8 D8 ]7 h, \2 k" ^* U
  15. * This program is free software; you can redistribute it and/or
    ' o. `* v+ a2 r" @
  16. * modify it under the terms of the GNU General Public License as* p# j# Y( m6 q$ }( I6 l0 g
  17. * published by the Free Software Foundation version 2.
    2 w; G5 G; E- H  i9 V7 f4 ~
  18. *) g+ M+ V2 t1 U& ~& S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' }9 ?8 n6 n; D+ a& l0 y- ~4 C
  20. * kind, whether express or implied; without even the implied warranty
    4 d) a4 l  W' [& u7 \% I' \$ L' ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : p# w8 m6 N2 A) X- h9 R5 U6 N8 u( _
  22. * GNU General Public License for more details./ K4 Z: Z6 b  D& C$ K2 ?
  23. */8 Y$ K) Q- h  r6 j; q: S  {
  24. 4 @5 y& i. f) M3 b
  25. #include <linux/module.h>
    ! Y: R, Q; ]9 @, p# L: X; X
  26. #include <linux/init.h>
    + u4 B4 \) H, S! c7 V6 T
  27. #include <linux/errno.h>
    5 k( \9 `# I6 b+ Z% l# r  i
  28. #include <linux/types.h>
    2 Q" a* S6 n  v' C+ S7 w. \+ A
  29. #include <linux/interrupt.h>
    1 F0 n: l0 v7 l( U; X$ `( Q, ^
  30. #include <asm/io.h>
    7 U1 c4 e6 b, V  m7 b
  31. #include <linux/moduleparam.h>$ T3 k7 ?8 ?- t% X' j6 V
  32. #include <linux/sysctl.h>
    1 N3 c7 {* M" q# U& B/ |% N/ O
  33. #include <linux/mm.h>! O4 r' E# G5 l- M' O$ o) Y
  34. #include <linux/dma-mapping.h>
    , j/ b& e: Y* p6 }# w

  35. - |$ L, W2 C5 |" F
  36. #include <mach/memory.h>- h: M$ Q! C9 j& |  D. x: N
  37. #include <mach/hardware.h># S7 `; Q: C+ @, L5 f3 y) z5 s  f
  38. #include <mach/irqs.h>
    6 [5 ^) o1 O# F; n0 w, V
  39. #include <asm/hardware/edma.h>9 r7 ^# F" E. J6 G

  40. + k2 S  _! T; c' T9 ^
  41. #undef EDMA3_DEBUG0 \. z9 A  G' A$ ?3 c
  42. /*#define EDMA3_DEBUG*/
    " t. M" R3 @* q  b! a: ]: m6 l1 T: M
  43. 7 k' o$ x" X5 Y9 c2 G2 W
  44. #ifdef EDMA3_DEBUG3 Q; n: C# A! K; j' A7 V7 m" C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' {1 W7 O4 ~& }8 E' y8 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( q) @5 O7 J3 W+ t" d4 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ h$ g. |; F- R$ x6 c
  48. #else- b+ \% J3 i9 n
  49. #define DMA_PRINTK( x... )
    6 s9 \+ f# Y& p' i- W
  50. #define DMA_FN_IN
    7 h, Q: t) R) z/ q5 n
  51. #define DMA_FN_OUT
    , M+ P" q9 V$ r) J" G* o5 {: H% h
  52. #endif8 \- V8 z! \' _2 V# Z+ V
  53. * |) s9 P4 ~- ?! U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 I* A0 ^; z5 s1 X. c  a8 ?
  55. #define STATIC_SHIFT                38 N! M6 `; }2 p
  56. #define TCINTEN_SHIFT               20& \- ~8 X( A$ W* r7 m* q
  57. #define ITCINTEN_SHIFT              21
    6 u- P5 S) a+ f6 E
  58. #define TCCHEN_SHIFT                22
    3 |8 H( m. a- M) r& ^- k  q
  59. #define ITCCHEN_SHIFT               231 q4 w+ _* c1 M3 r6 a% N  }. n; G

  60. + ]; {7 ^( t8 s+ }  E
  61. static volatile int irqraised1 = 0;
    6 `; C* ~4 ?0 P" k! ]
  62. static volatile int irqraised2 = 0;
    * P$ C8 g2 Q( z
  63. 4 D+ G+ g8 r8 s/ Q* a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : N  X. I$ D9 f7 r. Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* w! n6 j6 F( o4 y  a+ c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! E, S+ r  X- J( d- |
  67. % H3 v. q7 n' ]* J
  68. dma_addr_t dmaphyssrc1 = 0;
    " R: ]0 M6 q2 P6 I
  69. dma_addr_t dmaphyssrc2 = 0;" A4 c% ?" z3 T, m% [# D4 N
  70. dma_addr_t dmaphysdest1 = 0;% y# s4 w% c) h- J
  71. dma_addr_t dmaphysdest2 = 0;  M( G& N. T) u* q+ C

  72. 8 K, _7 y1 S) W) a  Y1 p
  73. char *dmabufsrc1 = NULL;
    $ P( ~% X6 w+ Q- G. o
  74. char *dmabufsrc2 = NULL;, D$ Y' I: {, z) ~, a# I
  75. char *dmabufdest1 = NULL;
    + K! d, C1 _, C* b6 W2 h
  76. char *dmabufdest2 = NULL;( \3 n( }3 ^# F, Q  ]3 x4 r
  77. 4 G6 j, J' B5 ~7 w& ?+ `
  78. static int acnt = 512;
    & q. m4 [1 Q, _, T$ F* i
  79. static int bcnt = 8;2 e* [- g  S4 ~9 ^* d" A. p
  80. static int ccnt = 8;
    # y1 k5 o6 B1 [& w& r1 F4 ^

  81. 0 e% C6 Y/ ~6 S8 t( P) n
  82. module_param(acnt, int, S_IRUGO);2 P7 K! p$ V/ ]& E$ v
  83. module_param(bcnt, int, S_IRUGO);$ Q; v& a* R" {& }6 ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 w6 _/ _3 Z# q4 ]3 C" g

$ ^" F, D( K% a0 `$ A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; X: E  q+ C3 x! Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) x. g6 Z& v' W: [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 s5 l. F/ e' F+ }  `+ V4 J, Z. c9 ]+ {

' G0 s: Y9 K% d! C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 10:55 , Processed in 0.039409 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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