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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - ^% g8 n" Y/ X3 o/ F* X3 d
  1. [code]EDMA sample test application) x2 s+ c- G# J
  2. /*
    . K/ ]: D: F; c0 i: h* @' G
  3. * edma_test.c
    . M8 Z! H3 b+ C. m: [( T7 t( L/ L
  4. ** A6 |; q: J1 S. z3 f0 z' L2 g
  5. * brief  EDMA3 Test Application/ v' u0 T8 P% b. D7 ~( y) u
  6. *
    . v. V% X4 c( k, {8 D
  7. *   This file contains EDMA3 Test code.: ]! a% F, _% w( m# N
  8. *- h* f8 C6 C3 a1 Q7 p5 \  j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / u- Q8 ]' X2 P: @% h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 x8 q2 A# ]& ]8 i' k! y, x
  11. *         TO CHANGE.  e; t' g7 a8 P9 H) g
  12. *
    % C/ V# P3 f9 G, K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 I" M$ r6 e4 Z- E9 l
  14. */ Y  ^9 L2 @9 q
  15. * This program is free software; you can redistribute it and/or
    1 M# f2 ~  r0 p" V; T( {, [
  16. * modify it under the terms of the GNU General Public License as( h- o9 S5 u/ h% y! B$ g
  17. * published by the Free Software Foundation version 2.
    $ b. l% B$ m0 ?, q% p# c# h
  18. *+ z, \7 X- w# q- Y5 M$ _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 ]1 q' M1 {+ E% D
  20. * kind, whether express or implied; without even the implied warranty' Y7 \. {  h! y, |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 n% a* P- @, O$ O
  22. * GNU General Public License for more details.1 Z$ c: a# N: }# o3 Q- J
  23. */
      f$ E5 I9 Y% K3 N' i+ ^
  24. ! ~5 N  C& M$ b
  25. #include <linux/module.h>1 ?& v0 J/ x( {1 b
  26. #include <linux/init.h>1 a1 }3 Z6 [/ A: _% z/ V& A/ k
  27. #include <linux/errno.h>0 r& m9 R; Z6 B9 t. g* f1 @
  28. #include <linux/types.h>% H) l8 y( _8 b1 r! p
  29. #include <linux/interrupt.h>
    4 F# P% w! a% ^4 I0 T
  30. #include <asm/io.h>2 G; U& R; y* Y2 {
  31. #include <linux/moduleparam.h>3 ~: H7 q& ~0 r* s+ Z- i% D
  32. #include <linux/sysctl.h>. Y$ g9 S2 N% t
  33. #include <linux/mm.h>
    ; ?) v# p0 p" [; n# u3 a, n
  34. #include <linux/dma-mapping.h># V4 H# \! W. H/ G( q1 m

  35. ' H9 p/ \/ G  N" J8 X+ K7 M. a% z1 e
  36. #include <mach/memory.h>
    3 N6 b3 L: }  J- R5 c
  37. #include <mach/hardware.h>
    1 R2 S7 y$ ^3 g" r" I1 H
  38. #include <mach/irqs.h>
    $ W+ _7 J/ f0 J5 x
  39. #include <asm/hardware/edma.h>
    , Y, ?. Z2 S7 s& h
  40. 5 X8 I* @) n& x# z9 E: ?( y
  41. #undef EDMA3_DEBUG1 R, H% ?) ~, ?+ K! X8 B
  42. /*#define EDMA3_DEBUG*/1 ^* i; j2 d( i( c; X* t; L& z

  43. 3 m2 s7 T/ r% S/ _5 H
  44. #ifdef EDMA3_DEBUG
    % L2 O5 B6 i6 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , K7 `1 w6 A# U; M: B* [. [1 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 T) |' S% U% }' b' U9 W% S% q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - _3 o; u5 W. [% w
  48. #else
    . k: F& Q8 _) t; ]% n! S
  49. #define DMA_PRINTK( x... )
    9 a7 z8 I* x: H% h
  50. #define DMA_FN_IN& Z* b, V1 j+ r! ]0 T6 @
  51. #define DMA_FN_OUT
    . _! X! Q5 y& x+ y
  52. #endif9 n/ ?+ K1 f! Q+ [: d5 s5 F

  53. : o8 K9 u: B+ K6 p0 ]) d) _* O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 |8 W9 l) u" A+ t6 o- ]
  55. #define STATIC_SHIFT                3
    6 `1 L, A* q" P& m* ?: N+ K5 J9 Z
  56. #define TCINTEN_SHIFT               20: Z  o9 D5 U9 u. m* `
  57. #define ITCINTEN_SHIFT              21' c* a) f) j  c& K6 b. i# j9 T
  58. #define TCCHEN_SHIFT                22
    & J$ C5 ^9 I) e! H. [( k
  59. #define ITCCHEN_SHIFT               23
    ( n! q6 [% x5 L6 e7 |

  60. 1 l- s6 \4 V; v8 j* f5 Y
  61. static volatile int irqraised1 = 0;
    * e+ ~+ r/ J, a) o0 k4 J; d
  62. static volatile int irqraised2 = 0;
    * d$ Y* I: p+ q; {& X7 s9 }

  63. . F( [0 B! L6 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 r% O0 l4 |5 _0 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 u4 I; d) g2 V" N6 n. ~" J6 w) L9 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% G. w( a& W  }" Z: c
  67. 0 `; v3 H8 T( P3 L/ C( Z
  68. dma_addr_t dmaphyssrc1 = 0;4 Q2 W; A' ]6 |1 d- ~
  69. dma_addr_t dmaphyssrc2 = 0;% c% s4 q5 R9 m& D9 P8 H, u
  70. dma_addr_t dmaphysdest1 = 0;6 q: l7 q  V; A$ x$ S) l" a* y
  71. dma_addr_t dmaphysdest2 = 0;' W6 @+ y0 W& \7 T
  72. 4 T4 Q- t& |2 A$ t5 f3 J8 U" r% |
  73. char *dmabufsrc1 = NULL;4 C2 l3 E/ f+ U, A
  74. char *dmabufsrc2 = NULL;, }7 F  H: ^4 Z
  75. char *dmabufdest1 = NULL;
    5 L4 _0 t. `; D$ `7 r, M1 |9 D
  76. char *dmabufdest2 = NULL;
    & e3 T+ c0 s" ]- F, C+ \  B

  77. $ @3 a3 m( m) @8 b& o# ^
  78. static int acnt = 512;# g7 Z5 w6 N; H  k; G+ s
  79. static int bcnt = 8;  i& P* C; @0 J. f5 q, y
  80. static int ccnt = 8;1 |* X- V; E. }8 ^2 v% i4 S" M

  81. 7 J9 C4 @5 m* S( `# L) ?
  82. module_param(acnt, int, S_IRUGO);9 t4 ]5 z: d0 h( s4 R) C
  83. module_param(bcnt, int, S_IRUGO);
    * ^: x7 m% [, i; o' A) k# r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 n' T& U1 I/ G& i! W9 S$ s, W6 T2 A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 U/ \3 M4 a7 K! b! m; i! D$ z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ `- v9 J2 n7 T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# _! |3 l# J4 P/ V5 X4 {" E- W1 ?$ D; b# ]- F

- M4 y+ X+ b* f0 C) h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 23:41 , Processed in 0.041058 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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