|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( D% ?" _- g0 W* y R5 p( y
- [code]EDMA sample test application
( g7 y: Z/ A8 `8 c; _- W! C - /*6 N# V% F. q7 @2 g4 k4 y
- * edma_test.c0 d8 X. e" W! t; \* f6 l
- *
$ C& O; F7 W; ?- \$ u. @ - * brief EDMA3 Test Application! V) T6 O( s) j6 l& K+ z; |$ t) y" r
- *
. r* b$ n. G$ |+ s& c1 h: e - * This file contains EDMA3 Test code.5 q% F Z" S; A
- *
i6 @, d( I6 k, T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
`/ w3 F( h5 g- [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) X H5 q4 T m
- * TO CHANGE.
8 D' H' @0 J$ B' X- Y. M, B/ Z - *
& X% y2 D+ |' Z1 s) Z6 } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 Z+ A8 E* d( S( N( ]1 O - *
( F& {6 M6 k" a$ B0 c - * This program is free software; you can redistribute it and/or
K5 e4 W- ]6 P# I& ^ - * modify it under the terms of the GNU General Public License as
9 X4 y7 d% }- E) p% [& F - * published by the Free Software Foundation version 2.) p! f. @2 P8 i: o( q1 \
- *- ?" L9 Y* E5 X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. X# B/ w; ?9 ?' i6 C
- * kind, whether express or implied; without even the implied warranty
$ v2 [! d4 ]! V( f/ z( ~. R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 i0 _2 y$ d) @8 E5 W. E
- * GNU General Public License for more details.
/ W. Y% L0 Q' o9 D! I# R4 p - */! n4 l0 E' U+ }2 g6 H
- x% J) t5 W# t6 T% ~/ S6 i2 z
- #include <linux/module.h>
@6 {0 T! B; r. K, ~9 W) I - #include <linux/init.h>5 E. S7 L4 \0 G! i8 r
- #include <linux/errno.h>
) @1 ^3 K/ a" q$ Q7 P - #include <linux/types.h>
' K0 {) ~3 b1 \. z8 |' b0 } - #include <linux/interrupt.h>
! V1 W0 t! `$ B+ s - #include <asm/io.h>, O9 u) y! e# s3 V# k1 u# C
- #include <linux/moduleparam.h>
% ]* R- a5 X/ N' b - #include <linux/sysctl.h>( s7 g+ ]# L E8 j5 {3 N9 }: \3 z
- #include <linux/mm.h>0 ^" I4 b) w5 f2 n3 R3 |3 v' G
- #include <linux/dma-mapping.h>- l, m0 f. j/ M5 D9 M
- ' V( X3 G2 X8 S; T- B
- #include <mach/memory.h>
+ M6 C+ [/ Q. ]5 b - #include <mach/hardware.h>2 T0 W0 `/ q+ _! |2 l2 `6 m. h4 `6 P
- #include <mach/irqs.h>
0 u: d/ o7 h5 p q" M4 I9 i. q8 ~ - #include <asm/hardware/edma.h>
( L" v3 ^' R, J6 J6 T; P0 }$ q
7 s8 R0 y/ Y7 i) P- #undef EDMA3_DEBUG
. D8 V6 n' M( K% T6 c - /*#define EDMA3_DEBUG*/
! p \6 A4 E! O2 k. J; E
, f% ^+ t) e! ?- #ifdef EDMA3_DEBUG
% s6 N& r) O r! A1 w' k' H0 \+ R b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- C' {3 k0 L7 U& U6 ~5 ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* d& G9 Z9 G4 Y: I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 p4 n0 Q! \4 W! G3 F - #else
9 U& m& C' ]9 W. }: [4 x+ X - #define DMA_PRINTK( x... )# u) Q" d* k# F. J" z, \' T
- #define DMA_FN_IN
6 E2 X3 {+ N* x4 q1 x1 G - #define DMA_FN_OUT
3 h& A a [, [6 U [1 } - #endif3 Z% @6 F/ o3 T8 b- H" W y Q
2 [; i& T4 H7 w9 O3 v/ ]' m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& R$ L! X/ |! P4 _: d$ V m, r
- #define STATIC_SHIFT 3; k o3 j6 N' w
- #define TCINTEN_SHIFT 20
5 k7 g4 m) v8 w - #define ITCINTEN_SHIFT 21( G# z; B( D4 k/ L2 T
- #define TCCHEN_SHIFT 22
. N* G( a6 u1 e1 F. o& J - #define ITCCHEN_SHIFT 23, G7 @! _# J1 w% M
( I) n+ u" a9 d v3 _- static volatile int irqraised1 = 0;
2 v6 R$ C" d9 b7 o" x - static volatile int irqraised2 = 0;. Y0 L9 _8 P, s) S0 Z
- : q5 b H+ ?4 T- \: r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); E0 O7 S# {/ q6 c4 D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Q( I* c, r, Y; [0 \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( r! s$ c1 q! m
4 `, o, A7 F( V$ ?- K- dma_addr_t dmaphyssrc1 = 0;4 x4 T8 A% P4 D+ U4 ^8 X
- dma_addr_t dmaphyssrc2 = 0;) m [9 F+ b0 R1 S5 J+ s& z% K
- dma_addr_t dmaphysdest1 = 0;
" b% Q- }4 K L9 @) ~ - dma_addr_t dmaphysdest2 = 0;# j9 `7 U: k! c* q8 N3 m' B3 G
* }; x" q9 m7 h# r. {& H" S- char *dmabufsrc1 = NULL;
% Q( D% V, R# v - char *dmabufsrc2 = NULL;5 |1 S$ W5 E6 I( }
- char *dmabufdest1 = NULL;
, { f* f$ l, S/ z) \8 F0 y - char *dmabufdest2 = NULL;& `" g1 A2 s3 N: m
# M' ~( J _2 Z8 z- static int acnt = 512;4 _' j' v4 `2 U3 S1 D
- static int bcnt = 8;
5 i/ X& c, Y6 S2 O8 }. ?: z1 ] - static int ccnt = 8;
4 e/ B" o+ k2 O* R1 x$ q# C! o/ [ l$ N
$ H8 g" v+ _% ~& R' |" m; \% d! \- module_param(acnt, int, S_IRUGO);1 L" y+ E- t6 C* i2 g
- module_param(bcnt, int, S_IRUGO);* L6 E$ A x0 ?6 Z0 G# {
- module_param(ccnt, int, S_IRUGO);
复制代码
# @) \/ o- ~: I, X9 Y3 G2 `7 J* {! b4 w( ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% D* n5 ^1 `6 `* {; i, v0 o& Farm-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 e2 r5 W, D% X& ]( B. }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 n0 j* K+ m: c. S3 ^( b8 r: ~
B) D! F$ s7 ^ W/ T3 J6 i- c8 ]
h& R& r& k- _) [4 U7 `& _! x
|
|