|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 v) `+ l+ }. J! f( l
- [code]EDMA sample test application7 h, L, D5 c4 }/ L: T/ Q) w
- /*. A# [9 X2 ^# j, w% b
- * edma_test.c
" ]7 D0 N, J/ t$ `4 K. U/ m! e - *
, O0 f! [% J q - * brief EDMA3 Test Application
% e* _9 m) ]" ]! C; A% R1 y6 D( T - *- L8 \3 G% y7 x2 W Z" U/ U$ J! Q
- * This file contains EDMA3 Test code.
5 X1 M, a7 M6 n- B3 O: f( K - *
$ _# m+ U* G7 J& ] x \' ?6 g4 i( V- v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 C% u6 Y1 r+ w; E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
Q3 O. R7 g3 z W8 u1 T5 l - * TO CHANGE.
+ N8 A: \' \& T8 U - *
- D) Q, V1 K* k7 K. n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. G. e2 f2 _* s/ S$ [
- *
7 E" V% i( ~. [ - * This program is free software; you can redistribute it and/or7 }+ _7 U/ Q( t+ H" W' J
- * modify it under the terms of the GNU General Public License as( w; g; d6 B( _& r+ x- }) h
- * published by the Free Software Foundation version 2.% D2 Q# W5 c! ^5 ]
- *
/ i0 {! I& _6 ]4 Y3 u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 v$ {( o/ n" C7 ~) p; k' I- ^. M - * kind, whether express or implied; without even the implied warranty
+ q) ^% P1 H% B8 @/ k5 x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( ^9 K' l4 Q6 ^8 m - * GNU General Public License for more details.1 j; @, L% ^9 W- ~' B( R% A7 k
- */
5 |8 Q3 s1 _0 N) N( v - " K3 M& @; ~! U9 Y+ k+ i6 T* ?
- #include <linux/module.h>
4 x U5 k9 y8 N y) j - #include <linux/init.h>
1 w# F* f( y0 @2 f0 s4 q# F G - #include <linux/errno.h>
7 O o: O$ [* b& f; c" r - #include <linux/types.h>
; T! O3 l O l$ K2 M# ] - #include <linux/interrupt.h>
% k! l" ?4 _9 c$ p q - #include <asm/io.h>
F; X9 a* j# p: H0 d: e2 R - #include <linux/moduleparam.h>) n1 ?) ?8 Z. U
- #include <linux/sysctl.h>
$ u; N7 a7 q$ u: b) ` x! F1 b) h - #include <linux/mm.h>2 e" n& k- d0 ]3 @1 W% C: ^" B
- #include <linux/dma-mapping.h>+ o6 i- g+ x' V( z, O0 y
- ( m$ p! `5 ~' K) q& `4 V
- #include <mach/memory.h>! w2 \2 f- t8 D% C7 K2 A1 w3 H
- #include <mach/hardware.h>
7 Y4 h/ Z3 y) S% m# G - #include <mach/irqs.h>1 p/ c$ h$ z0 j
- #include <asm/hardware/edma.h>
) J* q9 E. S& N: [/ \! e. A - 9 Y7 v1 |% J7 Q1 v) ^$ E4 i
- #undef EDMA3_DEBUG$ y6 F2 I( e3 p+ ^, L* o
- /*#define EDMA3_DEBUG*/
& \& `7 `7 A9 o4 q. p - ( ]0 C: z0 S3 h3 n
- #ifdef EDMA3_DEBUG
* r8 e3 @9 G! }3 S( k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ R4 T0 f$ G7 F7 ]. D, J5 r5 X6 D4 y+ I6 i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" c; `* m/ [- |- e8 k; J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ H, [; l1 |- P# @
- #else
6 V; b, z% J: |& [, J: c - #define DMA_PRINTK( x... )
1 M2 G) m) s& k6 n8 R - #define DMA_FN_IN/ [: }& _5 P, n% U+ r4 T9 f
- #define DMA_FN_OUT
) Q% l& ^# V9 b - #endif U8 y/ W( ]* w: I5 n, V
! r- M, s7 A, t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 R, b' t% q. M9 r
- #define STATIC_SHIFT 3
0 {& o" Z& v6 |. q - #define TCINTEN_SHIFT 20. h2 @+ \4 m' ?* ~7 e2 w
- #define ITCINTEN_SHIFT 21
) I% n" @: v: E B% K$ T - #define TCCHEN_SHIFT 222 i8 d7 R/ h7 b4 b; k0 C6 v$ k" q& H A
- #define ITCCHEN_SHIFT 23
& l6 \6 c! Q2 u, x6 M - % d' \3 ^6 L% A+ [. O; E d
- static volatile int irqraised1 = 0;
$ [. H7 F8 A" f# i( |6 S - static volatile int irqraised2 = 0;7 \0 F V& w; Y% M H8 b) Q
3 T! M* o, {& ^9 c% X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 O0 v2 ~/ I- Z% _/ n0 I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ^+ E9 H% x5 P2 L% G I; @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* J. _+ ]/ J" M. T2 s
- - a3 R5 Q8 G/ b
- dma_addr_t dmaphyssrc1 = 0;
' |: B' v# U+ n0 y - dma_addr_t dmaphyssrc2 = 0; j. E: O, U8 {. V0 C2 Y. T% {: Z
- dma_addr_t dmaphysdest1 = 0;* M3 I, Z9 F$ }- e; d
- dma_addr_t dmaphysdest2 = 0;
2 F- X0 h: }4 K' R* b3 G
) C9 j. |: L" k* ~ o- char *dmabufsrc1 = NULL;% y6 U+ w/ Z7 y6 h0 q' C9 z
- char *dmabufsrc2 = NULL;; d# S/ v- J. w( k4 r) e5 n0 M
- char *dmabufdest1 = NULL;
) Q; G; z' A i; E. x% O - char *dmabufdest2 = NULL;; C8 x& k/ `5 {) ]0 b$ y( F
- 6 j0 |) q# m' ~: U) ^
- static int acnt = 512;9 f' I) D$ |1 D3 m4 K& p' @
- static int bcnt = 8;- V- E0 V0 Y3 R8 q6 E t
- static int ccnt = 8;
% j8 D* U7 y+ a
" f7 B& H) Z5 R S, v+ b- module_param(acnt, int, S_IRUGO);
& u* k$ `6 G4 i9 z5 t0 ^ - module_param(bcnt, int, S_IRUGO);! t9 A' I9 k' z( N" E
- module_param(ccnt, int, S_IRUGO);
复制代码 5 x& Z: t' ~ ^: n' _
4 V- k" ^3 f( K" R0 e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 H1 [6 z( a8 E8 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ ]; X/ ] _1 R$ j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 ?1 Y8 n, h, T' @" _, V& w
7 H" c& j' |* F& \, ~) n( |% y0 Q- D% |9 ?/ G1 P0 k2 G2 O0 G
|
|