|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " D1 L; q4 x& l, `. A1 _& ?
- [code]EDMA sample test application
; z2 b2 `% C0 M6 m0 \' q, o) Q - /*
; u* y' d! [: s* L, u - * edma_test.c
* S4 r, B& S* l; ~ - *' ^# |! Z3 P$ u% g
- * brief EDMA3 Test Application
+ A( v" t+ H. U% D - *# G: ?- T7 A% G7 N
- * This file contains EDMA3 Test code.) n% b% `$ C1 ?7 x6 L7 B
- *
$ t6 X, t( m2 x7 D% S+ e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE C V( {) R; T1 V1 |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( y4 h4 r# n- T" m* {9 M0 e
- * TO CHANGE.
7 E* w3 y. g6 T8 j - *% F) y) z* K- Y& ]7 L @4 C) a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! l+ q5 [! H/ S: ~+ w C4 E - *: b! H h: p% i4 T: C# s, G
- * This program is free software; you can redistribute it and/or U- k5 ]8 N, S8 s- n/ ~
- * modify it under the terms of the GNU General Public License as
: G7 w; q( d2 ?' c2 ] - * published by the Free Software Foundation version 2., d1 s1 a! N$ r+ A% i
- *. C7 a5 \( R1 u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# e. n0 O2 E& s0 G
- * kind, whether express or implied; without even the implied warranty
% c' c9 w5 E2 k) ]5 E- {# [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* [& r4 B m% ~* H$ R - * GNU General Public License for more details.
- ^! l W! ^: z" G8 V7 T - */
; g* w) \* o. n1 `- T1 U - ' t$ ~$ y1 g+ l
- #include <linux/module.h>
! u4 c, _9 d, {: T7 p - #include <linux/init.h>7 w2 M5 i1 u7 z
- #include <linux/errno.h>2 W# g* \ [' H( e3 K2 F9 A
- #include <linux/types.h>
0 s5 L2 \3 v# C7 ]5 I - #include <linux/interrupt.h>% S+ \5 M) H1 m2 {( j
- #include <asm/io.h>
0 f8 E* O0 |% k9 x$ g* G - #include <linux/moduleparam.h>8 z: ~. F# O0 m& l
- #include <linux/sysctl.h>
- X) K0 r3 |- e4 a, W! o - #include <linux/mm.h>" `9 X% k1 G3 S3 M
- #include <linux/dma-mapping.h>; O: { \: I6 d
- # ?; A. D2 I1 X" t6 K: m/ O# d A0 M
- #include <mach/memory.h> i( G2 X4 G. C
- #include <mach/hardware.h>
# L' Y) K, p* d# ?7 M0 ^ - #include <mach/irqs.h>5 S; S; I `' T1 |) o+ ^
- #include <asm/hardware/edma.h># l$ D1 {+ I( C, `$ i
- # T' O+ j/ Y3 u; E+ Y* u: X9 b( n
- #undef EDMA3_DEBUG, ^ ^. n9 J( X& l: D; A6 o$ v; I' r
- /*#define EDMA3_DEBUG*/ M3 F3 G8 G/ N& ]0 f
- ' W2 G/ R y0 @8 ~
- #ifdef EDMA3_DEBUG- z, V9 X) {* i* W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 n+ S( U" j; B/ m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ I. I# C% _8 x. z) W; c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" `% |( A w8 U; D' s - #else. }- m: d7 T/ Y& @
- #define DMA_PRINTK( x... )
8 W, Y8 e' R1 r* ^& d! f g - #define DMA_FN_IN
, `. j0 r, D" ?$ v3 {6 j# D% ? - #define DMA_FN_OUT
( z' V# g$ o4 r3 R - #endif' o% J2 Y& Y; q
- . R5 i6 K% ~; W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). s; w- J* H/ H
- #define STATIC_SHIFT 3
$ A+ K6 c9 Q! d6 o M - #define TCINTEN_SHIFT 20) V. D+ I+ G- T$ r# d6 t" W0 t+ `
- #define ITCINTEN_SHIFT 215 Z+ @& g o- e- S* R! i/ o
- #define TCCHEN_SHIFT 22
6 i( s1 O. j% u! e - #define ITCCHEN_SHIFT 23
8 J! W) m/ o6 X8 q) Y8 [ - - w1 v- ^ u) O7 G- S- x
- static volatile int irqraised1 = 0;3 N$ j7 {; Z( n
- static volatile int irqraised2 = 0;
; ]0 u- p: a, Z! U
! |+ `8 W! \/ F' [& f: J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* `8 N& ~" L) @! p4 n f3 A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) Y0 o7 @7 R- O/ f9 e' `) x3 }6 }" ^* a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% X5 x5 G; o0 G; M) g h+ G5 }3 C
/ e4 u" Z0 p9 s4 X5 X7 E- dma_addr_t dmaphyssrc1 = 0;9 F5 p9 Z: p4 {% v( D' D( N2 U
- dma_addr_t dmaphyssrc2 = 0;4 B& w& t3 h2 G+ t6 A/ J" g0 z
- dma_addr_t dmaphysdest1 = 0;
/ W) m4 @4 b: @% H. A - dma_addr_t dmaphysdest2 = 0;5 P% L9 y H* M7 K) q. E
- ! ]8 H* H, A0 ?+ H) J: g
- char *dmabufsrc1 = NULL;
- ?$ x' r9 b# |. | - char *dmabufsrc2 = NULL;
4 h# V& A+ s% s4 d, _0 p+ ?) Z - char *dmabufdest1 = NULL;
8 j1 O' H# n, q! g - char *dmabufdest2 = NULL;
8 c$ I4 k/ ^8 g j/ ^* E( t( ] - 5 V& w4 U4 s. p2 q! a! [+ w
- static int acnt = 512;1 c; j2 ?, B0 C# r( z
- static int bcnt = 8;
# ?" {7 m" D& b - static int ccnt = 8;
! p5 x6 W4 C% E, I& {- I; U
% X/ v( ^, m" O0 z2 B% S/ s' V- module_param(acnt, int, S_IRUGO);2 c3 {6 ^; b* G) j) i
- module_param(bcnt, int, S_IRUGO);
% P, E+ n% i$ c - module_param(ccnt, int, S_IRUGO);
复制代码
* F4 X* V4 u* E" } j4 Y" ~& s( x5 f) d6 |! |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( y' C8 V* _+ Z+ T, Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( E% U3 P# c i. g! M; w/ {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 H& N# K9 h2 b' ?: L; W* k2 D
% O7 U+ }5 ]( b$ O @' D) u# @% |" u* X+ s8 b; T
|
|