|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: m9 X0 e; g+ n: g1 x- [code]EDMA sample test application$ m1 e4 E2 g4 C* e- |- i( p" g
- /*
$ d- g+ d5 e( a. M" n; q - * edma_test.c
/ `# T0 Z1 k" j @6 P# C - *
. ]7 o/ K7 z0 C0 |7 z - * brief EDMA3 Test Application
# ]5 W x. o4 q( A# B8 Q* K8 X - *$ p4 N' q" F5 K$ b, I: m
- * This file contains EDMA3 Test code.
A7 M1 ~, |) G$ t( p) t# h - *# ]6 F% N% T. t7 j2 _: t) Y; _( y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 l( ?8 M9 W. F% J. M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 u, _, A# g7 b4 F, M0 ~ - * TO CHANGE.
; \# ]* o$ T7 \ - *8 M" r1 L+ o' @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. X+ m G0 E- A1 Z \
- *# e# |( t- T4 Z
- * This program is free software; you can redistribute it and/or9 F4 {/ } U" C6 z
- * modify it under the terms of the GNU General Public License as
1 W) M. l, }6 ^) e1 o3 D - * published by the Free Software Foundation version 2.; C3 e; Q2 S3 R8 Y" G
- *
# y$ g# L( U" x- c( c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any I: H9 Q& b# |: {/ d! C
- * kind, whether express or implied; without even the implied warranty E, I1 q( e7 _! g( \/ o2 S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 s) s9 V6 S6 z3 X - * GNU General Public License for more details.' N4 u. R Y: H, Y% V/ Y
- */
}- K: Q" u: k% Y) \) Q
7 l. Q- O8 E J8 N3 t- #include <linux/module.h>2 E( Y7 |/ v. o5 Y8 K: r
- #include <linux/init.h>0 r o3 R, ^' [/ A9 L* I% u
- #include <linux/errno.h>' m; d+ H- H* |3 W( _
- #include <linux/types.h>
+ T. r8 q/ y+ J, c - #include <linux/interrupt.h>
2 k! U9 y! X9 I# R- k1 O - #include <asm/io.h>
1 O1 q: s+ f9 A" }/ j6 N) ` - #include <linux/moduleparam.h>
4 {6 [7 U1 I7 l" h7 A - #include <linux/sysctl.h>
8 T$ X' S; Z t8 Q' { x& z; E - #include <linux/mm.h>
+ c% ]% Q& ~- x. F - #include <linux/dma-mapping.h>
1 k6 ?5 h6 c8 Y1 m
T7 b- C* X/ i$ J; ^, R' Z, L- #include <mach/memory.h>. z Y! }; N. I* Y" F" N& L3 M
- #include <mach/hardware.h>
" q; k% W' _: j, d: C - #include <mach/irqs.h>" d! K' K) k6 K& n5 m3 C
- #include <asm/hardware/edma.h># n8 t7 a: \7 y3 I7 M
% J. q, {2 b0 j! }- #undef EDMA3_DEBUG( x/ q* m& I) \# w) _& g
- /*#define EDMA3_DEBUG*/( y3 L4 }4 ?% t4 {# z1 ~: C
- 6 `$ |5 Z, H$ T2 `, k
- #ifdef EDMA3_DEBUG2 S3 o7 z. ~4 t7 }* ~- g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 t0 k; i% R( v! ~! `/ X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, j% F9 Z- c) [0 f& u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 _* Q, e5 D8 h - #else9 H2 w" ?# V. U* U/ l3 @, m3 }: V+ T- E
- #define DMA_PRINTK( x... ): w) I& y0 F- \* c: t
- #define DMA_FN_IN
9 b$ M% c. X { - #define DMA_FN_OUT
+ t8 _* a: d9 T6 S+ s - #endif/ D6 ^7 ?7 n* @; G9 H6 H p' b
- p- T$ X" g5 n1 J; ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 k+ D+ f7 K6 K5 e! c2 r0 J - #define STATIC_SHIFT 3& w' y- T/ t/ N7 D' M( p; X
- #define TCINTEN_SHIFT 20' X* m- ^" L# x8 l* W+ y6 J
- #define ITCINTEN_SHIFT 219 T% U$ L- O1 N8 y8 D2 W( k
- #define TCCHEN_SHIFT 22
) O, M; R* u" T& N - #define ITCCHEN_SHIFT 23
1 G; E' t) t' i0 t `0 n( s
/ a9 \+ I+ a$ w8 @* u! T$ q$ t- static volatile int irqraised1 = 0;
1 A9 U' [$ i% o/ i - static volatile int irqraised2 = 0;
9 B C2 I% d E6 I z( R - 8 j/ O4 Z/ H ?: G' ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 l- _; q8 |0 S& B6 V& c; v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 r0 h9 u2 }5 [5 ]1 T0 [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: g' E7 x; q$ k( l! J - , Q( X. h3 z$ h! V% d
- dma_addr_t dmaphyssrc1 = 0;
: I2 z1 s5 a9 o+ M" k - dma_addr_t dmaphyssrc2 = 0;9 [$ h2 `8 u" l! J+ E
- dma_addr_t dmaphysdest1 = 0;* @8 Z4 O g- B* C5 o0 p
- dma_addr_t dmaphysdest2 = 0;+ B5 c6 o7 d, K+ s
- - k! b0 P4 ]0 Q/ _
- char *dmabufsrc1 = NULL;
; w" H+ n. [- l- p# g( I' t - char *dmabufsrc2 = NULL;1 `4 o* s( C! a/ b% r2 B1 z9 K
- char *dmabufdest1 = NULL;+ s" x; ]% i+ S- ] f
- char *dmabufdest2 = NULL;
+ [5 V% h$ _1 Y C - ) c0 f( W+ Y8 ?* g
- static int acnt = 512;
- E5 e/ O+ q* S - static int bcnt = 8;
* l- w: E9 Q {) O$ F2 B - static int ccnt = 8;
; b, _* Y9 E% D( ]& b - 3 q/ }. n4 S: F' \, a
- module_param(acnt, int, S_IRUGO);4 f8 _- m& N9 Z
- module_param(bcnt, int, S_IRUGO);
7 F h& A k$ w; H- s- O - module_param(ccnt, int, S_IRUGO);
复制代码 % j6 d- v: v) m" D2 Q* m4 i% g
% y* ~% j' Y+ o6 y1 E4 G: |1 X$ S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 p! y5 r" ]2 w: x: Z/ marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 O7 h% r; X' E4 B6 V3 t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! y# g9 h& Q; ~1 n7 U. A) A# j, n+ b% \- I; c
u" Y# C' H* m
|
|