|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 S/ L. `) q. H7 a1 e# J
- [code]EDMA sample test application
9 ]! ^# i1 S9 D# V' @ - /*( F9 l/ x# V% E: T& ?) b( D
- * edma_test.c1 E+ f) ]; s- D' d/ ?: B
- *
; E9 m' P# e. n' N2 Z" w+ P - * brief EDMA3 Test Application
1 A: E5 \0 K3 X5 @3 _; O7 H - *
& a) c+ H; R( E9 X# B; X& n+ a) s# D - * This file contains EDMA3 Test code.1 ^2 | M0 k* ~9 j' R
- *
) D' J, ?' a! a( L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 N0 V: b, {' K0 |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, T& `5 g! s5 K. K4 j1 j* p7 Q
- * TO CHANGE.3 }$ n/ E; L+ ?1 B
- *; t4 F- { O3 a4 n1 A- e( P2 j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 i6 J' I5 [& Y# v' Z - *
, H% l5 A. w/ m' A1 d - * This program is free software; you can redistribute it and/or/ F6 ?1 |% ?: H* i: P
- * modify it under the terms of the GNU General Public License as
& x6 _: Z" `! a i' O - * published by the Free Software Foundation version 2.
- A2 O$ o4 Z8 b# B - *6 Y- C/ W2 ]: Z3 `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: L" q4 }+ q' Q+ |% Z0 u. F& U* Z _ - * kind, whether express or implied; without even the implied warranty/ C' e) W$ |3 h9 {$ T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% j9 c3 n8 e8 f& Y0 \
- * GNU General Public License for more details.; Q, o9 C6 l) I
- */
9 \9 G# [0 A q2 f& o, B$ C
5 B Q# ^2 B8 V* K; v- O' X- #include <linux/module.h>
{; \4 j! T4 Z0 D* O) \ - #include <linux/init.h>
+ H1 x% `% ^ ^& P6 {% l$ A - #include <linux/errno.h>
$ k# g: O0 Z& S& w U+ v - #include <linux/types.h>
O2 Z B( v0 d - #include <linux/interrupt.h>
% r5 ~( p9 _& M5 p - #include <asm/io.h>
& A+ p( o# R( E6 a5 i: m+ S - #include <linux/moduleparam.h>
2 g; _! f& A9 z, t - #include <linux/sysctl.h>
; f$ n& ]0 {5 o% \3 L1 q - #include <linux/mm.h>1 Z0 Y+ |6 ?* ^' ?- a1 k- r1 j' r
- #include <linux/dma-mapping.h>
3 G7 l/ A( N; k' K$ x7 M
: l4 S/ p. K% `0 @5 R7 n- X- #include <mach/memory.h>/ ^8 g( o' K! X2 y0 U9 e
- #include <mach/hardware.h>6 S; ^% c2 f0 D! K7 W. j |
- #include <mach/irqs.h>0 ^* q4 c: s x& ^1 f% X- {
- #include <asm/hardware/edma.h>
+ _' t! X' N( s, b2 X - 9 I9 b1 r, ~6 ~; z w' g% }. v
- #undef EDMA3_DEBUG
9 L+ t& v. I6 s D q - /*#define EDMA3_DEBUG*/9 s) `3 m1 M7 e9 E9 a0 n' S
0 ?4 O7 T1 }9 Y* _- o: i' P- #ifdef EDMA3_DEBUG2 k7 ]- w7 o7 R5 Z/ U3 V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: S# M; U" X& Z0 x4 |3 J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( _: g0 b' Y Y# u$ c8 z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( i: y$ C6 l9 X% ^
- #else
- [) K& u! S" B: S) } - #define DMA_PRINTK( x... )
* u1 H) a+ v# V) n - #define DMA_FN_IN# \! D9 o1 ?( E, p, h9 p- H: _
- #define DMA_FN_OUT# j% o/ k! i8 d* q! y
- #endif
1 `. ]$ D9 {! ~6 H; A& y7 T - " z5 ^0 A0 v. J* _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ k2 [9 h' p- @
- #define STATIC_SHIFT 3
8 V: F- f% q: e! P - #define TCINTEN_SHIFT 200 n/ c/ r2 f+ B. U* k
- #define ITCINTEN_SHIFT 21
, s4 V# `7 c$ Q# t9 J. [ - #define TCCHEN_SHIFT 22
( V) b) v0 F9 {7 ~ - #define ITCCHEN_SHIFT 23
. ~$ L: o9 `- H# U) t3 w. i5 A
' }+ l& U# H2 N0 }4 }- static volatile int irqraised1 = 0;
3 E4 @8 x! W) U% h ~- J - static volatile int irqraised2 = 0;
1 c/ ]+ \2 C8 I5 p# e* E
+ k+ ]' f* ~3 H3 ~" w; l) z, K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% [7 @% O9 H# F4 u) @0 F& e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' e) R, t" ]3 R# S2 n* ^8 H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* M6 y& G5 r# _ G/ ?* ^ - 5 \# i z/ ]! v( e
- dma_addr_t dmaphyssrc1 = 0;
: {6 d- k* g: D( F7 g* ? - dma_addr_t dmaphyssrc2 = 0;) `: ~2 g) f- Z
- dma_addr_t dmaphysdest1 = 0;. a$ o- m4 b# N
- dma_addr_t dmaphysdest2 = 0;
7 r9 W- e! e% M
! H8 i6 e+ \+ B, C8 V- char *dmabufsrc1 = NULL;
% |: H# Y# ^- i! ?, U; S - char *dmabufsrc2 = NULL;
w2 z; e/ Y W9 B0 W - char *dmabufdest1 = NULL;- G# i- X+ e8 P
- char *dmabufdest2 = NULL;
! X6 O" y# Y7 F/ X' j - " ]5 v) V, [* S7 J
- static int acnt = 512;0 g9 J" n/ C6 S6 w0 X
- static int bcnt = 8;
# H- R/ [. b0 k2 C" U - static int ccnt = 8;! r* k; |% t- Y' a! s
- : S* z n6 ?$ B* i; k
- module_param(acnt, int, S_IRUGO);
* W; w* m' Y! A+ S3 [ - module_param(bcnt, int, S_IRUGO);# {. \6 h- F- A9 n
- module_param(ccnt, int, S_IRUGO);
复制代码 , P' \. O, ^: D/ A% f8 Y+ W
# ~ G! y- F* Q4 G% V3 E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 B0 Y& T x; } w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 _2 V8 t' a" D4 |6 j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- z+ ?8 O; A4 z
p( B9 h. a2 ` C% {+ e
2 b' J. X! X! J `7 D( M |
|