|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 X# c6 `2 d' s
- [code]EDMA sample test application
- F# I2 Z# D& j0 M" }8 T7 Q - /*
& y4 X3 l) S2 u+ d0 \2 T - * edma_test.c
* m% T# i" O$ ]' p0 L" O" j, o- l - *$ s) V3 S; j$ x1 m: C1 [
- * brief EDMA3 Test Application
0 ] {$ E- [! c+ f& J' F - *' Y* x! x$ ?8 W; u& @3 E
- * This file contains EDMA3 Test code.
2 d( M$ ^* L1 H1 N* | - *8 m8 j+ x; S% s! e7 `6 M% ]; `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( G9 ?5 g* R& x& G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ h/ Z/ H5 a& [& e8 \% T( O% S- h, c
- * TO CHANGE.
$ k' c9 Z2 K: s* C% K - *8 [( K4 P% t1 H7 \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 N1 z& ^/ G! Z5 V: f# I+ l - *
/ s/ O) E p9 K4 h* K2 I, @ - * This program is free software; you can redistribute it and/or
$ a& f b: R% x# W0 Q - * modify it under the terms of the GNU General Public License as9 H6 S) E% K) \! k* n/ Q0 t
- * published by the Free Software Foundation version 2.3 k7 v, b8 |4 T2 f
- * a* u5 H( o( x1 p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 ]5 W1 Q' E" ~9 Y - * kind, whether express or implied; without even the implied warranty
4 x- y) B3 q0 v& z/ E5 M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# e Y" |8 T4 l4 s* b& B( P
- * GNU General Public License for more details.2 E. X F+ O( n7 R3 D
- */
E2 `, t6 H' N: l6 K& _7 d( \3 m - ! ^ O6 J! B& Z. n
- #include <linux/module.h>
. `; [4 P! V! U - #include <linux/init.h>/ C1 m" |' ^- b
- #include <linux/errno.h>
0 A& c3 B) f, ^* E Q' r - #include <linux/types.h>
/ F2 g; Z8 }. S: E% g) A - #include <linux/interrupt.h>
d3 Q& m/ R2 g7 c6 C - #include <asm/io.h>
) \5 B% g0 L7 \7 C1 z - #include <linux/moduleparam.h>
3 v/ t4 c5 l7 M) K% Y# b# S' m - #include <linux/sysctl.h>
: I3 y. D" K! l2 N1 a4 v - #include <linux/mm.h>
0 w% ~/ U/ ]2 X/ w - #include <linux/dma-mapping.h>5 y0 O$ W+ L2 a# c0 }' H, X
- / f8 p* Q% p1 b. _3 T" ?
- #include <mach/memory.h>* E v4 r. K: D" {4 m+ Q4 \
- #include <mach/hardware.h>
$ a3 V! e' {( Q; Z - #include <mach/irqs.h>
' M) L5 I a, W5 Y9 V% B - #include <asm/hardware/edma.h>
! f) n ?7 `5 D( m7 r
! A4 l6 a* p; E' u+ N$ E7 {- #undef EDMA3_DEBUG
9 c0 n+ Q9 p/ v5 L0 {9 _ - /*#define EDMA3_DEBUG*/- d. v) Q% t9 A" z# W' S
- p; O: S6 g6 ?& b) `/ p7 I- #ifdef EDMA3_DEBUG
% _" a$ |% \& h9 A9 c3 {9 c0 G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 y1 [5 T% }8 G2 P# r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! R; U9 |) U# I3 s/ M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 t/ Y4 c& t, N! D T% R3 l5 c6 E+ _* L - #else
6 s; P# E6 M9 L+ R* c - #define DMA_PRINTK( x... )2 C! Y! m5 h, d2 E) w& u
- #define DMA_FN_IN& d4 ?- N8 {8 x: i1 d, Y2 T
- #define DMA_FN_OUT
* e" P6 x7 V6 q: X4 Z7 e - #endif
7 h) V1 a5 z8 N& l/ l& p
$ q& y+ K" w; \8 ^( ~# k/ W! q: x- #define MAX_DMA_TRANSFER_IN_BYTES (32768); z7 X( I: Q$ N- X& r! e9 V
- #define STATIC_SHIFT 3
* K# A. o# {4 }% g1 _9 V - #define TCINTEN_SHIFT 20( a' y1 L. h( J% _$ ~' Q9 g
- #define ITCINTEN_SHIFT 21* c% Q. W2 N+ }, a; i/ k
- #define TCCHEN_SHIFT 22# ]0 t. \6 Z4 Q7 N
- #define ITCCHEN_SHIFT 23
( S( F; I' f3 S& Q - & [: ?% b j9 m/ L% K
- static volatile int irqraised1 = 0;
9 f: }- }7 B* W$ u) O6 N) H - static volatile int irqraised2 = 0;
h" z, `2 }7 ` c, Y& D - ) ]+ D7 ^7 q: [; w/ |; K. g3 F7 u0 J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 B7 R9 H1 |! F) x1 t2 B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 D) _0 ]7 o2 l# v7 M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( G" R B" Z( g* l
( p* `# Q4 j* p( K4 w4 R- dma_addr_t dmaphyssrc1 = 0;+ i- w* R7 e* C% Z% E* j$ L, q0 M5 W
- dma_addr_t dmaphyssrc2 = 0;
8 \. l& j* c* Y+ I$ ^8 l$ E. m* v - dma_addr_t dmaphysdest1 = 0;% l& E2 i/ x) ]2 h9 \; U1 Q/ H# h7 v+ Q
- dma_addr_t dmaphysdest2 = 0;1 k- L- r; _* n" V) C4 a! T
3 v, C$ B+ R+ H& y) Q; g7 F/ l- char *dmabufsrc1 = NULL;
: k" r- c+ m1 I5 K - char *dmabufsrc2 = NULL;; m, I N, q/ Z' O2 v7 Z4 c( m
- char *dmabufdest1 = NULL;# x5 l8 |5 t8 _; `9 V6 C( y$ a& X
- char *dmabufdest2 = NULL;
5 P7 s0 G5 W: C' `
3 q3 i5 |2 S( s+ ^5 f- static int acnt = 512;
( H3 Y2 l, ^: B* E5 W" z0 a - static int bcnt = 8;5 m: c: o4 j9 \0 C0 y
- static int ccnt = 8;4 x. I1 P3 ?4 d1 t* |
. u, R( X- ?7 c4 w" I- module_param(acnt, int, S_IRUGO);
" ]( T! O# H9 g) }2 K8 a% u - module_param(bcnt, int, S_IRUGO);
C% u! ^' _/ t2 g: E - module_param(ccnt, int, S_IRUGO);
复制代码
2 v6 y% O& h2 M2 ^' W: P- b% Y( M
& L& a; e' g3 `$ ^2 y7 Y! Y+ ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 }. K% p" U D" \) x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: V: Y0 f5 f& O% W6 e& [7 \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: s: V- f# j1 l/ j5 N1 i
. \, \4 I( l9 P) Q
$ |+ J7 x( z6 W7 H' [0 Q d7 V |
|