|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % m5 k3 c5 v s- G; N) S0 U
- [code]EDMA sample test application( E4 Q( x4 |& r1 S
- /*
+ A: Q! a' C) G - * edma_test.c
G1 ?8 b: m' |( _) r - *# A2 }9 B3 Q+ t1 \1 I0 A
- * brief EDMA3 Test Application
2 Z4 D6 W, q* |9 M, V - *
& R! K1 ]3 _* y - * This file contains EDMA3 Test code.
7 y. p4 e6 V, Z' J+ m; M - *
8 v$ N' G6 q U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; E8 c' l5 b; H5 }5 x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* v- h9 u' Q! Q! G8 G2 M: P - * TO CHANGE.8 n, U0 f) ~6 u/ @
- *
7 h9 r v |; f, {; s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ g. @! ^7 E! C, Z - *
/ l) l+ m. n9 `: y* \& z - * This program is free software; you can redistribute it and/or' t6 r$ Q R, J5 ?% Z2 ~$ c
- * modify it under the terms of the GNU General Public License as6 p6 b, J2 |8 x
- * published by the Free Software Foundation version 2.
2 O7 m! S8 c6 N- q- r8 V% X3 ] - *
+ Y" O! M2 e" w, s* D' n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ z9 Z6 c( t$ ]/ y - * kind, whether express or implied; without even the implied warranty$ P, a$ D' k$ b! d5 H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: r. M; b: ?* f
- * GNU General Public License for more details.' I4 V! ^+ H# r9 j6 P8 s8 G( S3 a
- */1 E( w" r* \' }4 q) {4 R# N2 M
- # X4 }, [( O: f, o
- #include <linux/module.h>
5 g3 S' {( D% `' G8 t: U$ L. a - #include <linux/init.h>/ q/ F! G% B6 d% k3 E9 X& S, O/ g
- #include <linux/errno.h>; @& T6 ]5 V5 x
- #include <linux/types.h># l8 h. r: E+ C7 k1 Z
- #include <linux/interrupt.h>
8 O1 v% s; b: s6 y* u) Z7 L$ c6 i X - #include <asm/io.h>0 ]- z$ z& X3 n
- #include <linux/moduleparam.h>
, m. _% @0 ~0 y5 U; M - #include <linux/sysctl.h># A9 s( v! S1 Y" {4 }0 X
- #include <linux/mm.h>1 S8 A$ P4 o$ j% H
- #include <linux/dma-mapping.h>* w% }* a1 w# E8 m& N9 J6 I
- 1 S, C1 ~" d4 E% m1 |, @9 i; G! `
- #include <mach/memory.h>
3 Q; D8 k3 A( M+ t T9 _ - #include <mach/hardware.h>, m1 {! x3 W; w. g+ j% m
- #include <mach/irqs.h>! m0 T+ x6 a( E9 `) ~
- #include <asm/hardware/edma.h> [4 `; o3 Q9 U/ N$ s
- 9 @2 K/ O4 P+ k3 l s/ n
- #undef EDMA3_DEBUG
% w! x# m+ [8 ^8 ]3 }0 w) N9 O( z4 b - /*#define EDMA3_DEBUG*/1 ^ N# u' u3 r7 b0 O) H' H. I
- 1 p! R' h/ v) J) W0 u8 r& y
- #ifdef EDMA3_DEBUG7 K% m' z3 _( H2 D+ E( @" s b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( l! B) O- f" N+ ], v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 Z* o: z( u! [5 G$ T) s! y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' L% k; b& l+ K) H, M8 _+ T5 N
- #else
: |' Z2 `" T5 } - #define DMA_PRINTK( x... )
: U- W& r) d! Q - #define DMA_FN_IN
' O2 V2 J4 U5 i2 k; Q - #define DMA_FN_OUT
$ [. ^2 q, t2 t5 P7 g% t - #endif; [% G1 A6 M- A( w! u4 u
7 [5 s; Z0 _% u% I+ r- h- M7 v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# E+ r# }" s: p5 J- t! f1 S) N% a' i
- #define STATIC_SHIFT 3
9 p4 B2 x" T4 d2 T1 _ - #define TCINTEN_SHIFT 20
$ W# J% v/ }7 l, X - #define ITCINTEN_SHIFT 21
/ _: W* }/ b: i% @ - #define TCCHEN_SHIFT 22" a6 _$ Y p6 _' h7 x4 ^
- #define ITCCHEN_SHIFT 23% V+ O o5 }! f1 k; _" G$ E
- ) j0 Q2 O/ m( ?( [( M: g7 ~7 i
- static volatile int irqraised1 = 0;
i# w4 W5 U7 S8 v+ a - static volatile int irqraised2 = 0;
& u2 E I7 a) d4 R: ^1 S& q - ( |- o! k- v: k7 k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 E! D# G, {) Q7 n. S9 i; }- Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& e" J8 Z& P: z4 d, S' [3 {3 w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ p4 P2 a ]8 ?8 v$ C5 j# I - ( X& _) E2 O: @- Z2 `+ D& X
- dma_addr_t dmaphyssrc1 = 0;
) `3 e# F1 \7 k, z& J7 P - dma_addr_t dmaphyssrc2 = 0;
+ L9 E$ l. x$ g5 _) l - dma_addr_t dmaphysdest1 = 0;
. W' }1 A0 R+ f2 ~8 [! @5 X - dma_addr_t dmaphysdest2 = 0;
2 a$ \4 N* q# G" S( R - - ?0 r4 q: e# C1 v% h5 ]" [
- char *dmabufsrc1 = NULL;
2 y! h4 q9 i* P& k) B - char *dmabufsrc2 = NULL;# I# X( J( `, C; G4 ]6 a2 P
- char *dmabufdest1 = NULL;
% f G; D, ?. S( T( @) h - char *dmabufdest2 = NULL;! ^) W% j) z) U- \- ~7 o
- : G3 C0 R: c' Q9 l
- static int acnt = 512;
5 ~4 P! R+ S) P7 n7 i g; x - static int bcnt = 8;! j8 x ^5 R/ ~% k- Z
- static int ccnt = 8;
5 A. q/ X9 R4 g! c: N8 Z - ! k4 t6 O* k% `& ]2 s
- module_param(acnt, int, S_IRUGO);( I, G9 G0 ~$ O
- module_param(bcnt, int, S_IRUGO);4 x4 i4 z7 q, N
- module_param(ccnt, int, S_IRUGO);
复制代码
8 @ o; e; x7 A( e, F* F
, |- I3 g6 n" ^* ?' J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ Z/ z: q0 X. \' K1 f' E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ M6 m. m: p- P `& d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 v, M# Y# Q Y ?
' k+ F0 {4 w( w3 V% e& K* i5 S
: a ?# y* h, Z7 P# D |
|