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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, k1 B9 o2 ?  o" n
  1. [code]EDMA sample test application) T8 I. F" J+ J/ J3 N9 v
  2. /*- Q* U# v: J1 D
  3. * edma_test.c
    ( O2 l9 Q+ c: q0 p
  4. *
    # W: w' `0 n! ^" Y) t' L9 F
  5. * brief  EDMA3 Test Application
    3 K5 Q+ k4 _' i! J
  6. *+ h! S! B2 L3 o' c
  7. *   This file contains EDMA3 Test code., J! j3 k6 ~! I% r! u  |
  8. *
    ' `/ U/ S7 H6 y/ ^) Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! |  A1 [9 a4 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! s) }  n* z8 w3 O" @; {
  11. *         TO CHANGE.
    3 I( b: D3 K, q' y
  12. *
    : m2 Z% N9 I( _# U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 I$ {  h$ P" |. S) J
  14. *
    , a9 I5 N- S2 J- w4 e
  15. * This program is free software; you can redistribute it and/or" A4 U" c- A: i) d- K3 l7 V) }  m$ w  N# \
  16. * modify it under the terms of the GNU General Public License as+ D2 m; _) z5 L$ i( u' Q
  17. * published by the Free Software Foundation version 2.
    & O6 B& Z+ N0 t: K+ M4 }( ?+ O  f
  18. *
    ; v! g- G7 W" D5 Y) Q8 H' W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 l" }" o' n. e, g) |# h
  20. * kind, whether express or implied; without even the implied warranty8 n3 v& x( H( |3 H. ^5 ^8 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 g: ?$ h9 F1 j: |+ E' b- S* e
  22. * GNU General Public License for more details.
    9 |/ @* ~! S. N4 j
  23. */
      @2 I% q9 u4 q1 Y3 f
  24. ( z5 G  g  _0 E6 V, q; U9 E
  25. #include <linux/module.h>
    ( A8 T+ }3 Q& P7 P/ U: j: ]1 p3 C
  26. #include <linux/init.h>4 Y5 F# f  F5 j/ m
  27. #include <linux/errno.h>
    " q) s7 b* x+ a  {3 P
  28. #include <linux/types.h>9 B. J& N9 Q5 F* S; g& C1 A' }
  29. #include <linux/interrupt.h>8 [& v, Z1 c* u
  30. #include <asm/io.h>
    7 h& u3 p1 ], Y& k# q' k- \" c
  31. #include <linux/moduleparam.h>, b0 z# b: E9 x. Y/ F! l( F
  32. #include <linux/sysctl.h>( k) r7 E7 Y" E0 P6 U' |
  33. #include <linux/mm.h>, Y0 a/ ?; L( w, L
  34. #include <linux/dma-mapping.h>
    " T7 x& q: S  ?4 l( y9 p% y# J4 I
  35. 7 Y) a8 E1 g7 p. b" L8 a* ~
  36. #include <mach/memory.h>2 x% S' Q& x: A& o. w
  37. #include <mach/hardware.h>
    * l* e8 ~# f& `, {2 g5 w" ?" i
  38. #include <mach/irqs.h>; n" d8 m/ m% ?- [3 J
  39. #include <asm/hardware/edma.h>! ?6 n' `. i/ d

  40. + @8 h6 E! C+ z3 L: `0 O
  41. #undef EDMA3_DEBUG' v7 D: A4 c) T/ n: v
  42. /*#define EDMA3_DEBUG*/
    4 X2 X; s6 }8 t' p/ s$ }, @* K; l/ K
  43. 5 U1 @, S' k. @4 {
  44. #ifdef EDMA3_DEBUG
    6 ~$ _  f5 l! [, V$ I: k' p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 w# u1 K7 `1 _% m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * x3 ]) F- L, H0 E+ }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- I: ~2 }# f# ]& |! i3 d, P2 m, y
  48. #else
    $ a( H' T& J- _+ C  ~, @- b$ m& y
  49. #define DMA_PRINTK( x... )
    3 H. T+ I: j  N* R# e0 K" e% L6 r
  50. #define DMA_FN_IN
    ( R& P# `$ K! z# U  L( e! p0 {
  51. #define DMA_FN_OUT
    3 k; ^& d( j1 @7 @8 M& l8 t* @
  52. #endif0 J# |" ]9 n' M+ \7 t

  53. - c- {% b# F! K$ p' h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ h* v& Q( r% U2 g, Y
  55. #define STATIC_SHIFT                3
    1 h' @6 S- ?4 M3 B
  56. #define TCINTEN_SHIFT               20
      J/ t* T9 o" D3 ?* [& M% o9 c+ F
  57. #define ITCINTEN_SHIFT              21
    5 N+ I# B; c$ ^. @2 ?
  58. #define TCCHEN_SHIFT                224 B. V7 ]( C  P* S) L% w6 P
  59. #define ITCCHEN_SHIFT               23
    7 U8 U9 k1 r6 p4 S% m
  60. 5 d2 C, \" P8 ?8 A" F1 U
  61. static volatile int irqraised1 = 0;
    1 N$ T9 P6 ]9 _& r5 y
  62. static volatile int irqraised2 = 0;
    7 y; v% ]9 e9 y7 D' k: i+ c) O, [8 @1 K
  63. 4 M) G; r; L8 l; f9 Z' e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) R& J  f" J+ W3 b2 O) n% l7 Y% q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 T% V9 ^, y3 |  Y1 P$ {8 M! C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & S$ }* F7 d- v  r/ v

  67. ! g# c6 C" A- W$ Y  @
  68. dma_addr_t dmaphyssrc1 = 0;
    0 s+ R3 \+ e# Y/ X
  69. dma_addr_t dmaphyssrc2 = 0;
    , @: a, K) \- E) B
  70. dma_addr_t dmaphysdest1 = 0;+ Z' s. p' y7 g( V/ d6 S, r& A- J
  71. dma_addr_t dmaphysdest2 = 0;0 D! |/ B, [! @5 A0 j5 s% l
  72. $ \3 [* D1 D2 A' ]
  73. char *dmabufsrc1 = NULL;
    5 S" L/ d! `# W* L- Q9 D' p
  74. char *dmabufsrc2 = NULL;+ i) b7 K* Z4 R; p/ ~# T1 s
  75. char *dmabufdest1 = NULL;
      T0 l! o! z, S" ^8 ?8 D8 z& q* b' l" L
  76. char *dmabufdest2 = NULL;- J" u4 G! h7 A  e0 f% a
  77. % {7 q, d4 ]  Y
  78. static int acnt = 512;
    8 R/ B3 H5 G0 l5 D7 ?3 {' b
  79. static int bcnt = 8;4 @! A9 H# N, ?+ B
  80. static int ccnt = 8;0 a( U" K/ d! K0 X: l2 p

  81. 3 ^# o$ Z% F. u
  82. module_param(acnt, int, S_IRUGO);, h+ ^; ^6 S' O0 v; `9 v0 {
  83. module_param(bcnt, int, S_IRUGO);
    6 O: o: h; X% k4 Y  r& P3 u9 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 ]- e6 Z1 f, G3 B

  W6 v+ s4 O" M) {( L0 p0 K: e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 j& t3 N! w/ ~' B# N! v5 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 [/ d/ r) \; b6 j3 i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ }6 [( ~  D2 Z' r: p9 `7 d' V
8 }; Q  S" p7 u+ U  f8 i4 u7 _% o

9 R- Q! x7 ~8 c- l5 j( g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 11:04 , Processed in 0.036736 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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