|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" t- s3 |8 v& G& [2 X* H* c2 T2 \/ g- [code]EDMA sample test application5 E# T$ T4 G! V
- /*
% b* h6 J, L- l/ m [% G - * edma_test.c+ t: A4 r. {) z2 M: \0 v. H+ K5 _
- *
0 U# C( ~7 d: a; H - * brief EDMA3 Test Application9 D7 O0 E2 V4 _& U* M! m
- *7 d8 G& Y3 o/ Y9 p) C/ ~4 U* R
- * This file contains EDMA3 Test code. R1 [1 @9 u+ R0 U. h
- *
% t8 `! E F$ Z) Z+ G: O# I$ N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* w0 W% Q* b E! N" T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 y' R5 ~2 ^ h
- * TO CHANGE.' @* F# s- e( ?3 f3 L: x9 m
- *6 g* b% ?) o& X5 k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 X" h D. m S/ U8 l - *
$ q/ x% |4 W$ b l- L8 a - * This program is free software; you can redistribute it and/or, r9 [" I6 k( \
- * modify it under the terms of the GNU General Public License as1 @2 E& |) h" d& V( s( m9 R! x
- * published by the Free Software Foundation version 2.
- t! {3 u$ @7 L6 N; x1 H7 s( m - *
& S% {" B' |0 M3 y& f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 I8 \3 M* _" {, O0 r* M5 y - * kind, whether express or implied; without even the implied warranty+ X' L3 w1 Q0 _6 } z* u+ G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, }3 @ w; d$ C* Y
- * GNU General Public License for more details.# u+ N( o. ]( B" [
- */: `7 _; Q: o8 j3 o# _! U% `
# Q i" g; y& D l- #include <linux/module.h>
& A0 B# |; c$ _% P( P$ J3 J2 I& d* G - #include <linux/init.h>1 a: N& L0 v3 S2 R" t! o7 m4 o$ X
- #include <linux/errno.h> k: T, W% B5 m+ u
- #include <linux/types.h>
- _ O5 N v6 P* ~* r6 j, J - #include <linux/interrupt.h>" e4 v B S A
- #include <asm/io.h>% Y+ J( _) T* D1 c! W" y
- #include <linux/moduleparam.h>
2 I/ F! I# c" R j' b - #include <linux/sysctl.h>5 h% `; Z7 W5 ]3 I
- #include <linux/mm.h>' g0 J5 f/ S6 N+ G
- #include <linux/dma-mapping.h>/ i" y+ S5 n) P9 J
- w& n% ^+ O! i$ R0 \/ w3 m& t- #include <mach/memory.h>5 Y/ B) a+ y: A
- #include <mach/hardware.h>2 a. X3 m8 M7 K7 }' Z6 ~# z, |
- #include <mach/irqs.h>0 S0 x6 n, N4 w3 s
- #include <asm/hardware/edma.h>
% i) I* n) t$ F2 s - 7 l/ N7 {3 q4 D9 C. \* P7 @5 ~9 `
- #undef EDMA3_DEBUG! }+ w" d& z! x% W7 \
- /*#define EDMA3_DEBUG*/2 o. a- Q) C6 |( r) k8 U
' J9 i: O6 G n- #ifdef EDMA3_DEBUG
; O2 s5 }) J" J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" d5 d, _) f5 M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( ^" S/ ]( T+ \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 y1 A9 Z$ I& H. ^2 }- b
- #else/ W2 _+ b, ^9 W3 C1 U
- #define DMA_PRINTK( x... )6 a% J. a& b8 m$ C! ~+ x
- #define DMA_FN_IN
0 _1 ~8 e% E+ E- ~1 W6 p - #define DMA_FN_OUT, P" t8 l# B; J0 s
- #endif7 u% W8 H# R, _
: h$ Q5 m" g, t9 Q& R+ i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 G# m1 W/ W" f" x - #define STATIC_SHIFT 38 A( |7 j- j( r9 q: ~
- #define TCINTEN_SHIFT 20
) b/ u4 p, ] e8 `8 k/ Q6 L6 A7 [+ I - #define ITCINTEN_SHIFT 21
! n6 |! z* e0 q3 v3 B8 t$ k2 i - #define TCCHEN_SHIFT 22
. c) N2 Z1 r& e$ s - #define ITCCHEN_SHIFT 23
' l! W, Q* ~. d - + y" R2 n1 j3 {! u
- static volatile int irqraised1 = 0;
+ b w: y) {/ ^" Y/ q; C- x& c8 B2 S - static volatile int irqraised2 = 0;+ q3 z+ v* x# `" b- B
- 5 |; w0 | N7 h4 [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 l+ N( K; o' z+ \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ C- P0 W5 C& Q% y9 b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! q! p) K1 a+ E% q
, b6 U- Q* ]4 ]- dma_addr_t dmaphyssrc1 = 0;
' c, D/ ?7 m$ U& L4 z) e" e - dma_addr_t dmaphyssrc2 = 0;
7 }0 o2 k5 t: g8 e W - dma_addr_t dmaphysdest1 = 0;
8 o9 B' W# w4 p0 Q } - dma_addr_t dmaphysdest2 = 0;
/ w% g6 i! y, T
8 T. c. {$ }. T3 L$ y& @- n) y- char *dmabufsrc1 = NULL;- X, s8 l$ _' F5 z w0 L% R
- char *dmabufsrc2 = NULL;
6 T# q, U. _+ @+ j& N - char *dmabufdest1 = NULL;* J- ]1 b% F ?2 @4 o
- char *dmabufdest2 = NULL;$ ]! v: b& ]: O: O" F
- ! \5 C: X! ^# |- r5 \
- static int acnt = 512;
: f! C3 j& \" D/ ~; V - static int bcnt = 8;
+ o0 t$ F# f/ Q. b" C. {5 T - static int ccnt = 8;
" F9 r7 g4 q: c: e9 e. D - , f1 Q3 ~2 y, ^+ {
- module_param(acnt, int, S_IRUGO);
: z4 ]: q9 r% }% G2 U3 p - module_param(bcnt, int, S_IRUGO);$ j, D# {( s) _$ Y$ [: v
- module_param(ccnt, int, S_IRUGO);
复制代码 $ j7 b: W0 g* P3 k# v( a! s
& c: w! v! d6 e1 a% {2 m v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- Q6 q' T1 [/ }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! I% [4 c( ~2 @; i0 Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, D/ E8 Y6 m- g e# f& x& u1 M
/ u: ]- Y7 ?; c2 A; u+ y$ ?0 S# U Y
, L0 T8 d& @6 D1 g/ [7 B4 V: }. D' Q
|
|