|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 E r, M( t( @ Z% o
- [code]EDMA sample test application; S5 q" k( X% ]
- /*6 P2 R7 u# Z. l
- * edma_test.c
1 m' s8 h, s! f+ m \ - *8 p/ e, e8 S2 Q% i u8 _' s
- * brief EDMA3 Test Application
% J( t) j5 c1 a; t! k3 V - *
, `! I3 N& M l3 g' s - * This file contains EDMA3 Test code.% \% K* C2 Z0 o$ W1 W/ O. Y# J" Q
- *& c3 H1 w; ~3 m3 v/ P' ?5 @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, [0 v5 b/ X S" ^! f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) D4 s6 J4 U$ ^
- * TO CHANGE.# b& ?, d* V* ^0 ^" k
- *
0 l1 R% M! B' t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 S$ j' x% B: F* A6 \+ W" C
- *
6 p/ I* l9 ~+ _0 n - * This program is free software; you can redistribute it and/or9 }/ x% h$ t1 _' M- y
- * modify it under the terms of the GNU General Public License as& C1 _. t. i( p) L7 D
- * published by the Free Software Foundation version 2.7 d, q1 Q; N! @7 r0 d/ V8 J
- *. k9 z) q' }( f9 |5 k% F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) o) X$ W4 z" f) X4 P
- * kind, whether express or implied; without even the implied warranty8 T; _4 y! D0 ^! @4 f, ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! E! V$ P; K6 f9 q& B
- * GNU General Public License for more details.: [3 r+ I0 ]7 o: x+ N2 G' I+ L8 l
- */
, [* Z+ L# ?/ L2 A - 9 @0 x5 [7 N. f0 J- a# S+ }
- #include <linux/module.h>; {: n! [ h/ r; K
- #include <linux/init.h>
0 A/ `) Z0 @& p6 ^2 e3 t9 t4 j: p, i - #include <linux/errno.h>
2 ]7 U, n. ~1 L7 U& c - #include <linux/types.h>
3 i0 Z- z' p6 v% t) ~7 { - #include <linux/interrupt.h>4 n5 S0 x0 r# P; w
- #include <asm/io.h>
$ m% @% y. f7 q! t% a% ` - #include <linux/moduleparam.h>, v+ L% g7 T$ d8 y. Y3 k& m. J
- #include <linux/sysctl.h>( K2 L- g/ q+ N5 t+ C- x
- #include <linux/mm.h>9 L% K/ G( H l* |; |8 N5 b N$ E
- #include <linux/dma-mapping.h>
' l) m& S" W3 g( q% n/ l - ) {2 I ?0 ]2 }2 d5 m# }8 }+ H
- #include <mach/memory.h>% I. X% W5 Q' R" h' a
- #include <mach/hardware.h>
: ?# B! v: I; |8 q/ z1 C7 `$ r - #include <mach/irqs.h>; V! M! c3 N' w2 B6 L
- #include <asm/hardware/edma.h>/ s6 @( p4 X) s. ~/ K2 |# p) D
; {, `" J& n7 }/ f" u x! u3 S' P- #undef EDMA3_DEBUG' N5 G: V/ ?8 R* B( k U! Z
- /*#define EDMA3_DEBUG*/, `& g: b$ S1 a1 k7 ]! @
2 H; w+ H" V |* H3 H; ^ W/ K- #ifdef EDMA3_DEBUG: _- n$ x E8 n: l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 A3 q9 @) n( y0 u w( T1 H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ }( C1 V8 c5 @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). A: w+ \. X" r& z( P6 }- P( J# k
- #else) {0 c2 X8 }' \2 h% f
- #define DMA_PRINTK( x... )
! z4 O* u: G- R2 f3 S% | - #define DMA_FN_IN
6 G4 A4 o7 c) }/ e2 h% L - #define DMA_FN_OUT
& M5 H8 M$ x% ~1 c0 `( T$ [! {; d - #endif
$ T2 f; \/ C, a, j; A5 |
8 O" p/ c, I7 U- K; T1 V, z- #define MAX_DMA_TRANSFER_IN_BYTES (32768) p1 C% s' O0 X" t, k
- #define STATIC_SHIFT 3" O! O. H" r) e' X
- #define TCINTEN_SHIFT 20
1 Q7 G3 q! k# U$ ] - #define ITCINTEN_SHIFT 21* p2 u1 N; E1 r6 m4 h# X
- #define TCCHEN_SHIFT 222 n, Q) Y9 L% E9 H6 k' q' Y
- #define ITCCHEN_SHIFT 23
3 x( ]3 V: t: h3 g* O$ N& \! I$ H - & z7 \+ z+ [2 x8 K! @% h+ _
- static volatile int irqraised1 = 0;
* |/ {: c8 X' }% S* A! U - static volatile int irqraised2 = 0;, @) @3 d# E; W! _8 J. d9 @+ \
( a8 b+ E; \1 G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- J* l/ B7 ?/ U3 j) Z) U$ |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' y2 Q3 C( S2 d5 [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ W5 M9 i2 i3 J9 R) L! Y+ ]/ o - / q3 R7 [4 {2 E) N8 `$ `# e
- dma_addr_t dmaphyssrc1 = 0;. k& b% ^6 P$ i4 F* s: M3 \5 A9 |
- dma_addr_t dmaphyssrc2 = 0;0 ^ f6 C- J" u. C, k
- dma_addr_t dmaphysdest1 = 0;- B# A: S1 O/ M9 ~, J7 e
- dma_addr_t dmaphysdest2 = 0;
+ U4 ]. b4 F% p
/ C/ h; r. s. d( y$ M9 l- char *dmabufsrc1 = NULL;
$ n2 @9 w) v8 M! f; t1 ~ - char *dmabufsrc2 = NULL;$ ?" Q3 I2 B6 b# t) x6 l: |. g
- char *dmabufdest1 = NULL;1 B; X, o2 M, |1 o7 u$ o
- char *dmabufdest2 = NULL;
: |5 J! e( e/ @2 x4 `3 \7 r- J - / a8 B# {% H( r9 O4 U( D5 d
- static int acnt = 512;
; u: c$ f7 x/ R& y; f9 K5 N - static int bcnt = 8; Y& R8 f& w l. F2 i" O; S: U
- static int ccnt = 8;
) [* i# r9 G7 h5 H - . a: K3 q. N* G$ y, ~5 X2 K( X$ u
- module_param(acnt, int, S_IRUGO);8 q: {% p6 J3 |4 G- L
- module_param(bcnt, int, S_IRUGO);5 q& K. |; ]0 e) U- M% H! ~ H
- module_param(ccnt, int, S_IRUGO);
复制代码
" G5 T/ a8 _# W9 r* r; I: S) k; r: r
( R- ?- z, k/ M# @# h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ \8 _9 L+ H" d- n8 I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 l: `% P: X/ d/ Z+ j9 J$ w3 e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* j5 A; D5 s; s6 H0 Y6 D# i
% P6 I5 q: A! p" h* v; Q. ?
0 f) E( d% L1 l. _- K |
|