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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  h# u0 H# Y7 T/ m
  1. [code]EDMA sample test application6 R2 ~& u% q* T
  2. /*
    . K- \) v' @$ v( N8 `6 J5 p3 ~
  3. * edma_test.c
    0 F; {( g9 z. Q8 ?
  4. *- y, T4 m6 `! s$ M& G
  5. * brief  EDMA3 Test Application3 p$ T  q5 O1 {' |$ s# f
  6. *
    3 K( m; [: }4 W) ~
  7. *   This file contains EDMA3 Test code.' S; P/ O# W9 P" q
  8. *
    ) j' p9 C& v. v" N$ k- B* w* u' R8 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& A1 q3 V5 T% Q% K1 \: e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 I. L- G6 J, ?, ]' {1 U5 J
  11. *         TO CHANGE.
    # G( c: F) J$ n/ [# r& ~. k3 P" r
  12. *
    # P1 J4 E2 v3 K; T3 ?. A% q  L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 ]) L9 X, x6 u; g5 \& k: F& E
  14. *& y; q7 ?, H6 g7 h" a0 R
  15. * This program is free software; you can redistribute it and/or) I/ r0 {. d6 ~! o
  16. * modify it under the terms of the GNU General Public License as
    % j) _$ U6 }+ F9 {4 o$ p
  17. * published by the Free Software Foundation version 2.+ a! c6 t1 _: D5 |( a  y) v/ J+ X- O3 g
  18. *
    ' s4 n; o* E) l/ x  H( d+ S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# D6 F% ?. x: E  r: \" ^: S
  20. * kind, whether express or implied; without even the implied warranty( z; u: P9 E' k  a8 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ ^1 {  V6 S4 W7 w2 [
  22. * GNU General Public License for more details.
    4 v1 z) \& j( C5 V# S
  23. */
    ; q# r# F+ U" H! ~/ M. G
  24. + C2 r* l% Q. y, C" ^" C& f# Z
  25. #include <linux/module.h>
    ' l2 N% @5 ?8 ]# j. Q- h5 x; r
  26. #include <linux/init.h>$ Q4 O9 c- A8 E& p0 l# o2 v
  27. #include <linux/errno.h>) a2 I. S' V* H# d1 N7 ]
  28. #include <linux/types.h>; J5 U9 ?# U( K5 H' Z3 C
  29. #include <linux/interrupt.h>0 Z/ {2 A& b  X+ f# M* T8 B5 Q4 O
  30. #include <asm/io.h>( K( n* i9 @, g
  31. #include <linux/moduleparam.h>
    . X; O% M4 L' W+ o- W/ Y( {$ b
  32. #include <linux/sysctl.h>
    + n, ?4 |6 z2 o0 R$ b
  33. #include <linux/mm.h>5 L2 a/ f& y* M& w" n5 v5 ^% v3 Y: H
  34. #include <linux/dma-mapping.h>
    9 o6 D5 Q. b2 t5 W7 z% Z) {

  35. $ l2 a6 F# R5 X" _
  36. #include <mach/memory.h>4 _% L9 F  U4 J: I1 _
  37. #include <mach/hardware.h>
    + R" Q+ n& t$ M& K" X9 \. b
  38. #include <mach/irqs.h>
    7 n6 c  p( D! }4 m
  39. #include <asm/hardware/edma.h>
    ! k) S( r% K- n4 l

  40.   l/ b, n' O9 r' u; ~  r
  41. #undef EDMA3_DEBUG. X: c  [6 n) o5 {. S& q# q3 C
  42. /*#define EDMA3_DEBUG*/
    4 c) Q& v! l: u0 W0 \' c
  43. % k' f0 ^/ U, G/ v
  44. #ifdef EDMA3_DEBUG, T$ F) u; v( g" P$ ]8 I$ @8 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / h+ L1 \. a" u2 B6 {  H! \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " h- n( v0 K) C$ F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % r6 X5 m9 A% d$ Y' C) u
  48. #else
    ) B* X# b! ?- V+ X/ L' r
  49. #define DMA_PRINTK( x... )9 c( Q( d3 O  w7 f3 d7 \9 N: S
  50. #define DMA_FN_IN% B6 L  W" z2 Q
  51. #define DMA_FN_OUT# A9 D; E* D* ?$ |# \
  52. #endif
    . x# ~+ \  Q8 Y0 F
  53. 5 S8 U* M( b  d4 s( p; B1 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( \& `% z$ @6 n, I5 J6 W6 b
  55. #define STATIC_SHIFT                3
    * }) e- V/ M- a0 b8 _" Q/ Q
  56. #define TCINTEN_SHIFT               20
    - P% e% _4 ?; T0 L* j. F
  57. #define ITCINTEN_SHIFT              21
    . w0 z6 s" H" q7 T
  58. #define TCCHEN_SHIFT                22
    , Z3 Q" Q' z( y. ?
  59. #define ITCCHEN_SHIFT               231 u' J) F% h% R7 }  w
  60.   v& W5 ?$ e0 t3 l$ R9 j6 a
  61. static volatile int irqraised1 = 0;4 j& P. x3 G. y. q- p; V' O
  62. static volatile int irqraised2 = 0;8 N  R* ~2 F3 g/ m! i9 }9 ~- l8 B7 C

  63. ' `  L/ I9 v2 C: i: y0 x, y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 w8 B/ h. S, r* f( A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 m0 _+ @( L8 n$ |2 a- \: l  b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* n, z3 P# ^9 Y7 o6 b/ l

  67. : c# u. M$ \* k  `6 g' v
  68. dma_addr_t dmaphyssrc1 = 0;  U2 J  X+ @# C
  69. dma_addr_t dmaphyssrc2 = 0;; R( `- Y6 X+ J7 m
  70. dma_addr_t dmaphysdest1 = 0;1 x; R. V1 X+ R
  71. dma_addr_t dmaphysdest2 = 0;
    5 X& O- U8 u8 A8 {& A* z

  72. * h5 m1 A' |+ T. e6 U+ J
  73. char *dmabufsrc1 = NULL;* `" {, c) q0 l
  74. char *dmabufsrc2 = NULL;
    , L" w, Y* Y) ^. E
  75. char *dmabufdest1 = NULL;
    7 X- w: m6 {& p8 V0 \
  76. char *dmabufdest2 = NULL;0 U6 W: Q/ Q, H+ q) k
  77. 1 i" U9 J" u* G  }% [9 g0 ~1 Q
  78. static int acnt = 512;& B7 U- A( [3 P8 ]& s: Y$ i
  79. static int bcnt = 8;+ S  D9 R) s' ^/ U  W8 r
  80. static int ccnt = 8;
    " ^) w2 x, b6 h& E( R$ d1 t
  81. " X% {0 k3 A3 O" t) @& u
  82. module_param(acnt, int, S_IRUGO);, f  U6 k6 Y8 a* ~1 q
  83. module_param(bcnt, int, S_IRUGO);" `  j( |) y  D0 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 E! Y+ m8 V* j
+ ]/ m) i) F  A# J7 t0 |* _- e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; ~0 [5 A/ g6 V& k5 B- w# narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) S. G7 T) v4 i$ X5 {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 N. d$ P8 n, j6 N4 z% ^) t2 W0 t
8 u3 H. j) U. C/ }8 x5 c3 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 19:56 , Processed in 0.040066 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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