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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 \# F# X' A* M* ?( b
  1. [code]EDMA sample test application" i1 V- E/ g/ J7 q
  2. /*/ _, {2 `2 @& ]/ m3 A5 x( R7 {( H
  3. * edma_test.c
    : Y# s  P$ }1 J* J' |
  4. *# g/ l) |1 V  B
  5. * brief  EDMA3 Test Application
    % d! x& f+ G- M% u7 h# L; D
  6. *( d* I3 P1 w* G
  7. *   This file contains EDMA3 Test code.
    ( _$ I5 _1 A- T4 g# A! s( p" q5 A
  8. *
    " W, w9 Q/ O1 X) ~( ?2 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - b9 c/ g; P. Z- k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- N0 B- W8 p9 l$ G, C
  11. *         TO CHANGE.
    4 e2 @, x1 p. _1 M6 }
  12. *
    ! ^) v: v  I! Q. B6 j. N) s0 t* Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # G! \: I0 F) G/ v7 c
  14. *
    * C2 @- X3 Q  ^. m  F
  15. * This program is free software; you can redistribute it and/or
    4 A/ M4 O+ u% k  K/ _2 G
  16. * modify it under the terms of the GNU General Public License as
    . D% U; E4 U! c, ?0 M, A' G5 z
  17. * published by the Free Software Foundation version 2.
    $ |' f  h- R5 l1 @& W
  18. *' _$ Z  U/ m4 _- I' T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ U; `! q* e/ G/ q
  20. * kind, whether express or implied; without even the implied warranty
    % i8 F( v+ f" E8 H( i& @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % _( y8 a! u% n% A$ t
  22. * GNU General Public License for more details.
    0 t- Z5 B$ z2 }  ?& A6 I3 k
  23. */5 V8 S4 T2 R( x% R. d

  24. 9 Y/ P8 o& F, e$ V2 Z5 }' I8 {
  25. #include <linux/module.h>
    " [* M3 X2 {2 Y" x; ^
  26. #include <linux/init.h>
    5 k5 \0 |0 K5 s0 ~
  27. #include <linux/errno.h>
    : y5 O# |- S! @7 L; ]
  28. #include <linux/types.h>! K" p( W0 P$ l! b4 W
  29. #include <linux/interrupt.h>
    ' V# N8 K' L  R
  30. #include <asm/io.h>- s8 E# ?4 D( ^3 }$ [1 x( @
  31. #include <linux/moduleparam.h>3 H# `! z7 u9 L% Q. N
  32. #include <linux/sysctl.h>. ?  D) t, j# ]) ~* \
  33. #include <linux/mm.h>( F- E. p) `3 t5 ^* }
  34. #include <linux/dma-mapping.h>
    / m+ a. D, e6 }/ k2 \# g
  35. 3 X% f# a  ]3 s7 u
  36. #include <mach/memory.h>: L) [6 A& d, F6 T3 ?
  37. #include <mach/hardware.h>
    2 t: D; v* f. R' b2 i
  38. #include <mach/irqs.h>
    , m% W! x& f  S5 n' z
  39. #include <asm/hardware/edma.h>
    " ]2 n( I0 ]5 U8 i

  40. , t* X* w9 r3 d# Q! y: M
  41. #undef EDMA3_DEBUG
    # z  d% o/ H7 @) I7 E
  42. /*#define EDMA3_DEBUG*/
    6 d1 J+ o- B4 x! d% L

  43. 3 s/ i$ o1 r+ M$ ~5 ]  b3 F
  44. #ifdef EDMA3_DEBUG0 Y+ {6 a8 _) u; w# i4 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ _4 N) G3 w5 u# Q3 {; N9 K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 l- D4 g! [0 b7 ~- S% h- Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . F' K( S, f6 D
  48. #else6 M  I% G# [1 k' q/ g$ @! l+ C1 U
  49. #define DMA_PRINTK( x... )
      Y+ f9 J0 R# U
  50. #define DMA_FN_IN. x5 b3 e, D& |- F# R
  51. #define DMA_FN_OUT
    0 [: Q) M  h2 I4 ?
  52. #endif$ q" Y" Z7 l( z- a( T" F

  53. 5 N8 p* v# A! Z2 J* A/ M1 u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( t# e7 p( l7 r- r$ l* p  O
  55. #define STATIC_SHIFT                3
    0 x' n" A2 R+ @
  56. #define TCINTEN_SHIFT               20
    & c1 v7 s! S$ |2 l* n: e
  57. #define ITCINTEN_SHIFT              21+ V6 A; q$ \! j% m( Z( I$ v
  58. #define TCCHEN_SHIFT                22! l1 K/ K/ X- a, ]' o+ \1 o
  59. #define ITCCHEN_SHIFT               23
    2 @) m  }) \' `0 @7 d4 C% q
  60. : O# N+ j/ p* C7 G/ C4 C
  61. static volatile int irqraised1 = 0;
    ) d4 C: z" d! ]
  62. static volatile int irqraised2 = 0;1 ~  N( t8 ^% [" x  L' j( |1 I3 t& v
  63. 8 m; q# E; [1 W7 |! K# J3 L9 A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& P* D2 e9 R1 f" }- r: w3 F) d" @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! `5 W6 ]( b' F0 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* p2 c8 f- X1 K8 X: V

  67. % @+ v* F2 `2 o  P9 x; Y6 o% d
  68. dma_addr_t dmaphyssrc1 = 0;- f: E/ E' e3 M/ s1 B
  69. dma_addr_t dmaphyssrc2 = 0;
    + `( |  F! W1 a9 d$ w5 S! f
  70. dma_addr_t dmaphysdest1 = 0;9 b6 ]$ B% ]2 U
  71. dma_addr_t dmaphysdest2 = 0;# d- f0 \% k; ?$ I3 \( X

  72. 2 Y) p! c8 j! O/ ^: x& Y) j7 w% ~) @) X" ?
  73. char *dmabufsrc1 = NULL;
    . H, K3 J1 ?8 r2 W, [0 I
  74. char *dmabufsrc2 = NULL;
    8 g- p$ x! z, Z9 p+ d
  75. char *dmabufdest1 = NULL;
      V9 t1 Z9 H( _' W, _% I* M& v; t
  76. char *dmabufdest2 = NULL;! ~$ y; E0 w6 \5 C

  77. # x4 K+ @4 I# c; j
  78. static int acnt = 512;3 W  Q- S, q% X- e
  79. static int bcnt = 8;
    : J7 C7 t9 U& ^+ N. \- j$ ^+ y
  80. static int ccnt = 8;
    6 a+ X3 T; I: p- `0 u

  81. 0 f5 d& R: h6 p0 `8 H
  82. module_param(acnt, int, S_IRUGO);
    . V6 A8 {' c  J- w; p3 N
  83. module_param(bcnt, int, S_IRUGO);
    0 @! s* Z5 v& T; O& ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 a9 y! X. ^/ ^

! }, w7 k' s! [4 s6 R! ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 w/ e' X: z$ U) z& k) S6 j2 P! oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- B2 ?) O7 ~, `+ d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, @6 I. K: k: w+ Q9 E% y0 y! r* q# d) T7 o, z
2 A: A/ k1 R' h2 Y& J( Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 23:43 , Processed in 0.037561 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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