|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 q, [: R) f. H# @
- [code]EDMA sample test application# ?1 E) N% b6 o, E. x
- /*
. f+ h0 b. e6 W7 j# y% V0 R* p8 A - * edma_test.c6 J8 O" y b7 V W# l* I5 ?+ G
- *
; |. T; k9 s9 `9 g& { - * brief EDMA3 Test Application
- g0 m. k9 |2 v - *
1 e* I# y; ~4 F O - * This file contains EDMA3 Test code.
- G' ?* Y( l4 Q! P: B% y/ P+ `/ s - *8 h, V3 _6 ~: D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* Z$ N) p" W! M L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 U6 C( X! H1 V1 [$ X
- * TO CHANGE.9 U* Q& T6 Q% R8 s4 h0 C2 o
- *
- K7 O; D* J( L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 T5 U& [! A! \8 q
- *
' `2 K% S/ t9 S - * This program is free software; you can redistribute it and/or7 d, V0 ~3 r2 J7 o4 q
- * modify it under the terms of the GNU General Public License as4 i) R$ j/ F5 _# W* `' w! i
- * published by the Free Software Foundation version 2.- F3 `. d- p/ i* }
- *
( P" [7 o' a) P, g, A% y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" q- a5 ^( a( ~. J& `/ n" F - * kind, whether express or implied; without even the implied warranty
! N$ p( K7 l0 _- |" W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 o# C Q& f& y2 k& l - * GNU General Public License for more details.
/ K% L* u& \3 Y# C9 N, T# D" J" |* ~ - */
. L: a- o* C" g& i2 n6 w9 J# G C
% i. J8 R6 K4 t9 X! z- #include <linux/module.h>
' F1 V9 M+ ^7 n! Y6 N - #include <linux/init.h>
% f+ c' N9 z0 d+ M - #include <linux/errno.h>9 z% {* r v- W1 S* x4 M7 ?$ J
- #include <linux/types.h>4 J" T ?- ~- A
- #include <linux/interrupt.h>
8 E5 E" W# W( n% c9 {7 H - #include <asm/io.h>
& I) U( z: H6 @( b6 P3 |) ?5 q - #include <linux/moduleparam.h>6 ^; L/ x+ {6 v B) q9 G
- #include <linux/sysctl.h>9 d+ a$ j4 [+ [
- #include <linux/mm.h>
2 B0 G( `0 e/ s6 T - #include <linux/dma-mapping.h>
7 T I* ^% { x3 R8 T7 B - ( G4 i& u& ?, c3 ~4 i
- #include <mach/memory.h>
; s6 W, N, C9 | - #include <mach/hardware.h>
! o7 c* }& Q' `+ I) T - #include <mach/irqs.h>& C" z& b! v/ ^) `& p/ F# y5 ^
- #include <asm/hardware/edma.h>: c R0 o& w w. f: N5 s1 y( L
- ' f! }0 l, q C5 @& A
- #undef EDMA3_DEBUG
# V1 M% w' U2 ]' @: f - /*#define EDMA3_DEBUG*/; y3 y$ ~8 l+ G/ z5 i" p# f2 ?
- 4 N9 ]: ]7 |. u; V% s# a7 m& h
- #ifdef EDMA3_DEBUG+ ?1 N: a! p6 G, N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( M1 K: K3 P/ k8 ^0 V/ E/ l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; Y5 X7 ~0 N- R7 g2 b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) e% r& S8 V& E5 n
- #else6 y: S1 R! h @+ a. |& `7 F8 K: S
- #define DMA_PRINTK( x... )( o6 h( A5 q* E
- #define DMA_FN_IN# ~0 g2 n- D( Z- t, ^! j
- #define DMA_FN_OUT& W& J4 R( i6 O
- #endif$ O% e, ^- n- i0 o
- ( o! v$ S5 ?4 }( Y* y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( F* X5 `0 ~! N w
- #define STATIC_SHIFT 3
# u0 y! U3 O {; K7 I3 i* H - #define TCINTEN_SHIFT 20- Z! |1 Y& W: Z9 l% u3 u5 c
- #define ITCINTEN_SHIFT 21
+ G4 t/ D5 i% \ - #define TCCHEN_SHIFT 22
& u7 x$ H+ `0 m8 @7 t. E - #define ITCCHEN_SHIFT 23! S l5 T! R. V( W4 v5 R. l
- % o6 O/ K5 [" c* a3 S6 b* s" D
- static volatile int irqraised1 = 0;0 e4 V8 ~6 [+ d- [* N
- static volatile int irqraised2 = 0;' \3 R7 e+ R+ I4 o7 Z$ W
- . K" M7 s! E; N" r5 p$ O( w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 i7 A0 ^. [" \9 S- \2 J7 w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 e7 B) b2 Q8 g: s. h+ q4 Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& v6 A$ i+ G6 r% r - ; G4 M9 z- w* K8 ?9 H6 i! J, ?
- dma_addr_t dmaphyssrc1 = 0;
9 L' p7 {* a$ K2 _' t7 ~ - dma_addr_t dmaphyssrc2 = 0;
0 j6 D* V* D+ F4 d" D7 P, c5 r - dma_addr_t dmaphysdest1 = 0;
2 V4 P9 ?5 c* ?7 {( A - dma_addr_t dmaphysdest2 = 0;
! o* E5 @ }! V - * K2 g5 r e( T2 t
- char *dmabufsrc1 = NULL;
$ l& g) Z* R# d( W4 J - char *dmabufsrc2 = NULL;4 M6 _. q( i8 d s6 B( C
- char *dmabufdest1 = NULL;
2 _7 e2 S# E/ o# p5 X( E6 C* W - char *dmabufdest2 = NULL;
! V- ^- z7 Q& d6 w9 Z5 E3 Y5 q - 2 h3 ~( ^% _/ h% m8 w, {( X3 H) D ]. x
- static int acnt = 512;8 z1 c( A9 o; u6 z0 U
- static int bcnt = 8;
0 ^- f$ G! r# i7 e - static int ccnt = 8;: ]; a/ z8 \/ P+ A4 G; e
- 4 ?9 s" @* F" E7 \' e' B
- module_param(acnt, int, S_IRUGO);" u z: \( c8 O, ?" A& Q' u
- module_param(bcnt, int, S_IRUGO);
7 J9 a: x- B7 ?( C I% U - module_param(ccnt, int, S_IRUGO);
复制代码 ! z% g* }& r& M" W
$ u; g1 v8 i( ~+ X7 P: D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ u; ^8 G7 W1 e% n; J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ R* X/ e2 s3 t4 F! S0 }4 _ W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ z5 H0 l, u) F% l; B, U9 v, E
9 ]" P) t* S6 k5 a _, G
: {9 L* l& g6 D1 W |
|