|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " @* T$ S, H- _# a& z$ o4 S
- [code]EDMA sample test application& ^4 p0 b( T8 H; ]( ]% x9 v
- /*+ [# z' B( n+ {/ S
- * edma_test.c ~# _, e/ B& ]: Q% K; W
- *
3 n" A! C% ~7 A# @$ \; t+ r" P6 G - * brief EDMA3 Test Application
5 E) ]( g' I3 ` - *
9 h6 K7 ]' R0 n9 ^6 K" Z - * This file contains EDMA3 Test code.6 F- ]4 L4 @/ L+ e
- *
4 a$ G7 n1 K, i( @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 F$ a8 m9 x. z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; g/ U/ A# j5 M# V: S+ `
- * TO CHANGE.8 h0 A& e+ c* |: |' Y
- *) I& @0 w1 T# E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// W! K# Z) `; \" Y; Y5 x
- *# p1 y' P3 [4 I7 t
- * This program is free software; you can redistribute it and/or; |8 D4 h. P; o+ a, e, W
- * modify it under the terms of the GNU General Public License as
2 z! ]! t0 Q) J" D/ o - * published by the Free Software Foundation version 2.
1 \% w! t% ^% O: f - *
: k8 \" [+ X; G' a+ p' S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 i/ G2 h/ {, T. Z3 M- J
- * kind, whether express or implied; without even the implied warranty1 |( s+ S( ^: p" w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) n+ _2 C- F1 v& \! ?
- * GNU General Public License for more details.
6 P; B! I. J9 |9 w. C$ L - */
" q# v. ~/ ?* O! W
9 T4 ?6 M3 Y- P7 ~7 [" `2 T& [1 q- #include <linux/module.h>
7 w2 p, i- |/ I - #include <linux/init.h>6 V, S N" ~6 Z6 Z( W6 Y. u
- #include <linux/errno.h>
8 E# f% e' L5 B. J6 E8 e - #include <linux/types.h>
( x( A7 Y0 a/ p6 C - #include <linux/interrupt.h>; H, |3 `' b* t `3 s) X3 d
- #include <asm/io.h>$ G1 P6 e' C. X/ a( _' ~% f `5 ?* D) v
- #include <linux/moduleparam.h>
( W Q0 r$ [1 P- _4 W* G - #include <linux/sysctl.h>
4 ~: l% ~; _! k0 G2 o - #include <linux/mm.h>
+ o; ^1 }& |& C: L; G6 h2 a - #include <linux/dma-mapping.h># {. X# P1 y3 O! L/ ^ s
- 8 `% S% M J. }
- #include <mach/memory.h>( J+ [4 P# e- w; ?) B4 W1 t
- #include <mach/hardware.h>
* H6 `* w9 V/ b, w. t( A' t; G - #include <mach/irqs.h>
* o$ a* Z x% J6 v& d5 S. n - #include <asm/hardware/edma.h>4 e7 h- l2 u9 M
- D$ {& L) U+ _: G- #undef EDMA3_DEBUG
. O- N2 q! W7 l6 m5 }. T - /*#define EDMA3_DEBUG*/
9 a# ?& J0 o$ t+ l% t& ]
9 f. E- @* a2 c1 X2 z- #ifdef EDMA3_DEBUG
$ M) @1 v. ?( G' D( z# X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* Y' X+ D, H, x4 \% h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
S/ E& E9 h, X4 Z' ^: b$ { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 m' n9 e3 a8 V u. x, A
- #else
, q, X/ s: @' K* Q+ X - #define DMA_PRINTK( x... )7 F/ Z5 p, J& r0 k8 f4 q: [
- #define DMA_FN_IN; B3 C! K9 W" r; }
- #define DMA_FN_OUT' {1 B6 n" N$ v/ r
- #endif0 k. g, b% f8 ~( x3 i$ v
4 Z( r. u0 {* s- n2 i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 \* n/ c- i) ] g6 R" O1 b
- #define STATIC_SHIFT 3
8 c7 y& q6 N% V. |( Z4 E8 f8 I - #define TCINTEN_SHIFT 20
4 _4 U8 I* Y/ ^' X! K - #define ITCINTEN_SHIFT 21
. M1 z8 t, o1 n* ?- ~+ r3 x - #define TCCHEN_SHIFT 22
. R2 v, ?$ U4 d; R - #define ITCCHEN_SHIFT 23
4 }1 P- [, ]6 |8 x! f4 ~! K- s
5 ?9 X8 X) y* M0 i7 ~- static volatile int irqraised1 = 0;5 A U% V; w5 l, Y: x# f% `
- static volatile int irqraised2 = 0;+ l9 o4 Q b& _8 h2 ~
- - I0 x& Y+ _; e4 {1 [7 r0 v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 h6 ^' C* F; H# r3 ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( K3 g2 D& n3 y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 R% C. p" D E, O) x! _
: l W' J7 }9 G0 H! E- dma_addr_t dmaphyssrc1 = 0;5 [( C, G; U( h N+ C4 I/ [- W
- dma_addr_t dmaphyssrc2 = 0;& h8 n6 ^* s& p" j' ]) Q4 R8 M
- dma_addr_t dmaphysdest1 = 0;
) A! F5 H: x4 M' n' f - dma_addr_t dmaphysdest2 = 0;4 X% S0 I2 C% g1 a' M6 P
- 0 o6 H" A+ l1 L6 J3 @; a3 N- T
- char *dmabufsrc1 = NULL;
) D4 E/ [- ^! U+ B - char *dmabufsrc2 = NULL;0 M }; B* }+ J; p5 e- z
- char *dmabufdest1 = NULL;
& v$ s0 S4 N9 q - char *dmabufdest2 = NULL;
5 Y: c$ {- j* E7 }$ b, t* H - 9 |9 \8 R. V9 F7 X6 ]. X
- static int acnt = 512;( q. X* C# c) o9 J' p
- static int bcnt = 8; ]6 I0 s; W' v( U; r8 G8 ?" I
- static int ccnt = 8;
; L: V4 m: g, M, N2 `4 |2 T
7 K! x2 i4 ], X- j2 f7 w4 c' |- module_param(acnt, int, S_IRUGO);8 F, e. H" F/ u6 ~
- module_param(bcnt, int, S_IRUGO);8 q( E* ^' X& E1 L- f+ ?
- module_param(ccnt, int, S_IRUGO);
复制代码 5 H, p3 i( x/ s3 {
4 I) [! S0 S4 q3 F% G- ~( V1 z8 V! ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 T G' U/ k0 earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ f5 Y( g1 u) @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 w# T" B: T( ?; C! @* X( D
& @$ z8 E& a& U
[2 W2 M4 H# r }0 K |
|