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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% l6 f: ]8 P! a' C3 B! M8 s
  1. [code]EDMA sample test application
    & H6 z" z; x) O4 r1 D
  2. /*
    ) v5 n$ T( X. t; V/ k
  3. * edma_test.c
    5 W6 R6 W" ]1 \1 Z
  4. *6 O; v+ f: h) U5 P" _9 F
  5. * brief  EDMA3 Test Application* a+ _* p- [" i
  6. *' E2 }# ]0 _6 ?$ V* _
  7. *   This file contains EDMA3 Test code.- P! d  s, ]( K3 W# a- U
  8. *
    ) a2 H% U' e" t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& }) _5 l3 I' k- E7 s% ]1 K, F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 S$ m; r7 W6 i( a) O1 x" h
  11. *         TO CHANGE.
    5 \4 R7 z" z/ J& U0 S4 j, \2 r# ?
  12. *
    ; c5 Z+ u! t/ m' G' Q4 p9 m% ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 Z5 T0 w. C0 z: Q  v
  14. *
    * _; r2 J2 R/ M4 q# B
  15. * This program is free software; you can redistribute it and/or" k' a8 T7 ^  L" z: o* l# p, J# _' D
  16. * modify it under the terms of the GNU General Public License as
    ; l. M6 R4 h& U, u6 n4 B
  17. * published by the Free Software Foundation version 2.# \" G( H" [% r; w# a
  18. *, {  L7 w- D( L7 x) n3 D) O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 [8 A; U  `% y# b# ^" r+ V' ~0 |
  20. * kind, whether express or implied; without even the implied warranty& P  C3 J1 `' s8 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " D& I+ D6 W$ o" d3 A2 ]
  22. * GNU General Public License for more details.
    ( K2 @/ E( R8 b' m! Q
  23. */! u7 t& i+ S1 z; z* s% d9 f: e, a, @
  24. 4 K7 u$ `, }2 W. M3 O
  25. #include <linux/module.h>5 y: H2 K" b4 e: c. `  o  s9 N9 ]" k, f: j
  26. #include <linux/init.h>  C% p& K2 c, _; w2 k4 |2 O
  27. #include <linux/errno.h># {4 a5 f! ~4 g3 H- w
  28. #include <linux/types.h>% H; q! F7 G8 V) t8 z
  29. #include <linux/interrupt.h>
    . W* T( N5 ]: G9 ?
  30. #include <asm/io.h>
    & [9 T  Q' S0 b) O7 |( y$ {9 p
  31. #include <linux/moduleparam.h>- @6 h3 N$ J/ w9 w; ^7 t: L( O7 p& D3 ^
  32. #include <linux/sysctl.h>5 C$ n+ x7 u/ L3 |8 W# [5 [( S$ C
  33. #include <linux/mm.h>
    : W( F- k: D0 e9 S$ d* ]; f
  34. #include <linux/dma-mapping.h>! l- i2 f3 L) Z& X0 E
  35. 0 Z6 h  O% N: h2 ?9 \# Z
  36. #include <mach/memory.h>
    " q- n8 K7 a2 N2 g: m! t7 D
  37. #include <mach/hardware.h>
    7 ?( z& F3 y/ {  h
  38. #include <mach/irqs.h>
    ; E0 t. F2 n- x/ G1 H
  39. #include <asm/hardware/edma.h>; F1 ^4 R' d" m$ v+ H+ _
  40. 7 D" `# `+ ?3 z( n
  41. #undef EDMA3_DEBUG. Y3 ~7 S2 z- h& R4 s
  42. /*#define EDMA3_DEBUG*/
    : m' N' @! h0 R( H$ |) l" t
  43. ( p4 o" \: l: i! C  A: t
  44. #ifdef EDMA3_DEBUG
    2 ~0 ?& b/ D! K3 d2 w+ s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & S, y  s: z5 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # `7 K& _. |' x/ {. G1 O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! {4 R. T6 c& x* d4 {; v, _
  48. #else% z, f1 g" {" f: F: S: @  M7 K) @
  49. #define DMA_PRINTK( x... )
    + ?9 i; N/ w" P% Y/ }' R* M
  50. #define DMA_FN_IN
    # k2 F; t$ z, o
  51. #define DMA_FN_OUT
    , P, f3 ^/ `7 ~3 W0 v. a
  52. #endif3 C% A. g5 k) Q2 U6 T' i. |

  53. # j* m4 u$ @2 y6 f/ g, X; L& h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 U7 ~$ a! K1 t! B0 G
  55. #define STATIC_SHIFT                3
    ' X. p- {' O: ?; \
  56. #define TCINTEN_SHIFT               20
    1 H) V8 H  E" b4 A$ A# D. p6 E
  57. #define ITCINTEN_SHIFT              215 p# h. z' k4 G5 G4 K6 C) r5 f9 H
  58. #define TCCHEN_SHIFT                22
    ( ^1 W4 j8 N+ O
  59. #define ITCCHEN_SHIFT               23: Z3 T+ y9 Q# K7 j. ]6 h9 t

  60. - Y, O/ c: o: _! j
  61. static volatile int irqraised1 = 0;/ W# u% Y) s& x% j$ D9 Z
  62. static volatile int irqraised2 = 0;
    6 ]. ^/ _: U1 }3 r- |9 O

  63. : W+ Q1 v' x6 b+ m3 I! H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. n. P; m( E; d2 k% |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 c/ A5 U0 Q% C* \# u; }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. v$ M1 V5 [  l& ~+ ~7 H

  67. : z' @( ^, n2 ]6 c8 O5 A" z% J+ g
  68. dma_addr_t dmaphyssrc1 = 0;# A+ C3 e, O: I
  69. dma_addr_t dmaphyssrc2 = 0;
    7 b/ p! }2 u) f$ L2 n. K% e  a
  70. dma_addr_t dmaphysdest1 = 0;
    8 S  M4 _  H9 G! F8 ^( ]
  71. dma_addr_t dmaphysdest2 = 0;
    7 r3 ?; R( I; s( E# \" e

  72. * V1 X5 L( f7 M3 ?1 J! ^. o: c/ P4 y
  73. char *dmabufsrc1 = NULL;6 y+ D, d0 L# p0 X! v( p& J8 k
  74. char *dmabufsrc2 = NULL;6 v& e: T, q6 T+ F
  75. char *dmabufdest1 = NULL;
    ) G& B1 z1 U" s# v. V, D
  76. char *dmabufdest2 = NULL;
    7 d: e# m4 \8 }* n( X
  77. 1 K" w( ?# ^5 E: Y- e- g
  78. static int acnt = 512;
    7 _+ |; W* B' M2 F7 R
  79. static int bcnt = 8;
      q: w3 Y) s1 |; q
  80. static int ccnt = 8;' f1 {) J( h$ _$ U; N* |
  81.   ]9 K5 W  a$ I. g
  82. module_param(acnt, int, S_IRUGO);
    / m+ j" D) ]9 `
  83. module_param(bcnt, int, S_IRUGO);& V( z% D2 |$ O1 r! U- N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- U6 s$ I: F- |. F9 m' c3 U$ P: k4 |3 F5 n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" W, Y4 `  w& j& O, \3 T+ d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, D; b) a' P1 T. ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 g9 B2 H3 t& v1 w! E
% t- H, f" Q) ?& c5 {5 g  h

0 `, |! z/ x; Q& A' i# w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-18 06:32 , Processed in 0.110969 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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