|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 v( ?7 b+ s' @6 r) E4 s- [code]EDMA sample test application( t% T* } F5 w l
- /*
5 v/ Q" W% | d( T* [ - * edma_test.c8 r! p' y6 L3 o" ?; M4 r( ?: H% H: ]
- *" I3 i4 S3 }4 c8 f4 T
- * brief EDMA3 Test Application
9 [( n; f6 y& c1 w- v - *8 }8 z/ ]8 G8 P2 l
- * This file contains EDMA3 Test code.5 M0 b6 { s# L5 W
- *' g+ W }1 o0 _/ W& T) _6 r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 x" r; v* N7 Y- ?% k$ P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" o6 X9 y# }0 U# A$ H9 k - * TO CHANGE.5 E. R% R! {1 h7 c' \
- *
" s. a2 }/ j% w, [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
i$ q1 a5 C6 W6 u - *
1 v" D! O; x6 y+ U7 ? - * This program is free software; you can redistribute it and/or) l4 G- s3 R# r; b$ n0 z# {# _
- * modify it under the terms of the GNU General Public License as
) @) A% w. [$ n5 ` - * published by the Free Software Foundation version 2.# o1 T/ L. A$ y1 ?9 D
- *3 T9 [8 k+ x4 w! n$ E4 X) M8 K) b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; B0 M/ l' s [: t7 w0 X8 ~
- * kind, whether express or implied; without even the implied warranty A- _$ A* i, g; r( @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; g8 T6 K" N0 x! L& P7 R
- * GNU General Public License for more details.
w7 S0 q# H. s2 Y - */2 _" e1 _9 o' r2 Q
- G; z. t3 s: L# R
- #include <linux/module.h>4 U' `. G; Z/ J1 g0 j" h
- #include <linux/init.h>
. U I; S& B) P: {! N9 I - #include <linux/errno.h>2 A) M4 k# w2 w* y1 t+ S# }# ^9 C
- #include <linux/types.h>4 n5 p; X+ ^( z# G! y, k* {
- #include <linux/interrupt.h>- [6 g1 z s; D7 H3 x4 @: `) M
- #include <asm/io.h>. S8 K5 {+ n' m: Q
- #include <linux/moduleparam.h>. t+ g' A9 m- ]! P) ~2 ^
- #include <linux/sysctl.h>' a2 @7 F0 G6 B+ q8 \3 \7 A3 Y8 B
- #include <linux/mm.h>
5 ^3 m# x# `6 E. j* Z' G - #include <linux/dma-mapping.h>
/ n; L: v. ]1 F8 ]8 D0 Y, B - 0 [/ `2 @/ T% b2 `
- #include <mach/memory.h>
H7 p3 H1 U- v* Z6 C - #include <mach/hardware.h>, C8 I% J; A: a
- #include <mach/irqs.h>
9 r: y" E# |/ a! ^. F- |7 j" Z - #include <asm/hardware/edma.h>
6 D* N0 S7 w1 y$ j7 `* W - & h! F, G. C2 q' {" X9 b6 A& t+ U: l
- #undef EDMA3_DEBUG% H) [( q: y& x% |/ z1 x, `, `
- /*#define EDMA3_DEBUG*/# S; P* h, f n. T0 f/ H
- N# m+ X( p9 I6 j" U& }( @
- #ifdef EDMA3_DEBUG
7 O. Y) c: I/ S6 J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ T# _! I6 |0 a3 a6 P, O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# z$ j9 r( X. G, M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ _. x, [# y0 b' z. }# B, j5 C7 K
- #else
% }# [8 R0 D8 r+ Y) p! q8 h6 X- E - #define DMA_PRINTK( x... )7 q) h3 z) J/ @2 N! Y5 g7 V
- #define DMA_FN_IN
/ ^# `& F3 y. R# U: t8 o - #define DMA_FN_OUT
5 M- G! X0 I- K$ R% D5 g* |4 o - #endif
! [/ G t0 J! o0 w; ]1 B" P - ! s1 L3 p5 b6 O: u/ U: O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 u5 Y9 Q' L+ ?
- #define STATIC_SHIFT 3
( o0 a& s( ~8 H. I( k! F3 r7 x9 q - #define TCINTEN_SHIFT 20
( |7 s7 I1 [- ] - #define ITCINTEN_SHIFT 214 c) Q/ A# `3 L
- #define TCCHEN_SHIFT 22! D* w- |/ U# s0 R) F4 r+ o
- #define ITCCHEN_SHIFT 232 e/ V- V: ?5 f5 {) Q
' V2 v9 \2 b- |+ ]- @% j8 V6 p+ h- static volatile int irqraised1 = 0;
# Y8 P p2 P! s4 d1 f7 ^7 X- S - static volatile int irqraised2 = 0;
1 A: E- _4 i% e- e
9 {# I1 d# o4 ^. A- j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: V- E' o: z8 }/ c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 d" p0 X7 t, _# i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 _, M- |6 ?4 N8 v4 v" z
% C1 Y7 V! V; W8 W0 B! I0 D9 F& S- dma_addr_t dmaphyssrc1 = 0;
" |( |7 z* L* C/ y - dma_addr_t dmaphyssrc2 = 0;
4 e7 E2 R+ |! h. ?5 _7 G! ^- j - dma_addr_t dmaphysdest1 = 0;( c# j" W/ E: ~1 v/ R s5 e0 R
- dma_addr_t dmaphysdest2 = 0;
* ~3 ]. g( @! v3 ^* V
3 ]3 `4 M: D1 G2 V- char *dmabufsrc1 = NULL;: n3 f6 C* w, |% P5 j1 O
- char *dmabufsrc2 = NULL;
3 @* ]+ ^/ V. R2 i# i - char *dmabufdest1 = NULL;
2 {1 I" D+ h: s' J - char *dmabufdest2 = NULL;1 R: f" H: F0 ?! e3 `/ z
- ; j$ ?) @( y. D" M& ]1 A8 m. z
- static int acnt = 512;
4 K' f7 E+ `( n, h - static int bcnt = 8;4 \' Y l" a' W( i% E5 F) D( c, ~1 H& P
- static int ccnt = 8;
{6 i/ O7 G9 F4 W" N
L0 h- A* {4 r( z2 v0 V" o- module_param(acnt, int, S_IRUGO);
. T9 h( n! R* l8 F" Q) X/ h1 } - module_param(bcnt, int, S_IRUGO);/ K1 p6 Y" B# L3 d+ U
- module_param(ccnt, int, S_IRUGO);
复制代码 4 w) E, x! f/ ]% Q
0 F0 R# ?; P6 V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" [3 f3 t7 y. v0 u$ {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 J( x7 K5 T# E2 r3 W5 O; i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 v# {- \# _/ P6 d" w" f
& n7 I4 ^" X( m X
$ ?3 }$ r/ V7 i% ~" U' \ |
|