|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 v0 U# k; x+ @) K1 X" \" U- [code]EDMA sample test application
# C3 y# R. X! \# T* u: J - /*: c: G( M5 ]4 C5 U$ |3 {, e, r0 t
- * edma_test.c
" V; U9 Q1 S* t& F - *
* T S) Y$ }- w - * brief EDMA3 Test Application2 h* B- r' |; t4 g* G% q
- *
9 g5 v# Z+ [) `0 E2 \( I* v4 _ - * This file contains EDMA3 Test code.
$ f! X' f" p% I- V! ^ - *5 S( ^- ]9 U: t; u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 q; c' Y1 w3 |4 z0 ?) e" x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; Z3 l' B5 q6 G
- * TO CHANGE.4 I4 r4 I* s+ U( ~# e3 W
- *
/ \/ C+ y" T/ M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 g& X: B3 {9 H( Y! N - *0 E3 N4 c& _6 _) B/ i3 B% O
- * This program is free software; you can redistribute it and/or9 M8 }' B; F& K6 R7 x8 C% b
- * modify it under the terms of the GNU General Public License as9 M y: H$ K3 i& ^( m& v
- * published by the Free Software Foundation version 2.
3 q" v( B% s8 _- y3 ~% z- q( l& u - *. B5 C/ G) g8 w3 L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 z" c; {9 `2 A" v2 |' U, t
- * kind, whether express or implied; without even the implied warranty
% u* |; H& J3 c; z, U m) ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 M6 F. N6 I) j9 j6 `3 l - * GNU General Public License for more details.
, L! d2 o: E# P8 I' ` - */3 ?( X4 ~ f% R# W0 H
- - I* z0 A% o' |) D; b
- #include <linux/module.h>
8 T5 `$ G Y/ k2 s# ~3 @ - #include <linux/init.h>
+ ?. ]2 a: ]: k1 y; J' E - #include <linux/errno.h># C p% Y& D. t. l! X, V$ E
- #include <linux/types.h>. z" [9 a9 `+ N; [6 z, v% A! f
- #include <linux/interrupt.h>
8 S! W( k7 b8 i! r5 K - #include <asm/io.h>
% D: _, O0 E# K$ v4 l' Z - #include <linux/moduleparam.h>
H& R0 r) h) ]: a& R' r8 u" x - #include <linux/sysctl.h>& G" c0 b' j0 c5 S$ A3 C
- #include <linux/mm.h>
) s( {) M3 r; s1 O7 ] V - #include <linux/dma-mapping.h>
* s, B( l3 E. P, M- ~. I - 7 L' {+ v% r% \) v1 m! C/ a) ?) ]
- #include <mach/memory.h>
+ w9 h. @* @3 u! M, D+ u' X+ g2 K }; D - #include <mach/hardware.h>! o5 Z" }) ?9 M; @& S
- #include <mach/irqs.h>
: a1 O8 I+ f: D5 j Q - #include <asm/hardware/edma.h>
2 Z; `; N6 R: ?" w$ C! F$ `
1 I2 C) m. h6 R/ l, I- #undef EDMA3_DEBUG* p. ]+ ]( j3 s3 M
- /*#define EDMA3_DEBUG*// t9 K& Y0 m9 [
2 {* x! {0 o) c5 f; P- g- #ifdef EDMA3_DEBUG: U* S' g" Y: |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% ^% Z9 u- y4 t% ^; X; |) Z! S, Z+ G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 R: h( P/ B6 W5 q# O, G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 l! ]& A! U5 |1 d. I, i
- #else+ r1 P; e5 D2 H) g. {
- #define DMA_PRINTK( x... )" O' N- S% @& h& L: a
- #define DMA_FN_IN
# N. \+ V! x$ t - #define DMA_FN_OUT
( r# s: ]; U, i/ U: F - #endif
$ a' @9 z& F' j. [2 F
E% Z. O0 q5 [4 g. C, n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 T0 A, @( H/ u1 d# w, c- W
- #define STATIC_SHIFT 3- X; _8 n' y2 F, _1 o; e
- #define TCINTEN_SHIFT 20
- D; L% k5 M. e* \6 t - #define ITCINTEN_SHIFT 21" L) h$ J; t5 @
- #define TCCHEN_SHIFT 22
- W/ M ? `! v" c" I" q - #define ITCCHEN_SHIFT 23
S1 f4 N1 J, X
2 A1 m" v, U8 s2 Q) i" d- static volatile int irqraised1 = 0;8 E* u: R2 l* s# k U' `6 S* `
- static volatile int irqraised2 = 0;
8 B% U) ] L# T8 R1 Y+ I
' M% i5 p! |' Q% _2 K* E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 o( H' n/ ^4 p1 W. ]6 D9 E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 f1 c. t8 K1 r6 V) s" {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ `2 a1 A7 O) S2 h6 j+ c" N9 u1 Q - ( n2 ^$ z2 z# R( J
- dma_addr_t dmaphyssrc1 = 0;
' v) v* D8 H- W" a! C0 D: t# a' u - dma_addr_t dmaphyssrc2 = 0;
2 _. x, [; G& D, }5 u - dma_addr_t dmaphysdest1 = 0;
& r# A8 s0 u7 L7 u6 m! J - dma_addr_t dmaphysdest2 = 0;( |3 p5 z5 e7 N' I
- - c, N6 U, H5 j7 H7 V
- char *dmabufsrc1 = NULL;
1 U6 A5 N K7 B8 d$ u - char *dmabufsrc2 = NULL;; K0 `' | @: Z
- char *dmabufdest1 = NULL;
/ y1 Y! Z+ a N2 ? - char *dmabufdest2 = NULL;" S) {! N, Q$ c+ R8 F
- 3 H' \& P+ b. y+ Y* I) V7 m- _
- static int acnt = 512;; _* B# e6 f4 ]+ F3 f
- static int bcnt = 8;
3 X: b1 Z5 J( }: e - static int ccnt = 8;
% U& t5 a" b. V+ Z - 4 K2 u! D. Y6 ^
- module_param(acnt, int, S_IRUGO);
4 c. S x( O; J$ Z - module_param(bcnt, int, S_IRUGO);
2 |7 G" R4 _6 ]- G- T1 ` - module_param(ccnt, int, S_IRUGO);
复制代码
5 _- d3 u# B- a
( `" B$ t6 a: v- i/ w9 H8 ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 N4 d& G1 \+ t9 J' i! i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' }" x. x& M8 G. e( b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 t4 }2 }$ J- e% e# j' s/ x# U* H# ^! h
2 I- [9 g @5 @( o) y$ f
" \6 ^. d! @9 ?1 j7 b; o |
|