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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 M! y  w9 T6 w* K8 C- r5 N4 i
  1. [code]EDMA sample test application
    1 H% f1 \$ @- E: \; U1 i1 @$ v
  2. /*2 R3 ?6 G% n9 v3 a: P1 l
  3. * edma_test.c* ~  n" K+ p" D  [
  4. *
    4 x+ o/ ~7 R( ?, |0 [& O6 M9 K% ?
  5. * brief  EDMA3 Test Application' U7 A# r5 M9 F# T
  6. *
    - j: l- H% N8 w% ]: U
  7. *   This file contains EDMA3 Test code.
    ) D& P- }& P' f* n& C* O
  8. *
    ! V9 z; n. i# w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 X0 l  I# Z2 b) E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / N; H- O# J& T
  11. *         TO CHANGE.
    7 J) K' I1 |7 O7 f* J3 x  O. z
  12. *$ p. L& t( m# I1 ], ]6 G6 o' [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: I. Z1 x' H$ Q4 D
  14. *6 s4 h# z+ d! K9 h0 x( j
  15. * This program is free software; you can redistribute it and/or
    0 `; Z: e  E: R0 ?8 \% w" X! A* |
  16. * modify it under the terms of the GNU General Public License as
    ! }7 B" ]+ p& s# H4 }
  17. * published by the Free Software Foundation version 2.: k/ A! i: F) u4 j. K
  18. *
    " E2 T0 [' o$ }) f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 J5 B; r! S/ g2 _  p/ f& [
  20. * kind, whether express or implied; without even the implied warranty' q' E5 U7 Z1 S: l1 z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % Z, _! N$ l* {  D% }5 H9 E5 ?, e
  22. * GNU General Public License for more details.) }+ v4 }5 |; j& u9 t
  23. */
    4 x2 N0 L) Z+ \+ ?, X; U

  24. 8 P- V; `% m6 G
  25. #include <linux/module.h>
    & d7 b" R1 P; s: l
  26. #include <linux/init.h>3 P/ N: }! @3 w  t2 ^
  27. #include <linux/errno.h># A8 C! ?- Y& f- h! i& t( b
  28. #include <linux/types.h>; i- S( b5 C* ~$ B) v  t& f
  29. #include <linux/interrupt.h>
    6 K3 `0 I0 H" ^! U, K1 W8 d
  30. #include <asm/io.h>
    9 W6 E1 I! L, Z! g" f' P
  31. #include <linux/moduleparam.h># u4 {8 D* K) c- b) y2 u" H+ F
  32. #include <linux/sysctl.h>
    ) L1 u( d6 x. r4 m1 G9 @% v
  33. #include <linux/mm.h>- \" S& Z7 y% p) s- w6 v9 u9 g
  34. #include <linux/dma-mapping.h>5 X6 X8 G! P. f! ~" a
  35. ( u+ z6 H: f- k* x# S. J
  36. #include <mach/memory.h>
    ( T4 Y$ t3 b& F6 ^; V" i! Z9 B
  37. #include <mach/hardware.h>
    5 e$ B) |/ q$ W6 e0 x
  38. #include <mach/irqs.h>
    * _1 I1 G& g! d$ p2 w: C8 [) N
  39. #include <asm/hardware/edma.h>" M2 p' Q7 Z! c4 a/ C
  40. - V6 J: _/ u& D! r8 l! b
  41. #undef EDMA3_DEBUG
    & u) A; E! O' m1 f. {
  42. /*#define EDMA3_DEBUG*/
      n7 b, L7 X3 |2 b/ R$ A& G

  43. - @3 K+ q* R' ?
  44. #ifdef EDMA3_DEBUG8 q/ V5 _( x9 c' u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), H% r; g. N2 n) p2 W# F9 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 ?. T. b" ?4 i* L$ b: S; Y# O/ T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ o* ?: l2 F# g3 c
  48. #else( m4 f" J8 {+ ]& r! y/ m. S% v
  49. #define DMA_PRINTK( x... )1 `1 U2 Z4 k, J
  50. #define DMA_FN_IN6 @0 o' x+ Q- Q9 J( P
  51. #define DMA_FN_OUT
    " ]1 F. _" p( l: z& y  ?7 J2 x- A
  52. #endif
    8 W2 c4 K, X% ]. l( F( H
  53. 2 C# }# n" G1 ^# g# {$ y# [% u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( P3 m, d4 a5 q0 R: i& w0 E
  55. #define STATIC_SHIFT                3
    8 t# e$ L5 v8 I! O/ f
  56. #define TCINTEN_SHIFT               20
    7 D4 C3 u8 I2 c6 s/ e5 k
  57. #define ITCINTEN_SHIFT              213 S; I' T! l% D7 P4 l% r
  58. #define TCCHEN_SHIFT                22
    $ T! `; b/ ^$ ~9 }9 ~
  59. #define ITCCHEN_SHIFT               230 v' b) D2 G0 e# B. b  S3 s
  60. % f1 \8 {; T" J8 B. x4 U
  61. static volatile int irqraised1 = 0;+ [7 |; G& Y3 c/ {% ]$ E* w' a* V$ \
  62. static volatile int irqraised2 = 0;( Z5 G5 U) _  l/ T  k
  63. 7 j5 g3 w$ s. l  L) ^" E* Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , Q- q, V1 I2 }; L2 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . j2 a- E, G: P- G: O, c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 |3 v. Q3 P7 i+ [. ^0 _, X

  67. % Z6 i5 d1 ~0 q, [, {3 A
  68. dma_addr_t dmaphyssrc1 = 0;5 g; k: w& B2 ~0 ?: M# r
  69. dma_addr_t dmaphyssrc2 = 0;! J2 ~9 |. ~% i
  70. dma_addr_t dmaphysdest1 = 0;, U$ g8 A5 h' U9 S
  71. dma_addr_t dmaphysdest2 = 0;
    + f1 J- f  S9 d* i# m* j

  72. 0 I3 P/ V) k! O6 f0 K8 `
  73. char *dmabufsrc1 = NULL;
    0 E) v% c2 \- m2 J
  74. char *dmabufsrc2 = NULL;8 J5 t8 j& G9 D  t: r' D
  75. char *dmabufdest1 = NULL;
    ) j" X( o, w: B
  76. char *dmabufdest2 = NULL;# w! N2 Q$ s+ b5 }  h

  77. ! J' S. n) J$ c9 F
  78. static int acnt = 512;2 w. s8 P# b! Y
  79. static int bcnt = 8;
    ; z+ \. y6 s/ |! H$ k
  80. static int ccnt = 8;  [9 c1 u, j9 s5 f7 W% f
  81. % t! j. O0 F  p% ]. H
  82. module_param(acnt, int, S_IRUGO);+ i, Q& Q! J" e9 Q$ f1 r6 Z7 E
  83. module_param(bcnt, int, S_IRUGO);7 ?/ m, Q+ }5 z; l6 F& ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 _" c+ B, V* X/ A/ h6 S4 i& @+ D  R. \( _1 t2 I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 [- s. b8 L9 a0 P, R5 B! I" parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( L# M+ P7 i) }! b2 R  f( V7 B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 Y' }# q! {9 ~) l

& ~6 H# [) Y! W& T: G2 p
6 n# z# p/ o6 P4 O2 x( t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 19:49 , Processed in 0.044954 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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