|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( k* o9 U4 R8 }, u0 b* u* C5 a( g* Z- [code]EDMA sample test application9 [9 C* }" [" h+ e8 ^. r
- /*9 }4 V0 ~; _. u
- * edma_test.c6 E9 j: J) b% d, l3 b
- *
7 H: ~( W; A5 H1 k5 v+ Y2 L4 B - * brief EDMA3 Test Application9 w& \, X4 u. A) D! i( _! l+ y
- *6 N- A. K b, \9 O( S8 w7 Z- ]# \) Z
- * This file contains EDMA3 Test code.$ H1 J4 w' q+ w- w1 D
- *. ?4 G; N# w x6 X$ S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# Z. X1 h/ a! [2 F# A* K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, U# m$ W) R# s `0 e& E
- * TO CHANGE.
* f5 C% P6 {1 G" ^ - *( `3 H3 X( O' `/ q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ E4 s, U( m' b) C& `$ a% n% |+ @
- *" b1 Q+ X, B9 q. }: e
- * This program is free software; you can redistribute it and/or
$ C0 T; N3 k& y - * modify it under the terms of the GNU General Public License as
5 i& r9 t/ E$ Q" O - * published by the Free Software Foundation version 2.
; u4 ^( j8 q* d. t% y - *
3 @8 q% l6 S+ U2 p# [" ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 ~# F$ D7 ]$ ~$ a$ [ - * kind, whether express or implied; without even the implied warranty4 V6 A2 v" t9 _+ J$ n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 M$ J; d; f$ ]; }4 s - * GNU General Public License for more details.
" j) T6 p& x8 i" M1 y - */
0 E. t/ y# x( r: | - + m4 d' O6 V( D j& Z0 W( W
- #include <linux/module.h>7 h/ g9 C& i* W; M0 M
- #include <linux/init.h> i4 F5 J: Y( \+ B; g( L
- #include <linux/errno.h>
4 D- M& q3 j Y w: f( h6 | - #include <linux/types.h>6 D) o/ O% x4 d$ V- _1 @4 l
- #include <linux/interrupt.h>
* t- u% r! }; c: `( Z. L - #include <asm/io.h>9 c1 }3 N" [5 c* W9 A
- #include <linux/moduleparam.h>; k. N( h1 A! z) C8 H' E$ M: c
- #include <linux/sysctl.h>- N: Y% X& u8 t) m3 F
- #include <linux/mm.h> L' i0 \7 V ^
- #include <linux/dma-mapping.h>- Z# a) N$ _/ |5 L' |
- # O+ S/ x" Z% {+ J: M3 w
- #include <mach/memory.h>
; s/ [" g% B& m" j* h - #include <mach/hardware.h>7 ^+ }' \2 @1 w1 k0 G& Y5 M w! D
- #include <mach/irqs.h>' J8 n/ B) z" \* i/ C
- #include <asm/hardware/edma.h> |2 h" n4 y* v2 c/ R
2 Z% r1 N) h- S/ d3 y. @- #undef EDMA3_DEBUG* A/ M, i* L+ W! U8 j H Z: X4 F3 J4 g
- /*#define EDMA3_DEBUG*/
. ]# I- `$ N8 M4 k1 b - # C* ~1 Q2 p U/ g
- #ifdef EDMA3_DEBUG* D/ I/ Q7 \, J \+ Q* m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): F4 l' Z: {; ?6 _) I1 f0 K% O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 w; a* [; f- g0 Y8 X6 d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* D7 d" r% ~7 e - #else
* m% ~* k+ ~3 r" [+ B6 v/ c - #define DMA_PRINTK( x... )
, s0 {7 }% T) ~ - #define DMA_FN_IN, F1 X) B2 f- i1 h% W" u6 M
- #define DMA_FN_OUT
3 g& [, u! A( u. x% I - #endif5 } E' \* w4 F
- . o' l/ A* k% W( ^
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) A! x* m, y- r/ h' d% w( V
- #define STATIC_SHIFT 3
/ G, h6 D9 o* i' w& N; Z+ G- Y - #define TCINTEN_SHIFT 20; t! a" f" V: @5 Y3 @9 j: I+ V
- #define ITCINTEN_SHIFT 21+ u( X9 I7 I* h
- #define TCCHEN_SHIFT 22; o8 m( K* l+ Z2 K
- #define ITCCHEN_SHIFT 23
' Z5 ?( `# C+ W9 p - ' Y6 c3 P, m" w
- static volatile int irqraised1 = 0;
% x) g. m+ T; _; e1 ]. N - static volatile int irqraised2 = 0;0 W$ T s/ ^ M0 l) q1 C9 F$ N9 E
- + m2 c) i' [' ^6 p+ u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 L& c9 Q; j6 _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 ]1 {. z3 l! ?3 s7 f' d4 J2 U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 ?. I! X$ \1 Y! S
5 Z+ J# b9 }* ~6 S3 |6 p% D- dma_addr_t dmaphyssrc1 = 0;! x" e2 d1 Y* ?& d1 ^7 V
- dma_addr_t dmaphyssrc2 = 0;
6 Y6 g( `' }, f9 [' Z+ I - dma_addr_t dmaphysdest1 = 0;
' L( `6 ~1 b w, I+ j- |8 j - dma_addr_t dmaphysdest2 = 0;) `! u% E2 L3 A. a+ O. g4 e0 P- p
; j6 I) H& T; ~7 s9 [' f$ G7 e- y/ r# j- char *dmabufsrc1 = NULL;
+ j* L U5 W: A2 g8 [. T5 P1 h* ]6 m - char *dmabufsrc2 = NULL;
/ A' V, s T( w" E6 M - char *dmabufdest1 = NULL;) C m1 o ]$ d) W# k) T! C- g
- char *dmabufdest2 = NULL;
5 \: z: c) k0 H5 `1 s3 n' Z& F7 ` - ! j- t% j: W. M1 k! h
- static int acnt = 512;/ e e) E! ?) A0 ?" I, |( P
- static int bcnt = 8;
/ D, `" i& w5 c$ ^" y3 u - static int ccnt = 8;9 q+ B/ d [, a7 z3 R
7 O. H3 O' a& m3 x3 ?- module_param(acnt, int, S_IRUGO);4 O [: I" ~8 Y- X7 ]
- module_param(bcnt, int, S_IRUGO);8 g2 ~/ L) [; ^/ j; F; G
- module_param(ccnt, int, S_IRUGO);
复制代码 - N' j4 t# J: E# N# f) S7 g. b& A
; {$ |$ s8 t6 ]8 ]! C' I2 u, ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% X9 \; L& v# Y) L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, N$ b: j$ |( \7 \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* S& |+ f6 H1 f3 M, K0 K8 ~9 [ i, g7 |
8 T6 {) y; R* \: k! l0 j/ u |
|