|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% o/ T; X* V. u% K" a6 \7 b8 K- [code]EDMA sample test application5 {; M2 H1 T! m: [% U
- /*
/ k: a* r. e. k3 S& e- b - * edma_test.c, m+ o4 Q' @) h: s' g/ x$ R
- *
8 t2 \. i+ `4 l2 Z - * brief EDMA3 Test Application; T, U9 X+ [8 j/ D, d! _( p0 E
- *
' y" v( N! T- A( C, v, n1 B - * This file contains EDMA3 Test code.
K( X X/ [0 Z" R8 E4 y$ g: y+ { - *0 ]2 r6 _' |% _/ v1 y4 y+ U
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ r, W6 i/ I: k& j4 |3 q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; \/ |7 F) d0 x$ f) e% j - * TO CHANGE.
* D+ k* O- l) z! P7 j' b! | - *
% p9 k6 S4 d4 Z- M5 Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- ?8 f; V7 m8 p- t) `
- *; R1 D8 z0 U e, I$ l
- * This program is free software; you can redistribute it and/or
% k" ^# G) [3 w - * modify it under the terms of the GNU General Public License as' |# k! k: S: t$ t
- * published by the Free Software Foundation version 2.$ o) L2 t( S- I2 f g! j
- *
; U r1 [3 V2 }6 B6 i/ X# z+ B" @7 U# q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 K9 z. |: K3 r$ V& L' G2 e - * kind, whether express or implied; without even the implied warranty |! m1 v$ n: e' a p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 y- f+ H3 N4 O4 P" a
- * GNU General Public License for more details.
$ }4 j* G2 {! U1 X2 b5 \. C - */7 `* w8 q5 p2 Y, D. x. t/ x
( p+ E! A0 T% c* @4 l! X- #include <linux/module.h> y+ e+ {9 a3 ^6 s6 J. g$ w7 }
- #include <linux/init.h>
# G& E9 E% D0 z% r0 \" C - #include <linux/errno.h>
6 {. @6 i7 ~4 f% f; T - #include <linux/types.h>
( A( _5 F! ~3 p# P/ i1 x - #include <linux/interrupt.h>( M( L8 @/ V% `6 N; W% ?) I
- #include <asm/io.h>
1 [( D0 b$ l) I: n, B$ B& `, w) e - #include <linux/moduleparam.h>
8 ~$ W0 n8 _% d O* D( G% g k* X - #include <linux/sysctl.h>+ }' V; u6 K P5 D
- #include <linux/mm.h>/ b9 Y' {% l$ h: w7 F$ h
- #include <linux/dma-mapping.h>
$ {+ Q2 {4 d* A5 s- ^ - 4 {6 a% s( j8 }- C6 }: n
- #include <mach/memory.h>* `, l9 ^+ Z/ v
- #include <mach/hardware.h>& `- ~) ^% W8 K, q8 w, t4 m
- #include <mach/irqs.h>% r, l6 r8 z$ `$ P1 ?
- #include <asm/hardware/edma.h>
& f5 e6 W! ?, O
1 Q: _: P0 y1 a% a' ~' m& w% U- #undef EDMA3_DEBUG
( Y1 n2 b6 A6 M. @& g4 Z( T - /*#define EDMA3_DEBUG*/, c; S8 l' b2 g) h) X/ |3 i
% e! ~: ]0 I5 }; w1 l- #ifdef EDMA3_DEBUG% Z0 Z# P: q, i& y7 R' v7 }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) J; s$ F7 N) O6 h5 n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" @- A# E3 V1 u/ }. T+ X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' X& u& p; t! Z/ |; |8 Y% ]! v1 Z
- #else& K w- N0 ?8 N$ d( V- t2 i1 W
- #define DMA_PRINTK( x... ), H& o8 g9 Q) X. [/ D
- #define DMA_FN_IN
) ^$ q! b _. E3 J( R" S% l6 z - #define DMA_FN_OUT
0 ^, f! W. W1 e5 z - #endif
+ ?3 t d4 i V - ( w0 V1 E5 c, C1 G* ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 L0 X+ s5 q$ R9 _# h4 f
- #define STATIC_SHIFT 32 Y/ ]) O% _( p, z& G
- #define TCINTEN_SHIFT 20& j/ f3 O( J5 C" q
- #define ITCINTEN_SHIFT 21
: G; Q+ C9 e$ Q' u2 `$ S - #define TCCHEN_SHIFT 22/ g; B: k9 l- }
- #define ITCCHEN_SHIFT 234 @3 a9 E% |. g+ w# @: ~/ E
7 i! l+ s6 P B# `& H- static volatile int irqraised1 = 0;$ U: [ A9 X9 _6 I9 P; _
- static volatile int irqraised2 = 0;1 A" x6 A3 m) @. j9 {+ D
- . u: h0 v+ V6 z' K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 t+ n$ \2 f" f; g' s/ R1 `4 M$ k2 y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( \$ Z# m" ~, I5 X2 s! [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ]( Y9 [3 S1 n3 u5 J' m+ W5 `
5 H+ k2 z! [* x3 X- dma_addr_t dmaphyssrc1 = 0;
/ ~/ z; v, o" U5 w6 B9 e - dma_addr_t dmaphyssrc2 = 0;+ i3 v5 C9 r9 h4 M6 l& n
- dma_addr_t dmaphysdest1 = 0;, L9 G0 |0 Z1 B+ k
- dma_addr_t dmaphysdest2 = 0;
' l' p( X s7 d* m* b" Z$ g6 k
3 l3 r( |( w" y, `9 K( m5 `" `- char *dmabufsrc1 = NULL;: Y! s r/ R% Z) G0 n: O
- char *dmabufsrc2 = NULL;9 a5 i k& E! X0 O2 B
- char *dmabufdest1 = NULL;
% r0 z. c" X+ n9 k6 p& z: z3 v2 I) h - char *dmabufdest2 = NULL;# F% ^0 U" ^3 C( F3 G+ A
/ g9 l( C! W' u y( k- static int acnt = 512;/ } Y8 _2 I+ Z
- static int bcnt = 8;& |$ N! Y3 Q& H) `& x+ E5 P8 }* {
- static int ccnt = 8;
7 O1 N1 @- Y, o
+ f, x5 V+ [& r) ?. r' v- module_param(acnt, int, S_IRUGO);" j ^ G. M% d- q! O
- module_param(bcnt, int, S_IRUGO);
7 P5 ?# q1 H: z3 {2 j4 Y5 B+ @ - module_param(ccnt, int, S_IRUGO);
复制代码
0 x* ?, C0 E) o: F- C9 \1 y8 {/ v* R+ m& V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 z. J3 S3 k) V5 n: R' Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! M; o( \0 z% g! K; Q( w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ V& ]% n) j& Q& Y2 g/ a
2 g! g3 v$ o9 @9 `. s4 l6 K+ Q! `8 S( H0 M# l: N0 O) y6 h
|
|