|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : |' ]9 f) ^, h5 ?! Z6 f" h
- [code]EDMA sample test application* I4 d5 b4 n- Z b
- /*8 f& i1 U) [( T- Q( P
- * edma_test.c
( p9 W* }; _# H3 v( _' y - *$ \# J* U# u8 r
- * brief EDMA3 Test Application3 j/ z+ d; m' B0 D
- *
9 w6 l9 E e' q4 Y( t' a - * This file contains EDMA3 Test code.4 k( r" @) _) Z! Y5 S- j# J
- *. L h# V* u; |6 a# D1 D) y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; H+ H+ v9 {) ^. |! v' o5 W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 Y; u* }0 v4 V6 \2 O A9 p - * TO CHANGE.( T$ c _8 Z6 m S; f, k/ Z6 z
- ** K- w6 n: |$ ]4 t5 A! X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' Z2 m, v M4 o4 c5 s
- ** ~" |) K7 n @6 L' u+ _5 M* M
- * This program is free software; you can redistribute it and/or5 G7 a1 K. T3 ^) R' N$ J
- * modify it under the terms of the GNU General Public License as
# E- h- n2 D v - * published by the Free Software Foundation version 2.
' I, ~8 E9 O9 i7 k: z) Y U: p5 I - *$ u0 g d a+ x; U, A( f+ _# l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 P A/ U k- v C: P4 Z
- * kind, whether express or implied; without even the implied warranty O- l' m! o3 Z* Y& C, Y% T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* o) t& Y7 k0 f& M+ l - * GNU General Public License for more details.3 q5 j# X- U8 ~ s
- */
' S# E. T' ?% _0 I0 \
8 @, o1 U( s0 |0 B* Z- #include <linux/module.h>, W1 k+ }3 M/ y: |( T
- #include <linux/init.h>0 ?; \% }0 x0 z. U& O( [" L$ J
- #include <linux/errno.h>
" }/ A' z( k+ R" ~* E% F - #include <linux/types.h>
+ {( ?% K+ G [& v - #include <linux/interrupt.h>
( C. N, _! {# w7 a1 i. @/ W - #include <asm/io.h>- W8 Y/ f8 y2 p. ^
- #include <linux/moduleparam.h>
7 g# D9 ]- [3 k) q4 c6 d1 F O - #include <linux/sysctl.h>8 F3 M: w+ G9 G5 D& ^: w4 w" j. t; I
- #include <linux/mm.h>
% o0 D# Z# T3 ~% ]" Y. ~" r - #include <linux/dma-mapping.h>5 p/ E5 J5 S+ v" o. z
2 u# z( h( Y% ?6 A- #include <mach/memory.h>8 k1 ^+ ?# y# ?3 B
- #include <mach/hardware.h>7 P, y. V( h/ n! ~
- #include <mach/irqs.h>4 N2 Z. M. r8 @- {2 R0 Z. B
- #include <asm/hardware/edma.h>
( L m6 t3 K: `* Y - / g5 O7 K1 d% v
- #undef EDMA3_DEBUG* a$ D' `! Q! q, _; K
- /*#define EDMA3_DEBUG*/
* t; T2 z3 _: O0 u* f+ z! k$ h - 1 G( ]' a* a( g% Q
- #ifdef EDMA3_DEBUG
8 O* ]3 g. v) N3 Q. L. d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% z5 d- T5 Y. W: N& p3 y8 O2 x6 e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, `: M8 f7 x, z4 N9 }' R- _0 A* G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, N4 P3 V1 [) A( D5 d% ]+ d7 b/ a9 M - #else' ~1 D& a% H0 U- J. m, o* L
- #define DMA_PRINTK( x... )9 X0 [+ |" j% X0 b7 g+ k" S8 |
- #define DMA_FN_IN4 }& G& g: R) y0 T
- #define DMA_FN_OUT
% q' R" k! \/ b" C6 h) } - #endif. A9 B3 E. L. J* i
- 7 _4 j& j6 D8 c# z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# @! l1 C8 R* d- d
- #define STATIC_SHIFT 3
% E% U8 x$ u9 e1 T2 s - #define TCINTEN_SHIFT 20
4 q- R6 b' W, w& v( V - #define ITCINTEN_SHIFT 21
6 S' [7 H2 N! d0 K5 \) M& ^ F& G4 ~ - #define TCCHEN_SHIFT 22& J3 D1 ^7 g" [- v2 l" w+ b
- #define ITCCHEN_SHIFT 23
% S j( Y5 h; w' N& C( x - + V# H0 j) {, X. J6 i
- static volatile int irqraised1 = 0;
. f) K; H# V7 [2 \1 r - static volatile int irqraised2 = 0;1 e; h7 b9 ]. m! O
- 1 u1 l1 f# B3 E! _' T4 t# u+ H: n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 I" x0 O3 \( Q" b9 Q) x- q5 e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* w" T4 ]8 ?0 f R" B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 A" _5 j+ o9 g6 [; B - % _* d" w3 _. `# m; g
- dma_addr_t dmaphyssrc1 = 0;& d# s4 b+ T7 I+ {0 D% x- g9 ?5 ]
- dma_addr_t dmaphyssrc2 = 0;
2 Z! D( d' _, O( Y4 K: D - dma_addr_t dmaphysdest1 = 0;
9 y" y b! k# c7 ?' w q: n6 F% X/ D - dma_addr_t dmaphysdest2 = 0;
# E) q" c) a% L* p: ~, ]; h - 0 s" E: i6 E6 }$ ?
- char *dmabufsrc1 = NULL;* N1 y* A' n1 A
- char *dmabufsrc2 = NULL;
5 n8 ~# g$ S# _& `# G( o" X6 @7 y - char *dmabufdest1 = NULL;
' ]5 m( f% O4 N V3 p0 `3 n: S - char *dmabufdest2 = NULL;6 I/ r. z9 N2 Q* H X4 O
8 H( Q& f% \- u$ g9 x, j) B- static int acnt = 512;
+ L# ]" d( M g- D - static int bcnt = 8;& E$ V e2 I0 O* r! ?4 |5 e
- static int ccnt = 8;# c0 T3 t6 ?( c1 n7 G' m
- ' O6 x0 x, e* h) H0 X5 V
- module_param(acnt, int, S_IRUGO);" H# {( Q0 `8 ?3 m$ m+ k0 l# P
- module_param(bcnt, int, S_IRUGO);
$ Z' b; X1 f0 ~% U- ^6 i - module_param(ccnt, int, S_IRUGO);
复制代码 3 b$ K$ r$ F2 M1 S
0 Z, O6 C L' x, ~6 S5 s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& r1 Y" ?9 r" e- @3 `3 {
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 B; q7 M" ^& N* X8 Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, S, R+ m" C3 V. A+ ~) v
! Q2 K m0 j e' w* ^- X3 a3 q- Y& S4 [: z
|
|