|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . Y; j8 y3 V/ E6 y5 B
- [code]EDMA sample test application
8 D$ Y; L {6 X/ h0 V+ p' | - /*
% N' Q( z$ z q# C1 \( k, l - * edma_test.c
6 _1 H6 u/ L' L/ i1 ? - *, T, D9 A! R4 m+ l0 }; X# U
- * brief EDMA3 Test Application+ f8 y1 k" U0 K: Q. `2 r% e: X2 o
- *- _+ U! R) b" D2 n
- * This file contains EDMA3 Test code.
! d& d& ?5 K/ {# t: v. k& [0 q# G0 Q - *& ?7 a: H; c3 o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 e) s; w. E& Z7 _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 x$ X* W l' d* X/ d# t$ b
- * TO CHANGE.6 n; B% Z- c* r3 U
- *( F# ~4 H8 F# E9 d2 h; [. k7 w' p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" }5 A' t7 N% P) K _9 U9 s. P6 R
- *
" S6 a1 [; L# t/ r2 j - * This program is free software; you can redistribute it and/or
/ _1 d, W' S! U1 S3 L( u - * modify it under the terms of the GNU General Public License as
4 {8 Z1 k8 M% b! ?8 G - * published by the Free Software Foundation version 2.
- Y& v- x8 t. `" F - *: S8 U2 R2 U# o) O& c( ]/ U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- @1 u7 e% Q' ^% Y2 R" a2 u- H - * kind, whether express or implied; without even the implied warranty
9 z8 d5 Y& R5 q$ ?6 r* g6 n' k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' S- ?+ k9 A! |7 F - * GNU General Public License for more details.. [0 l; x& Y% @
- */
- D8 Z2 K' B) b6 P& Q
+ Z" z3 z# I7 |' l! E. J$ ^+ W& T8 g; s- #include <linux/module.h>
3 b/ z& i1 W( b L' F8 | - #include <linux/init.h>
5 x1 W( {+ [) u: x - #include <linux/errno.h>, t: X* f# u) a: @0 G
- #include <linux/types.h>; d/ f! k, m( S8 x
- #include <linux/interrupt.h>, J3 P9 v. f' Z
- #include <asm/io.h>6 a/ `0 T; e& R% \$ Z3 K, ]
- #include <linux/moduleparam.h>2 F0 k6 |( o- U5 V# |0 W
- #include <linux/sysctl.h>
$ z' U( a n/ x1 P" C - #include <linux/mm.h>
Q% O+ ^* g7 a! Q! S- N; e0 b - #include <linux/dma-mapping.h>
; Y$ I% c" M/ r0 Q" ?2 ?# Q
+ O% w* y3 u9 b6 c2 u# @1 |. R- #include <mach/memory.h>
* x& q8 ~+ Y7 N - #include <mach/hardware.h>
& I7 y# o& g7 O9 H2 A - #include <mach/irqs.h>
( V6 L9 G6 S7 R/ L - #include <asm/hardware/edma.h>
* s$ s3 n6 R+ [$ |9 \/ n
4 V5 h3 d: t$ T2 D) B' v v5 @- #undef EDMA3_DEBUG S, g( o- _ {
- /*#define EDMA3_DEBUG*/
/ u( Q. O" h6 o, o+ @- r2 ` _
: c' |! E W0 B! @1 w0 G5 Y8 F, e# N- #ifdef EDMA3_DEBUG
2 F4 [$ D# n7 A/ n/ A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ \# F7 j0 m9 H1 Y$ l/ |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 n, g9 |4 n& f( f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ s1 A. t9 H1 Q. D# J
- #else
$ R o% u p/ ~9 E$ x5 ` - #define DMA_PRINTK( x... )
0 l8 q Y' ]/ H0 V5 m | - #define DMA_FN_IN. R) V3 O3 j! U! j) M. P% [
- #define DMA_FN_OUT
4 ?- D: q" N6 D A - #endif. F& B1 \/ ^ i0 z$ M0 R/ ^$ v$ a
- ( i: K; }* V" K# A7 N6 |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! J+ v3 H/ j7 | S6 B. S0 w5 ~
- #define STATIC_SHIFT 3
: o$ [' s. [) t0 L# }7 i. C' \ - #define TCINTEN_SHIFT 20
+ n% \* f7 D+ K# {( L" r) K - #define ITCINTEN_SHIFT 218 S' a L" D; g: u- {- F
- #define TCCHEN_SHIFT 22
/ l: s( M3 k$ \7 o9 c" ^ - #define ITCCHEN_SHIFT 23
2 U* X8 m) c5 m( j0 o+ |6 a7 w/ ^. X9 M
" c5 c1 H3 R9 M) N- static volatile int irqraised1 = 0;( N! p) i9 Q4 p5 [4 \% X5 l
- static volatile int irqraised2 = 0;( W1 ?' i0 V7 c8 P
1 c' R: S, a% k J8 e/ P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( \3 e7 I9 Z1 K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. q2 @" v2 u: z: z+ U" p' Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 \* k' @) p( S( D
% m4 k$ [' y/ d$ J3 X- dma_addr_t dmaphyssrc1 = 0;7 K7 r6 s' j b& f# I5 N0 i
- dma_addr_t dmaphyssrc2 = 0;( e0 {7 Q" I+ @/ h9 K9 J- [
- dma_addr_t dmaphysdest1 = 0;, s- e& _* C$ J, M
- dma_addr_t dmaphysdest2 = 0;* J) V8 l2 B# \8 h
+ @. \( Z% m( ~) p9 c: J3 ]- char *dmabufsrc1 = NULL;+ V$ e% m0 K: r Y9 p
- char *dmabufsrc2 = NULL;
/ z6 M3 a R6 m, n - char *dmabufdest1 = NULL; C8 j3 d+ s6 J" c6 I3 |5 k
- char *dmabufdest2 = NULL;
9 _* f0 Q* d) Z) O - 5 A9 w# w/ Z% q4 x4 m8 s* e+ J
- static int acnt = 512;
" m5 N* }, p5 ]8 |# M( _/ L$ a - static int bcnt = 8;
0 B5 O+ y' {7 c2 T" E. k9 a9 g+ I - static int ccnt = 8;
% _! \8 B9 X9 n. K4 g$ n+ I - . b! i+ `+ ]" j _5 H
- module_param(acnt, int, S_IRUGO);; Q; X# s" D3 H$ c" M. Y8 k
- module_param(bcnt, int, S_IRUGO);
9 z7 m6 }; G% P% } - module_param(ccnt, int, S_IRUGO);
复制代码 ) z9 v) l% u% `7 q' g. q
. m; H4 X. e& \' |/ F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, P) p* }4 O( M% h7 H% o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 L d9 p+ r9 d- P) x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 \+ p* Z, ?4 A8 X( a& X
" H2 ], X) B; [" U2 D# K: D( k, Y
$ G" T. c: |+ A" i* j+ N) r( O |
|