|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- I. Q/ g' Q% g9 O3 q- [code]EDMA sample test application, N- y) s" V! x1 f/ P: ?2 l# j! T7 a
- /*6 w5 `, ~. j8 A
- * edma_test.c
0 }% }+ I: i9 m. l7 k - *1 `' n. U2 U( ?0 M- s- K6 Q+ ]
- * brief EDMA3 Test Application3 i0 f$ h4 s5 o3 W G! i
- *6 E0 T0 P; l7 ^. J. k
- * This file contains EDMA3 Test code." o1 w2 r' a0 g0 J9 ?4 }: g
- *$ o5 x) B) y+ A) `* ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% k1 V7 [( m3 {8 o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! }' {" c$ g7 \, ?3 d0 J( J, ~+ P
- * TO CHANGE.& C- z5 @1 N2 C/ c
- *# j( M6 A* ?: @- Q w3 ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 A1 b: k+ s: a6 t9 @5 L D - *
4 Q" d J4 j/ {( p - * This program is free software; you can redistribute it and/or
/ R7 @( K, M6 p% u T - * modify it under the terms of the GNU General Public License as7 V, Z4 q$ I$ g* L) `
- * published by the Free Software Foundation version 2.
3 W; A% G6 h3 {% S. U1 [' ` - *9 N/ `/ K* U, Q0 |, y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 ?) q; ~ a$ ~ ?
- * kind, whether express or implied; without even the implied warranty
% G# d3 X3 |. a3 b2 i' _& w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; T v& ` D7 d8 V* E+ i1 G
- * GNU General Public License for more details./ N( s9 F; C9 I; G. j( M
- */) Y' d, O( V9 G
6 M5 ^1 w( Z* ?& d+ V% \% E- #include <linux/module.h>- y( h2 Z9 Y9 i3 {. x
- #include <linux/init.h>
3 `) Q; h* ]7 z5 A - #include <linux/errno.h>1 E" _2 Z) Z! H/ }0 C, w
- #include <linux/types.h>
( x: o7 c5 {8 N$ X, F' O2 s - #include <linux/interrupt.h>
, D$ }) d( d: ~' L - #include <asm/io.h>
0 `, J" U( Y- |: w - #include <linux/moduleparam.h>* @- h& j. U$ R. {1 S' s
- #include <linux/sysctl.h>2 z2 Q7 L+ E% j" E) h+ i8 \6 V! d5 K
- #include <linux/mm.h>/ F/ l, i5 F" M! \7 \' C2 C2 E
- #include <linux/dma-mapping.h>7 k9 o1 M- a3 h. B3 Z) Z/ A$ l% {( `$ ~
" S5 H6 f" ?6 e( r n- #include <mach/memory.h>
/ `6 N2 l9 n' a% g6 ` - #include <mach/hardware.h>( p0 c- z( t& j# g' n+ a1 M Q
- #include <mach/irqs.h># {0 p: a5 x, D8 @- }
- #include <asm/hardware/edma.h>
# G4 z; ?) R5 t4 \. ?3 T' h' g
" T* J% o+ J/ @: g! h6 M+ E+ s: c- #undef EDMA3_DEBUG8 j; |' P' D1 B6 U5 U
- /*#define EDMA3_DEBUG*/! Y$ g) x3 m- x; F5 w* \% l
- ' t7 q& H0 p/ }7 r/ L
- #ifdef EDMA3_DEBUG
: ~/ B* G4 c: L4 j9 C, B$ F6 z+ Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 W6 n" O3 q8 L1 H2 z! p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 J3 ?* K* a/ J: ]+ |, U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( ~( C$ T, o* _/ O% Z- ` - #else
Y* ^2 ~% [; N8 ] - #define DMA_PRINTK( x... )
+ ^, {% X8 z4 H- q3 J4 O - #define DMA_FN_IN
9 e6 X5 m: i( G6 \- V2 P - #define DMA_FN_OUT# P$ r0 O9 ~8 G/ C. r! M# h' f
- #endif
! R. U+ C2 y) e; u, i, ~
$ D2 N8 {3 s8 ^" }+ }: C- #define MAX_DMA_TRANSFER_IN_BYTES (32768) F' c- V$ u) J$ G3 M
- #define STATIC_SHIFT 3. W/ ], P; _7 |; h
- #define TCINTEN_SHIFT 20
9 e) {4 E x/ @% m8 G4 t1 m8 F - #define ITCINTEN_SHIFT 21
+ m0 M: k; f6 U5 W j' | - #define TCCHEN_SHIFT 22
7 y/ X6 F, g. T4 ~* c2 q2 X$ W - #define ITCCHEN_SHIFT 23" z8 `2 T: O, o1 h" ]. h
: P# G' b+ d& k6 O4 m, o# X- static volatile int irqraised1 = 0;
0 s6 ~, a( s) m1 L( Z4 K - static volatile int irqraised2 = 0;
& K% h8 M" w! f+ A$ x/ n* t - + G( o: t: {) ^& W+ W. {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; q- j7 X- S1 s/ h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. \7 [& Z- i8 L; N! n; W5 c! D( h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ X2 s& N+ m( W# a2 d
: c) g, B( W) ]0 Q/ ]! k- dma_addr_t dmaphyssrc1 = 0;8 [* n) M: o4 o: J- V% U
- dma_addr_t dmaphyssrc2 = 0;
w/ k. T# v! f- u4 ` - dma_addr_t dmaphysdest1 = 0;3 _3 D( L+ V g# X' X9 ~' ^- o
- dma_addr_t dmaphysdest2 = 0;. \8 }8 O8 J* {
: k% o# S3 Q, e1 w3 L7 f' W! S- char *dmabufsrc1 = NULL;: ~3 N. c$ L5 E9 {: X
- char *dmabufsrc2 = NULL;3 E# x0 L# T' ^5 ]9 m, I# U
- char *dmabufdest1 = NULL;- s+ y- a6 O2 J9 T
- char *dmabufdest2 = NULL;
0 y5 a1 U' d: L/ C9 X, `. f - ! L2 A; a4 }; P9 U
- static int acnt = 512;
& f; b& h, r/ S5 y9 J4 Y - static int bcnt = 8;
4 f8 J. L! {" J2 ^& C. |3 I - static int ccnt = 8;0 \8 t, s( H8 U R( j. N4 x
2 Y* p( W1 Z/ j( o- module_param(acnt, int, S_IRUGO);( T; M" M3 Q' X5 g
- module_param(bcnt, int, S_IRUGO);
4 j% @. b3 T J$ W1 U - module_param(ccnt, int, S_IRUGO);
复制代码 y# G* Z$ G3 ~- ?! e0 N, ^
& m0 R3 L; ~5 D5 h7 v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& I$ A* ]9 ~; c$ x* ^( Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" e$ b6 @1 Y3 t; ]5 L% W3 a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' g6 |* V- D8 D) ~
1 y$ R; a$ b. }" ~
4 D1 _; }5 I2 O C |
|