|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( J2 s* p& W+ o: O- S- ~
- [code]EDMA sample test application
: `) \9 q3 [2 o; D) u) L4 c - /*+ g$ c- D6 n. S: C# n
- * edma_test.c
! S: b9 E5 ~- [# o- }* O9 M m& Z3 w - *- X) l2 r( d" S3 Y/ d, J4 k
- * brief EDMA3 Test Application; z+ h# D2 ~( Q+ n
- *
# y9 N, }- F! Q7 i0 R1 Y+ C - * This file contains EDMA3 Test code.2 }- H. `1 }5 r% y
- *
0 k: R2 Q$ H6 ?/ r* ~7 t" ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 T( I. {) o* c# c: z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ y# B4 f$ O+ h n1 }5 v; \ - * TO CHANGE., y& R5 ^; n. O; j. S
- *
. w; ^+ e+ D6 N) \+ S' U% b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) L6 s. W) N4 E- |" t, g - *1 p) k# b- m" r$ G. Z0 z
- * This program is free software; you can redistribute it and/or- f8 t# _9 t) h7 H) Z4 l5 Z
- * modify it under the terms of the GNU General Public License as/ P/ h$ }7 {! X8 `5 T
- * published by the Free Software Foundation version 2.
9 p$ Q7 }# s; \" a( ~; y1 @ - *1 e% D2 l6 c( e1 {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) g* o; H, t1 X" I9 \9 Y
- * kind, whether express or implied; without even the implied warranty6 g$ i8 J; L8 g. x+ [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( E$ Z9 C I* w; F2 w3 ] E. {
- * GNU General Public License for more details.
) e+ N4 R1 g( G5 X* Q5 Q: l - */) e; l" \' Y* V( ^1 G B8 _
- " }+ x! t* z% [9 ]9 w' B
- #include <linux/module.h>$ S+ W2 a ?3 n
- #include <linux/init.h>/ g5 x J- @( N3 [- B5 [) ^( ?
- #include <linux/errno.h>+ b" z7 l2 S3 R2 T
- #include <linux/types.h>
; y9 Y" x3 P2 N" q" ] f4 h - #include <linux/interrupt.h>
, e. q3 J: l' A* h( Y - #include <asm/io.h>, v2 Y3 G/ f6 g. t4 o/ Q
- #include <linux/moduleparam.h>) P, D: C' W9 V W5 V( S
- #include <linux/sysctl.h>
! {: D1 U9 _' _# g) G1 Z) x - #include <linux/mm.h>) L$ d9 K6 i$ H% j; B! n5 m& g6 A) ?
- #include <linux/dma-mapping.h>
8 M, _* e! E0 I6 J& d6 z' f - 2 b1 f8 r' P/ h9 {3 K8 k
- #include <mach/memory.h>6 g4 q" _4 ^+ Q& Z$ S0 d/ w) B
- #include <mach/hardware.h>" \7 y5 ^1 e8 [ I1 f
- #include <mach/irqs.h> W) {2 S# |& g
- #include <asm/hardware/edma.h>3 F. q0 D2 _7 n/ A
- % V X }0 i" z5 M) O" A
- #undef EDMA3_DEBUG: f4 k% { m) V* ^2 V
- /*#define EDMA3_DEBUG*/# P% p! L3 A! r1 |. O
- ! x& E6 B& m ]8 l. G5 j+ w
- #ifdef EDMA3_DEBUG
& i& M2 ^4 j# I0 H" J, F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' H0 d/ Z. H& |/ j K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 \5 Q; d' M) {$ X9 z! J( O7 D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). A, Z2 u K' j( M+ ?( Y. ]0 X1 N7 h
- #else
8 V3 _' G7 l( b- r' }. I, J - #define DMA_PRINTK( x... )' B8 X0 ?9 _; L( m- Q9 r, S
- #define DMA_FN_IN
/ q' c6 P6 h/ [' b2 A5 k! ?- k4 T - #define DMA_FN_OUT7 D! X! T+ q3 i4 s/ a
- #endif1 I" j9 h! T$ ~' h
6 \2 t2 D. T! |2 |3 H" j$ \1 G4 N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 O- r/ h. Q7 q4 f) [* y
- #define STATIC_SHIFT 34 R* t! ^# S4 o! _# e6 L
- #define TCINTEN_SHIFT 20: }# P3 j2 W8 i4 g+ b5 N; Q
- #define ITCINTEN_SHIFT 21
3 K9 n r0 Z4 E& P - #define TCCHEN_SHIFT 228 ^/ }. d, ?4 J2 Y
- #define ITCCHEN_SHIFT 23
' V( p, S) v3 m2 B/ ~/ h0 c
* C7 L8 X( _9 k3 Q& o" ^8 r- static volatile int irqraised1 = 0;
& R, }# i8 h* @$ _& | - static volatile int irqraised2 = 0;
: Q7 k' _2 U5 b" D O3 a H - ! B" f8 k1 l6 t. G. G) y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 X6 {+ r$ q# t- ~; Z) K0 n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& t7 l7 n; U9 |4 K+ g( R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" w0 D0 [/ ^( D; b3 f2 F
: B) A: @; E) k- dma_addr_t dmaphyssrc1 = 0;) o: Y! q: K6 x# a0 n" f6 L
- dma_addr_t dmaphyssrc2 = 0;
. S+ c$ P) r6 X0 |. l' ~ - dma_addr_t dmaphysdest1 = 0;
" E* m) w- k9 G6 {1 @& e$ m - dma_addr_t dmaphysdest2 = 0;
+ z4 W: ~/ s K4 d9 i) r6 [2 y- |: I+ c - 9 J# Q7 }. I. S% Q, w* b" v
- char *dmabufsrc1 = NULL;
% s# `9 I0 m6 I1 q/ _ - char *dmabufsrc2 = NULL;
: p1 o) V0 T1 H& Q - char *dmabufdest1 = NULL;5 k& H2 @3 k- E7 [5 w. ]
- char *dmabufdest2 = NULL;, w' |/ Q! a. t/ a
2 a9 v3 d3 G4 R9 c/ q& e9 f- static int acnt = 512;$ D$ b# w: o+ K1 Q6 d
- static int bcnt = 8;
% q) X3 x& j& D& v# \- C6 n# v+ r - static int ccnt = 8;' J: a% @0 A! s; }7 E
0 O/ V( @) B0 s7 G3 ?- module_param(acnt, int, S_IRUGO);% E! b' Z4 |: L4 C
- module_param(bcnt, int, S_IRUGO);
8 S; f. C% g4 [2 Y/ n" n5 U: [' i4 S4 M - module_param(ccnt, int, S_IRUGO);
复制代码
" s; x: `. }( W% c" z1 P& Q& |3 a7 g7 b0 Y* ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 l! x/ J7 J4 ^ a& l! r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ A- Y1 u/ ]3 K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! c1 Y/ |1 A0 S
, U1 c1 `. l, x4 C' z7 A) s1 n& e4 E
|
|