|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + o# b: t' W. \% H' _$ a# m
- [code]EDMA sample test application
' H6 @% [6 J; ~0 @ - /*
. _1 U$ ?* N @& u1 g' r1 y - * edma_test.c
4 d) e7 p4 V* Z! d4 b: b - *( W+ n. p3 p, F( D- `4 y, }5 C! I
- * brief EDMA3 Test Application
6 `7 O8 l8 E* A% f5 |: F/ P - *+ B( {! q f' ^ W
- * This file contains EDMA3 Test code.
3 P/ G$ M* r+ G1 H6 g# c9 a - *) I. s# T: q" e$ ~+ p% Z A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# q8 K8 f7 z% S9 a% {2 M; [. l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( v% N' o( |( w: q2 p( b
- * TO CHANGE.
/ r% F8 u2 i, [4 c - *
0 i: x. C% n& s( w0 r1 G+ N2 }5 h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 z/ F6 W% m6 A5 \# y
- *) Y% D( k% H8 g2 w
- * This program is free software; you can redistribute it and/or
/ ]. X( j: J2 w( F) T7 k: c% k+ ^+ z - * modify it under the terms of the GNU General Public License as' C0 |& W& k2 O( q! N9 z% _- F: ^
- * published by the Free Software Foundation version 2.
! W6 F, [6 I. r8 j1 o0 ] - *2 M7 K" A% A' _- J! r8 u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any F8 w* a, ?" ?6 k# @+ c0 \) c
- * kind, whether express or implied; without even the implied warranty
3 z: K8 M2 ~( P" g% K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@3 S- b1 `% f1 F, y' @- z - * GNU General Public License for more details.8 H( V" v9 f. r: Z/ _
- */! J3 _$ ^5 E; r+ @& c% e
- 4 @! U1 w' |$ M2 o6 x+ x5 y
- #include <linux/module.h>6 _7 b' _6 ^1 V! ^. L
- #include <linux/init.h>8 E. @) j$ S4 A5 o+ u5 b
- #include <linux/errno.h>
. c- f, A2 K) f0 q$ E - #include <linux/types.h>
9 z. N! A: h9 O C - #include <linux/interrupt.h>3 j- V( d- K1 g
- #include <asm/io.h>
- ]9 t4 N: N' O) m3 @ - #include <linux/moduleparam.h>
; ~) V# L( {" x - #include <linux/sysctl.h>
0 f/ A# O6 ]6 r( h* g, M& v6 z: b - #include <linux/mm.h>$ R2 ^' t9 L3 ^
- #include <linux/dma-mapping.h>
2 f4 g& l3 h4 k& X5 Y4 o! {! d
( u1 {! R) i+ |8 u9 v4 e8 A" m- #include <mach/memory.h>
! W0 W' S1 q. v% ] - #include <mach/hardware.h>1 A& k' v! u) r" h( N+ I
- #include <mach/irqs.h>
5 l' [: F! f3 | - #include <asm/hardware/edma.h>
% X' }, H9 x( W* L
% i8 p* E6 m+ k/ l! b& `8 Y- #undef EDMA3_DEBUG
2 [1 P% m5 r! R& |0 P6 K( w( H" g. B - /*#define EDMA3_DEBUG*/
$ Q( ?/ O* x% i2 S; k+ Y - & d( H1 U+ T% k+ v
- #ifdef EDMA3_DEBUG+ q/ h. E" T/ j+ N( ~" K- a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: M+ q: p3 n6 o# a0 Q) v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& p8 S: D1 c9 W- ^' z% ^& T5 w; S [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 {0 N4 `& W4 P/ i& P5 \: D; |, @ - #else
/ F: a0 d/ s9 i - #define DMA_PRINTK( x... )* c8 A* ]- E9 a$ i; h, K1 h3 q0 p
- #define DMA_FN_IN& W' w/ V6 H. s$ U( m' `9 p
- #define DMA_FN_OUT
& u/ ?" I+ O0 u - #endif, w* \ r. F7 h P
- 6 f" G* h" a/ i" t; Z* R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), S& B2 x8 H- e o* H. N! r
- #define STATIC_SHIFT 3
5 {8 n7 Q% u8 C+ o- h - #define TCINTEN_SHIFT 20
9 E0 }$ Y. e& ]( v - #define ITCINTEN_SHIFT 219 w1 O) D2 P, _' P
- #define TCCHEN_SHIFT 22
7 W- I6 l, x1 k E* p - #define ITCCHEN_SHIFT 23
1 X2 c, n: r% J7 e9 n+ G
4 R9 O" b* T( G! k- v- static volatile int irqraised1 = 0;6 O; r: V3 Z# z& K' r1 b
- static volatile int irqraised2 = 0;
4 V& _; Y! b. t - ! P' A: n G/ L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 `6 p& w& K( p. W7 C0 ~9 n- L3 U+ w" M# `4 r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- @0 r0 b+ x R+ m1 K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# K& }) ^1 f" N5 q& c- e - " |2 [( a( U$ ]: c1 J( q4 L+ W L
- dma_addr_t dmaphyssrc1 = 0;
8 ?2 X9 B4 l2 [3 H P" P - dma_addr_t dmaphyssrc2 = 0;" @- m% |. i' N3 ?2 @+ X
- dma_addr_t dmaphysdest1 = 0;+ v* z7 M1 J4 \- I" U
- dma_addr_t dmaphysdest2 = 0;
" p. Z! v. M* s1 [
" `4 Y0 t/ k2 w3 z9 R* K6 Y- char *dmabufsrc1 = NULL;
+ q2 r2 [7 n' q# a) q - char *dmabufsrc2 = NULL;
, E, R# }% E, a( b4 M - char *dmabufdest1 = NULL;
4 `: K. H! J8 A/ u - char *dmabufdest2 = NULL;& W% x/ l$ S8 S9 c) j$ b* C
- 7 W- ?/ B2 \% U; R
- static int acnt = 512;- n0 s1 K3 G5 b1 I7 i! a' _) e
- static int bcnt = 8;6 m6 m# y8 O1 j( ]; u+ B4 F
- static int ccnt = 8;9 x7 E/ i/ _; V t0 q# ]$ a
# G$ B# G! F) p- module_param(acnt, int, S_IRUGO);
* b Z8 i4 U) X. @* @2 m% _ - module_param(bcnt, int, S_IRUGO);) A$ J% z" o; @$ x, _
- module_param(ccnt, int, S_IRUGO);
复制代码 5 {% G6 A) M0 G5 e. y* Z# m
3 k9 L& B6 [0 [& p/ M: Q* c, r6 V. b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 @# C6 {: k5 p5 t* ~5 l. ?% h8 {+ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 x: z+ Y# V0 L2 A! f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( q# l/ \) h% L6 y
4 f) y) H& D) l
4 ]- ?5 j J# |/ U |
|