|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 [0 {% e7 D$ b$ X- [code]EDMA sample test application; ^/ h6 [8 d4 \* D/ q0 |
- /*
2 Z* }' _: T8 z4 B: ~+ ^) s8 @ - * edma_test.c- j8 {( i7 V* x; P3 }
- *. B; N1 n+ t4 \" |- L: W& r' u5 d
- * brief EDMA3 Test Application/ U: ]7 {+ M. `5 R& ?1 j; Z5 ?
- *( I; N" H! Z/ k
- * This file contains EDMA3 Test code.# p* b8 C# g F, n( r! W
- *
6 a$ I* k) ]& t* j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 J9 m$ V: z1 ]" r9 \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 I1 z$ Y& j( Y0 A6 p - * TO CHANGE.
0 \0 }8 U) i/ D+ H* T - *! Y" U7 F! [# c& U! u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" E9 o/ E# C/ v/ T( k - *
: ]& z+ T% J# P) _' | - * This program is free software; you can redistribute it and/or
/ L: v: N# o1 P6 @ - * modify it under the terms of the GNU General Public License as
, x3 V' P, h ^5 a - * published by the Free Software Foundation version 2. x- O- T9 S2 ^: u T' [: K0 u
- *, @2 ]9 L0 U& t) ?2 y: l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 T3 |& g& `! E! K$ }
- * kind, whether express or implied; without even the implied warranty) c5 l& k) g0 T# K$ e2 O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) N8 G. t- F1 n, b
- * GNU General Public License for more details.
: j# s( E/ O, |3 `, } - */
: i4 [ F3 e" m6 @ - x( [4 V6 Y" d3 Q( i3 _2 }2 y
- #include <linux/module.h>$ v7 c8 x+ C, v2 a
- #include <linux/init.h>
) u( a, m5 T% [ - #include <linux/errno.h>' @8 o3 j6 L3 |9 r5 q
- #include <linux/types.h>2 Q$ t8 {" b. N) \: w: E' m
- #include <linux/interrupt.h>1 l( P3 [6 l7 [ _
- #include <asm/io.h>
) j8 a: O6 y( M; [! ~$ a - #include <linux/moduleparam.h>: P/ o) y& e4 n2 r, u2 _7 B
- #include <linux/sysctl.h>
# ]; A3 c; a! l8 D$ V3 X" \& A9 O( k - #include <linux/mm.h>. k+ }$ ^9 z4 Y) l! S) m4 O3 Y
- #include <linux/dma-mapping.h>
: h: a/ Q' L3 p: j2 X; g, p - 9 ~% C7 k& Y$ N& }' n* K4 I
- #include <mach/memory.h>
/ s$ H! l) h2 ~8 k2 O, d - #include <mach/hardware.h>
( O k: I* J3 L# Q, k" W! o% _8 S - #include <mach/irqs.h>! n1 A. r& e5 U& }" P+ W
- #include <asm/hardware/edma.h>* b+ g9 w3 i7 h; i/ W
- ( U8 t* }$ j; T4 e# E, k
- #undef EDMA3_DEBUG7 V; @ s2 b2 E! P
- /*#define EDMA3_DEBUG*/! B4 c6 ?- }9 ~/ X! R
- 4 Q8 {% t0 ^6 e) Z& X
- #ifdef EDMA3_DEBUG
# c' l7 b& c; r& H; ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 E; b# n- c7 l+ T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 [* J" s$ ]+ L9 a- M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 D: s$ w+ ]) a+ F& Y
- #else6 v/ k" \" D; z
- #define DMA_PRINTK( x... )% W; i$ |1 ~, e' L/ R
- #define DMA_FN_IN
) h K& x) ^. Z) J6 K# U - #define DMA_FN_OUT
Q& k$ H1 {, x0 Z- R* c- b - #endif' Y' z' Z. \0 ~- ~2 o; B/ y% i
- , O+ i9 F1 g: {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 ?, Z! b# R% u2 L8 F - #define STATIC_SHIFT 3
+ ]( A/ `1 E2 A) S0 | - #define TCINTEN_SHIFT 20
/ `" J+ a9 n2 o# z% e1 V% O - #define ITCINTEN_SHIFT 21
, G9 J3 |5 y8 v - #define TCCHEN_SHIFT 225 G5 [0 q: k* |
- #define ITCCHEN_SHIFT 23
5 d0 w4 X: R9 S: M/ D' X( \
+ G$ n: o `6 }; j( s; B7 [- static volatile int irqraised1 = 0;! z9 f9 a. C: X& b1 I. t
- static volatile int irqraised2 = 0;$ R) ^% ]8 Y5 U4 C
- 0 x3 ^* x0 K+ I9 m! W2 @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ^. |% v6 G: @) y( a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# F/ H `9 c% \( e) f" _$ }! H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# u$ M, c# W) c; G0 Y- w4 P
+ ~" w$ b @/ l' z. M. c- dma_addr_t dmaphyssrc1 = 0;2 G2 J; D. _7 R% n" w+ M0 i
- dma_addr_t dmaphyssrc2 = 0;
5 Z* h" b( E( V* v - dma_addr_t dmaphysdest1 = 0;
5 q/ @0 R+ l) Q - dma_addr_t dmaphysdest2 = 0;& o2 ? F! i# M6 Y. G9 M2 a$ e
- ( G3 n/ H. q! N& V' M- s
- char *dmabufsrc1 = NULL;# g9 |! u% j+ C" A
- char *dmabufsrc2 = NULL;
6 r" o6 J$ O& N' R3 _) l5 V, `$ |3 F! k - char *dmabufdest1 = NULL;1 w3 n9 F( l& a1 Q6 N( G
- char *dmabufdest2 = NULL;7 j8 m) @; s" ], T2 M' j A8 k& f9 d
- ! ]- r/ r" V! Z8 X
- static int acnt = 512;) H. y# o( p5 F3 |6 E1 q
- static int bcnt = 8;
: T3 h' A9 L+ y5 w; ]& w - static int ccnt = 8;
( @8 i/ K6 [& r1 @6 d9 M - ; K+ R1 z( P" |3 |
- module_param(acnt, int, S_IRUGO);
* I+ `0 c9 E- D4 B/ N3 w J" T - module_param(bcnt, int, S_IRUGO);+ \0 t* c: a6 n* L7 I& Q
- module_param(ccnt, int, S_IRUGO);
复制代码
) k! S3 f+ {5 }& s' k7 c7 Z0 g( t+ k
9 H5 z6 I' F1 t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% n& u+ ]4 d2 i# p' ?. d( Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& [! o! {( b/ J; d* @5 F1 f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 f8 g( B" Q- T1 Z8 _0 U
$ V, x4 D) K) E. c3 V! `
" c7 t. S6 q3 p! L. |9 w D
|
|