|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- g0 p; _" B, i: x' [- [code]EDMA sample test application+ b5 V0 c! }( H; x# o- ^
- /*
0 Q5 R z, K* D$ h: a+ K - * edma_test.c
0 h+ F/ V' T- Y' \6 z - *' y" j: F6 q9 B; f
- * brief EDMA3 Test Application
% P$ q4 U7 u/ ~# Y: c* B |" K - *
B6 E9 U# V+ T1 G3 m+ o% d - * This file contains EDMA3 Test code.$ U% P7 c4 Q8 T. e" R1 Z
- *3 V* o8 @# N) B; b/ q/ W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ ~8 }& A' ]6 [$ u" Z: v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( z* k0 [! P* k$ v1 m
- * TO CHANGE.1 Z4 f3 g9 n7 u6 W6 {4 n4 Q
- *' V3 O" D' F& ^4 s4 y# g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# [8 o" v( r) }: A Q" x
- *6 l7 I6 r5 Z& R
- * This program is free software; you can redistribute it and/or
, k. z4 V& z4 R - * modify it under the terms of the GNU General Public License as
! q! f( s: @$ b7 M( t6 X - * published by the Free Software Foundation version 2.3 r6 ^! v- ]% X% d# t0 m4 j9 X4 s! ?# b
- *
6 t. h& q$ E# ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! M5 q6 H' b4 N8 [ - * kind, whether express or implied; without even the implied warranty
* x* r$ p& f* J& b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ f O/ D6 ]. ]' F; W - * GNU General Public License for more details.
8 N2 u; d! j+ G - */
. |. G+ F. n" r' @3 _ X - 5 e# a8 K4 ]! _* H
- #include <linux/module.h>
9 M! ^% H3 s5 W$ Y# P* r( P - #include <linux/init.h>6 D, V9 g0 a2 z+ s; d( `
- #include <linux/errno.h>
9 E1 r, X% f6 a$ r1 V3 c8 a5 N; Z - #include <linux/types.h>3 M3 w3 f: e9 e- Y
- #include <linux/interrupt.h>9 S/ E" G1 f' r. m3 _1 P
- #include <asm/io.h>
- a- T$ Y7 f% v2 ^" H( s - #include <linux/moduleparam.h>
W8 w: }& [, ^# |1 g) r9 m8 F+ U) E - #include <linux/sysctl.h>7 [. Y2 n: b( O3 l9 i3 X0 V
- #include <linux/mm.h> s& f y4 i7 V6 v, S
- #include <linux/dma-mapping.h>8 J" x) l# N9 Q" G
- 9 i+ l* e+ T4 y+ p& M
- #include <mach/memory.h>) E5 ?9 o; P+ f8 x$ a! J6 L3 A
- #include <mach/hardware.h>/ l* k" M- L- T7 s6 H4 ~1 E
- #include <mach/irqs.h>
8 i8 x, c. G+ U, h - #include <asm/hardware/edma.h>
6 F& q- N. |( k3 v3 ~ - ; i: N( I! D) C, z3 U+ a
- #undef EDMA3_DEBUG$ v& X2 d0 ~* H9 i% G
- /*#define EDMA3_DEBUG*// N. O/ m8 x2 O
- ' v7 u, x) n0 I- u; E* V. I
- #ifdef EDMA3_DEBUG- R2 ~- ~7 w2 ]7 d) P2 n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); |7 ~* @; q4 G4 E( I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; z' o- [/ _, j3 f0 Y4 A) `3 @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 f7 j5 e/ l6 |2 N/ F0 l/ G" ]7 M* g7 Z - #else0 H* H% f' @) B% a; `
- #define DMA_PRINTK( x... )" f; `9 I3 ]9 O) Y/ ~& Y4 j
- #define DMA_FN_IN
7 B' S) c0 k. P& Y* E - #define DMA_FN_OUT. u$ I/ \; Z5 E8 ~& W3 N
- #endif' J( Y) O9 P4 ]
- 8 a# M4 Z- ]" S8 K8 L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 \* h# R7 V/ P: x
- #define STATIC_SHIFT 3# v, b: i2 H7 X& ~& x# `
- #define TCINTEN_SHIFT 20
1 N5 z4 E5 o! E4 j6 ^1 u, a. S+ w9 l" \ - #define ITCINTEN_SHIFT 21
. f$ y. n$ P4 y: T- E( D7 t" | - #define TCCHEN_SHIFT 22
3 j3 J4 y+ I1 {2 ]' D, F: E - #define ITCCHEN_SHIFT 23
5 g$ Y# F0 |8 T9 Q8 n( S! v - 1 R# n" }/ a1 `4 z+ E; o! r
- static volatile int irqraised1 = 0;
% f7 ^# M! I6 ^ C3 q+ r - static volatile int irqraised2 = 0;$ V2 S3 p* t4 U9 q2 ?
- H# k# T% J& X) `' u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 h1 h5 q' [2 q! {* m4 `* G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 g$ c2 W9 U, b( ~" H* N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& [6 O6 v# Q' m3 J
$ d' O( Y! j$ H0 {2 M: [% k- dma_addr_t dmaphyssrc1 = 0;
2 U4 }" m$ M6 w3 [ - dma_addr_t dmaphyssrc2 = 0;7 t6 w9 u+ f/ {- X& k% b
- dma_addr_t dmaphysdest1 = 0;
4 m/ [8 {* i& o# f% J7 a7 @ - dma_addr_t dmaphysdest2 = 0;
; Z8 j" t. j: R! Z1 R' V i - ! v7 O* x* F, E9 N% }$ k9 L
- char *dmabufsrc1 = NULL;* S7 D9 `* e) {, I& M
- char *dmabufsrc2 = NULL;. r- _* X& O1 [
- char *dmabufdest1 = NULL;
0 G. R- g" ?0 ?: Y% D - char *dmabufdest2 = NULL;
& l& _! ?- x1 b" f - , A. @$ `+ G2 d0 N
- static int acnt = 512;( x: e- Y0 H1 v, B% U/ `
- static int bcnt = 8;
9 H8 K9 m( J, i' g; d4 P9 z- q - static int ccnt = 8;0 J: `1 n/ M( h" \
$ S& p; ]6 F- G4 }( Y- module_param(acnt, int, S_IRUGO);
: t7 M: ?1 a1 b8 [! u9 O - module_param(bcnt, int, S_IRUGO);
3 {* a8 V* v) d! _$ c% ? - module_param(ccnt, int, S_IRUGO);
复制代码 ! t, Z' u0 |6 J/ J
6 E/ H7 {4 a; F' P8 a8 D4 f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
F6 @$ U1 i" X3 L# M& K ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) b* R0 y6 M9 q+ ]1 Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ H1 s5 r- T; U
f1 v2 Q! W! H4 Y$ n5 W' j! s0 ^1 K8 \3 W r% n
|
|