|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * f! W: V" E2 d
- [code]EDMA sample test application( P3 Z& s+ V& w* t0 N1 s
- /*. V1 W+ h( X* d5 T: a) a; E
- * edma_test.c3 y3 d! o: f1 Z7 n, }0 N5 u( c
- *& c" R5 c" K- e
- * brief EDMA3 Test Application
; h3 ^1 t0 \ d' r9 l; t5 s - *
0 T9 H8 P1 y3 t- f g _" m - * This file contains EDMA3 Test code.; D8 R4 j/ l( T, @1 x
- ** c/ e( _3 g5 @7 K V" \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% Z' u0 `# l5 ]' ?: l2 y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 Z. Y# z/ s8 C: Y$ I8 M7 Q - * TO CHANGE.- l$ ?9 ]. r2 g+ _
- *, ^: h, c. v) d* I; v) [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" A. P* ]! F" a2 N! }' b8 X
- *: F- Z) u! d( {: x* p/ D
- * This program is free software; you can redistribute it and/or
- t& F w7 F2 }3 N( ~1 \( g6 [- x' |9 G - * modify it under the terms of the GNU General Public License as: W! }- q# A l2 B$ n
- * published by the Free Software Foundation version 2.
# W4 y& x' O- J - *- b8 q- x6 l+ w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% N4 B8 q! V( K3 i( i* \ - * kind, whether express or implied; without even the implied warranty+ A1 B; p$ G- Q& Y) G/ X @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, W. }1 s/ T N2 C' S, P
- * GNU General Public License for more details.
9 t/ p. A) ~/ g0 S" F+ ~ - */
( d' |% `$ v; \- j* l( z
/ t) R( v" v( H: i- #include <linux/module.h>
6 [/ p- e+ d# ?( m) }( F0 L+ U2 J - #include <linux/init.h>
S$ c* ^3 w2 t+ R4 I - #include <linux/errno.h>
- U. T; F! Z/ Q; C1 `5 L- j - #include <linux/types.h>
1 t) q6 K/ d5 M+ }" A# _ - #include <linux/interrupt.h>, |" ?8 G+ m6 U0 Y& z
- #include <asm/io.h>
, c$ K v/ y( h( q$ J9 q - #include <linux/moduleparam.h>
, u& S( B: T. x8 I( x2 u - #include <linux/sysctl.h>3 M* p6 ]' f: n& \% Q3 i Z0 J
- #include <linux/mm.h>5 \0 \9 `* @" L& Y: x* v
- #include <linux/dma-mapping.h>
- H: |4 R: t! Q$ }6 Y1 }
, Y* H4 J/ {* \' a4 Z! L# ?- #include <mach/memory.h>
I) W" u7 L7 f/ ?' p. K - #include <mach/hardware.h>
2 E o# V; Q% C y' Y - #include <mach/irqs.h>5 d: p* k$ j( w: i
- #include <asm/hardware/edma.h>
0 F E; \0 F. O5 K t+ N( S- A/ U5 O - : h' b% X% M: c& s* s E% K3 y
- #undef EDMA3_DEBUG
6 i3 D+ ]+ s" }0 ]( D2 J - /*#define EDMA3_DEBUG*/
7 {7 M a A9 v7 ~: L0 N! @0 A- |
2 Y3 p, j0 W1 `4 x- ^1 U- #ifdef EDMA3_DEBUG. a0 p4 @2 H2 n9 O$ [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ ^3 q% w& W8 P4 t/ y7 {, @# \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 s" A D) W, X& a' ^: O% @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ ~. i- p# J3 c7 Q% ]- m+ Y0 A3 C
- #else
7 G4 Q7 I% J1 _3 j: b - #define DMA_PRINTK( x... )8 u/ a9 s% A9 P! G g
- #define DMA_FN_IN- c" |1 j3 P. `1 t1 c6 d# W7 C3 E$ R
- #define DMA_FN_OUT8 I; }1 G) {2 F" G9 F$ w. _2 c& \
- #endif0 Z" f$ T( F7 l# ^ L9 ?* p5 t. x$ p
8 h4 k' U4 l* J3 b- m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ q* w; I; H! L* v6 ?
- #define STATIC_SHIFT 3$ Z" w) R* K g) ?3 p' {. h& }' j
- #define TCINTEN_SHIFT 20! j4 [, j% p0 |+ q" W! @
- #define ITCINTEN_SHIFT 21. m x* c- r/ f0 B% [: Y
- #define TCCHEN_SHIFT 22
! X$ B' X+ V1 h - #define ITCCHEN_SHIFT 23+ `. j+ u& }7 x8 C v6 ~+ ]; y g
- \) _* U6 }, r( |3 N" c5 A
- static volatile int irqraised1 = 0;
: z# W: _1 q# U4 P) T - static volatile int irqraised2 = 0;% t& G) h# Z! U' u+ g; k) \3 }
: n4 B& o! O9 b U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 g j3 h% w- |# J! ?0 F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! L6 m7 l+ t9 w R6 t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 e7 R+ G9 U( |# w3 b1 p6 Z
! g" ~2 ?8 A; q& e1 K' w& d: O- dma_addr_t dmaphyssrc1 = 0;4 E6 X' F6 V3 ], W' _, {
- dma_addr_t dmaphyssrc2 = 0;7 k* Q6 b3 l, m- y, D' F s1 n
- dma_addr_t dmaphysdest1 = 0;. h, H& s" K" U) E, Q
- dma_addr_t dmaphysdest2 = 0;
3 c- w( D Q' ^6 ~( u: `* l/ n - 3 F* n. v1 t% O" P
- char *dmabufsrc1 = NULL;
' L- f8 C3 Q. T% | - char *dmabufsrc2 = NULL;8 |4 S: }; o1 J3 A2 `8 ?/ O) }: y
- char *dmabufdest1 = NULL;9 @( Q R5 @. B( v2 s, v6 ]
- char *dmabufdest2 = NULL;7 M' L+ h* D4 K3 N
- ' \% T$ d! h5 g! @! J6 J
- static int acnt = 512;
) |" y( l* B Y8 E6 a+ l# P - static int bcnt = 8;
. j7 P4 i1 a/ ~$ D - static int ccnt = 8;* J/ f9 B. d% v3 T% l8 |- t) ~) }
- * l3 t9 b2 Y4 ~# b
- module_param(acnt, int, S_IRUGO);
0 k! i/ a+ d: K; K - module_param(bcnt, int, S_IRUGO);, [# F, Q" B( h W( z
- module_param(ccnt, int, S_IRUGO);
复制代码
8 E8 ^$ u3 Y* w" t) }: P7 f" e* a* j
9 F, Z* g: \* a* S0 i$ D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, |) o0 w @1 I6 E/ N0 Y6 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ K- O! c% { u3 k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# }. u) u% D% v, i* S, x! r9 W" y
' }3 w7 F. }7 @( j7 O7 a# m4 `% i, ]3 K4 B3 E2 h h9 ?
|
|