|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - f+ v0 v! G2 n l' q. U
- [code]EDMA sample test application
1 F; Z' m) c% ]+ M - /*4 v% E5 W' |9 |( i, G$ V% h
- * edma_test.c
3 d4 A8 q7 n4 a2 t, M7 {% s - *6 H- F) S/ U! H
- * brief EDMA3 Test Application
i: @8 E$ Y4 D - *
- c2 `9 ]! i) u# X' L3 i - * This file contains EDMA3 Test code., u- y* X+ ~7 y2 |+ X& J
- *5 b6 y% ?4 z/ Z& j! U' K+ m* T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 \4 g- a2 S& D0 w5 S- U# x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) Q6 G0 v) X+ ^! d* f5 s* {; F% W - * TO CHANGE.
( n7 y. O+ C7 ]! K* G - *. U+ H# _/ k5 J: V8 D5 e
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ ^0 m* z2 W& `
- ** F. }0 b+ {# T$ [8 s! r
- * This program is free software; you can redistribute it and/or3 ]* u3 A2 ^4 n) M+ i; V" p" K
- * modify it under the terms of the GNU General Public License as, S. P" A0 \" H$ Q: s2 N+ K# ]
- * published by the Free Software Foundation version 2.5 G: s4 o( {! ~+ ?
- *
" u" J, o5 r( M: x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; D) v- t3 V A% o+ p* b) D - * kind, whether express or implied; without even the implied warranty8 f; X5 g0 I9 R3 r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, g& J2 r0 U2 @ - * GNU General Public License for more details.) [' d2 H: q+ e
- */7 ^3 q! u6 C3 }2 r" T J: H& r& g
. p. g/ k5 D- P- f: X- #include <linux/module.h>: w! K( G L2 W& Q" \
- #include <linux/init.h>% l0 r: Q2 I2 ?5 [4 T" O
- #include <linux/errno.h>
$ ?/ r* R# P4 ]% E6 W+ y - #include <linux/types.h>. C/ r# n! W5 d( |
- #include <linux/interrupt.h>9 }" B8 s4 Q! u8 T2 k
- #include <asm/io.h>
1 I& n/ P2 w% W7 ^3 S, D# V3 i8 T - #include <linux/moduleparam.h>
- p0 D6 ?8 Y O6 u& O: r - #include <linux/sysctl.h>
( y( E# D% h: ^# `; H' L; `# H5 S - #include <linux/mm.h>
2 ]- p- l; S6 _ - #include <linux/dma-mapping.h>
( L( b f% ^6 ?2 p: r! \
, {+ ?+ s: D, |( `% Z- #include <mach/memory.h>) {& v* u3 E$ d
- #include <mach/hardware.h>" N* p4 w' O% Z( @" h4 u
- #include <mach/irqs.h>: a- N# F# u" u* A" k l
- #include <asm/hardware/edma.h>( s0 p* r3 R- Y! J& _; l6 j2 v0 q
- K( {: a, F/ T( f
- #undef EDMA3_DEBUG
! u2 R. y2 K, ]# L! F; K - /*#define EDMA3_DEBUG*/" s5 L1 T) B+ m9 ^- v1 l4 o
- * D5 c3 G8 ]2 }0 K/ C2 Z! `$ P5 A+ M5 Y
- #ifdef EDMA3_DEBUG
* x0 a( o$ @ h2 e1 E0 y6 o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 f: Y' T, ~% C0 I! @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; l" e. D( M! Z: i+ h+ F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ N P. ^ p1 |$ `, N j/ B+ v - #else4 k4 ?" S" M8 M( H& ^0 P
- #define DMA_PRINTK( x... )0 @4 f" G, ?4 f' M' X/ z& R& q
- #define DMA_FN_IN
/ X7 X5 x" {: p$ V+ i; G+ X - #define DMA_FN_OUT* d% R2 \1 z6 t$ Y3 }. N7 L- `
- #endif
" }8 N; o0 }# |, ]: r. d" X8 \ o* \
2 ?; P' q6 }9 M2 [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 Z& f7 L; y# U8 J2 \ - #define STATIC_SHIFT 3
; ]/ ^% F0 `0 O/ q8 S - #define TCINTEN_SHIFT 20' Y+ d9 [. ?" c7 b! v2 a
- #define ITCINTEN_SHIFT 214 G( s/ l3 C: _& D0 W+ S" s! p7 J
- #define TCCHEN_SHIFT 22
, V/ ^% ?. W1 S7 l5 C8 U) c - #define ITCCHEN_SHIFT 23# c) p" G4 \4 Y7 e9 v7 m
- ! d( n/ s; V/ ]" i
- static volatile int irqraised1 = 0;
9 |0 a% R0 T5 e6 m/ {5 | - static volatile int irqraised2 = 0;
. f6 C! X* l; o6 o6 d* n" J
1 {1 `! c6 `5 o- d+ Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& y6 N' e# o6 t5 w+ [- o2 K6 X& U1 W. T/ Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. E8 f* t+ t X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- c" y9 g- S( v& m
0 e5 f0 a, h, \6 ~! o- dma_addr_t dmaphyssrc1 = 0;5 o. P1 `6 T% e- h
- dma_addr_t dmaphyssrc2 = 0;' ^& q1 p! f4 M
- dma_addr_t dmaphysdest1 = 0;: b+ X4 t. d5 @& q
- dma_addr_t dmaphysdest2 = 0;
. p' [. c3 I" h# L - 2 R) [1 E# o# G2 y
- char *dmabufsrc1 = NULL;* G" a5 C' S ~0 S4 e7 o4 y
- char *dmabufsrc2 = NULL;! @2 |. G1 _# B
- char *dmabufdest1 = NULL;
# @ p) f1 x$ D9 w' l5 M - char *dmabufdest2 = NULL;
. C: L: y& J3 D, Y6 E% k - & U/ ?, W2 [* X3 |+ {
- static int acnt = 512;- N! @0 q+ D: O
- static int bcnt = 8;
2 X- M' {+ w: B5 _! \# B - static int ccnt = 8;' i, e1 \. P8 W; X0 W- `
- $ g" C0 y j- k# c8 w# y
- module_param(acnt, int, S_IRUGO);
z5 s- c' u9 m6 g, Y* Y - module_param(bcnt, int, S_IRUGO);
4 y4 S8 h( n" A - module_param(ccnt, int, S_IRUGO);
复制代码 ( o+ ~9 x7 y. u: [9 R+ k, S1 y6 C
3 x k/ c9 M5 h' Q8 l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' S5 t9 f2 E. W: H/ u4 o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' C1 _: \% Z+ b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 K A& O( r8 W/ K8 s4 M5 e9 U
4 L: B! j9 Q ?6 B q; _, @9 ~- q+ X1 f9 p5 z0 I% ~* r
|
|