|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; V# p4 }6 ^5 g ?( z. p- [code]EDMA sample test application
6 t% }' R- ?' Q - /*, ~5 B8 F) c2 e9 S: F- K% X2 T
- * edma_test.c
1 ?# k. u- g( D& g# T& t" R0 Q - *0 [0 ~6 b$ U J
- * brief EDMA3 Test Application
+ a1 J8 B: S$ P/ b2 [ - *
5 q# C5 T2 K2 l% l/ B - * This file contains EDMA3 Test code.
# U- J2 D0 w0 o5 F - *
2 v. y4 K: e5 W* n( k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% Q2 h6 C# u$ q/ k* H' k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 ]5 W0 p# y1 ?! |: B* C9 i - * TO CHANGE.8 g o) k3 D, d7 @0 Z
- *0 d# j2 @! }+ S/ [) [3 p* w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 |1 s2 b: q6 n/ | L- ~* D* \) J - *6 Y$ {" Q/ {' _* l8 V
- * This program is free software; you can redistribute it and/or% h; P8 ]8 i0 X: U& e
- * modify it under the terms of the GNU General Public License as
8 }# r: |, l* @" }. z2 p - * published by the Free Software Foundation version 2.
8 ?/ |1 R' }: d) E8 e! |' P - *% ~8 R1 A! N2 `0 ~' x, Z; M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, ?0 a* b$ z+ G5 L" _" e
- * kind, whether express or implied; without even the implied warranty, \6 ]% N; G k7 n: h+ ~, d+ ^& }* Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 P N" `; y s; h& J
- * GNU General Public License for more details., G- [% `$ l/ b6 Q& B2 c
- */
0 ]8 r- s, S: D8 B3 N - . I* l7 b2 d% C" r7 M* X0 W4 Z" } ?
- #include <linux/module.h>
5 b$ F$ B" Z! h5 o1 @5 {7 X - #include <linux/init.h>
$ I4 A) F% i8 K - #include <linux/errno.h>
0 k: e2 u) j0 t5 {9 f - #include <linux/types.h>0 _; i& z( O5 f1 C3 w& t
- #include <linux/interrupt.h>8 F0 L. K4 O( A* H( Q3 K7 r1 d
- #include <asm/io.h>
! c, z% F. t" A - #include <linux/moduleparam.h>
1 ~& l7 n* \" Z3 C# X" [ - #include <linux/sysctl.h>
: k; c5 r+ z8 b1 u$ y; v0 r - #include <linux/mm.h>
7 ^1 W# B! f& W/ ^: S& H# x - #include <linux/dma-mapping.h>' l7 f) ?& g- f; E6 B. b, s, y
7 A3 a2 R8 [1 N- b& L" y* g! `- #include <mach/memory.h>' k. }7 ? i& x# u" q
- #include <mach/hardware.h>1 F0 R. q; t4 s
- #include <mach/irqs.h>
- R: ]# E2 T% z - #include <asm/hardware/edma.h>
% i* U1 c$ N4 R3 v8 w4 X' L5 W4 ` - 8 M2 L" @# a, |. U9 `
- #undef EDMA3_DEBUG9 s! o+ u. k2 {2 g
- /*#define EDMA3_DEBUG*/5 s8 p0 t, h5 ~: F+ _
- $ J- e2 ]% q9 I2 ?% B x1 H2 {% Q% R
- #ifdef EDMA3_DEBUG* ~) N* i: h: U j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 a- c( x% {1 Q; `6 g/ x* `: W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" n1 s/ z- F7 ^5 O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" @- j* L$ K* N: p }" h# ]* G
- #else
! [0 P2 I g- Y' E - #define DMA_PRINTK( x... )
1 w9 t$ G8 u9 u$ E0 q" l# j1 { - #define DMA_FN_IN. N" F; d% V# Y; ]7 U
- #define DMA_FN_OUT7 k1 p& w1 D: W% `" d
- #endif# C2 l/ d) d! Y8 ?$ H
- 1 l5 S+ u6 m# W& g1 ^4 ^# y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 \ y# Y1 ^9 o; s. S
- #define STATIC_SHIFT 3) {- t: O1 ~" V- C6 t) }
- #define TCINTEN_SHIFT 20
7 h* Z3 Y: @$ q( R" Y - #define ITCINTEN_SHIFT 21
7 e) U4 c$ ]% e9 o! c1 _3 P$ @ - #define TCCHEN_SHIFT 22' }. `7 G3 S+ L2 j- Z4 s
- #define ITCCHEN_SHIFT 23
7 f! K! B0 }+ S, s0 G j ~
" W4 h {' o, p x2 u, H- static volatile int irqraised1 = 0;, B1 Y: i7 @% ^, T
- static volatile int irqraised2 = 0;
# e8 R6 s) h% ]6 q& N4 S8 { - 8 W* }! z4 x6 h6 V$ b8 @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
?7 a1 e' l2 l& s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 D* i9 i6 x3 k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Y. A( I( b1 r9 G0 O5 Q- f. E
4 x& B8 X/ S/ p- dma_addr_t dmaphyssrc1 = 0;
`( ]0 m0 R' ?+ `; l - dma_addr_t dmaphyssrc2 = 0;' C: x* l8 N2 }7 t
- dma_addr_t dmaphysdest1 = 0;
/ x" y3 F2 @" {7 S& ?" n - dma_addr_t dmaphysdest2 = 0;
; G- G/ U3 g. s0 g" q
8 n" j( [7 ~, Q) ^4 f7 z$ x @- char *dmabufsrc1 = NULL;
9 n" z; E. j( }* x - char *dmabufsrc2 = NULL;
4 N$ Y& L, I$ X% X; Q: K. r' S) P0 s - char *dmabufdest1 = NULL;
4 t% I- g0 g. N0 P" w4 @ - char *dmabufdest2 = NULL;& j; V( h& f! V& y
- % A/ C& [) P" `5 z. ^& g
- static int acnt = 512;% O& S$ [4 ~! a* D
- static int bcnt = 8;! ]5 e+ ~/ a5 H6 S1 v
- static int ccnt = 8;
4 ?6 L3 o$ {) \% X' c) Z- n, \
6 O" ]/ G1 c% v! V$ P- module_param(acnt, int, S_IRUGO);
: m$ J& Y8 E& F7 T - module_param(bcnt, int, S_IRUGO);2 K, A* p1 H8 P$ o1 Y! N8 J: X
- module_param(ccnt, int, S_IRUGO);
复制代码
# L' b# G. g, {& J* m9 M3 f' N) x, C3 Q# C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* i9 e' Z1 T# Y$ w Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( R" q, N% ^2 U7 W- g) b, l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! c7 h0 {% v4 ^: o, @
$ |6 M1 a3 O9 t. s$ ~4 D
% `- |" ]& m: H |
|