|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ L0 m0 }7 e \0 F
- [code]EDMA sample test application4 _; V- i' H' Y% p; a" Y& V' |
- /*
4 x7 T9 m3 ]4 s6 m! K& E - * edma_test.c
1 J0 U4 ]+ {6 c8 v - *
9 C. t- l5 S+ Y: H - * brief EDMA3 Test Application
* `7 y' R7 \/ F% k. K% z1 b - *
7 X8 S+ d* x4 d4 @ - * This file contains EDMA3 Test code.
3 h- z, X Y2 y( @, W. x - */ S( v ^( f' b8 y+ T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% m, [$ B, [' U- R3 B2 E& m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 `3 T) I" `; x0 \+ x& s$ ~: o+ I( P - * TO CHANGE.
+ Q- y1 [+ x' _& V- x - *3 n9 V! ^/ j t% K" ~4 |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 i1 l! I' x5 |) i% F ~ - *
' E. Z( | [+ r5 R1 B - * This program is free software; you can redistribute it and/or
1 z7 M( `$ q* X8 ]$ K0 l: j - * modify it under the terms of the GNU General Public License as
1 u4 k, x( r- g* _ g# k* C! ~ - * published by the Free Software Foundation version 2.$ y2 y& _0 _. p3 V+ D2 r
- *
& b# K! h5 F' U9 _# b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; E: S: Q2 D* m* C
- * kind, whether express or implied; without even the implied warranty: h$ n3 u% I( g9 q! \+ J4 J
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 h8 m/ S! P9 d2 x. l0 I - * GNU General Public License for more details.9 p" \ n( v0 J f% b- F/ a
- */
0 ]7 D$ F; E8 g) D/ I: X5 w* X - ' V w$ J- r7 I1 m4 n: b
- #include <linux/module.h>3 i6 Y. ]* X3 l/ d
- #include <linux/init.h>
, b; Y/ L( T% e1 U6 {1 f - #include <linux/errno.h>' W$ c$ a! W6 i
- #include <linux/types.h>, \9 v; n- P; x% V+ U
- #include <linux/interrupt.h>; i+ {" S0 P' v6 i* F% A
- #include <asm/io.h>" I# E: H6 e7 Q
- #include <linux/moduleparam.h>
, O8 b6 n$ Y1 \- n$ B1 \ - #include <linux/sysctl.h>3 B( {' C, d6 f* I5 }+ H3 A2 m- ~
- #include <linux/mm.h>
2 b' r, R0 x" S$ \. ^( K - #include <linux/dma-mapping.h>
7 n( n8 j1 o4 i# M } - 3 f& Y8 k7 @ y' W: M7 }9 W
- #include <mach/memory.h>/ I8 a. u1 ?- |/ _, y( V. N+ {
- #include <mach/hardware.h>
j! U9 ~* V9 b0 [5 e5 V: c" p9 i - #include <mach/irqs.h>5 x1 g v/ N- X, x8 [, z
- #include <asm/hardware/edma.h>
9 t) a+ N. e+ H9 M+ Z6 R3 B - 8 i5 r& r9 s. ^/ l2 S) ^
- #undef EDMA3_DEBUG
/ n8 p! K9 }) {1 H& k$ I - /*#define EDMA3_DEBUG*/, ~3 i4 d" w* M) C% w: V, q6 B
- k8 C+ X/ P3 R/ o, ~3 |
- #ifdef EDMA3_DEBUG8 j4 y8 F6 F1 z* ]+ @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" \$ ] n* u' C1 n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ U* [0 {9 E0 b0 c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ s' r, I( L+ n8 ]( u' K - #else+ T* C/ A& v' b4 x
- #define DMA_PRINTK( x... )
% }' V# @6 d8 j- y6 r" Q9 }) C - #define DMA_FN_IN7 {- g* Q- o/ f
- #define DMA_FN_OUT
6 R) P+ X6 v @+ A Q - #endif ?5 M# {, e! _. E& m
' W! Y. }( f# V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( u- ^; f+ t; {- p
- #define STATIC_SHIFT 3# t3 D/ G; k3 X3 d2 E) {4 v+ r
- #define TCINTEN_SHIFT 20) c$ e' a6 @' D" \1 B7 J) I
- #define ITCINTEN_SHIFT 21* g- ]/ B3 h+ a3 Z& x) ?4 e$ t
- #define TCCHEN_SHIFT 22
% I+ a1 ]4 T$ @! p4 b - #define ITCCHEN_SHIFT 23" {2 s. b! i. e p4 d5 i/ M+ z
- # T- i; Y$ c; s M+ N, v1 x
- static volatile int irqraised1 = 0;
" r& k4 A$ F$ i' S, y0 l% _* T% p - static volatile int irqraised2 = 0;
5 F! c: O* H \
$ G# D5 s2 l0 X. I: v, t; r3 w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ J2 H' H1 v7 c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% R3 ]. h: b- j5 X) T) g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' G1 J3 ?1 y8 E" G
- : c8 a' ]2 O E
- dma_addr_t dmaphyssrc1 = 0;( @- {4 J C/ {* E
- dma_addr_t dmaphyssrc2 = 0;- z' H5 a5 |- t, i8 g7 a5 P
- dma_addr_t dmaphysdest1 = 0;( ?# @7 [- G/ _; T7 o4 _, y
- dma_addr_t dmaphysdest2 = 0;
# R' ?/ y; H3 u - 0 w2 A6 e$ @1 G# R
- char *dmabufsrc1 = NULL;
! ~- X. Y' t H) m - char *dmabufsrc2 = NULL;- ^4 ~$ F( A: ~. k' B
- char *dmabufdest1 = NULL;
- I* y$ ]+ F, u% z# M - char *dmabufdest2 = NULL;7 q M* u- |7 B- v6 i
' Z1 _, w: V0 ?( y3 X" _8 b- static int acnt = 512;
: ^4 D0 c- r( m: x2 w, p! S* } - static int bcnt = 8;
& i% ]7 o7 A/ U - static int ccnt = 8;
# g, u R9 j/ a. m$ C - % T6 v9 ?2 \' r& \
- module_param(acnt, int, S_IRUGO);
0 D( z7 `. ?/ \& S! S* N - module_param(bcnt, int, S_IRUGO);
7 m2 ]; m6 X1 y# N1 v: @/ [8 ^ - module_param(ccnt, int, S_IRUGO);
复制代码
, f0 P- W1 N/ y9 y$ s+ _) u( c: V9 F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ a$ w K* a+ C p2 z6 i+ garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ j. m. `# {9 [% l+ D9 c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ V" Y) J3 `/ a7 z' E" M
) i8 Y. C7 S9 N- @. G4 s6 |( z- Y M9 M
9 F$ U! a9 N+ p, y
|
|