|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 w" n" u/ U) G) I) u- [code]EDMA sample test application
/ K, `% ]. g; ^/ U" E9 @ { - /*
4 ~. d% g3 |' g0 |! c - * edma_test.c
; c/ x. N# u, f0 I - *, a% t& h3 u( H- M
- * brief EDMA3 Test Application# Y) S/ v2 m! E1 j
- *
# w" T2 t$ ]# d8 [! V - * This file contains EDMA3 Test code.) I4 Z3 P3 ?) D. L8 Y6 H
- *
0 i; H5 |& a& H8 R+ P# G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: E& N: g! Q+ V, p: P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 ~7 ?- a- H5 H# l3 `
- * TO CHANGE.# _) m4 z7 u0 G) d4 E! s
- *. x) T, `7 O8 f5 h# v! s' }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ \: J, q* P6 m/ d - *
* c6 O& T2 v( E( {% M8 f+ P - * This program is free software; you can redistribute it and/or
: ?% D" C( f. i - * modify it under the terms of the GNU General Public License as
! T* |; Y, E% m8 Q - * published by the Free Software Foundation version 2.$ z4 w- m7 f$ t* q
- *
( F7 Q! G2 |/ X2 u. m- d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 G! D+ r7 z6 r* U$ [
- * kind, whether express or implied; without even the implied warranty
. M( ?" A! d" C8 Y' _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) @0 B1 L3 h: i. V7 t& Y' h
- * GNU General Public License for more details." n; H" e# _! \8 J* Z* M3 O: ~9 E3 d
- */1 ~5 J: _, _6 [1 m- @* g2 M0 M) H
- # f c1 l" T8 ]) E- U; H
- #include <linux/module.h>
7 H, q0 P& i4 E, k - #include <linux/init.h>
3 g; @3 A! E/ E! u& T - #include <linux/errno.h> E% x2 _+ o4 { _/ \1 D
- #include <linux/types.h>2 O% j7 [4 @1 @% O, Q& J
- #include <linux/interrupt.h>+ J) H1 g4 T5 D: i! G8 z, h
- #include <asm/io.h>
# i t4 j* v7 c5 R% ` - #include <linux/moduleparam.h>! y5 i( Y) T" C# @3 w. A6 S/ N1 ~
- #include <linux/sysctl.h>
' T% P- `, Z7 j. N K - #include <linux/mm.h>! G$ W5 W7 n: ?8 C* y
- #include <linux/dma-mapping.h>8 k, T( I) `" ~7 }
o! ?# _9 ~6 G* K8 ~. d; E# L: X- #include <mach/memory.h>
9 z m+ ], y {6 }; x6 ~7 X# j" g - #include <mach/hardware.h>
@# i+ K4 b3 k, E2 O, o - #include <mach/irqs.h>% S) u8 @* H9 r8 s2 I. J' l+ o
- #include <asm/hardware/edma.h>
' ? D2 F1 C) N
; M) z6 h' Z4 p3 B4 W" y- #undef EDMA3_DEBUG) W' `% P7 r4 A& ], E7 n
- /*#define EDMA3_DEBUG*// Z1 `+ ~- e3 I' i
- . J0 q0 V3 C/ ^7 P4 L, g$ J
- #ifdef EDMA3_DEBUG( M1 X# a3 \( r l( J: O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ f4 m6 ]$ ^9 K, Y2 }8 C: Z$ |* ~5 b+ n5 Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 H0 v5 D p0 O/ [/ z" b' e" N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 j/ [# d- w$ Q7 C6 J. ]. ]7 a
- #else5 N9 S/ q7 p% \; W# f' \
- #define DMA_PRINTK( x... )
0 Q+ v4 Y$ X& P - #define DMA_FN_IN
; h6 _5 M% I$ \: v- L - #define DMA_FN_OUT
9 ?$ H! k% |( q; U5 l - #endif( V E* m3 k. v, u8 n% y
- + ~( M% _7 ~: ^" G- Y- }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 R1 a7 j2 v2 p* p0 | - #define STATIC_SHIFT 3: N* y& X+ F' q1 @) S7 a
- #define TCINTEN_SHIFT 20
0 Z( _/ ?' e5 j* C8 }1 l" I - #define ITCINTEN_SHIFT 21' w" t7 |8 N1 w* L1 z
- #define TCCHEN_SHIFT 221 i4 N- ` [/ g, u5 z6 g
- #define ITCCHEN_SHIFT 23; B* T$ B! n8 ~8 t+ m' x
- : ^ y# h, r8 |& @2 M
- static volatile int irqraised1 = 0;. k3 Y u+ y5 l/ N2 M2 s) `! _; s
- static volatile int irqraised2 = 0;: R L1 q$ [& S* p, X0 d
* f* E8 w9 o3 X* P$ r" C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' I) a* E4 G: v- |) v- T" p F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 u# L1 M3 u, J6 B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); i. `7 b% D: P# y
- ) l& N+ \9 s/ g3 P! l
- dma_addr_t dmaphyssrc1 = 0;" u1 {! ~$ G; l
- dma_addr_t dmaphyssrc2 = 0;
! ?, }$ J/ I( X1 R4 c! L - dma_addr_t dmaphysdest1 = 0;- T0 s2 K5 M' S5 L1 o
- dma_addr_t dmaphysdest2 = 0;
1 O' [7 K; o" D* t7 i4 e7 i% O4 A1 ~
; {% y& v5 ^. A6 B* E) O- char *dmabufsrc1 = NULL;
9 V7 P) F0 m4 P* V* @. g( a+ j - char *dmabufsrc2 = NULL;
' T1 x- N! q4 W5 r8 L - char *dmabufdest1 = NULL;
% W6 S6 B/ m9 p- `( S/ Q8 k - char *dmabufdest2 = NULL;1 B' \ ]% y9 c. f
2 P# P" M! G% x- W0 ^- e; U- static int acnt = 512; t, O1 |$ v t: D
- static int bcnt = 8;6 K1 E; a0 z: H& d% P0 i% U
- static int ccnt = 8;
7 c6 v ^. ?5 v+ U* D - - X3 P% E# B. a) H- _4 t
- module_param(acnt, int, S_IRUGO);
; S0 i, J R1 Z( s - module_param(bcnt, int, S_IRUGO);% j% k! W% z" S# Y
- module_param(ccnt, int, S_IRUGO);
复制代码 2 p6 d& Y5 c/ [. \. ]
, o& D2 w/ i5 G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 K( W$ d, K. m6 t" Q H* W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. H* u5 s% s; N/ s! |3 T* K" V3 v2 } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 d% W: K. M. S) e: s- N& L
1 p5 l. ?7 u8 M W; y
( Z! a0 O+ B1 `+ i
|
|