|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) p: S- G C8 D/ A4 F
- [code]EDMA sample test application
4 m0 `8 g3 e$ }! F7 t) ` - /*
+ y% e# {% q( {: G - * edma_test.c/ \; E9 O {& ]7 C8 E
- *' ^* k) I7 b+ t" S/ t: G
- * brief EDMA3 Test Application9 B9 `/ ]* ?) e% x& J
- *
$ f, N% _( F4 c0 L x+ t - * This file contains EDMA3 Test code.' t7 O! P& S. @4 e9 u. a4 P& j" ]
- *
0 ?+ S* ]5 D% `$ c* N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
h+ X0 G1 w" q2 n/ \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! k: A: _5 G" @5 L1 _/ n - * TO CHANGE.$ O G" R! Z7 o# K7 z q
- *6 h" x$ c |* I1 c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 P+ o: D5 T$ m6 Z! Q1 `
- *
0 t+ f. @3 ^6 `* R i% |: y - * This program is free software; you can redistribute it and/or9 b$ u) U+ j1 E {
- * modify it under the terms of the GNU General Public License as9 |3 O4 b6 }/ W) s" ~/ ^
- * published by the Free Software Foundation version 2.; c# V0 J" w. p, U9 [
- *) }9 J4 ` I/ I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ `* d( x% `+ |8 E' r - * kind, whether express or implied; without even the implied warranty. E9 e H/ [0 ~2 }; p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* m, \4 w( }+ A' h' ]& R
- * GNU General Public License for more details.5 i" f! t( r3 I9 g
- */
1 R, }: ?- p* G' Y; \. o
% _& ?" t5 A( l# O- V/ a( D- #include <linux/module.h>
6 j O+ B) a$ g9 m4 X0 n - #include <linux/init.h>
m, T& V. l% g6 x7 a6 M - #include <linux/errno.h>
/ E, E9 Y. l; Y* V+ a6 F2 U - #include <linux/types.h>
9 I" B3 s5 c* B1 W0 ]. _2 e) N# i. Q$ G - #include <linux/interrupt.h>2 U3 i" ~3 z, }8 \
- #include <asm/io.h>
2 x' g; A+ M+ M# s - #include <linux/moduleparam.h>
) [ G( G- D h4 m% J - #include <linux/sysctl.h>9 S* `& c% t: L% r
- #include <linux/mm.h>
$ A2 y9 t2 ], u6 u2 C - #include <linux/dma-mapping.h>
4 f& T4 I" ~! }% ` - 1 O. h# B! C( @1 P. |$ ?* r3 q
- #include <mach/memory.h># L8 I6 N6 a' a9 K: W: _$ D7 m
- #include <mach/hardware.h>, H# C2 O7 y5 |9 F5 j
- #include <mach/irqs.h>
9 K6 Y( C/ w! R$ o9 H/ _( s" k& U) Q. E - #include <asm/hardware/edma.h>
/ f9 V: ] V% |$ u - $ e# z2 B' i$ }% v( i+ P- S- l
- #undef EDMA3_DEBUG
+ p5 L6 z& P% w6 S - /*#define EDMA3_DEBUG*/
/ U" F- U5 W/ F4 Y$ E
" U: [/ v6 m& @- #ifdef EDMA3_DEBUG* K- z$ u$ k/ n9 K: f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 F: u* n! ]( [. J# q! u5 U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) M7 s: g( h4 u2 F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( M- t3 n" c1 x5 C) J S4 }3 k - #else3 U$ \' u& H1 n& B
- #define DMA_PRINTK( x... )% z3 _6 S# t$ C8 |; P+ k) e1 Y7 g, S
- #define DMA_FN_IN+ F* c( Q7 K0 s7 z
- #define DMA_FN_OUT& R5 p$ I3 d0 g" C4 t7 h0 T
- #endif2 {! N) ^- Y- e, `, z E
- - V* Y9 L6 C7 W- E# g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' l' C) ?0 A- y6 t& b8 W# W
- #define STATIC_SHIFT 35 B9 h; y& M7 q
- #define TCINTEN_SHIFT 20
, o* @- e5 W* O W5 `+ @ - #define ITCINTEN_SHIFT 21+ Y3 M1 Z2 s9 W" Z
- #define TCCHEN_SHIFT 22
& m3 o7 m1 F! P: [5 K" Z - #define ITCCHEN_SHIFT 23; p8 @0 B, ]' o6 u) w8 U
- $ H! e4 _3 S" w6 H
- static volatile int irqraised1 = 0;
$ E8 q5 H7 @& a8 m( T - static volatile int irqraised2 = 0;
+ i% m/ Z$ X1 g. F3 l' V* J; {$ s2 ~ - ! Q) K4 R+ A) v; o7 d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ W: ]( [5 k7 F3 Q- l5 U! D- n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* J; \1 v2 k5 c& r3 G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ^, I& G0 P4 S7 a! U/ e* Q
- 2 H w+ G; z; q6 s
- dma_addr_t dmaphyssrc1 = 0;
/ M! V A5 N, _& O. u4 L - dma_addr_t dmaphyssrc2 = 0;
* ~9 M9 e8 R# T$ q6 { - dma_addr_t dmaphysdest1 = 0;0 J' A$ O& ^$ I& x( q6 [, K6 w! O1 T
- dma_addr_t dmaphysdest2 = 0;
5 |1 m! X; X ^7 z6 K1 ?" q - . @* K n. z% Z. c* L/ K8 n
- char *dmabufsrc1 = NULL;
5 _% A K! s5 T - char *dmabufsrc2 = NULL;$ @9 ~9 w3 V$ Z( F/ M0 d3 n% n
- char *dmabufdest1 = NULL;
# w1 u) f# w* g% H1 f5 [* r - char *dmabufdest2 = NULL;
7 Y" X) c7 z1 b5 r3 c" v/ L: m& F
) K5 Q ~( G1 x9 H3 z9 U, u2 }- static int acnt = 512;" t/ O& j; F. P
- static int bcnt = 8;4 y, q) D# Y! E2 ^# p- ~
- static int ccnt = 8;' E& z, r# \) E' \, s
- 0 F6 w1 E! H3 l
- module_param(acnt, int, S_IRUGO);
8 }9 Z# s# i$ ~" y) d* `2 L - module_param(bcnt, int, S_IRUGO);
7 s3 u: D2 y) s1 B% H( f - module_param(ccnt, int, S_IRUGO);
复制代码
/ @! B/ D! ]$ v+ ?! l
) A: v' r* G% p- ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# k& v3 r W# z4 S6 T; D0 v1 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, G; w5 p+ p k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ E# T% x- f# J2 @ g$ s0 w
3 `0 l1 ?: y% k% w! I
& q: \$ [. r) C, g, L- p
|
|