|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . B$ M1 I. ^+ X, c6 t
- [code]EDMA sample test application& K! s* R( {; i9 J
- /*( x: [, }3 b5 G- R% k Z/ T
- * edma_test.c7 s: }5 L# q0 Z3 y/ l' ]# Q
- */ ]9 i, K! \7 K/ S! g
- * brief EDMA3 Test Application, {$ S8 R! O% T% V! r0 B
- *# p6 ]$ d6 u( B5 Y) G5 l! {/ H
- * This file contains EDMA3 Test code.4 Y/ \- h! r/ v/ u9 M5 M5 x+ _. U
- *1 Z1 r- E$ {+ \: ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ M$ N3 E/ q$ I. d7 P6 D1 Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, E3 D2 e% H! V' {& _) L1 K, { - * TO CHANGE.
8 |/ Y; m) U- L* y* R% @ - *. J0 y; B$ a+ e3 _9 A+ G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- U8 g& ~/ r5 a+ I+ s* T - *+ O4 Z" }+ C) W5 F9 C" l
- * This program is free software; you can redistribute it and/or
, ~& G$ m8 f4 N3 v3 M5 Y- s: ^- n - * modify it under the terms of the GNU General Public License as
3 D9 S3 i( |; P# Q - * published by the Free Software Foundation version 2.+ d: h; z& R! I5 X8 y+ i
- *
. ]$ F2 L# s) k. t! |+ u; K4 b0 K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ J% ~* z4 H6 w: l; j V
- * kind, whether express or implied; without even the implied warranty" m0 ~% h: X0 V1 O- w: y) {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; i8 V% Y. Z2 a1 o& ]3 G - * GNU General Public License for more details.
. w. R# b) |5 I$ c% n6 C - */3 ~! R5 h2 J8 O4 z
# K& {) ]) p0 }0 ^, z3 Z+ R- #include <linux/module.h>
2 r( F/ }6 o# d- ]5 { - #include <linux/init.h>1 i* \# u+ w/ s; k% R! R
- #include <linux/errno.h>' G! K8 s g: L0 p
- #include <linux/types.h>3 \1 P, j. U$ U# I5 ~4 o
- #include <linux/interrupt.h>
. m/ j- |6 n6 N( u& j4 U5 b% f9 N' I - #include <asm/io.h>/ k {- G- P7 @& r# b+ B
- #include <linux/moduleparam.h>6 N! d3 e# m, Z$ |. J
- #include <linux/sysctl.h>- V, P( w6 {" k/ m" o6 X
- #include <linux/mm.h>
* X! ^. l' z+ k - #include <linux/dma-mapping.h>6 }/ Y" Z0 j5 V0 w7 T
! E) ^5 J) P4 w6 k' `' N( g- #include <mach/memory.h>9 i2 P7 E- h" l2 o; `1 _
- #include <mach/hardware.h>
6 c9 f' V+ P0 y6 @ - #include <mach/irqs.h>
/ [% j# s* c. {1 z - #include <asm/hardware/edma.h>( S- Y; s m5 ]* `8 R/ n
' |+ L2 b. m. y9 ~- #undef EDMA3_DEBUG
7 P J. a" i% l/ W, l2 X i - /*#define EDMA3_DEBUG*/
. g3 v# j3 z T: s( ~5 H' c* [- w- T: z
+ T& _" O9 \$ \4 O/ I3 F% n- #ifdef EDMA3_DEBUG+ v) V6 m) m: z1 e; \( F7 R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) }( S8 [1 r. P1 g. J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 C% p. G! x+ R* d8 h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
U5 b; x3 i; w - #else% B; g3 G9 ?& D! N3 O
- #define DMA_PRINTK( x... )1 d' r# w0 L$ e+ H( s; i% Q
- #define DMA_FN_IN( O) }/ N- e8 E: J6 t6 B }
- #define DMA_FN_OUT7 M4 y) _5 l. l- N# v, a% e
- #endif
1 x- A3 j4 F+ u/ P9 Z
- o- d3 i. g. c* F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* p& d! r7 e9 r( L, P1 Q6 i8 l - #define STATIC_SHIFT 30 x2 F+ {9 A* z
- #define TCINTEN_SHIFT 20
9 j8 m2 P( @$ e! j - #define ITCINTEN_SHIFT 21
( D1 D/ T+ V# H( l: F1 |6 K4 h - #define TCCHEN_SHIFT 22
/ u: y8 a+ s+ L - #define ITCCHEN_SHIFT 23; ]+ y8 l) f- G9 d
; J( J# @3 h e$ {3 z, X" c5 `- static volatile int irqraised1 = 0;2 d: F5 \, y k: d o
- static volatile int irqraised2 = 0;2 ?$ @9 d" t2 [# \' K
9 @8 D G5 J6 [( G/ y, g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 R8 q( W- l! u7 Y" D0 h$ U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, v5 o7 g- Z/ A/ Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 J3 ?& Y3 P* l! D2 o
- 9 n* m- {7 z$ R' g
- dma_addr_t dmaphyssrc1 = 0;
, S7 X$ Y3 `; u: m3 W" F - dma_addr_t dmaphyssrc2 = 0;/ V8 d* ]! s8 P/ r! s
- dma_addr_t dmaphysdest1 = 0;
0 a9 o9 T. [" S3 T' v' } - dma_addr_t dmaphysdest2 = 0;+ j2 @; b' N1 Z: J
; I) D8 n- i; E5 H+ r- char *dmabufsrc1 = NULL;/ y/ _$ @( [4 R8 Z
- char *dmabufsrc2 = NULL;% _& S5 B. e. i3 s1 i7 X- g
- char *dmabufdest1 = NULL;
: F. Y! ?) P, a, ^# @% c - char *dmabufdest2 = NULL;
5 U1 s3 Z* o+ e( {1 ?2 ]/ F
7 _, i0 A8 ]: O- f- static int acnt = 512;
8 r. z1 S0 H( I/ g+ I" o6 _! ~8 P - static int bcnt = 8;2 l9 Z: a$ L# u3 r
- static int ccnt = 8;
) g1 ?. o! B; i& t7 B
6 V- Z& D, U d7 ]- module_param(acnt, int, S_IRUGO);$ |1 M& U) P U0 }; Y) q0 e
- module_param(bcnt, int, S_IRUGO);+ s$ G! o0 {+ d/ ]8 s
- module_param(ccnt, int, S_IRUGO);
复制代码 * ^( X, B4 l" V9 r+ H/ b
2 E3 P" A1 _: t. j/ h( W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& `7 c8 V$ `. }: y! E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* I, k( F- h& p2 g+ M1 ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 w9 m4 I! J$ D7 [+ w8 x: a' f
2 j4 W( D/ a2 S# C; }8 I" I0 t& v" C5 W# A( C, T
|
|