|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, o! U4 ~* c4 X- [code]EDMA sample test application
0 J" k0 m* }, ?* Y - /*% Q0 T% |% L8 j5 @2 E
- * edma_test.c
9 I0 G" m; e2 h( Y( o& S - *
0 _# u" I6 H+ }1 f0 g: K- H - * brief EDMA3 Test Application: C" H' x c) ?( [
- *
5 _, B+ o/ K9 d0 h: r - * This file contains EDMA3 Test code.# X/ d7 f* g/ {$ g- d5 z7 U2 a
- *
; X) b- h" q2 i5 y& } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# V9 ?/ I9 k( ?$ H, w6 O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
D- y# k5 O; D N5 e, S1 y# _6 x) U* @ - * TO CHANGE." R4 }! \* L* x- l7 F6 q! f# c
- *
) a8 _ y1 h0 h) v' l' G2 R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 E1 D8 o/ h7 y* K8 W; k5 _ b - *
! {$ p/ P/ X1 z) D% K, E - * This program is free software; you can redistribute it and/or/ n4 G, }( [8 ?8 `
- * modify it under the terms of the GNU General Public License as; k# k+ ?5 z$ r# \& U, A' r
- * published by the Free Software Foundation version 2.
4 J* y- G8 `, h - *
+ Y1 S) M6 K/ R5 L/ X, F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" O1 r6 C0 T' u
- * kind, whether express or implied; without even the implied warranty: I/ R* ~8 i A d. R& M! F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 }4 G- j, R9 V) H6 k1 Q" A- \& G
- * GNU General Public License for more details.) Q( B0 g/ O0 ]1 s6 T1 n
- *// u5 V, [* \6 {+ x* T( T
- 2 w8 {/ e) [) C6 k
- #include <linux/module.h>1 {3 }- X5 B) z5 J l% l$ t: J
- #include <linux/init.h>) \* J0 D" I! c! X5 ]& w2 x# \
- #include <linux/errno.h>* `3 ~1 l# Y6 m$ ~& Q5 f$ n6 _1 ^
- #include <linux/types.h>) o1 M+ {. u3 P, T# F
- #include <linux/interrupt.h>
) X% b9 l7 V: g' V/ D5 Z' y; v1 L - #include <asm/io.h>
- s# G; a$ H' o" `% s1 S - #include <linux/moduleparam.h>
; G: r2 s/ e, {# K, q2 V. r - #include <linux/sysctl.h>! b! s- X/ b9 j. D- q
- #include <linux/mm.h>
% b) z( p# G; @, {# }* M+ R9 m& n$ L; O - #include <linux/dma-mapping.h>! m7 J2 m% x6 [6 q8 q
8 v3 Q3 ?. i9 e2 \- {% I* ?- #include <mach/memory.h>& ~6 ?+ W4 g; d
- #include <mach/hardware.h>5 q. G/ I0 [0 E8 D" w1 M/ x
- #include <mach/irqs.h>) I+ x' o1 F d& {5 p) z/ E
- #include <asm/hardware/edma.h>
% @9 `' b! ?* R( [8 Z J4 e - ; Y: n+ ^' [9 A% R- K; f
- #undef EDMA3_DEBUG
$ L+ H* z( V \0 B. {5 ?; Z - /*#define EDMA3_DEBUG*/
% R6 p& s3 Y) `
* a: W) z) L. n1 w4 w4 n: D1 S5 o- #ifdef EDMA3_DEBUG9 @. J7 q4 {* W6 x, Y/ ]9 Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% p5 _" y% K. d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ V0 b' d" G! r+ P3 e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( O) t2 x) l7 s4 U
- #else% O0 Z r* B: W8 i7 Y- ~5 L0 F$ n3 C
- #define DMA_PRINTK( x... )
& _( T* e7 H) t3 K" ]* L; R - #define DMA_FN_IN5 O- T6 N! I( u, W$ _* X8 }. A
- #define DMA_FN_OUT
0 R: N- f! x+ k' H5 ]* r - #endif0 W8 e K, R# Z5 ?
- 9 _- q; E7 f* _4 F9 F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 C. g6 A8 C% `# b6 x
- #define STATIC_SHIFT 3
, t! w$ o$ n b, P% r& D: w& F - #define TCINTEN_SHIFT 20
. ]! k* ^9 l T! C - #define ITCINTEN_SHIFT 21
/ T# }" C7 K1 q0 v2 {" X4 | E - #define TCCHEN_SHIFT 225 F2 }- l7 g3 ~- c
- #define ITCCHEN_SHIFT 23
, L" w& ?0 a/ x+ E" v - 8 j* J9 g) S' L5 i9 F% l. m
- static volatile int irqraised1 = 0;0 g. h4 A2 Z0 C# n* ~! G; E) u) }
- static volatile int irqraised2 = 0;" J8 x4 l! D2 i
! m) D, I2 Y1 u# r: M2 ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; x' |) `$ W' C' J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ s' V$ h n( s) F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. ]- B* r- M6 w' A2 c& O/ P
1 C! k, L2 R& Q, X8 A: p6 e! K, f: l3 y- dma_addr_t dmaphyssrc1 = 0;
3 [$ z6 ?! y4 e/ `. k - dma_addr_t dmaphyssrc2 = 0;6 G2 B% u1 F. S, H5 {
- dma_addr_t dmaphysdest1 = 0;( a2 w* n. V3 t3 v8 n+ _' I
- dma_addr_t dmaphysdest2 = 0;
+ b* @+ r% l9 l/ L% c! S - ; Y# u' |* z) N2 [* _* t! Z8 O
- char *dmabufsrc1 = NULL;& H7 n: y8 h0 ~$ \+ s* t
- char *dmabufsrc2 = NULL;
2 @$ a, s/ q* |: x5 l - char *dmabufdest1 = NULL;8 D( E" F. n1 H
- char *dmabufdest2 = NULL;9 _% L: y9 d7 h/ x/ t6 Y# n
- - D5 b8 Q: ?& F; q$ P, R
- static int acnt = 512;0 s" d" O( y9 N
- static int bcnt = 8;, j1 l/ ^- ^( w% V' W* a
- static int ccnt = 8;
" A6 J, Q8 t7 [. X' c; O* {) x
0 O; F/ N; B- x- module_param(acnt, int, S_IRUGO);
7 B, N; j0 U8 U: G. c: u" \9 U - module_param(bcnt, int, S_IRUGO);- H0 |" ?# t, Z
- module_param(ccnt, int, S_IRUGO);
复制代码 / p( k% E8 W( x
1 g' q! `) i9 ?% m% C1 O6 y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 `$ ^4 D; ` V$ q5 J( @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, j' Y9 w# W! N5 @; I4 [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 Z4 z$ D+ ?1 G W
L6 W5 a9 e9 L5 o$ {2 H/ f8 W+ y2 G1 A$ h" B- E
|
|