|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! f4 t! A) Q% C) R; z! E- [code]EDMA sample test application! _# p1 e' p; o& j# w
- /*1 t3 a' t2 f C; C4 t: I; M7 k
- * edma_test.c
: r4 F6 W& m) u - *) [/ B1 h" t8 r' ?2 z+ v
- * brief EDMA3 Test Application
/ r! r+ ~1 G3 i - *& b5 L7 s: J( {1 P- \
- * This file contains EDMA3 Test code.# O- |: B& R; R- J" V5 r/ c
- *
) ]7 f8 Z" H8 K. U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 q& X" V; ?% X4 C: m0 P& C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; `3 z' y# C( A* m: |! g$ e6 u% ~
- * TO CHANGE.- k4 ?: S, p% D$ o: v% L
- *' B' A% m! q" \% }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 F- }4 u, K1 q1 t: Q$ n1 } - *
/ u3 a% b C% t2 L7 E, y - * This program is free software; you can redistribute it and/or
9 k8 Z3 N& `& w1 M* n - * modify it under the terms of the GNU General Public License as
7 [ ]. y9 E" K8 G - * published by the Free Software Foundation version 2.
6 a" J2 }$ W) _* z- f - *3 m0 q! T. {3 n! c7 W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 y# _7 s7 T6 h5 q& a
- * kind, whether express or implied; without even the implied warranty
7 a3 U1 l2 N& Q% ?+ q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. L, W- B+ M/ B$ P
- * GNU General Public License for more details.
1 y7 L$ }3 t! m8 ]- X - */9 m( r- c1 r! @5 a9 i2 C8 N
- ; l- R9 y5 U( u2 W0 p# t" X
- #include <linux/module.h>
8 s* c0 f/ T0 }- z0 j - #include <linux/init.h>
2 G5 R! q5 r+ N8 R1 @! t3 x N - #include <linux/errno.h>
4 L2 @1 a# a x3 o& }, J - #include <linux/types.h>
2 h" ?" a* i4 p9 @; I9 J, _9 Q9 ? - #include <linux/interrupt.h>
' H( z3 D" { G' h Z9 x3 }7 c - #include <asm/io.h>
* g3 k! a' t5 D# Y- ? - #include <linux/moduleparam.h>
) o' u. V+ E2 \) B9 { - #include <linux/sysctl.h>& X( P8 N4 C$ `
- #include <linux/mm.h>0 _0 G; v1 d/ @# P
- #include <linux/dma-mapping.h>
& G' d, {& e- H8 C- S; B
6 y; u) s& o/ d' S- #include <mach/memory.h>
3 [4 N( Z \6 a V5 J5 v/ p- X" f. } - #include <mach/hardware.h>
?9 A4 H# r5 q% E - #include <mach/irqs.h>) r2 G; ^: E$ E2 x% R2 z' |: J
- #include <asm/hardware/edma.h>
8 ~+ J, {4 w p; h. V5 p% A$ u
3 s1 r, |& L+ |& x1 O: Q4 r* F- #undef EDMA3_DEBUG$ d0 ~# i8 k7 M) u
- /*#define EDMA3_DEBUG*/- x& \# }8 O7 Y, T
% s3 T( R w' o( R- #ifdef EDMA3_DEBUG- `4 N0 w8 w" K' j, X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ l) \" O/ l5 d0 {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) H; R! Q& E. b( ]5 ?& E: @9 L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% X4 W2 K3 H- A" V' T
- #else: [7 Z" f! T" w3 n4 f* P/ r
- #define DMA_PRINTK( x... )
# G8 T2 U/ A* z2 y - #define DMA_FN_IN! e) w, e( N6 Y% X |) U3 ~
- #define DMA_FN_OUT
* K3 f5 N6 }# s% a2 J- y& k - #endif5 v8 v: w0 Q3 H6 A$ m" P! g" ~
- ' ^. `; ~4 c- [' S% h& b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# J+ G6 L9 z. _: I2 \5 C3 d7 v - #define STATIC_SHIFT 34 `& E A! D" ?8 b P- m5 a! ?% V
- #define TCINTEN_SHIFT 202 d+ D& H& C9 F+ ]+ i& L) q
- #define ITCINTEN_SHIFT 21
% q8 ]2 @ @2 O0 z; z9 H - #define TCCHEN_SHIFT 224 g) `8 m9 |8 g, Q( ?
- #define ITCCHEN_SHIFT 23, o0 \8 K; \2 d- C6 ~
+ t- W/ H: J! j9 J4 _$ }, Z" a- static volatile int irqraised1 = 0;6 r1 g; m) t6 O Q; e% P' A8 z2 V
- static volatile int irqraised2 = 0;# K" v1 L0 Z0 y" G% ~
- 9 g) n( U5 U7 m5 c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
n* W. F- Z" A. q) c7 f! y, d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; @+ i$ ?/ k# c2 Y" j B- O" T, Y, F. a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ?6 Y! Q4 N) h& R- k( Q
- ) }" U. e i1 _. u- c' c% {& V
- dma_addr_t dmaphyssrc1 = 0;
) x5 c. D0 n# i! ?1 S2 |6 N9 V - dma_addr_t dmaphyssrc2 = 0;
: D7 u7 v4 {8 B C3 ? - dma_addr_t dmaphysdest1 = 0;
% K' n0 j8 e8 l1 {+ U - dma_addr_t dmaphysdest2 = 0;
$ q( f5 t# [0 ~, G, b - # H" {5 }9 J+ k9 o
- char *dmabufsrc1 = NULL;
0 [/ \: l0 Z' E- h3 u - char *dmabufsrc2 = NULL;5 X8 m, L7 \1 ^) O
- char *dmabufdest1 = NULL;$ R- A- n5 U4 Y4 D
- char *dmabufdest2 = NULL;
8 r0 N; U" ?( E. f; h0 a7 Y - 3 @' l s3 g# \$ e3 b
- static int acnt = 512;$ [' x' l! @$ `
- static int bcnt = 8;6 @+ X0 s4 r$ G- ~, y% Z* a
- static int ccnt = 8;
0 G. c. t8 k d" | - + E( M1 F: o j) k* _+ k
- module_param(acnt, int, S_IRUGO);5 c; a% d4 k [, J' L- z/ c
- module_param(bcnt, int, S_IRUGO);. s. N! a* x6 Y* w. p( Y, Q5 d( k# ~
- module_param(ccnt, int, S_IRUGO);
复制代码 ; r! G4 M# v* H5 h2 B
. r5 M' W _% l) r8 U$ b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 \2 e. a& A }; w t9 x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% W" @# R' @( o3 H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 ~2 \. s1 B. u+ A% m- K* k
, ~' ]2 ? s( t, A- X
9 L$ s6 k" x6 j |
|