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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 l/ E; B  E/ q) m
  1. [code]EDMA sample test application: s+ v, Y. }0 h4 Q( @: C" |
  2. /*% h- v$ Z" O" P; a
  3. * edma_test.c% T6 i( b2 q3 z! z2 F
  4. *, o( a& }+ a0 u$ f( ~6 n' n
  5. * brief  EDMA3 Test Application( D* l0 U$ {7 Y/ F5 p
  6. *
    - Z, s! X" B4 n8 T# f. D( U
  7. *   This file contains EDMA3 Test code.
    * b& ^4 ^& s" D- B! m
  8. *3 A# z3 w  M8 [6 w$ V  G7 v" L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! I# s0 E+ |) d. x, b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% Z6 s( `) G3 W: E% U- @& o
  11. *         TO CHANGE., @( U$ Z( n' k( T; h% ]9 F- v6 ~
  12. *
    4 r) O- A, f/ j! x4 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; ]0 p8 f; {5 T0 W+ |
  14. *
    $ P5 u* r. A( _* H( s1 w4 V, L& s  r5 O
  15. * This program is free software; you can redistribute it and/or2 M9 I  C) }7 E+ V+ A$ \
  16. * modify it under the terms of the GNU General Public License as6 B; w( _/ m6 ^
  17. * published by the Free Software Foundation version 2.7 J4 O) S1 a+ m- m) p0 p
  18. *8 q# G/ q8 D, m9 d) \2 R. H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: P* M) M6 z& \0 ^# |/ D) H$ l
  20. * kind, whether express or implied; without even the implied warranty( G% R* }3 }. F5 L$ H1 V. a8 a0 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + ]9 x5 @; h( O( Y$ i) W. K
  22. * GNU General Public License for more details.5 b; z, _# J5 ?; O" o
  23. */
    6 L. \. y, |+ _# x: T# ]/ G
  24. 4 |, {$ M# i" t! c% I
  25. #include <linux/module.h>
    0 p2 @1 f& p5 ~6 u3 g) x. A
  26. #include <linux/init.h>" X+ ]6 [- @4 N# M0 Z( i9 a
  27. #include <linux/errno.h>. j6 H) h* k/ z3 g& D7 j/ C0 R6 Q
  28. #include <linux/types.h>
    / O" R0 v$ x/ e& f6 i; @! h$ H
  29. #include <linux/interrupt.h>
    ; {# n) J4 S6 y+ S( b0 ?8 B: V
  30. #include <asm/io.h>9 _0 b2 A5 p, T5 |5 j, y. T( m3 T
  31. #include <linux/moduleparam.h>6 K* a; g* W8 n/ v) d0 j; D0 s
  32. #include <linux/sysctl.h>
    8 `% ?& T5 v0 D3 g
  33. #include <linux/mm.h>
    2 V. z" b' Y, |! {$ V
  34. #include <linux/dma-mapping.h>
    . z% U) a7 d& A8 k- Q5 p% u

  35. * o/ Y. f* s/ y" h9 E+ |
  36. #include <mach/memory.h>
      j# G6 L% P$ T/ f
  37. #include <mach/hardware.h>
    8 [0 Q( p5 ~" u: }6 M
  38. #include <mach/irqs.h>5 n' T4 J! e% v! C# m
  39. #include <asm/hardware/edma.h>" C/ C$ L0 |$ y# S5 _
  40. 5 Z) T. N/ ?- K' \' J6 L
  41. #undef EDMA3_DEBUG
    ' p/ B- k3 A1 l+ f# E
  42. /*#define EDMA3_DEBUG*/  @) F! M: u0 r# Y' D' Q

  43. + `9 R( O. g8 Z7 K7 t! B
  44. #ifdef EDMA3_DEBUG
    : s3 P0 D6 c* h8 f' L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : Q, k4 k( k$ V/ L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% H+ t% Y: ^, C1 h  _+ c' {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" @: ?) [& G# \1 Z4 N4 V& i
  48. #else
    3 I& `% Y3 G6 Z0 r; I
  49. #define DMA_PRINTK( x... )
    ; V' N+ L7 E# W$ t0 D0 i3 Q
  50. #define DMA_FN_IN
      i/ g0 ^/ N' m. {  F/ S
  51. #define DMA_FN_OUT3 m) R7 q8 [+ i; q" V3 r1 f* [
  52. #endif) L- C7 ~' R4 o( [: d; v
  53. 9 c2 g4 P+ I. W7 Y( q: f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , V2 v; K+ m, h$ Z' _+ q2 E( i6 M% V+ G
  55. #define STATIC_SHIFT                3% t4 W! Z* n: _5 z5 v
  56. #define TCINTEN_SHIFT               20( o$ M8 e; U+ C. m  r* E2 p* P
  57. #define ITCINTEN_SHIFT              21
    : @" r, V7 `3 L  `1 x
  58. #define TCCHEN_SHIFT                228 q) h5 g( a& {$ s; i/ C
  59. #define ITCCHEN_SHIFT               23
    + X) f/ n/ o' J& [; P
  60. ( x! M1 C: y2 y1 w0 a
  61. static volatile int irqraised1 = 0;  M1 D. f4 [" m" `) j# T
  62. static volatile int irqraised2 = 0;
    3 Z) B" Z6 d: R7 z% Q+ L

  63. 3 m2 h/ Y; h5 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 X9 e2 i- e- e: N" s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 }9 v9 a" }# K! D+ ]! }+ X1 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : g* @! v8 q/ K( A; I# A/ j

  67. 1 G7 V' L' q- E
  68. dma_addr_t dmaphyssrc1 = 0;* v. M) z" p1 H/ P4 E" d1 C4 P
  69. dma_addr_t dmaphyssrc2 = 0;* j  G+ L/ X# u& q' J
  70. dma_addr_t dmaphysdest1 = 0;3 K* C) G5 r% P
  71. dma_addr_t dmaphysdest2 = 0;$ P) f3 w3 X: ]

  72.   v& Y0 [+ s3 a
  73. char *dmabufsrc1 = NULL;
    + [3 |* a( ^7 L; T: E
  74. char *dmabufsrc2 = NULL;, X1 f6 y8 F6 z% L, C! u; w1 L
  75. char *dmabufdest1 = NULL;
    - h& `* Z1 z+ v2 ^2 B$ j! v
  76. char *dmabufdest2 = NULL;4 ?, B7 h# Y5 q) }" j7 ?
  77. . d9 E) M9 e" ?
  78. static int acnt = 512;
    4 [8 i& t# L# J3 d0 v% {/ J% }
  79. static int bcnt = 8;( @6 p1 S' A) e  h- e
  80. static int ccnt = 8;
    " M; q. |7 t4 O" p# F5 D- P* s$ L
  81. ' g5 y" x9 _- d! L* u" Q! o) h/ ~
  82. module_param(acnt, int, S_IRUGO);  _7 i) D4 I! \- h; H, k6 _
  83. module_param(bcnt, int, S_IRUGO);
    ) t! Q. m9 l! K3 d, ~* X( I) L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& J0 s5 x* s9 [4 ?3 q  {! c6 u' H
% \% j" H5 P6 ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 `9 I, h+ B/ o# u* y: m  U  v, V" Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) R" C, g5 Z' t( n% B0 C* V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 M& H" @( q( E
8 @! c. m' v1 m8 H/ K  x
& m9 X. A+ X5 z! i0 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 11:08 , Processed in 0.050317 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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