|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * y: y& c6 W& q
- [code]EDMA sample test application# I3 ?# N/ O) e% E% G, w
- /*
5 w5 T- P& v2 P - * edma_test.c: K- l/ J O( [! Q* J
- *
7 {* S0 |# w- v( J - * brief EDMA3 Test Application
+ J r& i* n+ W8 B - */ y/ ]; }8 `3 N9 z- A
- * This file contains EDMA3 Test code.9 N! [# t7 y( y; f! R% A
- *
/ L# A+ n2 b3 H2 b% C1 E; T& y0 I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE m/ k4 f, Q% J1 p& {+ h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 a2 I/ O. t+ O) x6 [; j4 |3 ` - * TO CHANGE.
+ g5 p# R& K. d& u+ Q - *
4 q8 _' q' L" D3 v2 ~9 n4 [$ z& v, k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 K% B# Q0 z2 V. E, B+ X; f2 M
- *
4 G6 @# R& i% r: ^ - * This program is free software; you can redistribute it and/or7 B) k+ T4 G0 D+ U# f& J* V
- * modify it under the terms of the GNU General Public License as
' e; G" y# q+ y - * published by the Free Software Foundation version 2.5 ~+ C" z) c1 S& [5 z; u- I e
- *
7 H/ g8 F- h- N& U$ d, t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: r0 ^8 Y$ g# m$ i) H' x8 `% V
- * kind, whether express or implied; without even the implied warranty
+ K# H! P( J6 W0 u0 S) z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 ]9 y! @3 Y, L3 Q
- * GNU General Public License for more details.
' ^, A4 W) G) U. N" V/ x$ R, ? - */
* w! A9 Y. W7 N; M! \# U - 2 F1 s. ]( x6 f% Y
- #include <linux/module.h>7 t' m9 C( u w5 C$ l4 j( v6 m* z& Y
- #include <linux/init.h>& t/ ^( Z0 U) r3 h) g
- #include <linux/errno.h>& z* _/ Q4 E. h- L7 e% a* W p
- #include <linux/types.h>6 Y# N+ E6 F" B' n4 \( }$ f0 b; }- }
- #include <linux/interrupt.h>
( l* A; q$ i0 y0 a% x) ^. L - #include <asm/io.h>
3 A7 u* f, ?( g* V6 b l' C5 B - #include <linux/moduleparam.h>
) `, O9 w+ b+ G/ k& l - #include <linux/sysctl.h>
/ U# x9 a I) X6 ?' f: o - #include <linux/mm.h>
( @, Q4 R6 J9 T- ]2 a# S0 I% p - #include <linux/dma-mapping.h>1 K; L8 h4 {: H4 t5 I
) W* i* y% a0 T/ z( x3 i4 F- #include <mach/memory.h>, g6 K6 q7 D4 R. Y: U$ A/ {
- #include <mach/hardware.h>( f' g0 `# [$ Q5 H
- #include <mach/irqs.h>) o1 J+ u: c4 y4 p' L
- #include <asm/hardware/edma.h>
! s2 N' D# q" e2 j0 ~
# u# O7 g+ g D) s, t- M- #undef EDMA3_DEBUG7 O# E0 s1 r) f
- /*#define EDMA3_DEBUG*/' {- V9 @0 A0 J6 @$ e+ Y0 g* T* c
- # `3 M& V" r# @5 @
- #ifdef EDMA3_DEBUG7 v, E1 \4 D/ c7 |8 s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 I/ q. E9 t. s7 u, X4 H5 G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- G& D* F) M( Q8 e5 y, C: D" S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% Q6 a I# F8 l# X2 j5 K6 W - #else6 Q' F- h$ H2 b7 A1 n! p
- #define DMA_PRINTK( x... )+ g- |( x$ I% D: v) t( {
- #define DMA_FN_IN
6 q9 w; J7 o6 J- `& R - #define DMA_FN_OUT& Z( w8 ]6 q, y
- #endif
) j) U. }& a3 I; N7 S6 g
+ v3 y( N( ?0 Z1 m6 _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 x1 `/ @. U. `! j5 w+ n - #define STATIC_SHIFT 34 w) y& {) r7 U; \8 |$ k! e
- #define TCINTEN_SHIFT 202 {. Y- g" p) }3 P- U- x, F
- #define ITCINTEN_SHIFT 21( J& f4 k3 e6 z% M" q
- #define TCCHEN_SHIFT 224 `( i& N( S3 c6 r
- #define ITCCHEN_SHIFT 23- X8 m: m! N \+ d* B/ t, K; n# `9 V
- % c2 o# k* ]& _
- static volatile int irqraised1 = 0;
0 y+ |# E# g% Q6 o - static volatile int irqraised2 = 0;9 [. w V0 W4 ?! N+ z- \! E& S
: Z6 F+ b: E/ u4 ~9 w2 h1 N. n G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ~9 m k! w- d+ n8 k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 M7 b& e) w# k- p! s& A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 L, B) l, @: k6 {0 W4 {$ [9 x* _) ]
" \9 z6 u+ i# `9 W. L! s- dma_addr_t dmaphyssrc1 = 0;* i) e1 y; h" z8 Y: ?( i# l Y
- dma_addr_t dmaphyssrc2 = 0;4 Z# q3 c3 m1 @9 T/ a: l$ Q
- dma_addr_t dmaphysdest1 = 0;7 |: w l: }& o( {* P
- dma_addr_t dmaphysdest2 = 0;1 U- c' F# x6 |2 l. r# W' E A( y" _% \
- ( Q/ |9 B" x" q0 _/ ?+ H J
- char *dmabufsrc1 = NULL;0 C m- r! V* |' h0 ^
- char *dmabufsrc2 = NULL;5 Y% d5 l. q1 d2 d7 N- @
- char *dmabufdest1 = NULL;" M8 `3 j7 `( y# {: `
- char *dmabufdest2 = NULL;, H! M! P) N7 ]3 a% E0 p# {! D
- 6 H& @. e7 |6 `3 s W+ Q
- static int acnt = 512;
. C: H2 Y; z7 B* `( g6 J& T" |# Y - static int bcnt = 8;# [8 \) y& A+ L& j
- static int ccnt = 8;
K8 U( s x, h: s
; w: C; S/ l, E' w0 @2 h- L- module_param(acnt, int, S_IRUGO);$ J# {* D2 Q, ^ K) {1 [
- module_param(bcnt, int, S_IRUGO);# L1 B) e3 v& V5 h, y
- module_param(ccnt, int, S_IRUGO);
复制代码 1 z! @! |0 r& s
3 e. O( T! V- K5 L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 \5 B* w- c6 }* J: C- {; o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 s3 y n1 [$ d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 u, c" C6 }5 O; W5 K
3 H8 V9 r' o2 v$ m' O$ H: v
9 x# \. y: t) a6 l7 ~1 c
|
|