|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - j5 U0 V! }& F& Q4 y
- [code]EDMA sample test application P' V" j; A. P: o
- /*
, q: y4 s& U' x - * edma_test.c) K2 D0 J6 j3 p& \) G
- * O" }% L3 ~! d; b
- * brief EDMA3 Test Application
5 G! k5 J& U: N& [6 Z) u - *0 j( W3 p* @* G7 S3 Z
- * This file contains EDMA3 Test code.
6 Y( C$ O) b# X5 ~# N- I - *
/ g) S, x0 O+ c: u% Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 [2 m5 { J1 v/ l ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 d: [/ `) a' ~7 `1 n5 |# ~) z - * TO CHANGE.2 u9 j, V2 K6 x$ H+ H* V
- *
" N, C8 Q& n9 J* y. y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; K/ s9 N! h% s% L: g; f$ G$ g
- *' O7 R% O- I2 l( K, H: g
- * This program is free software; you can redistribute it and/or. T6 H# ~: D+ c
- * modify it under the terms of the GNU General Public License as6 L2 O, K7 U$ z7 h1 v5 f( _$ F- q
- * published by the Free Software Foundation version 2.
' K( O, A' O" J0 i9 P- ` - *
! o5 s/ ]# c4 T$ k( s7 M5 | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. Z6 S, E' l! {, |
- * kind, whether express or implied; without even the implied warranty
3 \# o3 {6 l# n2 } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; K5 Q, s; N. u; O+ b9 j6 {3 t6 o
- * GNU General Public License for more details.8 M. G! y3 j6 z# ]
- */
, Q6 Z" N( P* K$ R( `7 _& U$ L
1 c+ O h/ O+ x) M: e) Y- a3 E- #include <linux/module.h>
~* Y% J4 |2 H4 d2 @6 l$ E( e - #include <linux/init.h>. e0 N+ K; x) s
- #include <linux/errno.h>
9 x0 I. M& _; K' P - #include <linux/types.h>7 `- ~& y0 N0 L+ @6 m
- #include <linux/interrupt.h>9 l/ ^1 |' w$ c, a. |
- #include <asm/io.h>4 m: ]6 k1 Z4 y# w& q$ J
- #include <linux/moduleparam.h>$ m7 H2 X: g, G. z
- #include <linux/sysctl.h>, P3 `8 [* C9 z8 p% f) H- V
- #include <linux/mm.h>
$ u% u( n$ Y, M( q1 h% u& Q - #include <linux/dma-mapping.h>) I. H7 {( C9 b+ p* Z
- 3 L6 A# P I( U8 q' `
- #include <mach/memory.h>: x4 X \% U7 x \! d0 Z9 n, H
- #include <mach/hardware.h>" M6 o+ }9 v5 h( i/ k3 H) T
- #include <mach/irqs.h>
! p0 v9 Y( K( @: {1 f0 I& ~2 R6 P - #include <asm/hardware/edma.h>
' O/ t* z0 I+ U5 e5 N1 g. O - + }, N5 y! @! {
- #undef EDMA3_DEBUG* a ?, {, k: o; n
- /*#define EDMA3_DEBUG*/8 V# o$ ~% Y: N2 R- H
, S* v0 w" f* R- #ifdef EDMA3_DEBUG1 Y. r( |7 e4 A6 u i" X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) ]/ A: q9 _5 s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( l% W1 e" A7 a2 [1 ] T' H0 S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 S& q* P5 q: p1 S: B - #else
6 C; {- q% c: o" _0 Z* b; @9 Y( u - #define DMA_PRINTK( x... )$ j% H9 Z$ N3 q; f4 z8 Y
- #define DMA_FN_IN
# W& [3 w& e, R2 |2 J6 k( `$ n - #define DMA_FN_OUT# D6 l! j) t/ D' s/ U
- #endif
* _. J7 h# V& J8 s
/ a P, ^, |9 B9 b$ h3 ^9 t- |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 T" j8 i. ^! E - #define STATIC_SHIFT 3% t, G6 p+ A! T! e$ J' C s2 I
- #define TCINTEN_SHIFT 20- }$ y6 T7 K. M4 n0 T# A
- #define ITCINTEN_SHIFT 21% x8 R4 n. w" b, Z7 q( x% S: }* E
- #define TCCHEN_SHIFT 22+ ` s1 I' d9 D6 z; z
- #define ITCCHEN_SHIFT 23
, i3 L7 `6 s( ?; N
8 N/ u3 n7 J% z4 e5 C W: `- static volatile int irqraised1 = 0;
0 k n9 l$ E. n' H# N - static volatile int irqraised2 = 0;8 y% {+ K2 X2 I6 n) v, O3 B6 A
. C9 i; o+ _$ o& v" U9 Z$ ?7 _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- p( {6 {* ~: C3 Y# P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ C. p/ e1 N/ P4 F* j( R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; _1 j+ |; ?9 j6 ~7 }
- / {' }8 O/ @) m
- dma_addr_t dmaphyssrc1 = 0;" O! d4 Z1 v( K2 K# Q
- dma_addr_t dmaphyssrc2 = 0;
- o& D$ S% [( {+ d- W - dma_addr_t dmaphysdest1 = 0;* G$ s+ \. ]. z9 b
- dma_addr_t dmaphysdest2 = 0;
c8 p8 w8 N2 r" {" R3 y - % W# r# F% I1 v4 d d
- char *dmabufsrc1 = NULL;4 n, K9 z; G( S7 m: ^% w$ Q
- char *dmabufsrc2 = NULL;
0 G, I' {: v) M) j6 P - char *dmabufdest1 = NULL;
6 b; @) Q2 L: ]4 W) h$ f - char *dmabufdest2 = NULL;. U3 P* l t5 }+ {+ m
, M/ I6 R! G, i# N( u3 A8 B- static int acnt = 512;' ]( K$ }$ R2 ^. I, q. U
- static int bcnt = 8;
/ J6 H7 t# K6 a5 W6 a - static int ccnt = 8;
+ q+ X x1 r [( I$ t! Q+ I, Y5 b* w - + E9 w* T+ }: G! g! t" v& o
- module_param(acnt, int, S_IRUGO);
- k3 {; M" z# b( `3 W - module_param(bcnt, int, S_IRUGO);5 A% x4 N# E/ X |! j# f( l
- module_param(ccnt, int, S_IRUGO);
复制代码 * }. P; [$ O; z
. S* q5 o; i0 R, F4 P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& [" m; [9 j* {2 ]1 J4 {/ Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 ^- X1 a% o! K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% ]- W: h1 N% [5 @* ]6 T# B
g6 { i* [" S# v6 [1 T7 Q
3 C2 [' a; {* H |
|