|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 N: @: S5 g) {% T# f% o
- [code]EDMA sample test application
9 a! r1 S+ U4 K' w, k3 r1 I - /*
6 n' C$ v' {; W& j' d - * edma_test.c
: }3 b( g+ J- a* e8 W: h! n - *
3 E U/ d( l7 [5 F4 |# s - * brief EDMA3 Test Application% j9 v* q: \0 {4 i& ]- y
- *& | R8 h$ b5 N6 x6 P
- * This file contains EDMA3 Test code.
3 r1 X" s( H1 I - *. d/ h9 u& K& l. u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 ]. A8 K' G [+ w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& _7 X4 X A' h/ `( [( I( S - * TO CHANGE.
2 }/ K' U3 \! a5 ] - *
: w/ c$ c3 i& G t' l. | k4 P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 @( B E8 k) F0 l' O - *' d7 M" |$ W4 h' A5 `
- * This program is free software; you can redistribute it and/or$ b0 H0 U7 _0 U9 B
- * modify it under the terms of the GNU General Public License as/ [% r' U; {/ U. k' _, K
- * published by the Free Software Foundation version 2.
, P" r- I. C( Z% L7 o - *
8 G( Q. g4 R; p6 o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& N/ A: m/ a5 d2 P
- * kind, whether express or implied; without even the implied warranty. R3 p+ d" O9 ^ Q* b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% V5 [+ u* C, G; K L8 b
- * GNU General Public License for more details.
& ^, J4 ~5 V+ ?1 v; V4 M: k2 b: C - */8 D8 S& d; j5 \- \5 i8 O
* z( c+ f$ ^& V$ n3 A- #include <linux/module.h>5 M) B; M7 C4 H# T$ `
- #include <linux/init.h>
+ G' b3 u* U8 \+ }8 ~( J - #include <linux/errno.h>, P h2 [8 |9 D6 S8 h) A
- #include <linux/types.h>( @2 }4 ]$ f$ U! [ T2 A+ d
- #include <linux/interrupt.h>6 {- B2 t7 j( j9 j8 T" [0 z; C
- #include <asm/io.h>9 g( Q8 B& W o, g4 g
- #include <linux/moduleparam.h>
1 I* P+ v! D$ H$ d- H8 N, F - #include <linux/sysctl.h>( A! Z( |" f, L
- #include <linux/mm.h>. i5 H+ X% A- E2 M) |' q( ~6 g2 M6 N. p
- #include <linux/dma-mapping.h>
. z1 l3 R9 z: ? - . S: ^2 L) t% K# _7 Z
- #include <mach/memory.h>
4 y- W/ }; {+ Q5 i; u. I- t) G - #include <mach/hardware.h>) j, ~* Z2 }; B" l: S
- #include <mach/irqs.h>
- O- h/ p" p5 x5 V. M- A& D - #include <asm/hardware/edma.h>
8 s- F; j S8 Z \! D% q" s: {; B
' w' x7 |4 e; }8 ]- #undef EDMA3_DEBUG) G' |7 L& F! I$ M# N
- /*#define EDMA3_DEBUG*/& r$ ]9 Z! j6 D5 Q
' H2 }( U1 @8 P' r5 I7 d* ~- #ifdef EDMA3_DEBUG
& P; I6 R- i+ t# e6 Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- E3 L+ T& m9 ^1 N3 R" P+ ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 d: [, Q6 z7 `* k0 w* P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( o4 U, M, Q- i( C1 v; [- ~$ K - #else( a7 W1 P' {1 C B3 s
- #define DMA_PRINTK( x... )
5 A$ ?% V% C) Y( G6 Q - #define DMA_FN_IN: J i. p" |/ s2 T" P
- #define DMA_FN_OUT
3 Y9 {3 y. v" p7 r, C) q" x- f - #endif8 T$ ^. g+ d) D9 Z4 ~+ h1 W8 W
- 4 t# z, M% M( N3 a j8 S0 @! X- X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 ?* q; \# S! r, s* g6 O0 y9 O
- #define STATIC_SHIFT 3
0 c7 @; a( K) p0 f - #define TCINTEN_SHIFT 20" X- N0 C. v* [
- #define ITCINTEN_SHIFT 21, W4 o9 I* U# f q
- #define TCCHEN_SHIFT 22; H! ~3 M8 U1 ^- c5 T& `
- #define ITCCHEN_SHIFT 23
4 r/ }/ h% W c, P. v8 u: F n; R& f. x - 4 c/ O$ ?7 i; C3 A9 s# h7 ?5 i( H
- static volatile int irqraised1 = 0;) I) K4 a( y( d, ^2 I% n- O
- static volatile int irqraised2 = 0;# k: b, X1 M7 ^# J
- : [, s& X+ `2 d p* [) m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# V# \4 x$ x0 X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) c% m$ B( C6 L- k) M6 a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 @0 d: A' B0 e2 E$ s& a7 E
" [) }* ]. _- b- dma_addr_t dmaphyssrc1 = 0;
/ X' {5 c* @! i2 A - dma_addr_t dmaphyssrc2 = 0;5 }- S5 E% ?* y5 B3 k
- dma_addr_t dmaphysdest1 = 0;
. t5 j9 L9 q4 w! y" ` - dma_addr_t dmaphysdest2 = 0;
9 I6 Y5 Y! Z: N; B c4 F
1 u, @1 Y7 `& K: ~" W4 [- char *dmabufsrc1 = NULL;# ~- t# k+ r2 M3 B+ `' m% x( ~5 w
- char *dmabufsrc2 = NULL;
1 G9 o7 U; ?0 }# f) X8 P - char *dmabufdest1 = NULL;
& u' H8 L9 d& ^' ] - char *dmabufdest2 = NULL;& o$ g" N( l+ |- t/ [- [
- , T# B5 [* P8 L4 A: y- b2 a
- static int acnt = 512;7 F5 W! A4 d' R, Y
- static int bcnt = 8;
* p1 `7 T# r3 j, N2 S9 Y - static int ccnt = 8;! B$ n7 e5 Q( a7 g$ {& U0 I
; C P/ Q) A3 D9 S; F- module_param(acnt, int, S_IRUGO);
+ P$ C/ [1 D4 v - module_param(bcnt, int, S_IRUGO);
4 v! O4 g/ ~. t3 | - module_param(ccnt, int, S_IRUGO);
复制代码 - S2 {/ `& S. p0 P( i- @5 }- B! Z& Y
# L1 |6 w I: Y$ d+ n0 z' M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% v, h" U- w/ y" ? D* Z V. K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) O+ g$ ~( {* v/ h* z, Q) n/ L9 c4 D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ |5 ?7 w* `5 _8 T& Z' l4 J* c/ \
- l: t6 I, i' z
* c: Q0 J) K' j2 N
|
|