|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 H& C, o( g& |3 k- [code]EDMA sample test application7 T: u+ S7 O9 b3 h% K
- /*
9 h) n! M7 |0 y - * edma_test.c
* Y( H8 j1 c; b' R$ @& k! H6 \" D( h1 [ - *
4 G5 Y0 \! K1 \1 g* }( z7 _/ a - * brief EDMA3 Test Application. x3 K* S) C9 B
- *: q* Q o5 o' B% G4 a5 F2 S/ G2 Q
- * This file contains EDMA3 Test code.
" R7 w* C7 |# g6 A4 {8 p - *
, v6 v; M8 V3 p- P" D# S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. {- M8 k9 @$ @: } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ O. E( G& O0 |( e$ _4 M - * TO CHANGE.6 x0 k1 \! p) f$ y& G4 b! ^
- */ A6 t, a! H: c0 q* u) y7 |6 n- H5 m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ T; }/ H& s3 Q$ z - *
$ S z- @- D! [* S% V: D8 A - * This program is free software; you can redistribute it and/or
7 |9 y9 v. Z$ s* b) c$ p8 } - * modify it under the terms of the GNU General Public License as
5 U( e8 w* x# ^ - * published by the Free Software Foundation version 2.
5 B9 \% f5 M) K# ~ - *
: [3 ?0 B' K6 F" O# J* w: M* `1 o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ W/ {2 I% _- y; P) b; x - * kind, whether express or implied; without even the implied warranty* D' s* u$ i1 |" I( i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 h% p9 h3 M9 s& w3 h - * GNU General Public License for more details.4 e" V/ ^- r2 b- [& ^
- */
' c7 V- X. m Y& H0 C: n - , H6 ]* S0 d+ L7 O2 Y' N
- #include <linux/module.h>
/ a0 l l, o' ~0 ?8 d! |( B0 J, t+ \ - #include <linux/init.h>; ^* r* W! t6 w0 q# ~3 U
- #include <linux/errno.h>
: U4 H3 q* @. O+ E" D2 B: W - #include <linux/types.h>8 M, z$ ^2 u k6 A
- #include <linux/interrupt.h>; c2 Q( f1 w" D$ J% g9 h& ?
- #include <asm/io.h>1 L; R6 n$ D6 O# P. `0 }
- #include <linux/moduleparam.h>* \4 I$ r! F/ S9 j* V" ]( Y! K
- #include <linux/sysctl.h>! J; E( ~6 d! O% m
- #include <linux/mm.h>
/ L: |( M+ \+ q2 K6 c$ ~8 {: n - #include <linux/dma-mapping.h>9 \, p d5 u6 L& d9 m9 N, l
1 A8 y# e& @5 H0 F- #include <mach/memory.h>4 J# h$ {; J4 }
- #include <mach/hardware.h>
4 z9 T I1 N" t& D* l - #include <mach/irqs.h>' U& i* G' V7 X2 c
- #include <asm/hardware/edma.h>! w' W2 S0 I3 ~" W
- " |7 b/ K* y W: D+ {
- #undef EDMA3_DEBUG
0 B: X' {3 s: A+ M( \. C - /*#define EDMA3_DEBUG*/+ R. _2 [' G( [* i! ?$ I! k O
6 e4 ~+ J8 J. x" C0 \- #ifdef EDMA3_DEBUG
! v; ^* y5 F6 T0 @* j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ K# q; c5 i6 J% a! i \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 j* Z: L7 H2 p6 }* m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 h6 g4 W/ b3 W4 ~- p* `5 U - #else
: [" J5 u# K0 V - #define DMA_PRINTK( x... )# j/ J# w2 g+ L9 ^5 V$ Y' V' |: s
- #define DMA_FN_IN$ s* }' V, z. i# Y* C: _4 s2 i
- #define DMA_FN_OUT$ d" [3 w0 y$ R+ s
- #endif% Q9 z. m+ k/ U& L( g
5 f1 l) }4 v+ h0 X* ^) [' Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* b- R7 m; W' v0 _9 \2 r - #define STATIC_SHIFT 3' z) u2 |8 w8 K) k7 z
- #define TCINTEN_SHIFT 204 ` ^: @' B2 s8 I8 V$ u9 l
- #define ITCINTEN_SHIFT 21
- g Y. ~7 R# V1 r( W7 @" Z - #define TCCHEN_SHIFT 228 g, l: D; R, }& `6 ^- C) w
- #define ITCCHEN_SHIFT 23
6 B. _8 p& A& J/ F. K" d4 T' W/ q
9 C( S$ [9 L: e3 `0 c( h- static volatile int irqraised1 = 0;
Z) J5 z6 L3 K. y6 v* w; b - static volatile int irqraised2 = 0;, u7 c# Z0 E ^' ~! ]- s, L
- + u! N3 u& ?9 j3 t: k; W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ^: f( ]' G" d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 h0 w* r/ v- Q# N8 f! B3 h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* y, A, F/ S7 U: K" U7 O - ) Z) D! `# r& [
- dma_addr_t dmaphyssrc1 = 0;
: G1 Y- {# o0 {4 W - dma_addr_t dmaphyssrc2 = 0;) c" k1 T, Z; \! u; U a7 T
- dma_addr_t dmaphysdest1 = 0;) u& R% d2 S4 r$ f% i" b# P
- dma_addr_t dmaphysdest2 = 0;
6 T) s# T* j' q8 I& T7 E/ I9 P - $ |9 i& c4 s9 C- V8 u/ k: z) H4 Z$ `" s
- char *dmabufsrc1 = NULL;
: d4 Y! U7 X+ \+ B - char *dmabufsrc2 = NULL;" \: V4 ~6 @. V% J. _# f$ j
- char *dmabufdest1 = NULL;
$ a7 O6 Z+ b @9 @% i - char *dmabufdest2 = NULL;
" D: f( T2 p4 C; A
' X8 f- H. \ ?7 K7 \8 M; i- static int acnt = 512;
) s: ~0 o0 Q B3 K0 z$ d/ N - static int bcnt = 8;+ n/ \ }% p5 y. l h
- static int ccnt = 8;
8 I+ e# |( ?; S, D1 s* ?) R( t4 N - # k: \- ^) P. v$ y% f! d) T6 g% k
- module_param(acnt, int, S_IRUGO);( Q) e7 q2 g* t
- module_param(bcnt, int, S_IRUGO);5 y5 z2 e/ D* ] M* s6 l" M
- module_param(ccnt, int, S_IRUGO);
复制代码 - N R3 K; c0 Y7 z2 k
/ p' ]: D0 c5 U T) R: l: M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 a- `: J2 w9 i- x8 e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ E$ L' u, ?9 q2 k; a2 c1 B; B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' i! ?8 W# x; N4 J1 e
- D8 a: F, k6 \5 a( T
! ^- z% i7 g+ h7 z0 i* H) D4 p
|
|