|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ M6 q9 k8 j9 z7 G# \) `' k- [code]EDMA sample test application2 T: A$ \4 |" `- |8 W( B
- /*( v( e( b8 f1 \) G6 j; @
- * edma_test.c3 V+ R! u( V' R! |
- *
9 m$ w* A" T9 q( G/ l - * brief EDMA3 Test Application
! F! Y0 @8 M: u - *
7 B0 {9 i* i( B" D& O - * This file contains EDMA3 Test code.4 n$ }' W3 u$ q4 a
- *
/ H, A1 S8 F' m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE P1 f; w/ y& |9 d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) E! t' f' Z/ ]+ n% G7 ?) u- T' M
- * TO CHANGE.8 v1 Y2 F9 s: S* I
- * t, Y6 g1 n3 `5 q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ D- L0 E1 l4 _) b - *( i! ]! O$ l8 r* f3 b
- * This program is free software; you can redistribute it and/or
- ^, U% z3 ^6 I" q$ s- ^- Z" n, G - * modify it under the terms of the GNU General Public License as
& W/ b! _+ p% k( Z - * published by the Free Software Foundation version 2.4 R/ q, @. F6 p8 \% F
- *8 v+ Z8 P2 T9 V# t" D( k, B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: \/ Z' E: X1 F0 x, ] - * kind, whether express or implied; without even the implied warranty) \' ^) k+ \* U. K7 A( c. P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 N0 @5 P6 K- v0 d# ~+ ]+ ~
- * GNU General Public License for more details.0 _, I" Z( W% s( ^
- */1 V6 T( B- ~$ E* m/ Y1 i2 [2 G, ?
; u; G8 p9 B9 q; R- #include <linux/module.h>, G, h5 \3 S6 B6 i0 G! F- Q
- #include <linux/init.h>
: e6 w8 t' |; B4 }7 e4 t6 C- u% }3 l9 B - #include <linux/errno.h>3 b- W$ d! S3 |) G8 J; J
- #include <linux/types.h>7 J' c2 ^ n- T0 j- e
- #include <linux/interrupt.h>7 d+ s5 X9 [( ^1 [' A
- #include <asm/io.h>& q$ d, |! Y7 S
- #include <linux/moduleparam.h>
$ `1 f6 Y1 \% w4 C* O/ { - #include <linux/sysctl.h>
5 u. N1 A9 r7 c, t - #include <linux/mm.h>2 B0 s" [9 Y- w7 h' W
- #include <linux/dma-mapping.h>, H" O0 {2 _0 y! r& _
& Y6 {$ d5 F j0 \ ?- #include <mach/memory.h>
c, V& b7 e5 R7 S - #include <mach/hardware.h>; M) ~: O/ Z: W) G) ~
- #include <mach/irqs.h>- ~+ D- G: o# I; B9 U
- #include <asm/hardware/edma.h>( L; R( G. }/ c/ j: q
- . h% Y' f. M2 q; f. L
- #undef EDMA3_DEBUG
8 R5 m2 G4 u. {7 g0 { - /*#define EDMA3_DEBUG*/& g! I- g: E ], D J! x5 k: a
$ K3 y; u! O7 {$ E- #ifdef EDMA3_DEBUG4 w1 `3 G& D5 q! ]; F- |7 E' r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ o2 z7 g% t! y# W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( q V7 @' W. y/ x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); N3 ?7 b. @. J7 J6 B3 q$ p
- #else
* w- y( j- `! e% x. s9 O2 q - #define DMA_PRINTK( x... )* `! l) Z" O, t% n9 M/ H
- #define DMA_FN_IN m! X# H8 G7 ?5 V2 m' ~' L" y
- #define DMA_FN_OUT
/ v$ N3 {) w9 a - #endif/ u9 L; _1 H+ C( `8 i2 \/ H; X
0 a) d1 @$ S8 t0 d/ e# b2 \& O' E5 l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ }+ L8 L5 U/ N/ b, k! }
- #define STATIC_SHIFT 3 L. I2 j6 G* C
- #define TCINTEN_SHIFT 20
+ w+ ~* h: {8 m" c5 W3 K4 a8 c - #define ITCINTEN_SHIFT 21! ^6 Z6 ?/ [8 X( k2 Q7 l% G
- #define TCCHEN_SHIFT 22; \/ h$ z7 G- k; W# ]$ ]$ w& X: b$ m
- #define ITCCHEN_SHIFT 23
& d6 W, z; X0 \/ R1 s
) y6 O. `9 v$ v( \4 h! t. E- static volatile int irqraised1 = 0;
$ L- a* G2 z: x3 F, T - static volatile int irqraised2 = 0;+ s; d4 D5 r$ C$ c1 x7 G2 h
, k2 i5 ~9 j/ I; O* h' ^! B& i0 @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 C0 k. a1 T+ V% } W6 E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 U5 @6 O& l* r. ~0 r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" o0 j( D+ `- B4 Q& z2 w1 Z! v: X
5 H% K- A) R) R0 R+ v, A- dma_addr_t dmaphyssrc1 = 0;
) _6 w* ^" g, B) `' f3 z6 I+ O - dma_addr_t dmaphyssrc2 = 0;2 w2 @" ?: q8 j% ]" [' x; W
- dma_addr_t dmaphysdest1 = 0;
, S# L& ~" w, K9 ]* } - dma_addr_t dmaphysdest2 = 0;
, T* [6 W6 D# ^
4 ?# V8 i/ u5 g' p0 ^: L- char *dmabufsrc1 = NULL;2 i- @+ t, D4 Z
- char *dmabufsrc2 = NULL;
% u- W' k0 Z6 {7 h' p) \ - char *dmabufdest1 = NULL;7 O/ }1 r5 d* |5 h
- char *dmabufdest2 = NULL;
$ _) W4 M1 [+ Q. g, G* t8 n6 B
( M) C8 L% b; _" Z# Q8 g9 {5 ~3 X- static int acnt = 512;
) {: C, P$ h2 D% w& f4 {: M - static int bcnt = 8;
* V; t+ ]7 F$ H+ ]' I3 m, O - static int ccnt = 8;/ o o+ F3 k: X5 L3 O3 Z
( c' @7 q/ k8 p4 d* W% z' d" B- module_param(acnt, int, S_IRUGO);& \, p' \4 t, b8 |2 V, c. d
- module_param(bcnt, int, S_IRUGO);
- b4 f, R3 k1 P - module_param(ccnt, int, S_IRUGO);
复制代码 3 ]" O0 t! ]) N- S: j
2 R5 a9 t, r& S) u' |* L/ h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: k+ t( r; }) ~. m: H6 G8 O% m% oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# l j' }, V6 k' r1 l" L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! ?/ v5 O1 b& {; B: Q' y) C9 n
7 a! k) r6 p8 a1 |3 i/ O
3 \5 W/ y( V7 q, b: z& K+ E0 X8 U3 [1 j |
|