|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 X+ f$ W* E3 a( L6 D' B1 A6 r- [code]EDMA sample test application9 J) l7 `, b. [
- /*( `2 ?! G3 I& Y, M9 E
- * edma_test.c
7 K" d) L* e" i - *
# B$ G# O/ A6 _! P1 z - * brief EDMA3 Test Application
1 _0 a$ H, j$ r6 y$ t# H/ c$ p; c - *; n. a5 h& C1 y q( W( ?
- * This file contains EDMA3 Test code.
3 g5 G0 Y* r! ^8 I# S - *
1 l1 c1 B f3 U! y" A3 _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: f l5 Y; y! }4 J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 ?" L, S! K# {: [ - * TO CHANGE." [7 N( c! r1 q' P! ]4 [: {
- *
( P+ f7 B8 e, x# k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 c6 l, g6 ?. } - *
! j7 M+ Y7 q! X) c# _& p - * This program is free software; you can redistribute it and/or
8 [' a5 b# Q5 N5 z - * modify it under the terms of the GNU General Public License as
- m8 y& T) D; A- P6 G# Q% q - * published by the Free Software Foundation version 2.& A$ X- G# Z P$ T& J% K
- *5 _/ L# f( _3 r8 ^/ Q& y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- B! t/ g# k$ O; T- m6 |
- * kind, whether express or implied; without even the implied warranty
4 K% b+ _$ F2 Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 u- L; T, H M6 `$ w& m% N - * GNU General Public License for more details.) e( @& A9 @9 G0 O
- */; _. h" D- {9 O: i% e' a
- 9 \% z' p+ |0 r- S
- #include <linux/module.h>- M! p; K+ U; i+ \2 l! v
- #include <linux/init.h>$ P$ A: x) L5 J$ Y. J
- #include <linux/errno.h>
& M% k' X% Y: P2 k - #include <linux/types.h>, q: X0 a X' s" j" W& }# s: ]( n* E
- #include <linux/interrupt.h>
' T3 i/ l, }: T - #include <asm/io.h>* ]: H' a) ? b$ e" D
- #include <linux/moduleparam.h>
1 }4 i; d' f0 s; x4 ` i$ w - #include <linux/sysctl.h>
, K' {( Z; F1 S/ e% @ - #include <linux/mm.h>
- @% R/ g) c' C2 _' s+ e4 P& I - #include <linux/dma-mapping.h>
1 w+ ^' f& e/ _! J( W. ?
- j( D9 S9 C' V/ z' A- #include <mach/memory.h>
$ |" o: s7 X1 I5 J) o) Y3 Z - #include <mach/hardware.h>6 f7 y# I1 ^7 U# g6 ?' p- S
- #include <mach/irqs.h>0 b0 Y" W" c" \1 h( f& \
- #include <asm/hardware/edma.h>- i' `8 X+ ~3 K% b% `
1 |2 u+ v( f" a8 Y- #undef EDMA3_DEBUG- u. K J$ [( }/ y+ }/ s
- /*#define EDMA3_DEBUG*/' Z6 F: e" p, G
- / I* y4 t+ b+ T
- #ifdef EDMA3_DEBUG0 ~9 G7 m/ f) p: z; m- I5 f: x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! `0 U' t1 o# x1 ]1 }3 J) ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 O1 h. v0 k1 u& x# M( k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), C+ W7 v/ ?: J2 v8 f/ L/ m
- #else
; ], Z$ M9 @1 W/ M% E+ U* V; p - #define DMA_PRINTK( x... )
7 d! D& t& L& a1 O. {: D - #define DMA_FN_IN
: q, L/ u- o5 Q - #define DMA_FN_OUT
3 H8 d# V; S: { ?. C2 g) V, i - #endif
# F& N* E. B6 M* J( \) W& o - 2 @9 p$ e# i+ Q5 [& N I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ {! ^* w4 d0 ^: w+ i( R" k - #define STATIC_SHIFT 3
4 ?' S5 M# }, C - #define TCINTEN_SHIFT 201 p) t, ~! ]/ T: T2 q3 J
- #define ITCINTEN_SHIFT 21
5 s" T: \- k9 @7 l ?* V - #define TCCHEN_SHIFT 22# i# j; j, f, W: S- b( F
- #define ITCCHEN_SHIFT 23
7 O2 f9 K+ ]6 N; B9 `+ A
$ y4 w4 F, K& D! q/ F \- static volatile int irqraised1 = 0;
( i# S; a) c3 ?- b8 K/ C/ {, Q/ O - static volatile int irqraised2 = 0;
- o0 H9 c. L% g, u3 J" D - & k4 z r/ w; Y+ W2 A$ z( F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( n$ o3 x" d" O0 ]7 `+ Z! M/ _2 L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 @) o6 G" C; e4 @ \. r6 m, ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 F* I$ b! b* h8 n0 [3 N
- # N% N" v5 \8 l i5 J9 z1 \
- dma_addr_t dmaphyssrc1 = 0;
- Y9 k9 u# d) g# I' I; E - dma_addr_t dmaphyssrc2 = 0;
* K6 [/ ?* f3 X6 S6 T - dma_addr_t dmaphysdest1 = 0;
+ X% |5 ~! q* C! I0 i% D# J P - dma_addr_t dmaphysdest2 = 0;
+ Y' z t" C7 r, u - $ h1 H( @( A3 I" L. l1 j- U. J
- char *dmabufsrc1 = NULL;
' K! {" @, l% w( M+ x% {$ W - char *dmabufsrc2 = NULL;) ], s% Z z! u8 M
- char *dmabufdest1 = NULL;( }3 H. b4 ?; `5 `
- char *dmabufdest2 = NULL;
+ L. c3 \2 l# e+ M5 }
L4 l7 [6 @, p# N: |+ X: \- static int acnt = 512;
; o! h( n5 w' u3 } - static int bcnt = 8;% V" r7 I0 s$ g$ P
- static int ccnt = 8;" B( u* a+ ~2 j* R
C1 h* [# T1 G9 o+ c- module_param(acnt, int, S_IRUGO);
. U6 [2 Y$ H y) V/ U! P% `3 L2 w - module_param(bcnt, int, S_IRUGO);
# ~, J" e; X: w - module_param(ccnt, int, S_IRUGO);
复制代码 , U4 \* [1 }) s! B
% Y8 f2 d7 S( w5 e3 i) n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- s! ~% n. E4 {( ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" ?4 U7 D& @ j7 c$ I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
w2 @( r. q7 H/ R! l J! j' h# I" w/ n5 F% }
; Q$ o1 v. A' d |
|