|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" P! g( \6 ^/ s! |% x- [code]EDMA sample test application" @" }0 K! _. C( m
- /*
: _; A* i% _# N3 F. F# i# I& h ]8 @ - * edma_test.c
' v% i+ k7 b; z% ]# a; K - *
8 _' a- i: c2 A* M2 l6 o6 o - * brief EDMA3 Test Application: B: `! \( l" I9 @6 p+ b
- *
' h$ B( ]/ W* b" T4 h* ] - * This file contains EDMA3 Test code.
" P5 u9 |9 e W: B3 R - *+ l* n& V5 z, l9 M& Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& s0 X0 R R4 p8 ^/ Q: D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 ]0 N R+ F* G# k
- * TO CHANGE.
+ c1 H# ?5 j& c - *$ L- f& o* H9 e7 R K! j- d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; b1 c9 V" d% U! i6 b - ** h6 z4 \2 `: z; r7 _: g. g
- * This program is free software; you can redistribute it and/or
: c% E i- ]# k: t1 m& d! N - * modify it under the terms of the GNU General Public License as2 {8 z/ Y0 S- N( B
- * published by the Free Software Foundation version 2.
3 p( X7 J4 P* T - *' L9 w) j" ^# d& ]# m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 }- H) a/ o& r$ h0 B - * kind, whether express or implied; without even the implied warranty% y3 v: u2 A: O9 g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ e) R: s7 d& r0 U7 L a7 E6 d) K' v6 p - * GNU General Public License for more details." g5 U) s3 K5 \* ]; a) J; _
- */
m- Y9 i+ Q& Q9 E3 m# _+ h
. @9 V$ ]# h4 p0 @- #include <linux/module.h>% d4 p, {# A8 A# a
- #include <linux/init.h>
# K$ h6 M) s% z5 {! K - #include <linux/errno.h>% Z) M9 t9 m7 j- y6 q. f3 d
- #include <linux/types.h>
0 S9 B: z; c0 S, t% g" O" y - #include <linux/interrupt.h>1 s, d) ?$ o2 q* J
- #include <asm/io.h>
' _, `* b8 ]& d6 w' {' S: L - #include <linux/moduleparam.h>
$ z5 _* d( Y) C' q1 K: U - #include <linux/sysctl.h>
7 ` G# d# r7 r* E7 |, M4 r# C, M - #include <linux/mm.h>- ^6 C1 z/ [6 ?6 L! @( W2 g
- #include <linux/dma-mapping.h>
- X3 d4 N/ q# ^( h- z' p
( z! g2 k- x' ]: F% H( G3 Q! L- #include <mach/memory.h>
0 U. D6 m# B0 W3 G" [ - #include <mach/hardware.h>+ `: \- Q+ n* @3 F! h) v
- #include <mach/irqs.h>. U4 L( Q8 R9 V+ U2 @9 g) m/ @
- #include <asm/hardware/edma.h>" ]3 B# A, p2 x5 d
4 J5 i/ i. V7 A# [! B; o+ t }$ V8 K- #undef EDMA3_DEBUG( h5 t# v5 x* {2 U6 q
- /*#define EDMA3_DEBUG*/
, A( b. p* ^6 H9 |8 L! |3 r. W - 5 i4 d2 v5 W! d/ Y8 s8 Z; i
- #ifdef EDMA3_DEBUG6 D4 L* l' Z2 O; E6 \4 j Q0 @, R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 L. ^& [* D- e/ d, n5 p' [$ { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 ^2 i. {& b3 Z8 k7 B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 {- K/ ^9 N5 r/ o5 @
- #else
/ I; W6 _4 X' y6 {3 L) h1 V - #define DMA_PRINTK( x... ). r1 v5 L+ W; Y$ s* B
- #define DMA_FN_IN
$ C; \4 u$ p( u9 d0 [ X- W - #define DMA_FN_OUT
7 N: x1 k, [- o1 R - #endif
* [, @7 `, |! u* E/ t: N3 w, h5 G
: q# b6 o; ^0 V( v# S; U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% _4 Z4 b# M( @: i - #define STATIC_SHIFT 3# b: A8 K. ~4 k& y
- #define TCINTEN_SHIFT 20! T( S3 t2 ?9 B% a5 Q, O. [: p
- #define ITCINTEN_SHIFT 217 s$ ^& _4 A. b! k/ d0 i
- #define TCCHEN_SHIFT 22
% F# x8 l" i* ^ - #define ITCCHEN_SHIFT 230 q; H0 J4 X" Q8 V, m' P
7 k2 M/ W! D4 ^# { V; [* v- static volatile int irqraised1 = 0;6 ~+ W* [" ]$ N3 E6 W
- static volatile int irqraised2 = 0;
, R/ D4 H7 B- `( R9 G
1 v" A4 k! A3 l& q* q$ k$ Y' M4 I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 M2 g W- H% ^' z% [: P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 [+ G) h$ B5 \9 p7 ]6 q9 s# T5 b5 y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 ^; j" v R8 S0 l- S* F# [; l - 9 q1 V) Z4 D9 L. Q9 }+ Z. C
- dma_addr_t dmaphyssrc1 = 0;
8 g" f7 @' p, n7 V- I- y - dma_addr_t dmaphyssrc2 = 0;) o, L! n M* _4 {8 I% n# Y
- dma_addr_t dmaphysdest1 = 0;. t: f/ j: z3 K' y0 S% _9 f: B1 U! x
- dma_addr_t dmaphysdest2 = 0;
$ X+ V) d5 l2 P+ q9 ^
, r7 O' S( r0 O: g- char *dmabufsrc1 = NULL;
1 I( ]4 B: V2 K, |% q. X - char *dmabufsrc2 = NULL;% F) i, j; H4 X7 E$ T
- char *dmabufdest1 = NULL;
% o) ?! V5 } H - char *dmabufdest2 = NULL;: e8 ?& {3 c: p3 N, V$ d# S
' q; t3 u4 b/ h- static int acnt = 512;: }( }3 z8 _1 p# e% ~
- static int bcnt = 8;1 P( Z2 @' k. I- N3 o y8 R
- static int ccnt = 8;
3 {( O8 u4 \% w3 U1 ?1 B6 L7 D4 } - , z& E, f% k. z- K7 k
- module_param(acnt, int, S_IRUGO);5 c. a' b# G/ Y: I* X0 H& L
- module_param(bcnt, int, S_IRUGO);
' S" I; n/ U- x$ h8 n/ q - module_param(ccnt, int, S_IRUGO);
复制代码 8 x0 J- ~8 P7 R2 k0 Y0 Q1 _
n5 S! S4 ?! x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" L& Q b( T+ N2 V; e6 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) l7 V/ S( B& k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ ~* Z; V5 r. R
7 r- N6 X0 S7 A5 k+ t S/ a, U Z" R$ |0 p0 c
|
|