|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" d4 i5 u1 O9 Q0 F- [code]EDMA sample test application7 J. ]) x- A$ _/ ^# f+ _3 G
- /*
- g: B3 h6 E; e5 Z5 n, j8 E - * edma_test.c& m( Z. d2 M8 R. \7 ^
- *. @, | ~. h3 Y! C
- * brief EDMA3 Test Application/ [8 h# Q( C" {) M
- *( @; t2 j- O- H3 v# u: I# B
- * This file contains EDMA3 Test code.
' X3 }, f, X- o5 x" ~! q - *, P! F- V2 Y5 E [* C/ j- X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& T& K" b# ]. o8 h% |3 q5 }8 j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, E1 q" Z; r- _; F& A0 W3 L - * TO CHANGE.& r5 y7 Y' y& y, j8 z% O6 Y
- *
7 C' s0 z8 \+ E' y: E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: ~: a" W, X8 o9 A: ~1 d# z
- *
4 w0 q' b- o/ a% |! N3 T) U - * This program is free software; you can redistribute it and/or2 Y; M% N( z3 E, ?( `- `! t. F
- * modify it under the terms of the GNU General Public License as `$ X) N" |) Q6 f9 M
- * published by the Free Software Foundation version 2./ A+ Q1 o. }) l
- *" ?. ~+ P. O* h8 p) b* e4 f2 c' P, Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 t5 Z) r: O9 E- T* @5 j
- * kind, whether express or implied; without even the implied warranty
' {; h5 h) [6 E% u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ s; v& C6 J8 c6 w- }, S - * GNU General Public License for more details.
$ z* a) v' d l' D& J% c - */+ `3 T3 Z- ^) Z" x( b4 Y" u
- : y6 R' Q+ N' ?
- #include <linux/module.h>
1 F9 M6 L+ B4 y$ `" f: R, s! a - #include <linux/init.h>
0 ^3 o0 I2 H* W: `7 |. M - #include <linux/errno.h>; }5 M B$ b o
- #include <linux/types.h>
8 e5 o- N5 h) i) g* _& c - #include <linux/interrupt.h>* J' R0 ?) @ A0 E4 J
- #include <asm/io.h>
% t( f* m5 f- a/ B0 T! J - #include <linux/moduleparam.h>% O$ X1 n& Q( y% i! W3 X
- #include <linux/sysctl.h>! N* j3 c1 |) E- S% U
- #include <linux/mm.h>
% _7 q3 k: @, H( T! V, } - #include <linux/dma-mapping.h>
0 U; U" A) i+ c X - 5 V- I7 G) D: Y" }/ O c8 D
- #include <mach/memory.h>
6 w! C6 L( P+ E. c8 f0 M - #include <mach/hardware.h>
, H, r5 [( a V% A1 m# l4 K4 [ - #include <mach/irqs.h>/ Q v+ ?3 V0 D( D- i
- #include <asm/hardware/edma.h>! d4 r" `% O- \) L" M( N* R6 |; f
- 2 w4 Z3 K1 d; x K; P
- #undef EDMA3_DEBUG
. k; U: y/ X! {: [: d% J5 X1 I |1 G - /*#define EDMA3_DEBUG*/
% f6 j7 C+ V* q4 J+ L; k2 b
! J4 J0 p+ |/ ~+ G$ L* w. b- #ifdef EDMA3_DEBUG
& j+ P+ C8 d+ G) T) W6 a/ x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 b, y- h- R# i! [: h! [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 ?) m# V2 }' U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 M8 L) H# X6 G: B' A/ T
- #else
- F. k0 ]1 |$ g/ r4 d - #define DMA_PRINTK( x... )/ [9 d0 O; b9 P
- #define DMA_FN_IN
( C: a. k* A5 r' m - #define DMA_FN_OUT" ^3 l/ G# f0 n/ F6 e$ ] ?
- #endif
. L- h+ q2 i8 ]) w, H- g- B
* y6 v, K6 U- r5 Z3 v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) V. z1 k S* L8 Y& j0 e - #define STATIC_SHIFT 3
, u6 C9 l2 I8 t, v- I - #define TCINTEN_SHIFT 20
! x4 L2 |( w3 I, ?) {7 A! v - #define ITCINTEN_SHIFT 21. F, f( V: ~% n5 A* ]; z9 }
- #define TCCHEN_SHIFT 22
2 H' U4 A9 y% ]7 [ - #define ITCCHEN_SHIFT 23/ i8 I/ h& P u) S8 F! g' ]
- % |2 `7 r# U' o' E0 K1 z" G8 A
- static volatile int irqraised1 = 0;
1 F1 t! A1 z( B1 g6 E - static volatile int irqraised2 = 0;1 h* _2 {+ f! N) `- n; Q& m" v
- & @. B, m& L8 q% o5 e5 T: |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 |8 S0 _% [7 }1 B: h ]" ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ _( E" ~7 ^6 n- ]' C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' J* H+ H+ r* u
- % p5 u- Q l3 B: x: ^
- dma_addr_t dmaphyssrc1 = 0;
. ?( i6 n* y4 ^# B! K: d- \% X - dma_addr_t dmaphyssrc2 = 0;% l1 G( K$ M, @8 m7 n" [, a
- dma_addr_t dmaphysdest1 = 0;& M, t3 ?, E. d% ~
- dma_addr_t dmaphysdest2 = 0;% I& V6 C- v2 J% M: M! r! n, U
& A5 k6 u1 }: @. {) L- char *dmabufsrc1 = NULL;7 V# J3 A* I/ }5 T) i( c2 Z
- char *dmabufsrc2 = NULL;+ L3 e G' s7 N8 E1 l# g$ @; r
- char *dmabufdest1 = NULL;" T% ^5 b3 D% x3 B
- char *dmabufdest2 = NULL;
: z. X$ } d# |3 x, O+ t& V - , T4 [( S& t& l$ h. ]: I
- static int acnt = 512;
( E$ Q; m" _6 `1 o0 } - static int bcnt = 8;
4 m- o0 _1 F, m9 t* ~- N2 H& q - static int ccnt = 8;
; O+ m' h7 h6 _: k- }, e3 F - 7 a0 T; R' z& v3 m; I$ \& i1 I, \6 Q
- module_param(acnt, int, S_IRUGO);
& ]9 m2 L. L5 Z' J4 U - module_param(bcnt, int, S_IRUGO);" s: d3 d D8 W9 f
- module_param(ccnt, int, S_IRUGO);
复制代码 5 E6 s0 _: G6 ~2 V( Y) f
" {5 ^- C, @! X) M/ n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( y* R: o8 k0 N9 n7 Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# `0 R; f$ @3 _1 o- ^4 @9 } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 k, S+ f+ m O! q% m( A+ w9 K
2 d- Y" P2 H& ^
9 M7 l. d& \1 {, j" [8 z |
|