|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' z- k: O; n$ G' a" y+ x. ?- [code]EDMA sample test application9 ^; H3 k z/ [5 n/ W9 I/ F
- /*& }2 z, ?6 d% f( f# R8 b
- * edma_test.c3 ~" B, C4 z- E8 s4 ]. g9 |/ [
- *
7 _; Y; y1 K0 b# [, O" m - * brief EDMA3 Test Application% C& B P9 f6 z* E# `: M a
- *
' ?6 H0 f" e) S. `& k! F - * This file contains EDMA3 Test code.+ h* Q( V7 p8 F2 j+ ^6 S$ B$ O
- *! p$ Q1 Q- T4 h9 j7 m5 ?, S) `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. J4 _$ I. [; c2 H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 y- s. v1 V' ?: S2 P8 S - * TO CHANGE.
L) Q3 @- q+ T4 z( i! U; Q - *( D! G8 ~* |! I$ }( f" B5 I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ s: S2 ?0 x9 P) o& n
- * l; h& u0 v9 b8 ]& s3 D. h
- * This program is free software; you can redistribute it and/or
4 o9 j8 I( T7 v# I9 y; K - * modify it under the terms of the GNU General Public License as# X- z7 d/ I0 Y/ f, {7 [' m
- * published by the Free Software Foundation version 2.6 A2 n' b' I! B/ f7 a; P! G
- *+ N+ m, m8 {8 z# W7 s( K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, R6 Y7 e+ }* G! W! ^) M
- * kind, whether express or implied; without even the implied warranty" P7 d, Q; A9 N# K! s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 F3 _; U' A) n% y
- * GNU General Public License for more details.
5 j" X, ^6 ]0 q/ }9 a# | - */# o0 |$ E2 S; U: G
- ' r+ g8 w/ t4 \: f
- #include <linux/module.h>8 R& E/ C% ?" c9 A
- #include <linux/init.h>
) s" h; \6 S0 N7 Z8 `$ U8 d - #include <linux/errno.h>
2 g5 [3 T3 E0 c6 i- m% @* O - #include <linux/types.h>
7 I6 m6 }- a: F, J$ m8 }) V - #include <linux/interrupt.h>- O+ G e$ w4 h
- #include <asm/io.h>
" k k; l% a+ h - #include <linux/moduleparam.h>
k, W0 i0 h* z3 p% \! G - #include <linux/sysctl.h>
2 P$ n M4 c: }; L$ ?- } - #include <linux/mm.h>
~) k: e# z4 L5 f" b& c - #include <linux/dma-mapping.h>
# q. ]* [0 }2 A+ Y7 X. m D - 1 s6 s2 u; E+ I* R# w) ]0 o
- #include <mach/memory.h>
4 b) q V1 K$ e6 |6 |4 P9 { - #include <mach/hardware.h>
/ n' ~- w0 T' z( T. ` - #include <mach/irqs.h>9 P' j* G2 q4 n- u. _# d7 \
- #include <asm/hardware/edma.h>
k6 ^" A3 z9 R& \+ p
4 ]( R J$ {) b8 V6 t A, [ T' y8 x- #undef EDMA3_DEBUG) }% q& c, c0 ^
- /*#define EDMA3_DEBUG*/
3 s2 Q" V2 Z; T0 j - ; V9 L+ r- K! P
- #ifdef EDMA3_DEBUG) g" g# \2 M/ I$ X+ d& A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
\5 A0 N; b, R2 \# \, ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
J5 \3 x9 @2 q; r* e) ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 L% I! l/ k7 l4 ?7 K$ }
- #else
( \! X( ~8 }) E( G* { - #define DMA_PRINTK( x... )
+ h& z7 Q& `& Y E8 b - #define DMA_FN_IN
' k: B Y4 H1 c# a p. [( Y - #define DMA_FN_OUT7 ~( R7 O: a P4 k4 P6 n
- #endif2 ^+ \. W l9 I8 P- U) u: T
- 3 T) E# D1 l+ B; C* Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! P* I. C1 d5 P2 `
- #define STATIC_SHIFT 30 u( I& o9 _. F T! Q7 I% Z
- #define TCINTEN_SHIFT 20 b& P/ w! L) `
- #define ITCINTEN_SHIFT 21
% W6 y& I5 j3 F: W$ K: G - #define TCCHEN_SHIFT 22+ }( e3 n" |3 ^9 O, {9 J/ x- j2 k1 s
- #define ITCCHEN_SHIFT 23
8 L& L. A) n) k, [; R
4 K5 J! H( a c8 b# y- static volatile int irqraised1 = 0;* R1 q5 N+ D# H
- static volatile int irqraised2 = 0;
. i$ G( C9 M h/ J0 M; X o - ' r; F" H" \3 F p# Z3 g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ q7 f; ~, J3 m# j' D& R! @# V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 V/ U+ Q( X; o/ Y+ r9 ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 h8 Y9 g ^. E5 d6 j$ K; {
# w9 G( ]0 W& T6 y" K, `: V: `, z- dma_addr_t dmaphyssrc1 = 0;
2 A1 t' o( T# ` - dma_addr_t dmaphyssrc2 = 0;' ^) d ] g# ~! p# x4 e( ?. R) l
- dma_addr_t dmaphysdest1 = 0;7 |0 U2 l! f4 h0 f4 z9 q
- dma_addr_t dmaphysdest2 = 0;- m+ i; j9 o/ o
- - u+ `1 Z& L+ v4 J! L# v4 |0 A4 ^
- char *dmabufsrc1 = NULL;/ B: N, E' J9 v9 I7 A: E
- char *dmabufsrc2 = NULL;
' S _! }0 Y/ ]& j* }. r - char *dmabufdest1 = NULL;; x: f9 g* Q( i0 ~8 ]" k0 M' M
- char *dmabufdest2 = NULL;
4 R% T0 Y- m# k( h1 k7 h - + o8 H6 z- Z; E7 A& \0 ]% f
- static int acnt = 512;( `6 S! r& @% }* ^' c# Y5 g
- static int bcnt = 8;
0 T6 p% h9 O/ Q4 B- s - static int ccnt = 8;. I1 F# r H5 x/ m
- . b# d, Z' D; l1 W C' p) v# D; B3 A( }
- module_param(acnt, int, S_IRUGO);) E) @. |; }- f. Z4 A+ J& f
- module_param(bcnt, int, S_IRUGO);+ \8 J6 B p0 y2 L8 P7 i" d
- module_param(ccnt, int, S_IRUGO);
复制代码 ! {6 {* v% h( _
) R' S5 N$ B$ ^( ?% P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) R) B0 P% ~0 _9 L* B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 e* |6 ~! D8 S$ V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. l- V: V! u7 {/ u/ f8 [
/ j' M( _" C: n2 L, I! x. y4 C. X) X$ O+ K: E
|
|