|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 \7 f$ c8 [ d$ N- [code]EDMA sample test application7 K$ L; ?8 ~6 Q! Y$ _+ S
- /*
% A% r3 T/ @6 h' I* y - * edma_test.c/ o6 O/ [1 d( e+ f) N
- *
; [9 R# G- h8 ? - * brief EDMA3 Test Application
8 [4 e G; v3 `; c4 t& z9 } - *7 _+ F7 `2 o# Y. p% {% |. E
- * This file contains EDMA3 Test code.3 V8 x( D ?8 L [" K9 L
- *
, \8 M6 K% ]$ \* `: w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 w4 ]( X4 Z5 m- \9 Z5 r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" ^7 q9 w) F3 C
- * TO CHANGE.
/ c" p# C! n; Y - *- V# U" o5 P8 w$ H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& t: A7 L, W* s- z; Y7 ?9 s1 s - *
5 m! p) t$ n7 B: m1 ^, m - * This program is free software; you can redistribute it and/or* X6 z3 Z, v$ x0 s- V' g
- * modify it under the terms of the GNU General Public License as
' V1 N5 P% G3 P2 Y - * published by the Free Software Foundation version 2.
7 d7 |% l" W; A+ t - *
`+ e! Q: i* ~7 z V6 D! G) { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 R. P+ d2 I w, F" F: M. D - * kind, whether express or implied; without even the implied warranty. z, n" S3 ]+ D9 m7 D3 a0 N5 O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 j* Q# F$ X% K' O M - * GNU General Public License for more details.+ j9 ]( o7 F5 d% j% M' V
- */+ _ \+ T/ }! W* S" T4 N
& V& L U. W5 f& j8 p/ [! N* W: p/ g. [4 B- #include <linux/module.h>
% \. s9 g! M7 a6 _, U# O - #include <linux/init.h>
5 S; J2 E$ y% X" f9 F1 A' U - #include <linux/errno.h>9 f- ~6 h, G2 u4 \
- #include <linux/types.h>
( i1 ^9 |9 ], y) f* Q - #include <linux/interrupt.h>
& B3 C+ |9 N1 P) m. o0 v7 I - #include <asm/io.h>
' H: i# D4 R' r, ~! H6 G - #include <linux/moduleparam.h>
3 j, G. w2 a3 p8 i - #include <linux/sysctl.h>' W" U1 M# L9 R) s( \' C7 ~
- #include <linux/mm.h>
5 @1 g; h, W- Q/ i k" D - #include <linux/dma-mapping.h>
6 x7 d2 l/ Z" I ]" c4 Y: B
, y8 B, F3 ?; s9 R( w6 ?: v( _- #include <mach/memory.h>
) y1 t$ J& d m6 y% \( z - #include <mach/hardware.h>
% b1 \% \: a- ~5 [; h7 G - #include <mach/irqs.h>4 I2 B& K: c1 X. D* f
- #include <asm/hardware/edma.h>( q A/ D7 u. T8 I! z8 Z& u$ E
- ! d: l* u, S4 a
- #undef EDMA3_DEBUG1 `& Y9 b7 T8 P( z! {* x. g
- /*#define EDMA3_DEBUG*/
! q' h3 M: u) T6 ~" | - 8 n) _3 K: j7 D. O& W( Q8 k
- #ifdef EDMA3_DEBUG
+ I1 K8 R: U' G. D - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- x6 l L3 I! `% A1 P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 q, E+ O: k( f* @. P9 T: L# X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 N1 {0 p. C! u1 D6 c: j6 p
- #else
) b! G+ O/ V5 q& Q: Q. x - #define DMA_PRINTK( x... )
; y- U6 `9 j) E: x9 Q - #define DMA_FN_IN
6 o6 k* Q; c4 B; A5 c - #define DMA_FN_OUT
3 y4 V5 c& H' N q2 t, T, Y - #endif
9 F" F h7 V8 a$ {- t, L - 7 } N: M- F1 {# i" t! k. T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% m: D+ w# z. m/ D7 r& j' W; y - #define STATIC_SHIFT 3: h ]! C, ~0 R" G
- #define TCINTEN_SHIFT 20* G4 c: t2 `# X# m
- #define ITCINTEN_SHIFT 21+ l0 C2 G; @. d6 G# R
- #define TCCHEN_SHIFT 22
, K; T% K0 r$ P d - #define ITCCHEN_SHIFT 233 H# q" {7 ?* }% ?1 e
- c+ Y4 q1 b. \. i
- static volatile int irqraised1 = 0;
. U' A c: c/ d; a) o& \6 N0 ]; e - static volatile int irqraised2 = 0;# w+ b; s2 a+ k, Y4 K5 J" S6 b
2 H$ Z' B4 q+ p& t5 Q4 p; e( E& I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Y2 N( ~1 t, Z+ G( s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 \ w$ Q1 I ?- R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 O" X" [& j0 {/ u, u1 _
% ^) l. q) H8 v( I1 k+ m- dma_addr_t dmaphyssrc1 = 0;$ o4 j8 A5 X ~( [
- dma_addr_t dmaphyssrc2 = 0;8 U9 j b, O2 ~2 ^0 K
- dma_addr_t dmaphysdest1 = 0;
; u- Z3 R9 W) K A% F4 t- f; F0 f - dma_addr_t dmaphysdest2 = 0;
* ^: g2 Q3 d R4 }8 ^3 ~
% }4 a3 S1 ?! o- t; h: W6 b- char *dmabufsrc1 = NULL;
/ w' b6 W, ?$ D6 D* I+ T - char *dmabufsrc2 = NULL;& T: ~( a. x7 s* e4 x0 H+ L
- char *dmabufdest1 = NULL;
d# I; u1 D' I4 N0 ^ - char *dmabufdest2 = NULL;2 I' J& l8 u1 I# S0 E
- 6 o- A; |& U* R/ w
- static int acnt = 512;
4 A- g, @: C- {& l - static int bcnt = 8;! @! Z: ` Y) C* A
- static int ccnt = 8;7 O/ {6 _9 Y5 t k" W% K- X
- 9 i4 G6 A* P- ^# G# e4 K$ D) A
- module_param(acnt, int, S_IRUGO);
! c+ b; f8 x0 }/ i; ^- B! c! A - module_param(bcnt, int, S_IRUGO);
+ c" ^% l3 K) s+ ~% v U - module_param(ccnt, int, S_IRUGO);
复制代码
1 S' H H, R N: ?! v: u) g& F6 S/ c: b1 q: v& i' s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 W7 q( `( x, H, r, S: Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 v7 n6 f7 F/ {5 B) A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" t7 [, y( F7 Y3 r# ^+ s' ^: _ ~" y0 w; O& s' P7 I
7 i" Z6 X S& q# U" c2 G |
|