|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
D0 C! A* Y" c$ E1 w- n" A. K$ v, j- [code]EDMA sample test application
& q" q0 v: d- r' s2 [& q8 \/ m - /*
9 \4 z$ ?. z7 ?0 T: `7 d" q - * edma_test.c1 s' P; f5 ^1 ?$ D! u7 E
- *" q/ |* w. \; g" L; x! w
- * brief EDMA3 Test Application
\2 {, e4 B/ s0 k/ U - *0 d8 ^ c7 F2 \" m; n
- * This file contains EDMA3 Test code.
9 X0 I5 X' h2 v+ F( Q: v! k* V! K - *. c" }: d1 G' Z& Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* t/ e0 n; ^6 T8 c0 ~! m4 I2 W! ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 w. h& R1 ?+ L2 U0 |" Z - * TO CHANGE.9 H$ @ i( k) w1 M/ h
- *
" E" w S* V* z& E9 O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 A" i: ^5 u! v/ E4 z& O+ L
- *7 r( h! O2 y+ d; R8 ], [
- * This program is free software; you can redistribute it and/or
1 F* d; E- ~. H2 z: Y - * modify it under the terms of the GNU General Public License as8 M, _) N1 j v, n c
- * published by the Free Software Foundation version 2.
' H) {( F; T- ?4 s - *- z: l1 ~5 t+ {2 f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 S9 k) D' `" u) l# a+ Z- i8 ^" `6 @ - * kind, whether express or implied; without even the implied warranty
7 B' s; K0 @ ~4 J; T" X - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- K8 ^! n8 b. z
- * GNU General Public License for more details.
# s5 D. g# a% l4 D4 I7 Z - */5 N# Y" i- u# g
% J2 L8 V) c( C2 i% G' f- #include <linux/module.h>
$ s( f8 s" v% o* f0 C k - #include <linux/init.h>
8 D8 w E7 V; H - #include <linux/errno.h>
0 ]/ d4 ` H! }/ N! _* a - #include <linux/types.h>
3 g3 F$ ?. h1 O1 [0 t - #include <linux/interrupt.h>( |% D& ~1 P5 a) ^& ^. i
- #include <asm/io.h>
3 A. W; L/ M3 ?9 ]2 M - #include <linux/moduleparam.h>7 {; d3 ?& X7 O% m- i8 W# h( U
- #include <linux/sysctl.h>
2 ]4 F: q. @% E: r1 K - #include <linux/mm.h>
S' f$ M; V1 [8 { [$ l - #include <linux/dma-mapping.h>
- V- y: r% x) O' v1 S - - V' r% u- j. o( l* `2 V& P
- #include <mach/memory.h>. j( [% M9 ?+ L8 o" J, b
- #include <mach/hardware.h>0 J& u7 a+ d" E
- #include <mach/irqs.h>( k- b( S0 g4 E; h; f/ L
- #include <asm/hardware/edma.h>
* Y3 r& f2 r4 v - 3 Q% F$ x; R: v( j1 G5 y" _
- #undef EDMA3_DEBUG7 T; D e$ |! {' ^. r7 `$ U R: g
- /*#define EDMA3_DEBUG*/
7 R0 V" p# ]/ F2 ^" ]- H - 8 O, I! @% W- j. K8 ?3 {+ j
- #ifdef EDMA3_DEBUG4 Z: Z2 i" N0 T/ M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, t ]9 w3 {: L' m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- N; _3 `3 f& G/ V% Z- V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), p. l% N! T* G& c t
- #else$ \ J8 _6 ?$ D& @; K6 L$ Q% G
- #define DMA_PRINTK( x... )
6 H# m5 c, N, Z7 O - #define DMA_FN_IN
8 B0 A6 e+ w2 a. S! K6 Y$ X - #define DMA_FN_OUT
( ^# P4 @- D& B, a* B) j7 q& k* ?! b# o - #endif
5 [ G6 U% ~0 o) m5 s; a
: O) T+ a- w0 C0 V4 n; z" b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 L/ l9 m6 B* l
- #define STATIC_SHIFT 3
: b5 E5 g8 q, d- M% f( i$ J - #define TCINTEN_SHIFT 207 C6 L8 f+ D' B# ]3 b* S! j9 r
- #define ITCINTEN_SHIFT 21* K$ T1 _5 V* y8 O* D/ g7 C
- #define TCCHEN_SHIFT 221 H- h' a! m7 V9 K8 O @- } C9 n
- #define ITCCHEN_SHIFT 23, t n, M, b" I9 r; ? k
: v( e* K# K8 `2 R* |. l' a- static volatile int irqraised1 = 0;
* B) a4 x/ Q2 ^; K! r9 g! T - static volatile int irqraised2 = 0;& V5 n: ]( ?) R/ z" Z; |* O# c
- 2 F0 Y; }7 C: w) D+ [8 ?$ [3 B* Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" ~0 l* s: w7 i! U( C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: X$ S1 E+ B' y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ V9 u' M P. P r$ ~- c5 Y
- ) @. h3 z7 E& i" K
- dma_addr_t dmaphyssrc1 = 0;
4 h$ m- r, N- H. n - dma_addr_t dmaphyssrc2 = 0;: _. ]% A9 `8 y8 c( Y O% ~
- dma_addr_t dmaphysdest1 = 0;
$ D/ L* r, [9 ]) m* l, U4 u- `: o! j - dma_addr_t dmaphysdest2 = 0;
4 u6 V8 G* ?+ x* U - 5 \8 A6 w8 z4 K/ }8 X" A& G
- char *dmabufsrc1 = NULL;( [; p/ S7 n% x2 o3 y# k
- char *dmabufsrc2 = NULL;' g, N1 O/ V/ h' K. G
- char *dmabufdest1 = NULL;
! c$ L# a( [* f( ?1 C0 C$ g: F3 [ - char *dmabufdest2 = NULL;) t; H! }6 X9 s! S" `
- : M5 }) r& Q0 ^
- static int acnt = 512;
6 ]0 M; H$ V1 `* G- S0 o8 Y0 J& B - static int bcnt = 8;4 ^+ [9 k9 N' U' n$ P0 R
- static int ccnt = 8;: E- T" |, f( Y: V; m
- / n1 _7 F- z8 K$ y9 t" J2 @
- module_param(acnt, int, S_IRUGO);
% L; `0 ^) Z! V8 G% r" _4 ]' w - module_param(bcnt, int, S_IRUGO);
* f5 r0 a& ] ~7 H+ T - module_param(ccnt, int, S_IRUGO);
复制代码
4 _. t. O+ j+ f8 c5 q, |( A/ m) |; ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' F( I" g9 _# y- M7 c2 n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 Z0 u1 V# T- ~ J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 `$ p, x- j3 ~/ V5 M. n
: ]9 \- E4 r4 e$ W9 F; A
: K- ]4 Y! ~& h |
|