|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 w2 ]! }$ e/ G# Q6 @- [code]EDMA sample test application8 j/ v: h- t0 T# U' b- C1 }1 X
- /*
4 Y& Q7 u: t7 u( z$ K9 \ - * edma_test.c
( b% k5 l2 f6 ~6 s8 _3 y - *. E, n2 K; m, G8 i/ P7 _
- * brief EDMA3 Test Application, ^8 H: j: W- u0 ]( @8 Q3 x; R
- *
. k3 H K8 D( b( H% ]9 z. C - * This file contains EDMA3 Test code." T( J# w/ f+ \
- *
7 f6 f2 W+ x1 g& @. N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" {8 v3 Y3 @0 ]/ C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% N& ?% P% z. P; F. v
- * TO CHANGE.
, ]! T, U1 J) {- d, i5 s - *+ t9 E' y0 i/ c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# d3 T/ f8 U* ~- x9 B) q! A - *8 z' @: _" ^- f: l2 P3 H l* J$ s
- * This program is free software; you can redistribute it and/or
- o) U. b4 ?& t0 x+ S1 Q, V - * modify it under the terms of the GNU General Public License as
8 U4 s) r! N# e0 @1 Z- X$ r0 o - * published by the Free Software Foundation version 2.
3 h9 n6 L \: ^0 v7 D5 U& m - *
0 \$ S& `8 ~' Z* @+ G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. M- H7 \( a- P' v+ s
- * kind, whether express or implied; without even the implied warranty
" n3 a O6 N- g( _ A [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; r3 @0 C6 y) F: p l) | u. B - * GNU General Public License for more details.
. y" i" x. m+ V7 S( ]* s% O3 H8 S5 T - */
; n* x9 e9 i: b% q- G; e9 p - , P0 T; l' k; ~ Z
- #include <linux/module.h>0 R+ S& o7 G: F- B
- #include <linux/init.h>) j: K: ]4 }+ h" I- L
- #include <linux/errno.h>
6 s* T1 I+ P5 o3 ^8 [. V9 }( p, | - #include <linux/types.h>% R0 T$ j6 [- c, v) V, C% e
- #include <linux/interrupt.h>
4 i, `3 a5 i' |; Y2 a5 S - #include <asm/io.h>* A/ W6 A( |3 X* O) J
- #include <linux/moduleparam.h>8 n6 r4 V$ H. w% D+ N
- #include <linux/sysctl.h>7 K, {7 x/ m2 y5 T
- #include <linux/mm.h>" S f. n. g6 {( S* v& h& v2 \
- #include <linux/dma-mapping.h>
) M: \7 `$ @2 F B! d7 g* C
0 t0 D4 u" M+ E* ]- #include <mach/memory.h>
- ~+ t/ x! N6 F0 J - #include <mach/hardware.h> ]0 A: q- y" {
- #include <mach/irqs.h>
, ~2 O! ]$ U7 A5 R7 h( v$ D( J - #include <asm/hardware/edma.h># y. Q* K' f0 d. K: T5 G
: ^, B$ B9 C, d- r. q- #undef EDMA3_DEBUG: H: m d! j K9 I: R0 q
- /*#define EDMA3_DEBUG*/8 Z9 }4 l+ W9 K' n5 ]$ D
- 5 @9 n8 u( p% _& H7 _
- #ifdef EDMA3_DEBUG
. @7 q& e# z i! A5 M4 X, S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ i) `8 w2 U V( Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: w' y [# ?$ h; ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 q+ o) B$ T) e$ K& v2 F# }- ~8 P8 [1 N - #else. }1 V3 L9 {3 G- b. }0 {- q
- #define DMA_PRINTK( x... )
- c) z2 k: H$ y2 f! \ - #define DMA_FN_IN* E1 r% E& t" F2 `8 b+ M
- #define DMA_FN_OUT
* W: a/ @( P/ S$ T! R& O5 I5 P - #endif
( _) G- _' v) O1 N6 s( f) l$ w - ( }; d. M) C' P1 R* T$ m$ T: b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; E9 a" L* m4 r1 b - #define STATIC_SHIFT 3
7 }% H4 C& m+ @/ u$ ` o8 z: W - #define TCINTEN_SHIFT 20
7 x# S" E+ m) p6 @ - #define ITCINTEN_SHIFT 21
9 E" S, n5 H% |9 e; b. W2 O0 G! e - #define TCCHEN_SHIFT 225 H5 k' H$ W* G2 K& E$ l+ r" G
- #define ITCCHEN_SHIFT 23
% i+ f! y2 r; r/ R( S# K+ v4 E6 i
- g9 T+ |. d7 C- static volatile int irqraised1 = 0;
2 N7 R: N; S% F - static volatile int irqraised2 = 0;
# l A) A( T; H5 t' e7 C; M
$ z( X T! g3 w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 ~9 ^" B3 \1 B, R) e7 P/ b/ } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 u! K* [/ M7 s; s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- @5 s: [; C% K% d! t4 ?
+ R0 Z) ~* i& ^- dma_addr_t dmaphyssrc1 = 0;
8 b- Y9 r, g0 h k$ Z c) l - dma_addr_t dmaphyssrc2 = 0;
* r+ d3 P; z* z: |( s, a3 d - dma_addr_t dmaphysdest1 = 0;4 u4 J& ]* h1 e! Z3 J) [- ~" p
- dma_addr_t dmaphysdest2 = 0;) C& R/ }! a$ G
- 3 l1 h" q: T* f
- char *dmabufsrc1 = NULL;
. H! U/ U# K' T* O- L - char *dmabufsrc2 = NULL;# w8 z! K! _6 u# g# K
- char *dmabufdest1 = NULL;
5 J* M' l. w: H; R7 i' u - char *dmabufdest2 = NULL;# m! y- x6 l8 z
( r" U- {# j0 [4 C/ [- static int acnt = 512;
; \0 x6 s1 [' u( ?& {% R- @ - static int bcnt = 8;
; J M8 Q- h* k, t; j$ `3 R* c5 F, N0 ? - static int ccnt = 8;/ x9 [0 {4 v8 g; ]1 q+ l$ n
0 X& N8 T/ I1 D- X+ A- module_param(acnt, int, S_IRUGO);
4 w }9 z* t6 }8 a6 o# r! ^" k0 l - module_param(bcnt, int, S_IRUGO);
) j1 Q( t6 h+ s2 i$ r! W+ ^3 t" r7 _& K - module_param(ccnt, int, S_IRUGO);
复制代码
6 g9 M# u# d$ E* W) k) Q) }
/ p3 h, ^% b G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 v! g- ]3 F: a% U4 k# ~3 K2 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 Z8 {! H+ I% H6 j& P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' k1 Q$ ?8 x. e8 U+ e9 [8 A" w- r$ ^
: ^' v$ O8 q( W; K; a% |8 J1 { h |
|