|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ P" K6 }7 b: S! o& f- [code]EDMA sample test application! E0 f3 P( ?4 I& K- {8 v2 Z
- /*
% f8 y4 X# u( n5 y+ o - * edma_test.c1 P( N5 _5 e4 K/ F: X1 x* _
- *
& R" O7 b5 L) N3 _7 ?& P) d# V - * brief EDMA3 Test Application! C6 d& t9 `3 T8 Y% J
- *" z2 f# E/ u5 D7 q' t
- * This file contains EDMA3 Test code.
' T; q( ~* l1 S8 Q - *; Y2 }4 g8 q/ l6 T ?& W6 f9 i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, K# e a1 B0 K0 |) u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 g* u- I, g8 H6 h* W9 r
- * TO CHANGE.* `* f$ t8 v+ X! Y% @ M
- *: N4 p) L+ q* z/ o) r2 d3 x4 s# u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 g) _) {' f3 a9 o: f
- *1 x9 X* F# R* H6 {# I
- * This program is free software; you can redistribute it and/or
) a& b" X6 A) w) B - * modify it under the terms of the GNU General Public License as7 a2 ~% {6 l0 v
- * published by the Free Software Foundation version 2.
1 I r: m5 J; q' \7 i5 ?5 a) x - *
9 m; E; s* t9 g; x! G( ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; H" B: H7 r9 ~2 h/ o: R0 S; J+ @) Y - * kind, whether express or implied; without even the implied warranty' ?4 e9 _! U6 u6 T! y5 u9 @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 j& y) \# z/ v9 p" \; {9 X
- * GNU General Public License for more details.0 A) A5 i$ _ r2 ?5 f, m, ]5 g
- */
9 F! _9 K/ v( Z - 2 k2 y1 Y+ h' C% Y* g6 L3 v
- #include <linux/module.h>
8 m6 h4 u5 c% M8 \" U: S4 B - #include <linux/init.h>% h, ~% @$ U1 ]
- #include <linux/errno.h>
" w2 b7 ?& p, K% e P; z9 Y - #include <linux/types.h>
4 }' G. H# n3 W6 N# e/ E - #include <linux/interrupt.h>
* J$ S( q) y# c7 U L - #include <asm/io.h>4 {' m; L' @% n% X% |
- #include <linux/moduleparam.h>
* ?; S9 ?: J' J n, Z. Q - #include <linux/sysctl.h>" E8 V$ f* q2 S$ h: \
- #include <linux/mm.h>5 K2 g9 b4 I& S1 a' W
- #include <linux/dma-mapping.h>0 i `5 u( G& ]. w5 [# v7 ?; |: E
- 1 X& Z1 w! n: i& H! l4 g5 D: M
- #include <mach/memory.h>& N0 _- ?3 s# _
- #include <mach/hardware.h>' j% z% e+ g2 ~+ _8 K
- #include <mach/irqs.h>. N7 f4 R, x" T6 C% ~/ O
- #include <asm/hardware/edma.h>% n/ V. j w ?( F$ p
- * V( v* t) K8 h# T1 }+ ~7 I, Q
- #undef EDMA3_DEBUG* u, K# n) ?7 z) R
- /*#define EDMA3_DEBUG*/
! O C0 t6 t7 T; S) _! b
3 K" i# |0 r6 X0 x. w- #ifdef EDMA3_DEBUG
7 z1 A7 M7 S! V1 `! M1 n& f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' i8 N; l' B# h; c, h) B$ r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- e$ I1 A. P4 K3 b8 R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 s1 p+ @; m$ s9 L/ y! M - #else
( E2 B1 E) x& w& g- [% w - #define DMA_PRINTK( x... )
# J& C) ?& E7 \3 Y - #define DMA_FN_IN
! Z/ j* o$ R2 R7 o/ u- L - #define DMA_FN_OUT
2 p1 r; e9 r" M& n5 h2 _ - #endif
9 R; q8 R4 O4 t F- ?) ?) G" { - ! j$ u; Y6 n5 a) m+ |! I1 g' G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 u, ~; M- n- Z1 t( F - #define STATIC_SHIFT 3
2 M) I- N; Q; s9 m. W: d - #define TCINTEN_SHIFT 20
& M! u6 f+ i; i/ e) z1 V$ Q - #define ITCINTEN_SHIFT 211 j7 P& g1 d6 V
- #define TCCHEN_SHIFT 220 b! s7 c! U" b
- #define ITCCHEN_SHIFT 23
; T" o, v" X' n- Y7 r4 F - ! H3 e# w8 E# k3 c) m0 ?
- static volatile int irqraised1 = 0;
3 z: W0 K; {2 [8 L5 \8 P; \ - static volatile int irqraised2 = 0;! ]' q$ T: y: O. i5 C2 s+ u
- * y6 N+ S$ O- G2 ]( V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 a( ^+ `1 A- {) c0 t% @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, d6 R( ?3 a# r3 Q( C) ]0 | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% V0 _& h$ v+ U; {* o - ; Z; \9 {1 T$ ?" X8 M4 V/ X& P2 ~3 j
- dma_addr_t dmaphyssrc1 = 0;( g. @" h' Q+ K) f. i+ {
- dma_addr_t dmaphyssrc2 = 0; h, A+ N7 m6 V) T3 M9 @
- dma_addr_t dmaphysdest1 = 0;- ~" [. W) V p0 F% J, H
- dma_addr_t dmaphysdest2 = 0;) _- c8 o! A, { I& | B
) z) @+ r7 P* c& e1 e- char *dmabufsrc1 = NULL;5 m. N* d3 t. g; r
- char *dmabufsrc2 = NULL;
- B6 w8 U3 l$ P - char *dmabufdest1 = NULL;3 \9 p( o& i7 j5 Y0 q/ D$ x
- char *dmabufdest2 = NULL;. V6 K1 L( \3 P" y
- 5 P' \. O9 w9 g: Z: X0 B7 c8 ?. x
- static int acnt = 512;5 p4 u0 P! B7 w* z% _ o, {" z9 a
- static int bcnt = 8;
+ T, D! ~) f( Y - static int ccnt = 8;4 [+ u5 b7 Y# Q& ^9 \- J
9 s, A* C: M; [/ r- module_param(acnt, int, S_IRUGO);
9 _. F! ]; Z3 p6 f; b - module_param(bcnt, int, S_IRUGO);
/ V1 L/ ~* A+ m: w0 k% r - module_param(ccnt, int, S_IRUGO);
复制代码
@+ w6 V6 [- T) G! J8 k
6 z/ z/ i# G$ d% M$ }* | 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
w. O" t5 m5 L; O" l5 {# E. Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( C: G8 P/ J0 J1 _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( P: ? i4 F1 b6 r) S
0 ]! I; A( f6 J, h8 o/ c9 V( `
$ b6 M) i3 r, r/ X) A) W& M |
|