|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 u4 ?$ n+ {0 E1 `5 K
- [code]EDMA sample test application
2 o8 k9 u9 r" q0 X1 \" O$ q% R - /*
9 ^0 @4 t; v0 Q1 _ - * edma_test.c1 `" J/ s# V% Q2 n9 z1 S K" o4 J# @- J
- *
2 T" T! {9 s) ? - * brief EDMA3 Test Application6 y: R' s: K+ `+ A0 W$ R. Q( |
- *
+ e5 |( j( r8 N1 c - * This file contains EDMA3 Test code." ], [$ a, x2 t- ^2 X! E& u: X
- *
8 {5 y8 \; S* n! ~. X, W( ?' X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& \$ \' {8 G" @4 M) I3 N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 F5 X: Z; A9 f; a) Q( R
- * TO CHANGE.$ y3 v# ~* x) F- q
- *
. ~5 y3 s N9 b/ g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. o: j0 c+ H: {8 i% o, J+ g
- *
8 `$ i- N5 B" Z+ J3 }, J - * This program is free software; you can redistribute it and/or1 \! {1 \6 } s9 I7 U% i
- * modify it under the terms of the GNU General Public License as
/ S+ t8 o& J; u4 c - * published by the Free Software Foundation version 2., X2 M( z1 ]5 a8 F0 ^
- *4 J8 _1 a- M. l v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ {, f# g) ]) I: | - * kind, whether express or implied; without even the implied warranty6 ^- Z2 a7 @/ Y$ t- U% C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& u/ b: N) s* a, b6 C. R) } - * GNU General Public License for more details.( v% ~2 ] Z5 Z
- */
3 O) m6 U9 i' B( a# A8 o0 Q2 b - 9 q r- L0 U, X( w V# L. U
- #include <linux/module.h>
. W, ]% [& Y2 U% F# ~9 U. n- k - #include <linux/init.h>
: Y, K o/ i- H" g4 F9 p# ^ - #include <linux/errno.h>
) R4 ?; g5 ~) g g+ B3 @% N - #include <linux/types.h>+ J. U0 J, V+ R3 L& v
- #include <linux/interrupt.h>$ F2 ]) q0 X$ u
- #include <asm/io.h>
. m, k3 F$ O- k" A- T4 C" ^) M - #include <linux/moduleparam.h>5 n. I6 N# n, Z) ^# t3 L
- #include <linux/sysctl.h>: d+ m- b7 W' ~5 Y# R# r/ e' ]
- #include <linux/mm.h>/ W S; U* p4 Y
- #include <linux/dma-mapping.h>
D8 w) n7 d7 U7 r0 R# H
0 c" l5 i: D3 J8 [ S9 l5 m2 x, [- #include <mach/memory.h>
9 d, t4 z7 g, c9 U+ X - #include <mach/hardware.h>: S& \5 u" I+ B" s
- #include <mach/irqs.h>3 B' d) w; A# u) p6 h
- #include <asm/hardware/edma.h>6 C5 f) X% V9 s6 F" f# p2 B+ Q; ^
# e* f( {, }+ v; c- #undef EDMA3_DEBUG
* l) J* W4 A- j2 S: m% _5 _ - /*#define EDMA3_DEBUG*/) S( |+ O5 z% o1 |
8 y: z: W7 }6 b" q" x2 b- #ifdef EDMA3_DEBUG
3 v" G O8 ]3 w7 B% _- h3 O$ ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" O) E9 `, ^+ _1 s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 f u9 `. ?- o8 V* [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). y( L1 U; r9 ]7 z' a; I! \
- #else% [) E4 U" S r2 R- `6 j* |
- #define DMA_PRINTK( x... ): J4 B s5 B* X/ {/ m7 r( N+ k7 H3 w
- #define DMA_FN_IN2 E# I' m, m4 g
- #define DMA_FN_OUT
& K* I- b( k. ^* j; d - #endif
7 A: M0 p9 v+ t( V3 l% ]( ] - 5 C) }- n' e! e/ D5 a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
o/ Z8 [4 o" F7 A1 \ - #define STATIC_SHIFT 3$ ?8 F3 c. f0 Q q2 n4 R
- #define TCINTEN_SHIFT 20% A7 E* \9 @2 n" U
- #define ITCINTEN_SHIFT 21
8 P, K( X& Q3 c/ {& @ - #define TCCHEN_SHIFT 22
( I: ^% Z+ d' w* p4 w, p* I& g, \/ H - #define ITCCHEN_SHIFT 234 g% R, k" S3 J, o) Y/ Q8 K
- . W. z" k! M! n- T
- static volatile int irqraised1 = 0;
& y* I# K4 b/ z/ k7 v( d( w! Z. d - static volatile int irqraised2 = 0;
0 z* h a) x2 d6 g* V' B - ' t/ o, Z; l6 o- m( O1 U; B1 H( k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( s8 W! {! I1 y, Y5 R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) i1 R, ^& ?2 I8 A# R# D6 K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' }1 C0 A6 S! ~: H, f/ \
3 o J, p# ]8 t, Z) W& w* i) C- dma_addr_t dmaphyssrc1 = 0;
6 @5 A) [, S- L; h7 ` Q1 Q - dma_addr_t dmaphyssrc2 = 0;/ t' ?! W" }6 c6 O d
- dma_addr_t dmaphysdest1 = 0;3 B4 h8 E% k8 i. k7 ~6 f8 C
- dma_addr_t dmaphysdest2 = 0; x* U9 l9 D) J9 a4 H' N2 q3 g
- 6 y. H" T- J7 \; K- b3 H
- char *dmabufsrc1 = NULL;+ T& k2 Z5 S, Y$ k! {- s
- char *dmabufsrc2 = NULL;
1 p( T3 n V! a, \& T4 C - char *dmabufdest1 = NULL;
9 X' _8 z' L, d( b! W$ Y - char *dmabufdest2 = NULL;
8 {- E% c2 ~6 Y3 F
5 `$ {9 B9 C4 u- static int acnt = 512;
" z' w" k7 ^6 l/ e - static int bcnt = 8;1 s$ w0 c3 B- X7 h; Y t \! y
- static int ccnt = 8;) ?: ^1 t f& [) `
8 u; n2 o/ e: D8 X- }5 E C2 {- module_param(acnt, int, S_IRUGO);) G( E/ s9 d3 R
- module_param(bcnt, int, S_IRUGO);
5 y) k1 u. j3 e- W0 Y2 M - module_param(ccnt, int, S_IRUGO);
复制代码
( k4 K6 C( x% l7 A3 v, p
: Z+ w, F* ^& I- F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 | u2 n3 D* E+ U9 A5 ~7 ?/ H$ p4 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 v! _' ~5 J7 f2 r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 K3 J( L8 r* E% `
1 o& N# o- W) o- I
/ M+ @) N& c& t" h |
|