|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + Y5 r" I M! N1 q& S q
- [code]EDMA sample test application |! ?0 N" N' y& g) L
- /*6 D4 Z0 V: Q8 M- |
- * edma_test.c5 ~8 ]4 z& C& d: w+ U$ x2 }/ \
- *
; e' ]; P- O& q* G5 `" d - * brief EDMA3 Test Application. g1 c8 E9 g& n6 a
- *
* t# Z7 v4 V1 k9 H1 V - * This file contains EDMA3 Test code.
f& x$ Y m; K& K; t6 K" h - *
9 b& |2 K3 l2 ?) y! f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. x$ S3 o$ h$ e1 x$ Z1 A( a* z2 t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 a) b5 c, x" x# w5 Z - * TO CHANGE.( I5 ?: }7 B6 j4 g
- *1 R' T# l! |$ u" f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 P$ C1 R% Q" f! h9 W& T; m
- *0 G8 F& [; A5 B. L! D6 ?9 J
- * This program is free software; you can redistribute it and/or
/ Z+ F" S( i, J' }! Y+ ^/ b l9 w+ i - * modify it under the terms of the GNU General Public License as, {1 O$ z. F N- V1 `
- * published by the Free Software Foundation version 2.
# f9 n2 O5 n% ~ - *; b* w8 k; D/ W0 m2 \, v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 w7 {/ @ g# {$ } - * kind, whether express or implied; without even the implied warranty
e& Z+ r# y" A7 }/ u! H$ \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' o0 M; m7 F4 B0 C0 P) n( G2 J+ E - * GNU General Public License for more details.
8 x) m* ?. C4 W( J) I( @ - */
7 P4 }5 S8 @& j8 r - * q% F' D; a7 D% e* q" F* O: @- Z
- #include <linux/module.h>( G4 }+ R0 |9 W& V5 U; P+ [" g
- #include <linux/init.h>4 Y, |- i3 K3 M# Q3 t
- #include <linux/errno.h>
. D6 g4 Q; @3 b5 d - #include <linux/types.h>6 r1 l4 D# F$ ^8 p% _* R8 V/ v
- #include <linux/interrupt.h>& h0 ^4 l* A; E
- #include <asm/io.h>
! H$ h. G7 [- V& A b; t: B) C- v - #include <linux/moduleparam.h>
8 z/ F5 [, P7 m: c1 v' m - #include <linux/sysctl.h>
* o$ S1 ~+ S( X+ @& y; K I5 y9 W& N - #include <linux/mm.h>
9 F% `/ T& d6 _2 T - #include <linux/dma-mapping.h>
0 z2 h$ n0 ~: `0 J/ l
9 _7 H6 f9 K; k) o* ?+ X- #include <mach/memory.h>! q. F! b" [# Q1 j# ?
- #include <mach/hardware.h>
3 f1 j& \, f! A" g6 O& \1 j - #include <mach/irqs.h>' _. F w6 a, }, r
- #include <asm/hardware/edma.h>
. A! b% H# w: x* C/ T( J, g* V" [ - 9 g% x7 ^5 H2 L+ T
- #undef EDMA3_DEBUG
4 j- c3 O* H. B6 U% W - /*#define EDMA3_DEBUG*/
$ f7 s! q% m5 X) Q. w ?
) u' V+ u2 }9 @' ?3 M# y- #ifdef EDMA3_DEBUG
' I1 u6 g" S7 c$ z0 M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 D8 s: r0 Q- R; G: F: [9 \2 T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 J5 e# p. z: w8 O( A+ c7 K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 s. G* L& l+ b# \/ D - #else( \0 Q/ R# k2 K: b* |6 Q
- #define DMA_PRINTK( x... )( Z$ L' V7 F, b+ f6 m3 B8 F
- #define DMA_FN_IN# N& w: J6 Z6 F6 B; L- a
- #define DMA_FN_OUT" s+ X* q H Y9 c5 H1 Y6 \/ M. H
- #endif9 X+ x9 C9 M- {7 G4 [
/ g* T/ E# @% _. ?: C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 X. N0 ~, z0 l5 U' F
- #define STATIC_SHIFT 3
% Y; @, u# M. M& t b( ? - #define TCINTEN_SHIFT 20
q1 ?5 [) q) s6 s( P - #define ITCINTEN_SHIFT 21
+ {$ V7 g% @! K, |) O - #define TCCHEN_SHIFT 22( r' p7 V1 \: L9 }& e) l5 J
- #define ITCCHEN_SHIFT 237 j, V: e$ g ~
) ~' y/ @9 [: v1 q9 b0 Z- static volatile int irqraised1 = 0;8 {7 B& x& N1 b4 F3 K
- static volatile int irqraised2 = 0;
+ ]- Q7 ?- c3 U0 D - % c- S3 g1 @( }, E. Q% y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) r+ p, U2 j3 a% V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 }1 F7 D8 }0 `7 p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
w% `; [; [0 U ]' [- U* P
. ?9 G5 Q; Q: V! Q- dma_addr_t dmaphyssrc1 = 0;
1 v5 _3 I$ h% t+ b, w, D - dma_addr_t dmaphyssrc2 = 0;' N9 @: J# Q: K6 u7 n
- dma_addr_t dmaphysdest1 = 0;
* Z, a# Z* Y' O0 [# z! u( I6 N& f - dma_addr_t dmaphysdest2 = 0;
{, G7 i) @1 u; N) k - 0 K" p0 ~$ Z# ?3 j; [% ^
- char *dmabufsrc1 = NULL;6 v d) D& U# P7 P% ]( E6 f6 m7 L
- char *dmabufsrc2 = NULL;
. f9 u- K8 o5 y* W: v% _ - char *dmabufdest1 = NULL;
( i5 S9 d \5 i/ ]6 T - char *dmabufdest2 = NULL;" n) I/ y3 L! X; p. w2 O8 \9 s
7 Z! y1 f/ b7 B9 a& P( Z* P- static int acnt = 512;, S8 X+ d; J& g8 a2 M
- static int bcnt = 8;+ a8 p9 n& ^1 ]/ \2 B
- static int ccnt = 8;, M! `7 X% V9 _7 }: z. \
7 E$ C) U4 J0 g2 X8 a6 l- module_param(acnt, int, S_IRUGO);
; y, q+ t8 h- ^2 u1 m2 D - module_param(bcnt, int, S_IRUGO);/ ^/ t4 b G2 f5 t* \) ~2 a, H
- module_param(ccnt, int, S_IRUGO);
复制代码 * g8 \% f! G1 O
- \, d) W( G$ e9 Z- [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- H. Z/ p" N/ Y$ k8 ~9 p, O5 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& U" G7 f& g& m0 o- I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- }6 A9 L2 [. g, j$ H8 j: b5 x; A- a0 l9 F& t1 t( F4 @+ \
3 g# i( Y; Y2 ~1 l0 Z$ s" a$ N
|
|