|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 L) y' e' z9 x. ^, V' Q- [code]EDMA sample test application6 v" P& }: {& j
- /*' |8 F% V8 I2 `! h' z0 | L
- * edma_test.c+ v/ M7 p+ R Q% c/ R
- *0 a# a1 ^, L Z' k
- * brief EDMA3 Test Application( ` |7 M1 c% b# i) }- Q% `
- *5 _$ z+ x8 C3 |7 u& q
- * This file contains EDMA3 Test code." F% _3 p$ u" p/ s: Z
- *
E* i+ W. a: X) u$ { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 f0 W$ G. i' J6 r9 @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ l h' ]( s1 m2 o$ m - * TO CHANGE.' Z% P7 _9 ^! E( X" k
- *
: P; N- o$ t0 Q9 L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' {+ F# g" \6 A - *% }5 S/ z3 Z2 O& D& Q/ B
- * This program is free software; you can redistribute it and/or, \& j3 V0 C* V' g0 D" ?' h
- * modify it under the terms of the GNU General Public License as2 g. X1 ?9 {$ W" A0 \; N \
- * published by the Free Software Foundation version 2.
* G6 E0 H0 X, U. H: F, v5 a - *9 j! v9 u! M5 z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ n( p _$ V# R9 ]% ^
- * kind, whether express or implied; without even the implied warranty6 T& n5 Q% J% h8 l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 h4 N1 u* c4 H6 F4 e, o) t
- * GNU General Public License for more details.& E/ b' V' r Z+ n
- */7 [+ {5 w% {9 ]: g
- 2 w g/ u/ q" z/ x; |
- #include <linux/module.h>
6 N& m* x. R. `0 p' {* D - #include <linux/init.h>
+ }, e$ G1 G; `" [9 k8 o7 U9 R6 N* D - #include <linux/errno.h>
7 W9 j' M( }1 { \3 w5 }7 ^. ` - #include <linux/types.h>- `% L- j9 a& j3 E7 ?( |% X
- #include <linux/interrupt.h>/ ]" L% Z8 |7 _- W0 Q- |# n
- #include <asm/io.h>8 N' u) I W# L: Z" h5 c
- #include <linux/moduleparam.h>
1 z( q4 I/ Q( c) l0 ?! a. I - #include <linux/sysctl.h>
) z4 P5 l9 k5 U4 Q3 {5 q - #include <linux/mm.h>
9 b& S S3 |$ A0 o2 N4 w$ c - #include <linux/dma-mapping.h>$ o# X4 J( \5 B& a
- . r' L' u, o- [' b
- #include <mach/memory.h>% }! ^7 D4 H/ W7 ~; \/ b Z1 O& [
- #include <mach/hardware.h>0 K d: j. n3 ^& S& z: ]
- #include <mach/irqs.h>, v- T, |- t, R3 R. d# D
- #include <asm/hardware/edma.h>- I6 ]6 w; b. G4 e( v
- + Y# M' `4 P% J* R* {" h3 [4 \
- #undef EDMA3_DEBUG
% _- s3 b8 E) [4 e" w6 O3 b - /*#define EDMA3_DEBUG*/
: R6 `) V: Z+ p& V& w
6 E0 K( |) p, H- #ifdef EDMA3_DEBUG
* T4 Z3 f) w% I: \/ S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" \5 D q& |! @: e6 B; N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 i0 t2 p0 Z) O# a4 N, o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& g2 e" H7 P( O6 ^3 }
- #else
! F8 r" M4 h- X! S* T- o1 Z' L - #define DMA_PRINTK( x... )# A% C) V3 \+ J# x0 {! A
- #define DMA_FN_IN [4 G; S9 I$ V
- #define DMA_FN_OUT9 L5 A+ h2 t( {
- #endif$ C/ C3 p2 C }. e5 u1 h
( X! `5 p3 V9 R8 y5 F8 \9 H* q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 m; t9 D& a/ X6 L* k
- #define STATIC_SHIFT 3* _; c5 d5 A/ S& i K
- #define TCINTEN_SHIFT 20
/ T0 j y7 O8 n3 [+ j# x - #define ITCINTEN_SHIFT 21
( D5 i+ [1 L7 _0 m - #define TCCHEN_SHIFT 22$ N1 e3 `2 ^6 H; q
- #define ITCCHEN_SHIFT 23
U. L% Q$ t/ t6 e+ L9 r - - V9 P5 B% r+ R. \3 {; ]- m
- static volatile int irqraised1 = 0;+ ~% d' B. P/ W- T
- static volatile int irqraised2 = 0;9 s5 @- q" `3 i- I" x7 F* n
) |2 _: v+ x0 U; k0 |) I# \* _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( ~- d& s1 V3 d7 {: N+ ?& G2 F# u; N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 Z' j, Q% W+ q. V. S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 d, O) x3 k0 W! M7 ~ - " {/ T8 E3 x7 F! {% i
- dma_addr_t dmaphyssrc1 = 0;( x3 u+ a' u: j$ N2 B7 e
- dma_addr_t dmaphyssrc2 = 0;; Z) J' [/ G% M/ C5 n
- dma_addr_t dmaphysdest1 = 0;
/ T" Z, d1 E# J. `- p - dma_addr_t dmaphysdest2 = 0;/ S1 @4 u; f9 S
- 3 a( a1 C: ]' k. x, @
- char *dmabufsrc1 = NULL;
! W2 j( Y5 }( q2 x1 C7 O - char *dmabufsrc2 = NULL;) q/ P/ Z# a# m1 s
- char *dmabufdest1 = NULL;5 L1 z9 X5 A3 }+ ^1 \
- char *dmabufdest2 = NULL;% n. T% j3 _% q) K5 W. H0 {1 R
2 R ~: e( _' K+ _7 R. f' {- static int acnt = 512;
: s- V9 K1 M2 e+ J% z! F7 J9 g/ u- p - static int bcnt = 8;
: w+ l5 h4 m# L, {0 U) I p - static int ccnt = 8;
: K0 D* b- E' w! H0 s: |2 T! ~ - ( R; s4 N2 y7 ?- N! ?
- module_param(acnt, int, S_IRUGO);
6 Q' g( p+ z: P% C - module_param(bcnt, int, S_IRUGO);6 X! X! B/ [& Y. P! b
- module_param(ccnt, int, S_IRUGO);
复制代码
/ ]: m, [% }' \9 h8 `% N1 {$ F0 H! s$ u7 r* D) F* S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 S3 D% ?4 ~3 i M) }% G( j6 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& c+ @' F3 l4 x; } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 I% i5 @/ p0 D) O" g: V# |( |, g; _! u4 c% V
6 t6 ]* j1 K2 N: i* j7 H |
|