|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 ^/ S0 o9 |9 u8 n* H- [code]EDMA sample test application. l0 s7 U; S" }% V& l( ]
- /*$ b3 Y) s7 k* A' j# C) y
- * edma_test.c* V% s. |3 R$ S9 ?: J1 o0 y( G
- *
5 G' g) }* H8 [ - * brief EDMA3 Test Application
1 a5 n1 [* ~" _, X/ a- y - *
7 J+ h) v( b; E) `3 E - * This file contains EDMA3 Test code." l- V% ]" |0 L, l5 e* \
- *
" G% o6 d1 v+ k8 U5 P6 d5 O0 E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ z9 ^# ?$ N3 H$ P) V% n* I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# _% p0 @- f9 W - * TO CHANGE.! l) E: ]9 F* s9 j8 [8 p
- *
' u8 c+ D) A- A2 Q" r+ Z9 C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' P8 ]1 ]1 A0 m- Q
- *5 T3 W& |. `: W$ r& ]! E
- * This program is free software; you can redistribute it and/or
; r/ _! Q) }+ v5 D0 h; }' r/ Y2 Y - * modify it under the terms of the GNU General Public License as, n0 c; T' K# D' L9 e9 g( P
- * published by the Free Software Foundation version 2.
% p o' A* X8 ` - *
; q5 d! z1 @7 v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
B8 [& X: a* s) E& Z0 e - * kind, whether express or implied; without even the implied warranty
6 s) _! h; ~4 G$ } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the b3 ~9 u9 p2 L" d$ c( C7 }
- * GNU General Public License for more details.
U3 m( n, _) F4 i2 N3 y0 Q8 ~ - */
9 M% Y2 G3 \+ M
4 F% B+ c+ M& w, V- #include <linux/module.h>0 F4 P( n) z, D, j
- #include <linux/init.h>
' D+ }' [4 F+ b - #include <linux/errno.h>
# P- a! r' K3 Z" G - #include <linux/types.h>' B9 C9 n) i3 M# |8 y
- #include <linux/interrupt.h>
9 [, G2 q; [; `0 ` - #include <asm/io.h>6 f* I6 N: q8 n& ~7 n, M8 i% z
- #include <linux/moduleparam.h>1 I7 @7 H; r+ x" O, ]$ _$ K# s
- #include <linux/sysctl.h>$ S; ?5 |- u* w% ~% l* L
- #include <linux/mm.h>: I% U' E1 K9 Z' t2 n3 [" a- J
- #include <linux/dma-mapping.h>- S# r7 X8 G- J6 r
/ d( \. @9 k; @! ~- #include <mach/memory.h>
/ A$ m8 H; r/ z% T+ h7 C% e$ F) G4 L; g3 ` - #include <mach/hardware.h>, p5 G. W( l: b# g& r
- #include <mach/irqs.h>
! k4 n9 V$ Y# y, P4 K7 L1 B - #include <asm/hardware/edma.h>
+ X8 e/ Q* I ^- s6 R" \5 a. X - D) \% x, W4 K' a# h2 a
- #undef EDMA3_DEBUG
' Z4 [; n: A- z! ^3 U* z& d* r - /*#define EDMA3_DEBUG*/' l) w8 U$ P7 ^2 @3 z% R
& _) G2 E4 j2 |8 t6 X# s4 G8 }9 U- #ifdef EDMA3_DEBUG
2 d2 i; q2 P3 d: \8 g' ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( L5 \& n B% p6 j6 c1 P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ a c$ W5 ^6 Q* U9 i# C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" j3 l2 K0 D$ `) s8 F, \: X) Y
- #else( e* i# U% }+ D2 @$ h. a/ g
- #define DMA_PRINTK( x... )
. z3 ~$ A) N; j a - #define DMA_FN_IN8 U8 F4 |6 ?; ] `- C
- #define DMA_FN_OUT* z3 }$ l8 |& q
- #endif# f8 Q8 W0 \$ M/ ]$ f. f) A; T
& H8 V7 f2 H0 B# ?/ s6 e3 _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ S5 o' t1 a: _7 R2 ] - #define STATIC_SHIFT 3
: s9 j4 c& l1 {$ }% e4 z, ^/ e, G9 W - #define TCINTEN_SHIFT 20+ J( C3 V: o: l
- #define ITCINTEN_SHIFT 21( V" O$ ~, R- H. ~4 O
- #define TCCHEN_SHIFT 22
5 K; @* {/ I9 C - #define ITCCHEN_SHIFT 23
. f( x J! ]/ ~* N; D- i% ~ - 1 J5 `: `, I8 k/ P* b) c3 Q( X
- static volatile int irqraised1 = 0;1 J2 |6 q6 X1 m% h
- static volatile int irqraised2 = 0;
2 `. ~- s( @. v" M: i: I1 J - + ?8 [! j6 w* @: N; D+ I( m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 p5 k3 \& q: x1 b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. q: r3 `2 J* B4 x- }! I7 i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: H% n6 J) W% G' y& ^0 u" K! K
6 q2 L. g! Z, r; S; w' l6 }- dma_addr_t dmaphyssrc1 = 0;5 H8 {& O: V; X, N4 g5 }( t
- dma_addr_t dmaphyssrc2 = 0;
7 Y7 U0 `. K; R: `7 ^3 o - dma_addr_t dmaphysdest1 = 0;
' v' i2 k+ p* q. y, |0 Y1 Y - dma_addr_t dmaphysdest2 = 0;
- ?3 n e; n) o$ M* y; Z% _" D - % B$ L, x" P; s2 S+ ~
- char *dmabufsrc1 = NULL;
+ G) O) N ^- A5 P, [% S2 L1 y- c - char *dmabufsrc2 = NULL;
* i+ u. k3 n. A) ^& R( z - char *dmabufdest1 = NULL;7 ?3 z; t- \+ N6 z* r
- char *dmabufdest2 = NULL;3 R9 v" M) y- {' C: A- t% B) ~# ^
7 z" C) `* v! C; o! J A9 n- static int acnt = 512;
- M! ?$ o! S7 |4 {: D! Y0 U - static int bcnt = 8;" R) v u0 G9 [) [
- static int ccnt = 8;
& m3 L8 D" b4 i0 s' E/ j - " @) @! H# m! n" s3 l& Q4 W
- module_param(acnt, int, S_IRUGO); D, O0 ]0 O \" v3 J
- module_param(bcnt, int, S_IRUGO);: K% w w& A* x& ?" d
- module_param(ccnt, int, S_IRUGO);
复制代码
5 R: s, b8 Q. I3 g7 z" a7 c
" a1 i( M/ H' r, t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% T6 x4 n4 [2 Z. @$ {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 O; I/ u/ R% X" Q/ A3 W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: k+ l7 E. n& f- z( d+ l$ y9 v* O9 h3 f0 ~2 V) V5 r. v# [
0 L" d# e/ ?2 y( h9 A2 o |
|