|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ W! b: C% b! {% m- W1 z- [code]EDMA sample test application! ~; J- b/ N1 D8 E: N! e# B7 e& z
- /*' Z ?! G4 `% R! A0 ~1 Q7 C p
- * edma_test.c8 ?" f' ~( f3 g5 g0 A
- *
& k0 i l5 w8 _ - * brief EDMA3 Test Application4 q5 @( x/ O1 @! w: X
- *
% U( B" S7 q9 ], I$ p - * This file contains EDMA3 Test code.3 }6 _2 u$ f$ D( Q
- *
/ @ o1 j- E7 F* l8 \% W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( q% n; z8 L0 ~7 l/ b7 F; b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' p/ b% a4 ]# x) @ - * TO CHANGE.
& N3 p8 ?0 U8 O: I - *' ]; L$ ?+ f% J5 Q# `, ]( J9 S9 |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" l5 X0 _% M" y7 i! ? - *9 w* z, U# ^- p6 h
- * This program is free software; you can redistribute it and/or
* w' D* J5 v/ G( q$ g - * modify it under the terms of the GNU General Public License as
- M1 M$ P6 H6 P7 b - * published by the Free Software Foundation version 2.
! ]) E6 T( h! ~* X( `5 r$ W - *
# M @" l3 P7 ~* D8 | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( C. w" h$ R" X" m' i$ |5 z - * kind, whether express or implied; without even the implied warranty2 r$ T& D+ C; T1 D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 k1 G- h" N5 J8 n, `6 G# G - * GNU General Public License for more details.
: e; Q7 `7 V, H" N7 l/ ` l4 n0 ] - */
2 I" H% d& W& X; q) {3 F: t& M1 [$ r
/ ], r% _/ K9 T# M( o9 F' _4 H- #include <linux/module.h>; w' ?+ f) g6 V; A- h0 `0 t5 M
- #include <linux/init.h>
6 J% ? I3 `( v6 \+ ]3 o* ? - #include <linux/errno.h>; L3 b# }! H1 p6 l' ?
- #include <linux/types.h>
' s) x2 b& _- v9 f/ F - #include <linux/interrupt.h>
* K: H6 o& x0 h3 _. Q/ x - #include <asm/io.h>
( o7 w* A8 R/ S) h - #include <linux/moduleparam.h>
! C2 F* l( C; W" B6 f Y f - #include <linux/sysctl.h>
; W! ^+ @1 ~( Z% ]! q$ \ - #include <linux/mm.h>* @" \1 ?0 C- ?4 Z
- #include <linux/dma-mapping.h>
: |0 w0 M+ ~( E0 s
3 ~ r+ Z( ~% i, l/ t1 ^7 e- #include <mach/memory.h>% A$ i# P' u; C
- #include <mach/hardware.h>
. ^# |) _8 J7 D - #include <mach/irqs.h>
) ~- d! p% L7 r - #include <asm/hardware/edma.h>9 ?( s6 n9 r9 K
- / ~4 `7 m- f2 w" t
- #undef EDMA3_DEBUG
1 c) N+ f; _8 O: a3 C# `2 T - /*#define EDMA3_DEBUG*/) J5 `# e7 M1 @/ J9 r; c$ A' K" ?( A
- 7 a$ A( Y! s# r j& ^
- #ifdef EDMA3_DEBUG9 ?# k* e* a/ ~# Y& a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). q/ N9 N3 Q, X4 P4 P. F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ D m5 o7 U+ ?& c2 J - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% q, G) r$ _+ Q' G
- #else
8 l2 r" O' e" m. c/ C0 d) Y - #define DMA_PRINTK( x... )' H( y9 Z) ]2 [& e
- #define DMA_FN_IN
6 {% |5 I* R4 J) F - #define DMA_FN_OUT
8 G# B+ @8 q4 Z - #endif
* n7 k* S7 c: ?" O3 y
# u. ] l; l$ T% a. Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. X% c% Z, z8 s5 [7 J" p9 ~ - #define STATIC_SHIFT 3 P& R b; X9 |* c9 Z
- #define TCINTEN_SHIFT 20
- l1 l$ S% B" w) N9 m- x/ W/ U1 A) S - #define ITCINTEN_SHIFT 21
2 L1 y" Y3 C% i3 v - #define TCCHEN_SHIFT 22' i3 E6 P, X, {! W& c+ Z% j
- #define ITCCHEN_SHIFT 233 N! F9 s2 r6 K& C5 n4 ~
- 0 t& D# N: C* K* H, t
- static volatile int irqraised1 = 0;
$ k) l4 v+ ^& z) L - static volatile int irqraised2 = 0;5 T+ O1 \+ V" H5 c- x7 p: Y' h
- ) ]8 f, a' m9 c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 X* D- \- P, i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# q" N! I/ w( o2 N. {" q7 R, w, W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' d6 @& m! t; o% y" N g1 O- E6 g - $ p7 a3 U" g* f; g$ g2 q
- dma_addr_t dmaphyssrc1 = 0;
* n' A, C6 v! Y, o4 P+ G - dma_addr_t dmaphyssrc2 = 0;
2 X: x+ o+ C0 L* F1 \6 G* A - dma_addr_t dmaphysdest1 = 0;* d4 g* B: `5 W. t5 u( \
- dma_addr_t dmaphysdest2 = 0;
; n( Q* ]$ g0 ?0 x( m" r9 k% v$ R - 2 Q; c' J) _1 m, o
- char *dmabufsrc1 = NULL;
5 B: J9 X/ g7 B' r6 S0 k, y - char *dmabufsrc2 = NULL;; l' b: }% ?. ^9 f# b
- char *dmabufdest1 = NULL;
* ]) w6 X3 a/ O. y - char *dmabufdest2 = NULL;# X( z/ f5 C4 P( y- ]6 k W4 U
- . \" k. R9 T1 b* x6 n+ U
- static int acnt = 512;8 v( p# r; c. x. U2 N9 [% V9 E7 f
- static int bcnt = 8;
3 f; `/ V- `/ C - static int ccnt = 8;
" \* b2 L) \6 i Z" t - + d5 f' ~/ w8 a" `0 A$ d
- module_param(acnt, int, S_IRUGO);" k! \1 {/ [! j$ G; c+ y
- module_param(bcnt, int, S_IRUGO);/ e/ K7 Q/ p1 ?6 T( F& _( b
- module_param(ccnt, int, S_IRUGO);
复制代码 1 b8 d2 U/ h0 n
6 ]3 U& |' }9 B2 z* h! q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 {5 e# {+ P' H8 H4 W% Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 ?" z8 L0 ^( s/ n4 }( X! X) k" A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& F3 a6 W- Z! e' a( ~" i
6 V+ x% V) T- F8 ^& h
Y1 l& k+ `# u- P
|
|