|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* }! `+ f' v* w( [3 L- [code]EDMA sample test application2 I% Y8 }' d8 @( H3 x
- /*3 b+ C5 J9 W. k+ a4 J8 [
- * edma_test.c2 w8 G, [* s3 o
- *
) y2 O" X/ w. g n' U - * brief EDMA3 Test Application+ A9 y: J: u# P
- *
, ^: ]% r% H! s6 B' b - * This file contains EDMA3 Test code.% k$ r6 @ ~3 G8 t! s. R
- *
4 f0 R# K1 R; N: }: u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& F: V! Q* j* c# Y4 C# {" A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. m! ?, t& z& O" t% v' o - * TO CHANGE.; D& v8 A+ r* _$ L7 b/ e
- *! S4 \/ N* [5 k. a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 j8 v6 ]8 \8 s3 q) ~ - *
" \6 p$ y. V5 V) @( k) M9 t1 | - * This program is free software; you can redistribute it and/or! I. I, c: }$ @9 H# o: R
- * modify it under the terms of the GNU General Public License as
1 a! _! K2 Z/ T7 H# p - * published by the Free Software Foundation version 2.
/ S! j% O/ u) _$ V- ^3 j9 Y - *, E8 V, r( l1 Q+ W6 [% I4 V& V# q! ^ r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& F- ?4 }, W. a6 k' j
- * kind, whether express or implied; without even the implied warranty# r5 Q5 O* S, A9 B* |' q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 W) |0 l {+ y; A3 F2 ^) @
- * GNU General Public License for more details.& d; I. \' r$ J) Q- z4 @. p5 @$ L
- */
# {* U* ^ G$ p; \9 v8 }7 @ - 2 ?' k. O- r* B& p
- #include <linux/module.h>
' n: b+ Y+ Z! K' \- r - #include <linux/init.h>( `* Q2 Q5 B: S4 y# M1 E2 @
- #include <linux/errno.h>: s* Y1 }: ?( Y; m+ B* q
- #include <linux/types.h>1 z( L% b/ f7 u) @1 F
- #include <linux/interrupt.h>" z7 T7 G* z: S0 N- `+ s# m- K
- #include <asm/io.h>9 t, ]% E9 G3 b# `, ^* i- Y/ F( g3 Z
- #include <linux/moduleparam.h>
9 B7 F5 U% _3 p; Y6 I* ^ - #include <linux/sysctl.h>6 ^1 C L5 E/ U3 s4 r* g, `* m
- #include <linux/mm.h>6 @- P, k9 ]4 P4 G
- #include <linux/dma-mapping.h>. d! s2 @% d% C
# w0 ^3 T/ j5 P2 c2 ^- #include <mach/memory.h>
8 o- _" i# }$ @3 @ - #include <mach/hardware.h>/ o+ W, v/ F. h
- #include <mach/irqs.h>
# P; u |- b7 g* d - #include <asm/hardware/edma.h>
% E4 R% L) [% d1 k) N; ^1 n: y
' V( I: x: T2 i; c8 \: i. B# D) g- #undef EDMA3_DEBUG
+ A" }+ M8 Z' [7 p - /*#define EDMA3_DEBUG*/3 `5 F2 T! B$ ~& Z8 x: H
- % i& d( H: Z; H z& H. G9 }
- #ifdef EDMA3_DEBUG
7 Z; k, X. G: `! ]3 b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 r/ z( h( s$ ?" P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! L" B4 M) ~5 e1 T( @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ L; e8 j6 I; \ - #else( x$ b% P" |( ^ [* @# }: G
- #define DMA_PRINTK( x... )
7 U. ~, ^# k' w& v - #define DMA_FN_IN
" v9 K+ I; M9 w) t) \5 s - #define DMA_FN_OUT
* s" M) s0 m9 k9 o: z3 R9 s - #endif: O$ X7 |6 T/ j' s4 p/ H4 r
- 5 d1 z' {" S' \3 _' i: f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 d: a% \ b% Q" g8 q. B" ^ F - #define STATIC_SHIFT 3, U% z) Y1 V& k. u& N6 N
- #define TCINTEN_SHIFT 203 P9 P# a6 S# x1 Q9 s3 e
- #define ITCINTEN_SHIFT 21$ O) Z- z( i; s9 Z* M: j% q' r3 P7 U
- #define TCCHEN_SHIFT 22
' J$ S7 d, [8 z - #define ITCCHEN_SHIFT 23
4 s" Z% Q5 z; C. a
- f2 ?3 X4 t# M6 o; ^( a% I- static volatile int irqraised1 = 0;
& z5 f1 i% v8 T7 B4 y - static volatile int irqraised2 = 0;1 t: ~ q- I6 r6 T7 E7 K
- . F9 J0 O( R" c) B! c8 P# k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( C/ r$ i' \1 Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& b4 L' G1 \9 j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ f" r$ S' s% C3 p! ~3 q
! i! V/ v) W8 ]7 o- dma_addr_t dmaphyssrc1 = 0;
5 ^, ?) m, ?; D0 d6 u - dma_addr_t dmaphyssrc2 = 0;
1 z5 s$ r1 P) i; f - dma_addr_t dmaphysdest1 = 0;4 F$ Z) M6 S0 [) m! ~
- dma_addr_t dmaphysdest2 = 0;" e& p3 c8 U# P5 N& {4 g3 e
( v. t9 t- J$ \7 n* i8 n$ ?. Z F( g- char *dmabufsrc1 = NULL;7 }7 j! H1 j% F! U3 k8 ]
- char *dmabufsrc2 = NULL;
! d3 t" _7 P4 O3 c3 ^6 i- O, u - char *dmabufdest1 = NULL;
- w$ a3 h$ B5 d/ S2 e - char *dmabufdest2 = NULL;$ C8 D4 ]$ L) ~# S5 g5 q- d# i! I
5 e% S6 e# ?( e7 y5 z: k- static int acnt = 512;
5 y0 ]5 f4 E& ]! I! e7 m - static int bcnt = 8;. S) |% u/ G: p
- static int ccnt = 8;" }& ^4 B8 a" f" l: q
- " G' [( A8 F( C! K
- module_param(acnt, int, S_IRUGO);% B& T Y9 `" K; p6 v2 A# ^
- module_param(bcnt, int, S_IRUGO);* s2 H1 d# D% g$ y8 f" f3 a
- module_param(ccnt, int, S_IRUGO);
复制代码
3 l$ C; D. O2 a# M3 G1 w1 e
" ?3 ?& {1 \, V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 X: Z0 B* O" S C4 X7 d8 p" O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& K' I, f& M/ |& O1 m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 ~. ^+ c, U. B5 ^% V
8 F( y- u/ C8 J8 u( k9 D, ^ y/ Y6 ]: s0 |
9 k6 U- [& b( }; h, O |
|