|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) X( k' c3 U6 j% n( I- O9 z
- [code]EDMA sample test application
" q; ^3 [& x/ W7 z- b - /*0 M& n4 ?: O. b6 F
- * edma_test.c$ |, S- f1 E3 @; g* Z5 L J9 E
- *# X/ F0 T! r y, E) q4 Z
- * brief EDMA3 Test Application* A# V6 `1 d2 l, K1 Y
- *
+ g1 E" g+ |9 W - * This file contains EDMA3 Test code.
7 K8 J" }4 j- @9 }* A* ~ - *. Q& |3 k; X2 I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- h \! h, }6 C" y; C! E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& `2 @/ L2 G2 ]( E* v S N% G* p0 S
- * TO CHANGE.
* ~+ ] j& x0 F( F; `5 P3 I - *
, T$ f5 b: X& w2 |- N$ I3 d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 s$ e2 Z! n7 s6 G: j
- *8 t% a% \* L4 N" T
- * This program is free software; you can redistribute it and/or- G; t; }9 h. I* H6 V5 u8 |" ~6 ?
- * modify it under the terms of the GNU General Public License as
6 {. U7 A6 W( @/ ~3 o - * published by the Free Software Foundation version 2.. P: [7 s$ {6 V8 l
- *# M ~, `6 F7 E0 o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any G: J2 J. k/ r
- * kind, whether express or implied; without even the implied warranty
- d# I3 w( ? m) U9 a+ w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- y, y, u* S5 I. @: \
- * GNU General Public License for more details.: D) O& o, j o/ u- `
- */* g, M5 m8 T6 k! l
- 0 D( C4 }+ T: }" H6 |. S# U
- #include <linux/module.h>8 C8 M" m+ ^6 ~4 x3 `1 J$ t# `' c
- #include <linux/init.h>
3 K% A2 t l+ S* }9 B4 j: O6 G3 d5 f - #include <linux/errno.h>
1 P) q4 {( A/ b - #include <linux/types.h>; y% w6 w k: H# h" J' J+ ?
- #include <linux/interrupt.h>
8 }$ P& q3 i" \# ] - #include <asm/io.h>
; @7 i% K& O9 f' a; ~( C% [ - #include <linux/moduleparam.h>/ q! A4 I$ V Z3 o* f( \
- #include <linux/sysctl.h>
$ U. o& j+ i! j/ u$ u/ R4 m - #include <linux/mm.h>
" p% B2 l# I- {+ B4 z2 m - #include <linux/dma-mapping.h>
1 m3 c- \5 I8 h/ F; s: d - & j. X, v4 b" a( }2 [# J
- #include <mach/memory.h>+ _" W; `% ?8 Y3 j
- #include <mach/hardware.h>0 m: [/ s! P# p& ]- b4 }9 d/ i3 b2 A
- #include <mach/irqs.h>
) o+ W* o9 @; s, y. g - #include <asm/hardware/edma.h>
, e2 B' f) z; g+ N, B - 3 [/ n+ U8 d+ x t" Z2 i5 Z
- #undef EDMA3_DEBUG
9 t8 g$ Y6 D% k r; ~ - /*#define EDMA3_DEBUG*/& I& C {/ ]7 W) U. l: ~' t6 |
+ i8 d7 \$ @% Q5 \* V- #ifdef EDMA3_DEBUG5 C# r D3 }" ^' o- C- |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, A5 D6 j! ?3 s5 H* j1 M7 m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 V% G( @8 s# I5 _3 [' d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
G9 m1 K! t5 F; x - #else
4 H4 f* V8 v2 ]& P - #define DMA_PRINTK( x... )! Q! ?" K; l, k. u% [
- #define DMA_FN_IN
4 A4 q# p1 s$ p4 F - #define DMA_FN_OUT( F# q1 n: ^9 O9 I2 V" I
- #endif
2 g3 Y- [ Q: u% w b" A+ |
# z [2 ?0 r2 l3 O) z% |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! B: r2 _9 I" Q- I: I+ p
- #define STATIC_SHIFT 36 g: a' L- U6 ^" |) l7 G% I
- #define TCINTEN_SHIFT 20( e, ?' ^3 |# F
- #define ITCINTEN_SHIFT 21
& A% m% c* _. W9 U - #define TCCHEN_SHIFT 22
, t- c% m+ e- t% C2 R7 @0 s - #define ITCCHEN_SHIFT 23' M) O. A6 i0 g" i! u
- # @4 V& T/ w4 \! n9 W6 A" G, c
- static volatile int irqraised1 = 0;# j/ N- @+ P7 X* _1 z, ?8 e
- static volatile int irqraised2 = 0;, D" F& t" i `9 b
5 T1 \3 O+ `1 y3 a: z' Y; o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! D* N! o: l5 N1 s4 L2 s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# Q8 J% c4 y' i' g8 z( i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ r9 L: i, x* s
2 ]8 I7 A2 y1 A5 @0 H9 m+ ?2 }- dma_addr_t dmaphyssrc1 = 0;
( N% \- p# `4 x$ b. ^6 n5 G - dma_addr_t dmaphyssrc2 = 0;
2 D! p" a' f* m9 |8 U. } - dma_addr_t dmaphysdest1 = 0;
) F) V) U- @1 j$ g; v - dma_addr_t dmaphysdest2 = 0;
( K/ W5 X' ]/ |0 [0 N - 7 n7 B4 W6 Q8 r" }9 {0 z
- char *dmabufsrc1 = NULL;% V, R& c- V6 l# W) x: D
- char *dmabufsrc2 = NULL;! D! }- v8 r$ |, I; `; U
- char *dmabufdest1 = NULL;
4 B s0 b9 ~' k8 c# W - char *dmabufdest2 = NULL;
2 o0 u5 p+ K1 c3 Y. v' P - ! Z: t8 K* K( Z$ @; F
- static int acnt = 512;: h. ?4 p) u. ^8 ?
- static int bcnt = 8;
/ S$ J3 `. [8 F - static int ccnt = 8;
9 x" G3 M% u W: }! K% \8 x - . C/ f( s9 _2 j7 X1 ^2 H6 y1 ]) z
- module_param(acnt, int, S_IRUGO);! j$ M8 j7 e+ f
- module_param(bcnt, int, S_IRUGO);
5 g& l. E! m( v. o1 | Y; |# V - module_param(ccnt, int, S_IRUGO);
复制代码 A) y. V4 ?) q7 w: W f- }) V' K
/ `+ d& B+ Z4 d/ I8 |; q K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 x) r" Z% C* S% O$ N7 S( A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 O+ g& d1 I& x" i' K% l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ k9 D9 n! L: s* g1 O" `' m/ { t" x) Y' H3 X2 T0 s/ W' k+ c, R
J3 _& l; N- t# T( a/ h2 E8 q
|
|