|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . \( Y" Q6 C* B2 ~# h9 d/ M
- [code]EDMA sample test application
% b" F# U2 s/ |' h/ u6 S - /*) F1 z: g8 V; {; `
- * edma_test.c
$ f/ }( \6 ~' a) G - *: s1 N3 x% n$ T, T/ a* r6 A1 e f! g
- * brief EDMA3 Test Application5 j+ p9 R2 H# E* d
- ** j# z# ^1 |2 R- C
- * This file contains EDMA3 Test code.
& L' `; [& `% { - *
* V/ F, C f. u" |$ ?0 L6 I- [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 Z, F3 p; M) I' H* K2 u# k- i. V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, V4 `" Y$ } T: H& Z' y" w: ] - * TO CHANGE.
) G ?( c: T* g - *" A5 _4 c6 {) i3 i- k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 t+ c% I0 d0 K - *
$ p$ m1 C/ k2 W - * This program is free software; you can redistribute it and/or$ i' _8 _) L4 i8 y3 ]1 b9 n, L
- * modify it under the terms of the GNU General Public License as3 T4 {8 q$ f: \% @. J
- * published by the Free Software Foundation version 2.
9 w! I8 T. h' b1 V. r - *
. j6 @5 D8 d* P/ G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 e0 Z; r" ]! Y* p
- * kind, whether express or implied; without even the implied warranty# [3 S4 e. N- {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* ]% M3 }: `% _5 D' Q2 @: L& C - * GNU General Public License for more details.3 ?$ f0 C& m6 h6 Z) V
- */9 a6 f4 n6 ]& N4 C& N
1 n2 o6 P: ^5 H3 T1 [! Q5 B! ]. f- #include <linux/module.h>
) M2 Z( `1 l9 Z8 Z6 t/ A9 q - #include <linux/init.h>
5 [/ [+ r6 S6 D" Q0 r - #include <linux/errno.h>; |- q; S! F. X" x0 r
- #include <linux/types.h>) s2 F. T+ C; t" V
- #include <linux/interrupt.h>
- x! b! q; l, C% f/ v& } x P: w - #include <asm/io.h>
) k) W d/ E; ?- x5 ?1 W - #include <linux/moduleparam.h>
3 k+ t( w; N" Q# z - #include <linux/sysctl.h>
+ f/ r7 |/ |8 a9 y$ v - #include <linux/mm.h>
! C. `" D+ T+ U* t - #include <linux/dma-mapping.h>7 M! x2 ^8 A: g6 w$ w% A% B2 z
5 c, W; v, p. Y( l- U+ X4 s$ O- #include <mach/memory.h># y% Z s1 D7 q+ q# p
- #include <mach/hardware.h>, ]! Q) R; l8 s: c
- #include <mach/irqs.h>
& g& F1 {6 v) k& ]+ [2 B - #include <asm/hardware/edma.h># I$ ], S' ^% c! m. S7 d
- 6 _2 t" J2 `7 r2 k
- #undef EDMA3_DEBUG
# G$ I4 F/ J$ H5 i i5 X - /*#define EDMA3_DEBUG*/
! I1 v2 G0 C. [, K* f+ F" p
4 y" C/ s9 s/ ]5 l4 C, W; @. [2 t- #ifdef EDMA3_DEBUG
, E* {! M6 l9 _ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' X/ A; W& J7 Z4 A" } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% v1 m( S0 e4 d I% k: i, s- ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' F" P5 g- R! r# ]. Q3 m* M
- #else1 O0 X7 ?. A. Q7 f1 n
- #define DMA_PRINTK( x... )5 I, `! [/ @- r7 C0 t9 G
- #define DMA_FN_IN# u+ k" U5 f- @. ]8 s
- #define DMA_FN_OUT1 C+ l+ p* P/ x* b, N- i
- #endif
, D( H! F' t+ j1 T
, Q) t& U; I4 N3 ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; c$ [5 @6 b' R! V! ]+ M - #define STATIC_SHIFT 3
6 V O4 G9 N* {5 z: N/ [% ~2 s7 L - #define TCINTEN_SHIFT 207 f3 m6 y3 }& ]: w
- #define ITCINTEN_SHIFT 21
: t/ ?& k. V( c: [! D' v8 r- x - #define TCCHEN_SHIFT 22
: A9 ^3 n0 M* H* k& e - #define ITCCHEN_SHIFT 23
! d( D, \6 t) O: C$ w
9 C* D7 A0 q8 O% A, `* J* @- static volatile int irqraised1 = 0;
" S+ ]* x R+ _$ q# ] - static volatile int irqraised2 = 0;; d7 `6 B" d; r: N' N$ r
; d( B" A: f# {/ k" Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 B. ^ l8 }7 n" k, o7 U. A/ j' S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 [1 _5 D+ [0 b+ J9 S( _# j& ^% H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 A6 ?0 E# E! D2 J6 X
- $ K9 F1 X2 \; v/ R
- dma_addr_t dmaphyssrc1 = 0;, b) Q& @6 {) c, x! z
- dma_addr_t dmaphyssrc2 = 0;5 W3 N+ E, q' { v# z
- dma_addr_t dmaphysdest1 = 0;- V# o7 ~' {8 u1 q P
- dma_addr_t dmaphysdest2 = 0;7 R) M# q) [7 U& V1 y
9 t/ i5 N9 m5 d2 {7 b7 m- char *dmabufsrc1 = NULL;6 L0 N# D! Z/ u9 M6 t
- char *dmabufsrc2 = NULL;; j3 u9 O7 u* L
- char *dmabufdest1 = NULL;+ P- m. o% {; s; Y* x0 W
- char *dmabufdest2 = NULL;2 r- Q) e9 y% w" X6 Y) b2 f
& z& A) w& Y r6 e$ A8 \ m' q$ H- static int acnt = 512;
) V9 V- C6 T+ ~( B: E& B - static int bcnt = 8;* z; T2 [3 Z4 W2 k9 S
- static int ccnt = 8;
; n8 Y- M: x, ~; L: I6 z, A3 W8 d7 p - 5 H F$ B/ A1 ]3 i- @
- module_param(acnt, int, S_IRUGO);
7 h7 v" G& z0 [5 m! Z( N4 K - module_param(bcnt, int, S_IRUGO);% o ]0 G, r% l0 D L4 V
- module_param(ccnt, int, S_IRUGO);
复制代码
6 Y3 x: L" p9 } {+ v! l p$ L( z0 Z r( _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* l& i8 f& `1 _0 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 z2 ]# z+ s$ ?. P n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 R, p) J* F! g" T+ h* ~* t
# f, e1 T6 L7 M* R
( T! O* F5 N2 u4 C* m. G* r |
|