|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 }+ l1 S' w0 A
- [code]EDMA sample test application
+ W! [! ]1 k+ `/ v( i* V7 H - /*( {2 L3 i5 Q" `$ V, V4 g
- * edma_test.c" U" l1 F1 m+ {0 a, }% e
- *
3 h; U. \( @: E - * brief EDMA3 Test Application, }0 t! a# o( {& B* i4 W& O
- *3 e% w8 L3 p- H1 i/ X0 M" m
- * This file contains EDMA3 Test code.
/ J9 w* e3 d+ G- x - *6 n6 _: `' H! D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ T% E( G% |3 G& N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 ~( k S _5 E( \4 w, g
- * TO CHANGE., A3 x: Z3 n( E2 ~9 E
- *% @ n3 R9 r. k$ D$ P9 }6 o N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; m" j2 v' ?5 _- ]5 T+ t - *
e$ W3 d5 u2 u# a, \$ f! \+ D - * This program is free software; you can redistribute it and/or
- k* k- h7 V- o5 j) q" o) | - * modify it under the terms of the GNU General Public License as* y# X5 i: ?# D: [
- * published by the Free Software Foundation version 2.2 G2 G" X" N+ T$ K0 n7 I+ ^
- *0 z7 D* f& v; v9 P2 k5 X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; _, I1 f. O) S! E5 J& c - * kind, whether express or implied; without even the implied warranty8 I( k1 S2 b e: a+ S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, \3 Q1 V. r7 ~* q, |# t2 \
- * GNU General Public License for more details." x$ r8 y3 l, {1 c0 W1 W, G* d# ]
- */
1 k+ \% K/ S$ e" }* h9 E
O7 \3 F- B" y3 u4 v- #include <linux/module.h>
1 T* p+ V* Z+ P8 W' x - #include <linux/init.h>
) z0 O/ p# U3 c2 m - #include <linux/errno.h>2 C& |) t: p! k: r
- #include <linux/types.h>
6 g. J/ I5 U+ X& T* I, U - #include <linux/interrupt.h>
s; ~9 f" W; Y( m, p% |! T - #include <asm/io.h>( Z7 G/ R+ w; U) v
- #include <linux/moduleparam.h>
4 K R4 J) z/ @$ }2 W - #include <linux/sysctl.h>
$ u7 o* o e( ~" k - #include <linux/mm.h>7 H; v1 o/ q" {6 l2 f; a% A
- #include <linux/dma-mapping.h>
- O0 j4 n7 i+ q
8 F, b ~( r4 i9 h9 u: N) u- #include <mach/memory.h>
0 s8 Y/ E- j% N - #include <mach/hardware.h>
; V; Y4 L5 G/ X+ p6 z& A; f - #include <mach/irqs.h>
) D/ R5 g X! s3 T4 x - #include <asm/hardware/edma.h>
g" C3 M% |' r! N - * ~( g$ ^, a+ `7 V! Z
- #undef EDMA3_DEBUG6 ?! M; m/ \3 T* @9 `
- /*#define EDMA3_DEBUG*/5 U4 R: g. T% x! Z
- 9 m# d @# M# H& u& s
- #ifdef EDMA3_DEBUG
% I6 k5 ]! K. M/ E# a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( m t2 v+ N( M( U9 R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( J+ U! |. u& I- M/ y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: [1 t& M1 @' ` p% x: o+ V! | W6 P - #else1 S5 I4 L& h h& G( g
- #define DMA_PRINTK( x... )
8 N2 C, o+ s0 N - #define DMA_FN_IN
& q3 |6 G* m/ w& K( }0 t* g( F+ H - #define DMA_FN_OUT5 T0 V' \6 U$ n A: Z7 ?) d$ w/ S7 n
- #endif
$ v- r0 ]3 d* P( } @: C
" I5 B! n4 f( @! b5 o5 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" P1 p: S; I# o, T9 R6 @
- #define STATIC_SHIFT 3+ G7 A" E" }. m3 B5 n
- #define TCINTEN_SHIFT 208 E. E0 r: s9 J4 k2 Y/ X
- #define ITCINTEN_SHIFT 212 m; Q# e5 f, j1 _0 U% E
- #define TCCHEN_SHIFT 224 l$ S% r Z% W$ }
- #define ITCCHEN_SHIFT 236 Q4 w" Z: P0 \8 E6 z
' W; e. i- y2 A" O7 W- static volatile int irqraised1 = 0;
2 R& C, ?" j5 _* q* |# s - static volatile int irqraised2 = 0;+ x% D" d/ f+ a9 z! Y# \
7 q' L( b. Q; M0 L. k1 K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 z/ j7 I! ?! i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: a J/ s. e- p) ?; A$ b# F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* E8 G# Q; v/ V4 A& G4 E
! v2 W: Q) i7 G2 Y- dma_addr_t dmaphyssrc1 = 0;5 w, m6 r. i% Z3 s. i( |( i. h# g
- dma_addr_t dmaphyssrc2 = 0;
$ R. ^. Z, V: W3 s - dma_addr_t dmaphysdest1 = 0;
B' k P0 w! n- ~ - dma_addr_t dmaphysdest2 = 0;
' d% [2 w2 [- F. X$ v
, |7 m9 u/ e1 r' p0 V$ C1 @5 V- char *dmabufsrc1 = NULL;. A9 h6 {3 t( s* K0 Z
- char *dmabufsrc2 = NULL;
0 ]; T: p" O9 R3 D - char *dmabufdest1 = NULL;: W% s+ _+ L: K# x2 J1 |
- char *dmabufdest2 = NULL;
" b8 K. M: P% V8 U, T$ e6 d( P
9 q9 z8 d! Q3 e! L5 I1 z5 ~- static int acnt = 512;
# P+ J4 s' s X" ]. ?% W - static int bcnt = 8;! |& x: t% i. |# ^7 i
- static int ccnt = 8;# W* L, r- s2 }: p2 m
# V" u9 G" c p7 A4 X- module_param(acnt, int, S_IRUGO);
1 i& r! p% h9 v6 ~ - module_param(bcnt, int, S_IRUGO);
% s" v j: W% F2 T - module_param(ccnt, int, S_IRUGO);
复制代码 7 f3 e- t0 P$ d( M0 h! n+ \9 r
2 E V% `6 {: K* X" w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 E# e: N/ a. }# j$ L, b' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! ^. \( \; D u% S. G% _8 d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# ~2 L; o9 O; h# G# E% o2 e3 T) G5 S
# o8 {# P; ^9 D; E. x2 Y
" K% S/ i: `) j7 i4 Y0 @+ [ |
|