|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * v! t8 _3 e" t
- [code]EDMA sample test application" W- R9 U1 n. `( \3 R5 m# C
- /*% l$ [4 T' ` y, U0 j- o
- * edma_test.c
& H5 v" p, K$ K j$ a - *7 c- N+ e" D( U
- * brief EDMA3 Test Application" q' p) v# E7 d8 o0 N6 q4 Q0 i
- *1 K" A5 Y3 p# z! o; x4 n
- * This file contains EDMA3 Test code.
" P: e: {0 G% H( A - *
/ Z2 @) {' V7 d2 r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 _) ^2 r6 j2 h4 i @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 `: X; f% ]+ T/ ?& G6 H
- * TO CHANGE.
& K; Q5 @, r! ~9 M5 J - *
4 B. B8 p, n) O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ ]7 J' y& B! P; H$ r3 j - *
, {+ L3 ]8 u/ ^/ B* p& @ - * This program is free software; you can redistribute it and/or
3 Y) a) z1 F' T& j" R - * modify it under the terms of the GNU General Public License as
, i4 |& k) B- `. B' H/ r; A - * published by the Free Software Foundation version 2.# `9 Z0 S3 P5 W" Q' c9 A# S
- *
3 n6 y6 q' Y# W. E+ @! `; m8 z/ | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 O" s3 ?$ i- i. M- H
- * kind, whether express or implied; without even the implied warranty) h/ h% J& H: \9 ]% I5 S8 d' m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 ]" j% H8 c& U' \ - * GNU General Public License for more details.
% j' F1 A; R# v' Y) ~ - */
! c9 j4 O2 K' A4 W2 w
0 H: d+ l: `) \0 d- #include <linux/module.h>5 i; O/ N6 }3 i+ t2 h3 p
- #include <linux/init.h>
- e* @0 C% C( @! |/ }# r. O - #include <linux/errno.h>
/ d6 l3 U; {, O. ]6 E+ M% E$ ?: q - #include <linux/types.h>! z+ p/ ^: w, b' f6 ]: g
- #include <linux/interrupt.h># K3 {' [! D8 Y/ P4 M
- #include <asm/io.h>
: Z6 {2 V8 H+ e - #include <linux/moduleparam.h>
8 o! m: j6 O# n5 T3 s: \5 a3 | - #include <linux/sysctl.h>8 ~6 d& T/ _* ^/ Z& C
- #include <linux/mm.h>+ {3 x1 z- o M' x) b
- #include <linux/dma-mapping.h>
* ]; V4 A2 D; a0 V* L - : h! Y) V# e# B; i |0 r
- #include <mach/memory.h>
d% ` C% Z5 {4 p - #include <mach/hardware.h>
+ _( E" b- y8 D$ a5 |0 M* U8 t% C5 W - #include <mach/irqs.h>% Z$ i6 U4 O. I
- #include <asm/hardware/edma.h>- b% P$ s5 J% b! Z8 O" g$ S& i6 `
- - O/ ]3 @1 P3 k8 C" q1 W
- #undef EDMA3_DEBUG7 ^" C8 V% H- _
- /*#define EDMA3_DEBUG*/
* ^( m/ Y+ A/ N! S3 Z; M
$ r5 r$ F# L/ M$ R H- #ifdef EDMA3_DEBUG3 q2 p, W i# n4 N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" Z+ }: B% C( Y# S. ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
s/ g" Z% \. {7 c5 S5 H0 r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( {5 g! W- a c - #else
; J1 U3 ~& n$ f( y3 O" q - #define DMA_PRINTK( x... )9 U" G3 }6 ~- s( h) k) Q; K$ Y
- #define DMA_FN_IN/ }/ f* h. _' y
- #define DMA_FN_OUT
. f" y# d: t& Q( f2 J - #endif
# t! R5 z. t4 ?; {
$ k* l- @' ]) ?" s) u; P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 W" N1 }1 `8 s2 m3 u& r - #define STATIC_SHIFT 3
h1 t! R' k& a5 }9 s* } - #define TCINTEN_SHIFT 20 K' m" d- O( F, D& Y- |+ V( j
- #define ITCINTEN_SHIFT 21 ?* J1 F( e( D& A3 u5 o
- #define TCCHEN_SHIFT 22
r% ~1 X. ^. b( }. a/ e - #define ITCCHEN_SHIFT 23
/ m' b, [' k2 ~1 p/ K% Q9 ~- Q
& a! v. O% O& [# n$ n+ q6 q u- static volatile int irqraised1 = 0;; q- x% s a; ^# a3 X
- static volatile int irqraised2 = 0;
1 S. g, d1 G% c' ~1 Q& J
" Y# o8 x1 h6 z( r0 |- J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' r( ^2 e5 E+ L' A' b! W; x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); {/ P. z) r9 C5 B* B8 O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. v" \7 i& e) T& v) D2 Z9 M7 P) x8 O8 c
v/ Z! T6 ^" Y" h7 G3 ^* R- r- dma_addr_t dmaphyssrc1 = 0;
! A% u3 a/ J! l4 o- R4 R0 T - dma_addr_t dmaphyssrc2 = 0;
7 m8 h1 w1 S6 S! \& ~" W - dma_addr_t dmaphysdest1 = 0;
5 v4 X' A( Y p- |4 g# H - dma_addr_t dmaphysdest2 = 0;- X$ ]/ w* @ }
- ; X& N: |' G( ]5 i6 k5 u' c' ?- m
- char *dmabufsrc1 = NULL;1 E0 J: M- K/ _
- char *dmabufsrc2 = NULL;1 j4 u! H& i& N3 e0 @( d
- char *dmabufdest1 = NULL;
@- V6 O1 x1 |/ h X) v, C - char *dmabufdest2 = NULL;' D) n# v) j! \3 d4 p" t* Q
; V+ p3 Q7 Q- g$ T- static int acnt = 512;
. y7 O6 d+ K: M5 I1 Y - static int bcnt = 8;# w: x: L0 ~( h2 a/ p9 q% A
- static int ccnt = 8;1 D: C" @& i- E# \" [
( }! F. F( u/ z! S( a0 V4 j- A- module_param(acnt, int, S_IRUGO);& B! z5 e/ @! |2 U
- module_param(bcnt, int, S_IRUGO);
. B9 T/ q* u9 o; N b - module_param(ccnt, int, S_IRUGO);
复制代码
2 c' X4 I6 d4 O4 l# C. M) B7 S" U5 X# q: u- `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 c( h k: U; g) t. O6 N# Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, k4 k$ {1 x; Z& j3 Q$ c) _8 {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 x: j/ S7 M5 f/ r) {! Q% r# ^+ R0 G" T/ m: l B5 Y
4 G% n+ p0 @6 p7 Z4 D1 f
|
|