|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' q4 Y/ O: Z/ g0 |* u- [code]EDMA sample test application
) I! |0 S1 f, z: }' E - /*6 C6 Q; i2 z5 e8 z# P
- * edma_test.c
* h0 c% M V& o - *
- L& x) m2 ~' B2 {! o: m0 O - * brief EDMA3 Test Application- z( i' q/ p+ U6 v! ]6 F5 E
- *
+ M1 d( l$ A& |1 M$ S; C- S - * This file contains EDMA3 Test code.
! U' k+ `$ @5 T5 f1 ^5 @ - *( E. m/ G2 T& f V+ H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 j3 }4 s# H* n. J- j5 j! c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT s$ B; H" O9 j$ S
- * TO CHANGE.
4 @6 D6 n' u% ?: ]8 U% G, Q - *7 w' H3 O8 U3 F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, u( O, L$ W" G# _% B/ x2 t - *) ^- @+ c' a3 y* i1 e' x8 U4 u& e
- * This program is free software; you can redistribute it and/or+ }& o3 A8 @9 C% M2 t1 b
- * modify it under the terms of the GNU General Public License as
& Q" u' j) j% X6 o - * published by the Free Software Foundation version 2.
7 o `" e9 w5 G5 F7 e- V: Q# v - *
' g7 X# m, h8 a# Y4 v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! N- F) q' x- B& I% S! d( S4 H - * kind, whether express or implied; without even the implied warranty1 q9 n, u. \; s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( J+ C+ h1 d7 j9 A p. A4 M, P - * GNU General Public License for more details.
* L! f4 r% {3 i2 ^+ R - */, Q+ { B3 h( U# m' n' j
; t2 ~* u5 M9 }- j0 U- k4 H- #include <linux/module.h>- \4 }% W) m1 i3 a& x
- #include <linux/init.h>
) c( ~ ?; A7 |' ^) ^+ J' V; a: U - #include <linux/errno.h>6 J% K l$ Z8 Z. f# J0 ~ ]- G5 n
- #include <linux/types.h>& B+ `2 S/ h, q: Y3 K* u$ p9 [
- #include <linux/interrupt.h>
0 D4 |( L! o5 Z8 j - #include <asm/io.h>
/ K& F/ g+ A1 E8 S4 ` - #include <linux/moduleparam.h>/ E, p5 U& w" |( H( ^
- #include <linux/sysctl.h>
; b2 i( \" t1 T" ^6 C" R - #include <linux/mm.h>
, q9 D4 |5 h* Y' j; v& K( k6 U2 Z - #include <linux/dma-mapping.h>1 G& \ [. t+ _) N' \9 y0 Z3 Y
- D9 Q+ U' n9 R8 X& f
- #include <mach/memory.h>
5 k. @+ Q& T: M9 p5 d; g8 o - #include <mach/hardware.h>
$ p' g, O' }4 Y( j - #include <mach/irqs.h># x. `0 C7 L1 W, \* G
- #include <asm/hardware/edma.h>
* f' G6 ^8 E4 w( @1 b
5 s. g7 B% F+ _* ^) W- #undef EDMA3_DEBUG
5 L5 E4 S) v& o5 t/ S6 U* D6 C - /*#define EDMA3_DEBUG*/
0 |, r6 f) g" Q - . a1 L7 N$ T' K9 n l, G& S. K) V3 F
- #ifdef EDMA3_DEBUG
|$ q8 }) p) [2 s. f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% b3 x2 @& G* v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 H/ T! u) p; A9 i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 b3 n n9 \& i5 \( ]3 `
- #else* W, Z4 k1 {* p( [8 x
- #define DMA_PRINTK( x... )
0 `/ J0 U0 C# e5 E+ |: v8 T - #define DMA_FN_IN
3 v" u- e5 L3 P4 b2 N - #define DMA_FN_OUT
& }9 c$ A4 q7 _. ~' X. `6 [ - #endif, _$ K% D0 S \7 M6 i" _
# r { m8 E7 f Z9 U: h# B& {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 N7 f3 h2 ]+ F - #define STATIC_SHIFT 3
. v+ B" ^0 y* r( K D, J+ s - #define TCINTEN_SHIFT 20
2 m$ c$ }, x% s- o5 p& D2 V - #define ITCINTEN_SHIFT 21
# b6 B% w) E8 t/ Z - #define TCCHEN_SHIFT 220 u+ h o; j& Q5 f" w; c
- #define ITCCHEN_SHIFT 23
5 o! \9 ]7 \1 { - * M- J9 `& V6 E6 H
- static volatile int irqraised1 = 0;% d/ m- W: S* X: E2 z& _" ]
- static volatile int irqraised2 = 0;
8 d+ K; s* ~3 ^5 K9 h - ( o) a: C1 p; _0 f" r' |! P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ h4 ]3 C9 B) _. I1 |7 P; q7 A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( I E- Z/ d+ k+ a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 G8 I! D) Q5 A/ v8 U! v
+ B$ i' b3 f; j+ |( q- dma_addr_t dmaphyssrc1 = 0;$ M0 G' f% y. O! b3 @$ ^% M& A- r: {
- dma_addr_t dmaphyssrc2 = 0;, `7 |' g6 G* r+ t
- dma_addr_t dmaphysdest1 = 0;9 j# E% H' S8 y" _& M$ I) `) D
- dma_addr_t dmaphysdest2 = 0;
# P9 C2 N) Q8 a2 ^ - , ?& Y( m9 k/ h& h
- char *dmabufsrc1 = NULL;
; s' J8 _! J3 Z! f: \" V - char *dmabufsrc2 = NULL;. J: L4 q- h7 p4 U# z |) J) L
- char *dmabufdest1 = NULL;
% Z: c" L+ o7 t. b( e. s! r - char *dmabufdest2 = NULL;* y" m% e0 u8 O6 A; g
; m- h$ \: t! z- D3 [$ h4 s- static int acnt = 512;
6 B4 u* Z" [4 U* `# y/ Z8 C. n - static int bcnt = 8;# v* B5 |/ h2 S; [* {
- static int ccnt = 8;, ]3 F d5 {; O. m3 L- F
) G; z# ]- x. K ]( z0 k& }1 o- module_param(acnt, int, S_IRUGO);+ y4 n2 j! ~* z( w- S7 A
- module_param(bcnt, int, S_IRUGO);. x$ g& }6 D: A0 ^9 K
- module_param(ccnt, int, S_IRUGO);
复制代码 : u/ l* i: G( |. d. L+ N
& M: v# k* Y& j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 ?% Q& t' J- u: r, N( xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# H) }5 A2 ]- j t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 D& s9 M a+ O% b Y2 D# w; p. K
5 K8 |1 p% }6 R# a; q$ N6 X
+ `0 F! `+ J( m0 @% Z
|
|