|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- ^( H% c ?3 ?* q- [code]EDMA sample test application
) m5 H7 c I/ K' ]- h: {' [ - /*
$ R- n( w* M: g. S0 Q - * edma_test.c
! o1 a& H* L' r2 c6 D! v0 F: D0 {. M - *
/ r5 \$ W3 y9 |7 r: g' v% z% c - * brief EDMA3 Test Application, C. m7 S A2 f4 b$ v! \# i6 m+ z' p
- *% z5 Y8 k8 i6 S$ i: J L0 w! ]% L
- * This file contains EDMA3 Test code.
& ^" d3 d" s. a# e$ |9 U4 U - *
' R9 W" A) z4 F3 ^$ e% H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( N' J4 I% F$ [+ ?; R. f( N, ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" T& z) S+ S2 E
- * TO CHANGE.6 @: X) J* G$ v9 O+ L% l
- *
% X2 y9 Q1 {( o' G/ A( j" [3 B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ Z8 K5 X: s! [% a
- *
& d! x' [* Y6 H9 b3 `$ Y* ] - * This program is free software; you can redistribute it and/or2 m, r$ S, N5 _% \, ^* i- O
- * modify it under the terms of the GNU General Public License as# G( G5 h5 D+ d7 R) Y; p
- * published by the Free Software Foundation version 2.- |; ?- [8 `$ [! n% R
- *
" a1 V$ J* G# h3 s5 X( W. `6 N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ R W/ W* e# w( B; \9 ?! {
- * kind, whether express or implied; without even the implied warranty
! z! n, Z% A) j+ N. p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 Y+ T( A8 ]- f5 r1 }6 R - * GNU General Public License for more details.
& e" t. ~, Z e) A; I - */
6 s9 S7 O! F* f) n* _* j$ Y! e
8 |0 B) _; J, m% y$ l; D3 \# o- #include <linux/module.h>
6 H+ [- i7 B9 h" D% A! b - #include <linux/init.h>
: C; E* S! v; w* w8 p1 w. J( L - #include <linux/errno.h>- M9 Y" V8 B, W0 |6 U6 D" H0 c
- #include <linux/types.h>
- j# ?% r0 J0 s- h6 ]/ B( g - #include <linux/interrupt.h>
: ^/ `$ Q a' W. A' B+ y - #include <asm/io.h>
% G+ ?" F @( X - #include <linux/moduleparam.h>0 u% }% m, |& V; w' O
- #include <linux/sysctl.h>7 S" k' }# Y9 a9 t% e
- #include <linux/mm.h>
: W" L( I; s, Q6 w& Y" G% G - #include <linux/dma-mapping.h>
, F/ f: S' J4 P) t3 j, u/ \
3 i, H; O( B9 I! C @, }4 r- #include <mach/memory.h>
4 C$ ~& ^ n! e& d) ? - #include <mach/hardware.h>) m& y2 [: W: u; _
- #include <mach/irqs.h>
- r2 D6 Q, i! F! `4 D - #include <asm/hardware/edma.h>
9 h8 D6 }; F9 g2 c - * @) l' l" G3 e& ?! Q& b8 z" \/ L' K
- #undef EDMA3_DEBUG
5 V* R# d3 u Q - /*#define EDMA3_DEBUG*/$ H1 k& k0 m" W; E
7 l. i1 A3 O9 z; ~. u- #ifdef EDMA3_DEBUG% ~, Z- J0 s9 _& g2 x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( x/ r7 i5 {+ t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). ^ n% o8 N: Z- d- Q7 R9 w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ ^8 O; o( S2 A. K6 I# |' u
- #else
' U T) `6 \+ E - #define DMA_PRINTK( x... )6 P: e; `5 O, `) D9 z/ b8 u9 d" ?
- #define DMA_FN_IN
: X$ a( i# B6 L4 u - #define DMA_FN_OUT
2 l' ^) t1 E" c! ?% N - #endif
0 b/ c) S8 U2 B8 I8 s- b& R) I - * w$ a& |9 r9 S5 _/ C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); m% y* C5 N% ?+ w- m
- #define STATIC_SHIFT 3
4 P2 B% `6 D3 p U2 v. l - #define TCINTEN_SHIFT 20
( E5 G% _6 s$ l0 Y - #define ITCINTEN_SHIFT 21
+ g& o/ h$ K5 P& p - #define TCCHEN_SHIFT 22
: Q$ Z1 p; K8 M3 x) p0 }" m - #define ITCCHEN_SHIFT 23( j: M3 J2 e1 ^+ d9 b! B- I
, X( v \' P( F6 Y- static volatile int irqraised1 = 0;
% t& J! }* i: B) `1 G - static volatile int irqraised2 = 0;" J/ \) p- Y" U: C# T' y( v
9 V! d2 } o$ |2 `/ _+ u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. P; W! X1 ]$ V1 q9 p9 l0 O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" U9 S8 c; ^* ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 B8 s8 R5 y' W; |* W: A1 g' U
; h/ L5 N. a; l7 p1 W: {0 R- dma_addr_t dmaphyssrc1 = 0;/ }8 t, p2 S- h* R
- dma_addr_t dmaphyssrc2 = 0;
+ \1 e% u) s: H W2 K- M. V& ? - dma_addr_t dmaphysdest1 = 0;( A! ~! ]9 N3 r3 E2 l0 A
- dma_addr_t dmaphysdest2 = 0;
1 i: s( n# r6 y2 }7 f - , a2 g6 k1 Y( ?% B; O, q: b
- char *dmabufsrc1 = NULL;
4 n! C+ @, k2 y; w; [/ s - char *dmabufsrc2 = NULL;
5 e* H+ \' B( L( a0 Y7 } - char *dmabufdest1 = NULL;
; a. b4 T- y0 \& w* }) p. A - char *dmabufdest2 = NULL;5 C, g1 i3 U& p: l
- . a2 X) g! U; K
- static int acnt = 512;+ v$ V" @/ N3 r+ W) B* A- D
- static int bcnt = 8;
6 P# |) X9 _! S9 \ - static int ccnt = 8;. F* m1 I) d0 F& f
/ e5 X! s" I7 S5 E1 e. L1 {- module_param(acnt, int, S_IRUGO);- }5 U( o0 I8 K* p' N
- module_param(bcnt, int, S_IRUGO);2 D/ T6 i5 K4 w. Q
- module_param(ccnt, int, S_IRUGO);
复制代码
8 }" ~# k) c% h8 Y& q: u" J; b# Y& P
) @) z* B2 @/ T1 d8 ]' M1 i! ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ X V& F3 H/ n8 h$ Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 m) _' N# n5 n6 V% b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) F# W% `' q- [$ J! h1 k2 `: }
3 [3 E1 j8 g8 \& b
( f' R/ }7 H2 n7 E* \# v! n |
|