|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 s9 h+ [+ x6 f9 q) L4 V
- [code]EDMA sample test application
M" n( L2 W/ D$ ` - /*0 E( z* q/ g0 [- r$ G4 z
- * edma_test.c ^0 h3 f' L* D# [8 j) c
- *% x1 N8 E1 {- w0 Z3 h( E
- * brief EDMA3 Test Application) B3 W9 a- K5 H+ P1 l
- *- O7 m* B% c7 V. i2 \6 [
- * This file contains EDMA3 Test code.
" B. S. ?# u: \ - *# o0 D8 D: `, v: ~, K: O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& g0 v o) v. D- f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) S0 V7 |! b0 ?4 b/ @+ W3 b
- * TO CHANGE.
n) n- a3 r6 K. I1 ]0 ]- U - *! q, d! B8 |$ i. Y I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. [' C% F& M b/ Y - *
1 C% W7 V- r% o! A: U5 t: u - * This program is free software; you can redistribute it and/or
" `1 l( |) X! c1 U/ ~, c - * modify it under the terms of the GNU General Public License as
0 Q$ g8 c( M" z- C8 K7 F# B - * published by the Free Software Foundation version 2.
9 ?! V- u6 h1 j. k& G - *' x: o0 R* }* P; [0 B7 {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: L; S1 \ t ?- J4 E9 E1 @+ _ - * kind, whether express or implied; without even the implied warranty0 |6 M( g& G9 c, i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; Z) t7 v6 v( R+ h, Q, g* F, m
- * GNU General Public License for more details.8 c" r; U7 Y7 S0 q' B
- */, j, z6 c/ z0 T
- 0 B# S$ a" A% V! }2 o2 b
- #include <linux/module.h>
: V; y! G p+ m( Z- ?4 \5 `/ u - #include <linux/init.h>* |/ M1 I) t7 }- `! [$ U$ W
- #include <linux/errno.h>
1 y% H1 `2 Z' Z6 c - #include <linux/types.h>
8 x# e T1 y" h! g - #include <linux/interrupt.h>
( V2 x* a" o. K9 n4 I$ q - #include <asm/io.h>
: P- U4 F# j& h0 O/ O1 S - #include <linux/moduleparam.h>; O, c/ D+ X% I& L) G& \- D
- #include <linux/sysctl.h>
- W5 n$ V! O. I, Y u - #include <linux/mm.h>
3 ?8 U5 U4 X# d1 j0 e$ U. J$ p - #include <linux/dma-mapping.h>8 a6 d6 w# C! D2 l, P+ c1 b/ v0 k
2 _, @9 O& `- M" _1 |/ x- #include <mach/memory.h>
* R9 q8 d& P$ `. v# k' \ - #include <mach/hardware.h>
+ \+ ^' X8 U9 @ - #include <mach/irqs.h>7 z; c9 Y/ L6 `
- #include <asm/hardware/edma.h>
, h& p! t/ g$ P' a
4 U8 U: e4 K& ?3 V; U: ?: v4 Q- #undef EDMA3_DEBUG
+ Z2 Z$ x" O9 m( v8 w7 D - /*#define EDMA3_DEBUG*/
1 E( t$ u$ ]1 F
5 \; u# Y9 j G- #ifdef EDMA3_DEBUG7 I, g- a3 ?. C6 D' k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
v; ]" i$ d: W |8 l. ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 j- }: y5 m/ N% p! M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
Y. d" B! x a+ G3 G9 K - #else. `) ~' M. e4 f9 j+ P8 }
- #define DMA_PRINTK( x... )
. U, c3 C3 Q% p5 J$ E* o3 `! w - #define DMA_FN_IN/ t1 Q& }9 m' q7 O* P! Q
- #define DMA_FN_OUT
; y, j9 i1 I/ e2 |2 X b/ x - #endif
+ y& Y9 \; }4 j2 v. j4 B
, l2 b$ G5 f" ]: T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. z3 _' m3 t* w$ e# A+ D% J: X- D - #define STATIC_SHIFT 3
% J8 O* b2 _$ K: P - #define TCINTEN_SHIFT 20
7 R4 W% B7 @. B3 j, u5 N - #define ITCINTEN_SHIFT 21
9 k$ W8 n1 D: c9 l3 Y' d' [9 S - #define TCCHEN_SHIFT 22+ E" \' _2 A& X% F0 E
- #define ITCCHEN_SHIFT 233 U1 K2 x$ P8 N7 U+ x, [/ F; W
- X- Q$ |/ }/ B1 k8 b" d0 X: \
- static volatile int irqraised1 = 0; J3 @0 l% Q5 J# i
- static volatile int irqraised2 = 0;. H+ Q$ h8 ]# G5 @2 n
- H" g* h, o0 l& H" n' P9 o1 y% y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 i3 v/ K q% ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ^8 H* r: m$ i0 z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 b. Z' E9 U. R" z5 l1 `
9 Q- ~+ s: a) `) _) ^( K- y* n- dma_addr_t dmaphyssrc1 = 0;+ @' P8 u# K0 a/ g0 [5 w$ _+ c
- dma_addr_t dmaphyssrc2 = 0;( M" m$ f9 @4 n7 a6 [' e3 T" J$ M, T
- dma_addr_t dmaphysdest1 = 0;
- {% [" V' ^( j" ~ d3 ?" x# C - dma_addr_t dmaphysdest2 = 0;5 D8 J) \, q0 [$ V. v* O1 q! O
- H v; C5 I( _8 E: P$ d4 f
- char *dmabufsrc1 = NULL;
- \& s- i" [/ O2 ]3 m5 V - char *dmabufsrc2 = NULL;) f ~ l/ P) K& n
- char *dmabufdest1 = NULL;
- S! t' B9 j/ ~; r6 }; _ - char *dmabufdest2 = NULL;* R9 W' p! y4 {$ u$ o- `
* `: b1 j: I# ?% z, L- static int acnt = 512;
, a6 ^' ~5 ]* b2 [& L6 ? - static int bcnt = 8;
$ K3 B' I4 b Q: b4 f' g, k - static int ccnt = 8;! a8 C: y a) {
* P# J6 l' s7 f( q* ^- j e, P- module_param(acnt, int, S_IRUGO);
* I% K0 \0 b, G) F! W3 r9 R. \ - module_param(bcnt, int, S_IRUGO);- h2 k% V: G! U/ C6 l8 z: a& ^
- module_param(ccnt, int, S_IRUGO);
复制代码
% B& p, j% }5 I6 I1 `" X3 \2 W
$ U+ L+ y# m3 P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 A0 _5 ]5 o* {( R! p* c6 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 S2 d6 @8 t2 V2 @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; }* g/ D2 B5 a: @/ ]% W
2 S( j2 ^" U* ~: |+ i
, X! k+ D% q6 i: s( p3 u
|
|