|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * O* S2 F$ J$ d. X) R6 b
- [code]EDMA sample test application
- f$ _8 U, F; }6 O8 \/ j! n - /*
6 t/ S5 @2 @: K ?: ?2 D - * edma_test.c; C0 \ Z+ _; i8 B; }
- *
$ ?# s j0 z h9 `- d( A$ X& k9 K+ i - * brief EDMA3 Test Application+ r8 h" ~$ ]3 {& S! g, k( ]
- *
7 b* Z7 p+ L: Y) f - * This file contains EDMA3 Test code.
; A8 f! V& g% ?" a. p. i& y3 j - *2 b. O2 g# O+ i) y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ |; V4 \* z" S2 \/ C+ F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& p6 J' {4 J, ^% t - * TO CHANGE.: d1 R7 r% {+ R3 M* w8 I
- *
9 f! A2 D3 _) {) m' N; ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 y; M9 S4 [ x4 E& Q1 d - *
3 {0 _2 M2 H G+ d, C2 K: { - * This program is free software; you can redistribute it and/or- x4 E* E0 U8 |4 h( ]
- * modify it under the terms of the GNU General Public License as
; K& s) H4 J+ Y - * published by the Free Software Foundation version 2.1 j! Z' d" S5 `. w! d* s( R
- *4 o! k5 \" _6 c8 h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ h$ ?3 N4 k( @% e7 A' C4 \. n - * kind, whether express or implied; without even the implied warranty& s: z9 |* e- Y. f7 v7 Y; r) }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- v$ ? r: ~: f" s' j( d' d
- * GNU General Public License for more details.
' k1 O$ x, K4 C1 f; { - */$ Z+ I- K7 H* T6 u
- 5 b( {$ m& R9 o; p( d
- #include <linux/module.h>
0 z& R; m. a6 r, ^, k - #include <linux/init.h>' {& w' j) j5 B; J/ [8 Z y2 c
- #include <linux/errno.h>4 y! x% m g4 N- {1 N, ]
- #include <linux/types.h>
( A/ v+ O e4 j7 J" R! U. ~4 p - #include <linux/interrupt.h>
5 @& Y5 Z- C$ @. T - #include <asm/io.h>
# R# A" c+ R0 g8 v, r2 N7 ~" l - #include <linux/moduleparam.h>
' j$ t4 ^; R3 t( V. G& {% K5 u - #include <linux/sysctl.h>
7 W9 q K# Z* f - #include <linux/mm.h>
2 j5 n. C# I# M8 ? - #include <linux/dma-mapping.h>
9 D8 P8 d! t5 i* y* u
& l/ @0 `, Z3 Y- #include <mach/memory.h>
8 Q3 a: O+ n( Q+ |0 g1 X. Y - #include <mach/hardware.h>2 r1 o8 @0 M/ {- Q4 a
- #include <mach/irqs.h>
0 @1 i# y9 o* B1 B - #include <asm/hardware/edma.h>8 e0 \4 E0 p1 H8 u
* d: E& R9 `8 b4 [! q) x9 D8 x7 H- #undef EDMA3_DEBUG: P3 M9 O) z2 R1 G4 m5 c
- /*#define EDMA3_DEBUG*/
: Q. I5 n7 t4 R) G8 S! t - [' u! \9 [/ @ M$ F
- #ifdef EDMA3_DEBUG
" j5 j0 v4 h: R+ j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- ^2 }* ^, R( N# F# c: ?! i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 O, T) ~- s7 S$ _! b; V" s! k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, E0 P/ F% |- A - #else% Q( K+ C J7 E6 f, q
- #define DMA_PRINTK( x... )
2 Y: p' [7 \' V- g$ p& S3 I - #define DMA_FN_IN; H8 z O7 X2 [+ g; e
- #define DMA_FN_OUT
0 v( s, F! c1 y7 B7 }# I. m, K# F - #endif
: I3 d# I5 U |9 B5 {3 ?6 u - , O3 {, F6 ?7 A: x6 o. I' |) b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 K% p6 \6 Y0 V: b. V/ C2 z - #define STATIC_SHIFT 3
+ S* |1 W2 d. M9 K* z& w& @8 k - #define TCINTEN_SHIFT 205 i5 Z4 ^# x) M; t
- #define ITCINTEN_SHIFT 21
8 Y$ ]; m' V# ~ e2 L - #define TCCHEN_SHIFT 22* Q. s% b3 Q1 ^9 G/ a! E5 a0 _
- #define ITCCHEN_SHIFT 23
' {) f2 |5 s3 v% ^3 V0 S/ L
* E# ~' C T* i) Q/ w- static volatile int irqraised1 = 0;" p9 o: `* {: u6 C
- static volatile int irqraised2 = 0;: |* N3 O0 b+ a" g6 A5 n
% ?! \- S5 K }8 f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( \/ P7 N- _7 O: _ `# [2 t( Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 F* h1 m" ^& c5 D0 U! N3 {" W- l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 A r6 P; r* I* Y
4 n) v$ ` ^6 k, a- dma_addr_t dmaphyssrc1 = 0;' X* l# e+ q* \2 |$ L9 I
- dma_addr_t dmaphyssrc2 = 0;. s# z3 W7 n+ ] a" o/ g k! [3 Q
- dma_addr_t dmaphysdest1 = 0;
( d! e# H* Q& \ c7 }7 s - dma_addr_t dmaphysdest2 = 0;
9 ^2 e( W4 R) g# G1 U* p3 p. `) m
1 e& o% p; S7 b0 j2 u" @- char *dmabufsrc1 = NULL;) q3 K" v8 b7 z. Y
- char *dmabufsrc2 = NULL;
; f: _: K& |. D5 C, r, O8 C - char *dmabufdest1 = NULL;7 h) s0 Z$ _( E" Q" S. ], V
- char *dmabufdest2 = NULL;
. ^2 s$ T9 e, _- n; t C; u0 Y b8 j - 0 D( J' A3 ?0 I {9 [5 D
- static int acnt = 512;% o( [) S- |+ ^ G- A ]
- static int bcnt = 8;
0 c8 y& J8 ?( P+ p6 Z7 { - static int ccnt = 8;. b1 E) s' a9 g! {& d
- ( D6 m7 L5 W3 I- p: e
- module_param(acnt, int, S_IRUGO);1 e" O* p' [. Y5 _
- module_param(bcnt, int, S_IRUGO);
+ v1 Z7 u: m0 v% b. ~% N) C" o' H - module_param(ccnt, int, S_IRUGO);
复制代码
# r* R5 n6 P( t- l6 q9 f8 S2 F* n- @* U2 ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. H7 F( I# q( ?2 c" |$ v/ sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; s1 e' c) i3 B9 m: E+ U& f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. p& s8 O# x7 j2 y
& R# M$ Y' P1 s- [( i! q- L$ v' V! o* }3 h/ E/ R9 x ~& b/ i
|
|