|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - ]) c& g% I( Y) C; @
- [code]EDMA sample test application+ x# x {8 m |8 m0 f$ s O
- /*
4 v9 c) }% w3 A$ O1 @ - * edma_test.c0 U& I. n6 ]* W" U
- *
3 U0 h/ Y+ \' q) @* p8 l - * brief EDMA3 Test Application
* e/ U+ ~4 U# l; { - *
. a2 G" ?' ~! ^; Y3 D) _ U - * This file contains EDMA3 Test code.
0 H$ i y# Q3 C3 x) o - *# D7 L1 b7 U$ `: T4 B0 B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ o/ p' `" H1 D6 {2 G7 p; ]" Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) z" @' _ c' W- }- f
- * TO CHANGE.6 A: q7 l1 q3 `3 X0 a( k
- *6 V" ? m. D m j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 f% p" S0 p! ~* O - *1 \" D5 H* { L3 w" L3 u3 i/ y$ P
- * This program is free software; you can redistribute it and/or
# k3 ?% V% G4 {5 \1 ~ - * modify it under the terms of the GNU General Public License as% F2 q8 f- @+ B" P3 q
- * published by the Free Software Foundation version 2.
: n. ]. { T$ f7 G/ N6 G1 {' M1 r - *
" v! i& M1 T0 G& r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ l) d c" c# Z' j! p, @7 Q
- * kind, whether express or implied; without even the implied warranty1 x7 m0 F9 N+ P4 N' x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. K7 ]! ^& P- }9 [! ?" c - * GNU General Public License for more details.3 I5 \9 u6 y& I z4 r
- */* f, o1 g% ^2 C6 {% V$ \- M
- ' k/ t$ x- h; p; g: k
- #include <linux/module.h>, w6 Q c/ s s, ]
- #include <linux/init.h>+ W4 b7 ~/ G. b% [) E$ {, U2 ~7 U
- #include <linux/errno.h>: ^$ n- I- @* u% p* A( O
- #include <linux/types.h>) N3 K6 s0 ^4 D6 k% P
- #include <linux/interrupt.h># _) G( H. _& l0 b/ M2 l Q
- #include <asm/io.h>
, i' Q% _" I! z1 O& E" a - #include <linux/moduleparam.h>
8 p% w5 o' |- X8 {' Q - #include <linux/sysctl.h>
! c3 F) N( c3 _8 \( M1 z" Y - #include <linux/mm.h>
: H6 B1 q* X+ `+ | - #include <linux/dma-mapping.h>' n% j' d, B0 d# j
& z/ x$ M( u. m1 ?- #include <mach/memory.h>
6 @( m( A+ ~$ |# k4 A - #include <mach/hardware.h>
4 ^ P2 |- B6 }0 B+ l - #include <mach/irqs.h>
: B3 V$ |8 A! Q) s0 A - #include <asm/hardware/edma.h>9 ]6 X0 _5 p! e* @
- 7 \, X! b# z9 K3 \( \. {) k
- #undef EDMA3_DEBUG
k' [3 y5 K3 U - /*#define EDMA3_DEBUG*/
, L$ @& x/ `/ I% u7 n; F; P/ }9 u7 q - % `- W5 V# J8 s, b& x3 p4 W
- #ifdef EDMA3_DEBUG
! k$ l1 C0 D% N) s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! O4 `0 F, O3 L% h5 ~) t! \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& ?+ w5 t. O3 l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% M* o* q5 ^! q& G
- #else) p4 h8 t J$ P3 H6 W
- #define DMA_PRINTK( x... )
5 Q" R O$ @; i) g/ G# W - #define DMA_FN_IN
: ]: ^1 ~0 C3 V4 k* H, k - #define DMA_FN_OUT
3 l5 w& f! v" j1 W. [ - #endif
$ U6 V7 p& q0 a4 {6 Q! ^ - 7 Z" R. R! l- T# k. S k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' z! a$ f, P( p Y9 x/ v - #define STATIC_SHIFT 3
* n( A, ]9 _+ w3 ] - #define TCINTEN_SHIFT 20; h5 @; t" f' L9 c: K" j, C
- #define ITCINTEN_SHIFT 21
" k# T) u" ~. c - #define TCCHEN_SHIFT 22& a$ I1 l8 E- T+ w- G
- #define ITCCHEN_SHIFT 23( M2 W5 i0 w. V! J
7 l& |3 P/ d, w9 @9 _- static volatile int irqraised1 = 0; v( v/ w5 ?+ m0 g2 _* \% X) S. [& {
- static volatile int irqraised2 = 0;
4 i6 A% A# T, H2 b
* M$ ^, O$ k& v9 d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* `/ a0 F$ y, C, \1 n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( S, U( o" i! X5 {, y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 c1 }& U8 m3 {1 H+ m' Z! A1 X; j) P - 3 E2 |- v y! P3 G! }
- dma_addr_t dmaphyssrc1 = 0;# ~7 ^" W) I6 w; C# o# z# H
- dma_addr_t dmaphyssrc2 = 0;
) S- j5 O. [3 h i% l, A - dma_addr_t dmaphysdest1 = 0;
2 Q6 Y9 \ T0 H) {3 C, B5 P - dma_addr_t dmaphysdest2 = 0;- {" {# w. @2 K. ~
+ z' [$ _. D7 {) c5 n* i7 e- char *dmabufsrc1 = NULL;
: j: P. S: [, h4 f9 w0 L" ` - char *dmabufsrc2 = NULL;
3 X2 \2 `5 O" g; J7 C - char *dmabufdest1 = NULL;' }$ h* p: V! a4 E
- char *dmabufdest2 = NULL;
5 L% b: [/ ~9 F: y: Q# t/ W - 4 c; S# n0 y7 x( I
- static int acnt = 512;: _2 O) N' ^) k% R
- static int bcnt = 8;
; Q& v$ k: r# I" y0 w$ b+ b+ p - static int ccnt = 8;
" P$ J9 ~5 a8 O6 r! Y0 { w
0 ?. e: X* b" T* R U! D3 b, h: ~* E- module_param(acnt, int, S_IRUGO);- D& k1 b5 N1 P* g
- module_param(bcnt, int, S_IRUGO);* p$ X- a1 {7 l# f. Y" t
- module_param(ccnt, int, S_IRUGO);
复制代码 $ K+ u' Y' l. [7 J: Q* n
: _ y9 U1 i* M! B7 j) T0 v* D% ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( u( @ M9 n; Y1 \8 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" ~ e( B, l3 l% S Z& s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, j; `& `- R5 o2 I c* o$ I6 P k/ D, ?- p. A
1 m0 Y5 p: t; X( [- u6 W: d |
|