|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " o% h8 m3 P. I9 H# ~! P
- [code]EDMA sample test application
& b9 d2 W2 e# _3 L7 X8 } - /*
8 E% z, Q% ?( ] d" n$ N" { - * edma_test.c/ M3 I* D, C* ~3 o
- *
1 T+ z5 v$ b. U" x - * brief EDMA3 Test Application
& {! [. |' _- C$ ?0 m - *
( k% A. H# d" j* C" [/ ` - * This file contains EDMA3 Test code.3 W: w' C4 g6 m7 j* m4 M: b
- *
6 h' U$ w! G* A+ ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! n+ F, Y* s1 Q4 |+ a/ w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# V, h& A4 Y9 w* u
- * TO CHANGE.% N8 X7 K( @) _3 B- l- _3 ?1 u
- *
4 Z/ ~( L2 l9 M' z' g- l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 a- D0 m9 p' f0 Q% v
- *, V. i! W8 }# _ \* u
- * This program is free software; you can redistribute it and/or- l& h4 I& T( n' k3 P& o
- * modify it under the terms of the GNU General Public License as
% J, G* z; Q; u1 @7 A - * published by the Free Software Foundation version 2.$ S' y8 \- b8 l9 X
- *( z. P3 m, g, ?! \8 ^. c! T4 [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* \: G) b+ N8 l; p - * kind, whether express or implied; without even the implied warranty
( P. o! |' i% Z7 w, @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 C& a2 L, o( J, o% v - * GNU General Public License for more details.$ Q6 `$ T/ E0 z2 ~: w6 A# h
- */
9 Q" z& K8 ?+ y6 v+ Z
v5 k& e/ C. y+ a4 k9 V4 j- #include <linux/module.h>
2 r& v5 t" r( I9 y& Z - #include <linux/init.h>
% b) }; \- O- Q! _! R - #include <linux/errno.h>
3 e: ?+ Z; x1 _! L8 ~" o - #include <linux/types.h>
1 O+ h4 l! p0 K1 v" H - #include <linux/interrupt.h>
, L% Z$ t( L7 P" { - #include <asm/io.h>( d- O+ ]& |& s1 N
- #include <linux/moduleparam.h>
6 S% v+ S8 j# L - #include <linux/sysctl.h>: _# h4 u: I" g
- #include <linux/mm.h>
/ H6 n" y' `( [# c# y - #include <linux/dma-mapping.h>
% B; w, r1 u7 J - 0 }! W3 {( z+ G: @# P: G9 M: L: m
- #include <mach/memory.h>
/ @' e6 T6 i' T9 w - #include <mach/hardware.h>
# d4 A) {5 b4 h6 m - #include <mach/irqs.h>- s$ Y* @6 I! X8 C
- #include <asm/hardware/edma.h>
- C6 |" V3 e1 u- r; `6 X4 M - - @+ i5 ?7 z7 u8 B8 D# _( t
- #undef EDMA3_DEBUG, }5 P- y7 n# S' z
- /*#define EDMA3_DEBUG*/
8 a6 f$ N P4 s- Q H - ' b2 V; x: \% R, i! {; R" \' B
- #ifdef EDMA3_DEBUG) V+ |/ ^6 Z1 G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ N5 P( O Z8 p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ f1 i- F' b: q( d& o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! f: s. B% E1 Q/ R1 K8 T6 q
- #else' f& W) d# h2 l+ s7 K7 `
- #define DMA_PRINTK( x... )
$ J' B+ W" I. R$ t) ] - #define DMA_FN_IN
: J- Q( d( C% w) H9 j# Q# v8 ?) a - #define DMA_FN_OUT
# n! A. L1 K6 p% j- j8 \9 ~ - #endif1 @ w7 m6 y" Y2 P; C
, f- Z" q3 ^$ r' w- K& `* k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ V/ R; {2 ]; O9 t6 m
- #define STATIC_SHIFT 3
* j8 e: D2 i( d/ `: p - #define TCINTEN_SHIFT 209 p/ \" u1 s( i) w6 x% s
- #define ITCINTEN_SHIFT 21
* u. o# D; n. i8 \ - #define TCCHEN_SHIFT 22
# p; ?& n# ]5 k7 w* g$ _ - #define ITCCHEN_SHIFT 23
& y' y' ~: `( c3 I: h
% v3 r0 [9 K; D; F9 S- static volatile int irqraised1 = 0;: \* B) t# A! v) Z% V0 U8 x
- static volatile int irqraised2 = 0;9 k2 `' u# M' V# w1 g
3 ~4 I* T; e' f, p! T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& q, {% u8 G( i- C( J; K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 Q' W! l; }$ M" j# C" c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); Z. h$ m* P) P, J5 M
- 1 N+ o* x7 p5 e, O O
- dma_addr_t dmaphyssrc1 = 0;3 A4 t+ ` r- R# L: x
- dma_addr_t dmaphyssrc2 = 0;
: A0 A4 X- k+ H( Q! i - dma_addr_t dmaphysdest1 = 0;* a, f, M0 Y) i5 U8 J
- dma_addr_t dmaphysdest2 = 0;
6 s: h7 x0 t0 c) g1 D. A! Z
) j$ g0 r8 x9 [/ E- char *dmabufsrc1 = NULL;
7 j2 V0 \: I: ~2 _ - char *dmabufsrc2 = NULL;
% i/ h/ t1 \5 }; y+ w; e - char *dmabufdest1 = NULL;
4 B# }/ J7 t) ~5 o - char *dmabufdest2 = NULL;
* }& K: n( |% n
: q8 W6 O" H; T6 m" G4 L( l- static int acnt = 512;& E5 w8 h' L4 O6 L7 C
- static int bcnt = 8;
`% ~- j' P( v& {" X - static int ccnt = 8;
! b' v% B ?9 R/ R+ }1 d2 |2 Z( r
9 n% w$ o7 |" R8 {0 _- module_param(acnt, int, S_IRUGO);
. F$ W$ {0 v# |% F0 e/ p3 g/ _ - module_param(bcnt, int, S_IRUGO);2 p( d4 j( W6 e$ a. C
- module_param(ccnt, int, S_IRUGO);
复制代码
( O$ r- X! m" G" R4 ]; a* E: I9 `, ?0 _; G* y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 C$ O/ F5 u. Z, Z3 rarm-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 W% Q: s. j& C: z3 _, h) C; L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 j* p- s# a$ s. F5 ^
% \7 B6 U! V) c3 y: ^- R* h; I) g+ p3 G4 g; l1 Z, M1 n( m
|
|