|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( ]( ?. q$ q. w8 ?& s+ B1 c- [code]EDMA sample test application
$ |( B3 \$ O0 F, s' D - /*
6 p6 v* ^4 t7 w! v - * edma_test.c
0 r% T& w- @- w5 }# l - *
1 _$ z. m7 ?* R- D: a5 s& L8 t, C( ~ - * brief EDMA3 Test Application
) g, B( n2 U. z9 c8 m7 A - *
$ M. U- F- F+ a: v$ U' q1 u1 q - * This file contains EDMA3 Test code.
& z6 b$ O6 q; _$ } - *
3 X/ N, f' Q! w" l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" R" P% F+ O6 P+ M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 }2 V6 \& q9 d2 O! P; M# z
- * TO CHANGE.
5 n! o- m7 |& X8 Y - *- S3 z" e* P* i4 `* \# u2 G" w- R
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ a6 S1 |. [+ ?! r; Y
- *. U! M( L- R M9 h
- * This program is free software; you can redistribute it and/or
2 a+ Z C" } l- p* J& L - * modify it under the terms of the GNU General Public License as
4 h! ?1 s5 O7 T2 W - * published by the Free Software Foundation version 2. s7 j! q1 ?8 A' i9 b& t. n
- *5 m7 V# D' I5 {5 Z* P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 n% ~0 N0 @" F6 d9 ?
- * kind, whether express or implied; without even the implied warranty; z4 v" S3 Q7 j1 }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 y: G" h- H9 H9 h( Q: f
- * GNU General Public License for more details.0 h* Q) ~( l/ c! ]9 t, q. e
- *// H1 u' k! f6 w6 Z8 y
2 E3 s" ^: i3 ^+ b: M- #include <linux/module.h>
. q. x6 d4 A1 U: L/ } - #include <linux/init.h>4 k- v3 s; _& ~2 W
- #include <linux/errno.h>+ |# W1 N" f& K+ u& C
- #include <linux/types.h>
3 p) D! S: S0 i& j- R+ u4 c - #include <linux/interrupt.h>
/ p- Z- ~0 G) n1 C2 J - #include <asm/io.h>
( j' E1 Z8 y0 N I; G - #include <linux/moduleparam.h>' v. \, x, y a3 k
- #include <linux/sysctl.h>5 k+ |$ Y* A4 M2 C& Y
- #include <linux/mm.h>
5 w' P4 `% y9 S2 I2 A, B( w p - #include <linux/dma-mapping.h>
7 }0 `% k- x2 X; h/ u - 1 F# k" |, D1 p1 b( x
- #include <mach/memory.h>
& {+ N: Q" j3 j! d - #include <mach/hardware.h>
8 ]& k/ R5 p/ D' @ - #include <mach/irqs.h>9 J/ h. N/ N- _8 O. M
- #include <asm/hardware/edma.h>
3 E+ V/ A$ h1 j - , E; [) m2 x: f: Y- x( k. A
- #undef EDMA3_DEBUG
r1 L+ Q- U8 N* t2 |2 q - /*#define EDMA3_DEBUG*/" p& |$ j+ N; {7 r
! ^4 s8 S' N# w: L- #ifdef EDMA3_DEBUG' l9 n; X }; T; c: Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ ]' a% N! i$ i8 A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 s' n6 ]# G( D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ q; X4 r/ ~9 q7 I - #else/ V* ?5 T% r1 f
- #define DMA_PRINTK( x... )
0 p, }4 A6 g% Q: `# _ - #define DMA_FN_IN+ v. ?; O; _, j
- #define DMA_FN_OUT
/ P8 \+ _0 M: i9 v) |, M6 F - #endif
8 Y; B4 `. N! z: [' c" w& ^
) f1 g! d' B7 X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 A* m! U; w' x2 Q; P - #define STATIC_SHIFT 38 N" C) r6 S' I/ M
- #define TCINTEN_SHIFT 20
, h' F0 E& R4 k |2 G - #define ITCINTEN_SHIFT 21
0 F2 Q' i$ |. f# {; K. l9 O - #define TCCHEN_SHIFT 22
$ O% J. g' p; x - #define ITCCHEN_SHIFT 231 \/ c& k0 U* K# c# L% ~
- * W+ t0 ^' m6 Q* F: E
- static volatile int irqraised1 = 0;
5 w, w9 J- J* o" q) g - static volatile int irqraised2 = 0;
3 [! g( k: [1 @' U! t8 K! ~% D/ u
& ? F r' m4 K0 s8 l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: g- S( P& b9 {' p- Z5 ^% n, Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); d- E4 N& u' f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- _* t: u( P0 o g3 ~9 }' E - - ?5 a8 Q2 e. I6 w( s; @! |
- dma_addr_t dmaphyssrc1 = 0;
0 K& l1 M: i% l' C - dma_addr_t dmaphyssrc2 = 0;2 q0 k( e+ Z& {: ~0 b. F
- dma_addr_t dmaphysdest1 = 0;0 P( k4 m9 l+ O/ N; Y
- dma_addr_t dmaphysdest2 = 0;
4 S! ` i. \8 A1 N- w
; O6 g4 Q1 w1 c: a) o! g9 g& y- char *dmabufsrc1 = NULL;
. {! a# D: B" N - char *dmabufsrc2 = NULL;; J* I1 P2 ^% L$ |# ?0 F8 Z3 `
- char *dmabufdest1 = NULL;
* A* l3 x" }7 T K; p - char *dmabufdest2 = NULL;
. x2 w2 W7 v, l. A - ; c: x& _- V& M- t/ F! o' z6 l
- static int acnt = 512;
, r9 X9 L% j7 B' j# O2 b - static int bcnt = 8;" m& s/ {) |2 Q- ^8 e5 Z5 v' Y1 O6 v' c
- static int ccnt = 8;
8 o; S1 a H( _- ] o g* ^8 S# ? - 6 Y- z9 T& J/ e" d8 ` L
- module_param(acnt, int, S_IRUGO);
2 d _4 V8 D( g3 B' O - module_param(bcnt, int, S_IRUGO);' R% b( x2 N, w( W. C$ }' O0 i3 o) [
- module_param(ccnt, int, S_IRUGO);
复制代码 $ b0 b" b" Z( X, ?1 q2 ]
3 z/ W5 ]6 i* d+ y" O5 O W+ l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' Y m/ Z4 L2 R/ H4 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- T; }3 B1 d C- W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 I5 A7 r- p& b6 M/ `" m- a1 B% S
, b* c" x- Z5 x
: q& K/ Y5 M* n4 k; b& E
|
|