|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
c# F, X: e# h" U' L- [code]EDMA sample test application o: d$ Y8 P& u4 r% Y8 e
- /*& N. y( |# H7 k. U4 a; I
- * edma_test.c
0 g+ Q( r+ z- ?2 N* R9 _ - */ ]( @0 K& W5 Y* ~
- * brief EDMA3 Test Application
$ W/ H' p. g; o# q8 p - *
6 p2 \# M0 t5 A1 f: B9 K - * This file contains EDMA3 Test code.
! L3 _6 X. g4 M9 j4 F1 b - *
# ?0 G/ X- N4 h7 h7 I2 G" s/ y- T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! J0 F: i ?( x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( F+ Y: T# S) E
- * TO CHANGE.
$ S9 Z6 L J+ F8 M" q - *% U# p7 M9 v3 R8 c8 {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 m! q+ j w) F' w4 {$ Q - *
! A: v* i, D# w6 T4 q: X4 E- ? - * This program is free software; you can redistribute it and/or7 T4 @" H* s# A: ~- u+ v
- * modify it under the terms of the GNU General Public License as
+ b3 D' @3 d$ s - * published by the Free Software Foundation version 2.# D9 `4 c. f( H8 ^5 h. w" J, V6 U
- *
$ h. p) k. H/ e$ t' X- Q$ i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ C& x6 C/ f# h, n8 ~ - * kind, whether express or implied; without even the implied warranty$ e% j4 I) T: e* F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( h6 u3 o# P' n$ {9 a) h& F3 E- ^ - * GNU General Public License for more details.0 a$ Q7 O1 k+ [! ?; \
- */
9 C5 A" [& ]7 Q* |1 b% W! Z - & N Q3 p/ y$ f
- #include <linux/module.h>
- c6 @) ]2 d& `. q/ ^ - #include <linux/init.h>$ b2 i5 @9 Z4 S$ j9 f( J5 B
- #include <linux/errno.h>( ^7 G( t7 ~0 v: U
- #include <linux/types.h>) L! Y4 d' w! o, V1 I; y
- #include <linux/interrupt.h>
+ w# t* m; ~4 Q: P! X* v - #include <asm/io.h>
' W5 S- |# M- e# O- d2 h* y - #include <linux/moduleparam.h>/ O6 j: H4 \. c+ `6 g4 p
- #include <linux/sysctl.h>$ S9 z# G) L4 s% Q" t
- #include <linux/mm.h>+ x3 M1 f1 ^% w* b- S, |! X
- #include <linux/dma-mapping.h>, d/ `( }2 o/ W# Z1 U4 e
/ b3 O. s& @" p( @4 X. b- #include <mach/memory.h>
2 k p p0 F; v - #include <mach/hardware.h>9 J+ X* N! e7 z; W4 [3 X
- #include <mach/irqs.h>$ {( u; j4 Y, p1 N# f; Y
- #include <asm/hardware/edma.h>
0 a+ C% @; ]: [+ u Y, H& E
% I, T0 _- V \9 k4 D( i- #undef EDMA3_DEBUG
! j! {, \6 t8 R0 I7 N, ^2 n4 C - /*#define EDMA3_DEBUG*/, ?, \. e6 l0 U, f. A- M
- 1 Y+ x0 K5 y s6 L, o0 v0 t% z
- #ifdef EDMA3_DEBUG6 a9 b( a0 E0 _( |0 G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" h3 l! N* d: o. I7 Z5 c5 }0 s3 A5 l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ `* f. p/ B1 X. w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& R! L l2 }6 ]2 i! x- [ - #else
4 Y c V: W6 i9 _7 u' e6 H - #define DMA_PRINTK( x... )
: i! y1 p1 f. w/ K. U% ` - #define DMA_FN_IN
2 B! i0 ?' p+ g1 y- u$ G4 O - #define DMA_FN_OUT. |5 S4 H6 W j
- #endif
+ \2 I- N! k4 ~, j/ ^$ i - ) x- x1 C. A3 n+ C' J; ]/ z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 p: r) }# ?0 O0 ^8 j/ R2 W - #define STATIC_SHIFT 3
* @% U. i2 V( ^ Q* r3 [( h& } - #define TCINTEN_SHIFT 201 g0 e% z7 O: ]; u
- #define ITCINTEN_SHIFT 21; N8 ~. l2 y; s5 W3 `: ~
- #define TCCHEN_SHIFT 22
?( r2 B6 x3 A - #define ITCCHEN_SHIFT 23
0 w b1 Y( i" F7 ?7 h2 ]( b+ b - 7 ?4 L5 H8 F5 [5 ~" E
- static volatile int irqraised1 = 0;& k+ Q8 K& Y' F' ]8 W! } G" R
- static volatile int irqraised2 = 0;
' z& Z3 Y. z9 n/ M5 W. P8 t
' E2 M3 Y6 S; a% M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ?9 D( E+ O3 ?( ]2 B( e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 d( T6 _ p1 ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& u& T3 N3 C* `5 T2 A. j$ _
* S( n; g2 v, ~( z, I; H* l1 O- dma_addr_t dmaphyssrc1 = 0;
5 s# K# W3 m1 y0 { - dma_addr_t dmaphyssrc2 = 0;; @9 g" C' @' l' \9 p: [
- dma_addr_t dmaphysdest1 = 0;% [$ l3 U5 S |5 ^7 _% j, o( `
- dma_addr_t dmaphysdest2 = 0;
8 P: K; C/ L, x4 B
8 \0 {7 i; n' v: I7 f- char *dmabufsrc1 = NULL;
* |0 z1 Y5 T! m, w5 @5 Q! i - char *dmabufsrc2 = NULL;
2 ~$ [9 ~) n6 b* p9 i* n# A2 h& m - char *dmabufdest1 = NULL;4 H4 w. o( N |0 Q5 j
- char *dmabufdest2 = NULL;
, T o& `0 b d - ) \$ @0 ? f+ w. ?/ P) l$ B2 J
- static int acnt = 512;/ U' P- Z) c3 y" h+ ^8 D1 ]0 w
- static int bcnt = 8;
: i; g1 V" c1 @$ z2 L7 e4 ? - static int ccnt = 8;0 V; V8 c9 r8 j! X' Z( K& A; c- v
- + {# t* i7 Y3 G+ S1 C
- module_param(acnt, int, S_IRUGO);: M/ o5 i" j9 N2 G9 n3 l2 B/ P g# S
- module_param(bcnt, int, S_IRUGO);- P; `' I* N+ }( B
- module_param(ccnt, int, S_IRUGO);
复制代码 * S. W. ]0 d- t
. _+ `+ q, E+ b4 l! n* I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ s$ K2 O/ m/ I( b' Y- ^5 Parm-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 R3 d7 f; @; g# q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! o! c& h/ A) `$ n- L
/ d5 D. ]2 d3 s1 B3 @' |! j# D* `. V3 x" ?- Y+ o/ N
|
|