|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! K( g3 R( `2 i p; d4 X/ |- U
- [code]EDMA sample test application6 J3 g9 D6 Q4 }% w3 j- Y
- /*
) C4 c, }9 J1 g x9 Z: i- L - * edma_test.c' v. J1 \' }4 Z# d% U$ h
- *; K% Y8 ]' n. X( X5 p6 [: S2 x( W
- * brief EDMA3 Test Application
# y; z1 o r- s* g, v6 C; N9 \ - *
/ D% Z! {. ^8 e0 C - * This file contains EDMA3 Test code.
f( |3 u" }( L8 B, q3 ^ - *
e" Z" P7 Q: b5 E+ E2 w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* F. ]6 B) d: e8 c7 X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 Z5 }1 c6 W4 W) A* [' I$ z - * TO CHANGE.
3 D! Q. s7 \: G' T - *
( V$ y7 c! X& V) G# h5 }9 I' L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; s; l7 ^0 X" a. p& j7 O2 r5 ? - *
; i/ _- w8 d: X1 S* f/ J - * This program is free software; you can redistribute it and/or! U0 T& E" v% w: q7 ~3 A: m
- * modify it under the terms of the GNU General Public License as
: ~# B1 h- Z2 h, k - * published by the Free Software Foundation version 2.5 [6 m" V6 f" }$ N) P. A
- *
8 ~/ V4 d6 r0 n2 r8 A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' j0 n* q, {" z; U
- * kind, whether express or implied; without even the implied warranty m8 ~: o9 g7 f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& N: s+ d5 [7 Q
- * GNU General Public License for more details.! H0 s6 p9 d) @- Z/ d1 @
- */
0 Q8 ]( V5 Z3 ^7 } - ) m f( ?- [$ L% w' _* ~4 d
- #include <linux/module.h>, Q( o( P* G2 q2 [7 v) }
- #include <linux/init.h>
) Z: N/ d( l3 f& J - #include <linux/errno.h>
+ @- J9 e3 r, S; H; P' k! m - #include <linux/types.h>
" J( d# ~3 {9 _7 m4 g- a) _ - #include <linux/interrupt.h>* ^* q7 v' ~- b
- #include <asm/io.h>: h: e" S. \" \! o5 _+ ~
- #include <linux/moduleparam.h>
; b; K, X* S: L' d, \6 a/ x - #include <linux/sysctl.h> v4 ?, ?$ Y$ X) L$ {
- #include <linux/mm.h>, K- e# P- s' N- P. a1 z- y
- #include <linux/dma-mapping.h>0 ~+ _) \3 E) h* g4 @$ p. {7 r
) ]6 O% Z7 V7 U8 R4 t- #include <mach/memory.h> ~0 Z. E0 z. k, v, B5 Q5 v7 p- k [
- #include <mach/hardware.h>
# I" u; q4 B: b3 } - #include <mach/irqs.h>+ I9 ^, p, C+ Y/ f. d3 W
- #include <asm/hardware/edma.h>
2 O! Q8 S3 ^( O7 U* U/ L - 9 L" R( O4 g4 _( \; E
- #undef EDMA3_DEBUG
' {6 n: T' {2 E) l, e& V7 B - /*#define EDMA3_DEBUG*/; l" T9 {: v3 f# n4 E
- ! C# V: c& r8 @) s, J' t: m
- #ifdef EDMA3_DEBUG) E9 d% W& q( w7 R6 K. m- x: ?5 {9 D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ f( K8 F1 _- h! ^$ g0 t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 k4 M% F+ @( x& k; L5 ]! F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ Y: |% Z8 O- x1 U5 q
- #else k- G! y. g; V2 B- O0 ]/ P
- #define DMA_PRINTK( x... )
$ L0 Q. a( f9 G; x! z - #define DMA_FN_IN
& H. c( e9 }4 ^1 a9 ~ - #define DMA_FN_OUT- Y, w! \9 X, o( \* G' w8 ~
- #endif% s! A) X$ \) \, ]* S" j
- $ l H ]: v" y+ k# g. n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 a, H0 l2 q0 U4 E0 r1 a
- #define STATIC_SHIFT 3
+ X$ Y7 W" L0 ]8 M! ~- J - #define TCINTEN_SHIFT 209 W( P% n( k& S9 x" w |
- #define ITCINTEN_SHIFT 218 U& n* Y- E, U
- #define TCCHEN_SHIFT 22$ L/ R" u9 h# z+ U) j
- #define ITCCHEN_SHIFT 23
g3 I3 |1 c: r; V5 U! B2 S
P7 {0 ?2 O ~- static volatile int irqraised1 = 0;
" t& \+ n; \5 d% m; p" K8 ~, w - static volatile int irqraised2 = 0;5 x- y% M4 l& ]) [3 n- h4 {" w
- % _/ G: c7 c0 t$ ~. n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 d9 p& f( V+ m4 R, \2 W8 G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. O$ ]5 T" [9 [* f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& d3 X1 g5 E" O$ `
: f5 k! H5 m* j5 h- dma_addr_t dmaphyssrc1 = 0;' f/ j# A$ J' v) F6 u
- dma_addr_t dmaphyssrc2 = 0;7 T2 Q% O% A! T4 [! j# p
- dma_addr_t dmaphysdest1 = 0;
6 @6 K' B2 Q$ L1 B8 m - dma_addr_t dmaphysdest2 = 0;2 z1 Z2 N6 q9 W
- 2 \8 w: b& q9 ?4 ]" p
- char *dmabufsrc1 = NULL;
0 T1 |, @; [. Y3 j1 a - char *dmabufsrc2 = NULL;
+ k$ S" B( |' A0 W. u* k - char *dmabufdest1 = NULL;& k7 B7 z+ R( ^0 v
- char *dmabufdest2 = NULL;6 Q0 n t5 N# w$ S+ a' {
- % \2 F( O4 C7 P% M5 Y8 [/ y1 _
- static int acnt = 512;
+ h% b1 r/ \6 q - static int bcnt = 8;5 V5 J; [+ o+ y, P) w1 p- L
- static int ccnt = 8;6 f4 }6 c# I" r+ X% c0 w; `# N* U
- 3 [3 D C; X6 | |. o
- module_param(acnt, int, S_IRUGO);
: Y: q/ W6 H2 Z+ ?5 [ - module_param(bcnt, int, S_IRUGO);
6 q* L8 h* P+ }* N$ z4 { - module_param(ccnt, int, S_IRUGO);
复制代码 - I/ v" O+ m$ R. k( t7 ?
, \8 N$ N6 h! H1 j n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ V$ h3 B- a; b4 T$ \1 R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 X v% I( w( N& D9 c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' t0 Z5 \- j/ N( y; U
+ a, V6 s, x; b3 X5 F1 Y# J3 Z2 B- q: L' x' Z
|
|