|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 X' m) x" G/ |# h+ ` ?- [code]EDMA sample test application m! C% t+ V+ h: }$ d7 w3 B# x
- /*8 ~) C' R" z4 X1 W$ N- _2 ]
- * edma_test.c: p" Q1 I) z! x6 T0 P- x, E4 Z2 u; {/ D3 I
- *
$ E: J: \$ l% n7 P9 \( _& U - * brief EDMA3 Test Application$ l: }$ C, O' } p. B9 n
- *
5 L; e" I: p5 q4 p* e - * This file contains EDMA3 Test code.) b/ X% V9 {4 b
- *$ I" ^. ~+ i1 M) ?9 [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 z' r/ D8 f& [# \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 v& t9 D9 @* W$ ^( Y - * TO CHANGE.
W d# h0 {0 f0 O% G; { - *% R$ b7 c1 p# {9 b a% a" | D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- p- X8 ^/ r! t
- *4 W' L$ u# D$ C% ~) d; z
- * This program is free software; you can redistribute it and/or' K$ _+ Z& _' {
- * modify it under the terms of the GNU General Public License as
. s5 N: C& [& i8 L) f1 Z& } - * published by the Free Software Foundation version 2.* E4 x2 @+ C; ?* M- x
- */ s: z( s; h% X' U' U: r3 C7 g+ i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( s1 x# J* ~9 \ C( A5 J& A
- * kind, whether express or implied; without even the implied warranty( A% Q, Q+ g3 F/ e$ x$ H f* q2 [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 n' q) W0 V; |) Y, N
- * GNU General Public License for more details.' u) Z0 C' d1 k
- */& c4 D* v, ?4 V" d* }
9 f9 D+ c+ ?6 c0 p8 G6 ?/ E1 k6 @- #include <linux/module.h>0 E$ _9 x Q. T! Q
- #include <linux/init.h>
9 N) p* B5 {7 f/ g: L - #include <linux/errno.h>4 m& c- ?3 Y6 u( ?
- #include <linux/types.h>
" z$ f" L) Z @" o0 u - #include <linux/interrupt.h>+ d+ O3 f I6 e. y% s& P% `& J# c
- #include <asm/io.h>
: E9 ~: K' T" L( R# f - #include <linux/moduleparam.h>
& q2 u) a( j1 D# S3 X; k( z" E# | - #include <linux/sysctl.h>( o) I, Y9 o7 Y0 T
- #include <linux/mm.h>
7 J0 M2 q" F W. w - #include <linux/dma-mapping.h>3 \* u' T4 } w5 A- F' k7 _+ E
0 u7 U( V! |( o0 n- #include <mach/memory.h>& ~" m' ?+ P0 U& F# K8 P X
- #include <mach/hardware.h>, I" [. d8 T0 \, {
- #include <mach/irqs.h>
0 O+ X& t7 k, v* N - #include <asm/hardware/edma.h>+ z: C7 L0 q+ N7 g; u, P6 T% U
- & I; q4 Y R9 O6 T8 a
- #undef EDMA3_DEBUG; d/ y- m e; |/ K/ f a! J
- /*#define EDMA3_DEBUG*// v, l* _) s/ F* Z4 G* p
- - A+ a" g) h" I Y/ X7 k% a
- #ifdef EDMA3_DEBUG* j7 H; c; p9 O* |1 l/ `5 H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# f1 m% S& C; T; i- l4 u& W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) @% l; K5 ~( j( V; H8 m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): _/ J, U2 e: l9 c# P/ Q/ G
- #else
" x! J1 s8 ?+ f% x3 e' Z4 j; H - #define DMA_PRINTK( x... )# C0 e1 k- Q$ B, P1 g$ t4 ~" K
- #define DMA_FN_IN; x+ P) M- R' ^5 f- a! t! T5 j: |% A
- #define DMA_FN_OUT' ], A Q" B0 v6 o
- #endif! Z& R' P1 x, v, d7 R) G+ f( a
/ T* L7 y- U* |7 ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% p. D+ }, ]1 \! g2 i/ Y - #define STATIC_SHIFT 34 a# Y& t0 A6 s+ e# p5 s# j- h
- #define TCINTEN_SHIFT 20
% ?% q# d* `) o s+ k6 R - #define ITCINTEN_SHIFT 216 B# \9 B3 M0 @/ R
- #define TCCHEN_SHIFT 22! `3 O* y! U+ v9 y6 ~
- #define ITCCHEN_SHIFT 23
0 i( t0 n; `1 A5 D8 e/ i) @8 K - 7 A; W2 `. _% y3 m5 |, q) u. C
- static volatile int irqraised1 = 0;% D4 J+ j) x0 l) i! }- B E
- static volatile int irqraised2 = 0;
& B/ v1 h- F4 O t - ! p. F% s3 }2 w+ k+ X$ J# |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 t2 T2 {7 J, `% A* N u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: R1 o9 Q, |5 x& C. w; { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 f, D) s S |7 D4 y/ M) q& J) i
, R; r, o9 g" L- dma_addr_t dmaphyssrc1 = 0;" G- ~3 y& A9 _2 q* p
- dma_addr_t dmaphyssrc2 = 0;
: A; k' e3 `, r2 I - dma_addr_t dmaphysdest1 = 0;- F: _6 }1 J2 d. [: c
- dma_addr_t dmaphysdest2 = 0; O) ~" g4 s2 o1 D" U9 L/ ~
& g* R/ Q5 N( n! L8 {; S- char *dmabufsrc1 = NULL;- ?/ w b/ W6 N' |0 I
- char *dmabufsrc2 = NULL;# |+ X7 g4 b: g2 I* |& O3 V
- char *dmabufdest1 = NULL;2 L- u# ^& L& e' N
- char *dmabufdest2 = NULL;7 [/ k" k" N! X# N
5 q, i7 J, {9 `2 F- D0 M& Z- static int acnt = 512;
6 b! T3 _1 V% \; f: @ - static int bcnt = 8;
- f5 }* ~' }9 t$ E - static int ccnt = 8;$ Y& U2 y# D! r/ r; y
- / C/ B0 E0 b! m. j
- module_param(acnt, int, S_IRUGO);! k, `% b! u; `. ?6 z
- module_param(bcnt, int, S_IRUGO);
5 F# n3 W4 K, V* N0 o! p! m - module_param(ccnt, int, S_IRUGO);
复制代码
, |0 A5 {; ^$ j5 ?# A. r; u1 t( C
7 ]+ U y, A9 t3 b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 u3 t" E! x$ d5 }" A$ \9 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- ?. G$ r* g4 ^: L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. q# |- H! r( y8 [& H
% F0 u0 v) U0 J9 N2 c; T2 W) Z
6 |& P& K6 Q+ A& q |
|