|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
n0 f; _; N* v# W" A) D% W- [code]EDMA sample test application
. i1 ^& G8 I( |) ~. m9 O$ K) @ - /*
: B: F3 J- P4 I& Z1 n# s - * edma_test.c# f9 U/ G+ i) L3 a( t7 C8 m
- *( w, x% w1 r+ i% m, Y4 g
- * brief EDMA3 Test Application
6 j. O7 `+ }+ Y; ?2 F - *
: f/ X; D( ~, ]( }4 o/ u. R6 N/ n - * This file contains EDMA3 Test code.( o9 d/ i7 Z3 Z' l+ T
- *
5 X3 A) t4 ~& w4 B& O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) Q* U1 O7 b* i3 {! d r6 @7 C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ a1 A8 e3 ]) z8 V1 {: y( ^ - * TO CHANGE.
" `3 d1 x8 D0 Q; @ - *
W# f' i- U: V* H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. b% s. Z3 w/ F5 Z - *; Y* K7 t' y8 |4 ^9 U& R% o
- * This program is free software; you can redistribute it and/or; _; V/ i$ b6 z9 D
- * modify it under the terms of the GNU General Public License as: e3 ?4 W+ c! Y+ {9 F
- * published by the Free Software Foundation version 2.
0 R# E: |; p, i! L& [ - *
9 R; K, z8 s# K8 \0 a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ S' s0 B: v' G) Y5 K - * kind, whether express or implied; without even the implied warranty+ S" G. ]6 I, L/ L$ z* `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 \7 v/ `# x) ^/ r$ T5 p1 O$ W5 w - * GNU General Public License for more details.
1 h: ]1 i& ]& r7 K1 N - */3 \4 `1 u. x& V( Z0 j1 _; I
8 z e" D) `& J* t- #include <linux/module.h>4 Q" D5 ~- K1 h# y( ?- X7 E, J, z
- #include <linux/init.h>2 L- u; S! u* [& Q) S
- #include <linux/errno.h>
8 x1 G; X- J! j - #include <linux/types.h>3 Y7 p( |: \2 f R. m1 V, D
- #include <linux/interrupt.h># a5 P8 r$ k" j! n4 ~# e
- #include <asm/io.h>
, z) r. q' a2 R; y+ I) G2 q - #include <linux/moduleparam.h>
* @& B4 `8 f2 A$ n - #include <linux/sysctl.h>' h1 v$ B/ o: z0 w) l0 q B
- #include <linux/mm.h>
8 Z7 m0 \- C0 ~$ w% O - #include <linux/dma-mapping.h>
4 h' x: [: D) r# G% z$ G/ n - & H. ^6 G3 N' P+ \; |# E
- #include <mach/memory.h>
% C: C5 @. r1 S - #include <mach/hardware.h>* |$ y. u6 p4 G- t
- #include <mach/irqs.h>( \; v4 i! Q/ G$ B# C6 {2 a
- #include <asm/hardware/edma.h>
0 L& U4 `7 M7 R: M - 6 G" u& m# p" r9 E+ J4 ^( l
- #undef EDMA3_DEBUG2 z0 j* L% E! K
- /*#define EDMA3_DEBUG*/
8 `1 w$ l4 z) q. A' ^ - 9 E1 y9 [2 `2 X+ @/ }/ Z
- #ifdef EDMA3_DEBUG
3 t' i9 u, A% D" a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 F% T6 n J5 E" n: j. X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- T( X& @5 G% m' P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- k1 y% @! j6 V/ C
- #else/ ]7 Q& D/ o+ R W! `2 L% T
- #define DMA_PRINTK( x... ). v8 N A% i j& t) M) {# C
- #define DMA_FN_IN
/ a$ {0 _1 Q( f - #define DMA_FN_OUT
4 p: m( Y @( o( ~ - #endif
! S) N. z( `$ z - * f+ Z4 R" m7 H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) z6 B' d" V6 f% z' n' ^. b# k! z - #define STATIC_SHIFT 39 n7 I& |: Z; s8 s. V" w, o r
- #define TCINTEN_SHIFT 200 w7 Y, ]$ e6 Z+ g8 @) c* c9 ^1 p
- #define ITCINTEN_SHIFT 21$ h G- O/ P- i/ _5 D
- #define TCCHEN_SHIFT 22: d; Y% n0 R& ?; e, G& d
- #define ITCCHEN_SHIFT 23
$ [3 U% i5 L6 i: y" T8 e7 R1 Q$ Y
6 J9 o+ l$ p. r; [: g- static volatile int irqraised1 = 0;
* Y- w! O6 s1 m6 b! W% V - static volatile int irqraised2 = 0;6 U9 r) u3 |% b9 r
- ! c( C. i- m# }& u4 q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- d/ K. @" c4 [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. ^! `3 D1 ]" ^" Z1 x ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# X4 w8 A. W0 a
' E- ^( r% W& `( N- H: ^8 V- dma_addr_t dmaphyssrc1 = 0;
' L" L2 @+ T3 J - dma_addr_t dmaphyssrc2 = 0;8 h6 G& _1 h! [0 A' K; e4 R" W' k4 K
- dma_addr_t dmaphysdest1 = 0;
: O0 {- o" r- b) e - dma_addr_t dmaphysdest2 = 0;. N% d- B, [& ^* v4 Q* s) B
- 7 D; f1 s# g& X6 I0 S6 B3 x
- char *dmabufsrc1 = NULL;
* u* |- q, }4 H9 ? - char *dmabufsrc2 = NULL;8 i6 E8 u$ X, v8 U7 B6 a: E
- char *dmabufdest1 = NULL;
# Q* p0 Q! g \; `8 f5 k* q4 i - char *dmabufdest2 = NULL;# q0 \+ p2 u* T0 P
' L& [, B. d% r: c- J0 o" U- static int acnt = 512;# H; Y9 }- h" B' S9 M; X) c
- static int bcnt = 8;. O. T- J, ^, r7 [' J i& D7 G, Q
- static int ccnt = 8;
6 F0 N& }' F" m3 O1 Y- n
* Q" ~7 a( R+ [# ^- module_param(acnt, int, S_IRUGO);
" Z! D* w5 W5 {& ^+ m8 p( o7 y - module_param(bcnt, int, S_IRUGO);, W R" l/ N: k& w! [! b3 s
- module_param(ccnt, int, S_IRUGO);
复制代码 5 U- V% c! m( }% u- [
9 F+ w; U+ ~' n) p: h/ P% o8 Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 J8 Q! \0 F) g' w% L, varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! [& ^! K! O$ T5 P: C0 K: y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& q! u Y% l% f- B; R! V' ^, m
- v* X5 I1 ]+ e1 @" }3 [: V4 k% X4 l! p
|
|