|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 j& Z, G, e& h! X' L- [code]EDMA sample test application3 B: ?! |( U- m" d% x a( E3 @
- /*
6 `0 [2 ~: J3 n9 h( ~ - * edma_test.c
6 ^) s) t$ F7 L+ M1 T" D - *4 z& G V, h) P, x8 `8 S e
- * brief EDMA3 Test Application2 D, C7 y! S; J* }& R
- *
8 M; V. c% Q$ K! J7 G8 {3 X' ` - * This file contains EDMA3 Test code.
* f- ?- r3 j) n- Y* r7 W - *0 i3 [# K% V: h9 C1 b. t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 ~8 L* f$ z) H. O) K3 g8 ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' i9 U9 C( y8 i) r3 x4 y# X
- * TO CHANGE.0 z8 N8 P6 _1 e7 B B
- *
$ m0 d" F/ Z# f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 l, p( m, N1 l" V+ [
- ** K9 T3 Q- ~! B3 ^- |# N2 t
- * This program is free software; you can redistribute it and/or
7 n7 k4 V; z- Q+ ?: c. N( @ - * modify it under the terms of the GNU General Public License as
1 @- y' Z" A8 q - * published by the Free Software Foundation version 2.+ ]7 z) T% C/ i! J+ H
- *
; {; {2 L) z+ ?/ [. D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: N7 L6 j0 K" F+ K6 f( A4 _. z
- * kind, whether express or implied; without even the implied warranty3 M7 q* @1 L( n7 b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 ^- L2 n9 R* l1 ?' z+ E - * GNU General Public License for more details.( r1 w# Y3 a0 T6 ~; Y
- */" ^; r2 `; B( B& F7 Y
% ]$ |: c: e/ ^# e) M- #include <linux/module.h>
3 O$ J7 v" r8 w( t# I3 @ - #include <linux/init.h># k. @/ v5 E7 d
- #include <linux/errno.h>
2 |, G+ a6 D) C5 P1 L5 M - #include <linux/types.h>' J2 }6 W8 E/ N$ H7 G& N. ~
- #include <linux/interrupt.h>
- L5 @7 h3 |0 K! W, y - #include <asm/io.h>
$ i. l1 q0 `0 h% E% w - #include <linux/moduleparam.h>
; h+ [+ v% k6 g& V5 I9 ]; [ - #include <linux/sysctl.h>! c! L2 t2 }5 J/ ?7 o1 p: ~5 S
- #include <linux/mm.h>
: S2 @2 _& Y2 @% t - #include <linux/dma-mapping.h>0 H, C6 p4 A2 N3 p6 L6 q
- ' b/ o- C: s! `. K
- #include <mach/memory.h>
3 P k5 }+ [) U# Q) A/ g - #include <mach/hardware.h>
" q3 [/ m/ S9 S5 @ - #include <mach/irqs.h>
# G* c- c0 m4 ~& E+ q' @2 G7 F - #include <asm/hardware/edma.h>
" G* ]1 x* ]& S1 A/ G! q( K- V - . |% P7 s Z+ ^5 k; C$ |
- #undef EDMA3_DEBUG
8 [3 N" w; v" S5 K: k0 ?# c - /*#define EDMA3_DEBUG*/
2 ^& H" g% m2 X% o6 X4 u - - Z: n9 T) [, H. V5 g* r& ~8 d, u4 ~
- #ifdef EDMA3_DEBUG
1 @: l" w$ ~; T- ?, S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- a. S! u5 @* b+ |/ v/ P j) i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 a/ p- t, n( q* _2 l* W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 p/ F# O8 k7 N( ^- L/ x - #else
: G+ s( \. f( _; \8 T - #define DMA_PRINTK( x... )6 M5 ^( a* [0 E# t9 P
- #define DMA_FN_IN
0 X6 a$ x! S t+ p; T( ?. z3 i - #define DMA_FN_OUT
& k6 j1 r6 p8 j! m; f - #endif+ K, z e B3 q7 V. j' y
8 z4 y$ R, ?( R; c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 s8 w$ Y; ?5 r) o7 J
- #define STATIC_SHIFT 3
, R: U- N8 [5 Q4 g - #define TCINTEN_SHIFT 20
5 j/ Q- {% G) S0 h' { - #define ITCINTEN_SHIFT 21
. l( ]) ~# ~6 ?, Q+ b. ? - #define TCCHEN_SHIFT 22& L/ Y" k* j; ]7 J8 E4 q8 c
- #define ITCCHEN_SHIFT 23
+ {9 s) _3 |4 O S0 x* u+ l
0 A: |. O( ~& [5 j. D5 P- static volatile int irqraised1 = 0;
& L$ N ?, a4 l8 f% L5 x - static volatile int irqraised2 = 0;
6 O; @ S& o1 Y$ y - ( d9 b" X8 \5 ~! [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 p: `8 Z( b6 S0 J* j _1 O$ q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 @; A7 @. e/ F o% }8 i$ h' i% a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' @6 c, U% x4 a4 M - ; H9 T0 K4 o; h3 Y% K
- dma_addr_t dmaphyssrc1 = 0;, M+ L5 E% D$ p' O+ v
- dma_addr_t dmaphyssrc2 = 0;* E+ I5 q, x% l2 S% B# c
- dma_addr_t dmaphysdest1 = 0;
/ I2 B# x9 e, {- S. @& L, R - dma_addr_t dmaphysdest2 = 0;2 ~# q9 Y' j" r8 b, C
- % U" F9 a0 B: W& g$ J1 N! U
- char *dmabufsrc1 = NULL;
( l$ l2 O$ V6 L4 N( k4 ^1 ?# ] - char *dmabufsrc2 = NULL;6 A4 p2 p/ k$ ]5 M/ L6 X- u) E, {
- char *dmabufdest1 = NULL;0 T) D; h/ r, p5 b4 Z+ a
- char *dmabufdest2 = NULL; Z0 M6 K( @8 E0 |1 r. D7 M
- % ]( w6 `8 n0 u) y" H$ X0 H, K
- static int acnt = 512;
+ `! L; z3 Q4 u5 Q1 q - static int bcnt = 8;
9 v5 A) b$ Z. a6 n* v! N0 t, ? - static int ccnt = 8;
; D# e$ |' e3 j, a- F, h8 P - ) G4 j v# E+ a# `) ]: B
- module_param(acnt, int, S_IRUGO);% m* N# F0 s6 ?6 s( T+ }( S; s
- module_param(bcnt, int, S_IRUGO);
, V0 h6 `: ]# Z - module_param(ccnt, int, S_IRUGO);
复制代码
$ N3 G) C* |. j# w; w7 ~) y8 r& R, j0 E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& I& ~9 x8 w5 ^* s# u, [- l) qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 U2 B" {4 B8 e3 w( e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 m+ k5 z; h+ |+ m( s- b' S, X
8 K- t0 p8 X, h; {2 R
3 Q6 |8 Y. u E- G" G |
|