|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 e% e9 _# y. O8 ]" [3 U
- [code]EDMA sample test application# f! J& ?$ \" m4 B, l8 b
- /*3 ~. K* f b' @, U2 a
- * edma_test.c* U; s$ d; a0 A; |- M: Z
- *
% H3 w' ?5 ~6 Z - * brief EDMA3 Test Application
; E8 S0 s/ i: A9 L& x - *
8 }& G0 D d0 B/ T - * This file contains EDMA3 Test code.# T0 E$ A5 {/ r2 ^4 _
- *
/ O. W* J$ T Y$ @' q0 y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 m6 D) ]! T* C" t8 L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 @5 A V* ] g) A, o* `
- * TO CHANGE.
! w1 L8 h1 g5 ]8 v - *
T' [2 b, G) M& i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" E- I# a2 @+ [2 z" B - *8 W. N; l5 `3 V+ f
- * This program is free software; you can redistribute it and/or4 p; C" U1 q8 H& [' M) z) U! l* F
- * modify it under the terms of the GNU General Public License as; _8 t" V! z1 v0 Y
- * published by the Free Software Foundation version 2.
+ n. T3 e& V$ O! D" p - *
2 ^1 G4 s9 R! _ F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. T3 O7 U4 f1 w8 q9 ?& ~ - * kind, whether express or implied; without even the implied warranty* y) m4 ]& P' X( X: K7 _, W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. `2 t0 Q& |+ t% H# N& ]; A
- * GNU General Public License for more details.5 T' z" ~# H3 X$ z. w2 ~
- */$ a# t/ j& _8 g- v
- ! q# E9 E; L Y. j x7 Q3 m
- #include <linux/module.h>
+ P* s" L! P7 {2 y8 l0 ^& Y9 k$ i4 p; O - #include <linux/init.h>
& f+ {" e! o( ^/ B" o- {8 W9 K - #include <linux/errno.h>
* T2 b5 `1 O k, C8 F5 } - #include <linux/types.h>6 J- r5 E6 l% q* z' f' U
- #include <linux/interrupt.h>2 F& n6 ]% d4 M( A5 V4 `) y( Q. n' G
- #include <asm/io.h>
4 A+ J. S: b* |- t. N, P7 Y - #include <linux/moduleparam.h>
3 A( D5 G7 _" h8 u8 Y" j# E6 _ - #include <linux/sysctl.h>
9 l! J I# T- Z- w) A/ e$ N - #include <linux/mm.h>9 N. N8 b" ^6 H f, J }. p- L) A
- #include <linux/dma-mapping.h>
9 o5 \0 A8 W! ~0 j, Y' b# {
4 u. i( w* {2 y9 }- #include <mach/memory.h>& a- I1 _' t7 g) u, e* ]
- #include <mach/hardware.h>* {& s0 p2 Y2 b6 V" D' s
- #include <mach/irqs.h>
4 B/ n, X. @' H' n0 G( C# C - #include <asm/hardware/edma.h>; w0 h8 U7 N2 h# X0 ] E1 S
- 6 V' H. z! g* X' g% {9 l
- #undef EDMA3_DEBUG
5 T4 q/ u4 c5 o7 ]+ O% Q: e - /*#define EDMA3_DEBUG*/2 K% U& [6 A. v+ ]: {4 ?1 P
4 }9 s- S8 k3 |. R' |- #ifdef EDMA3_DEBUG
, r5 f$ T" s1 s* x% m% u1 ~* f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( I1 Q" g$ w4 Z/ s' ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 r) i9 F! ^) i, ?( ^/ ]- _' p1 I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! a$ c4 F6 V2 O7 r l5 y0 s0 f6 R0 Z; | - #else5 c! W! `8 k3 e, o+ F8 n/ `
- #define DMA_PRINTK( x... )
3 Y$ b* q7 b. X" `& z1 ` - #define DMA_FN_IN. X$ W) S8 V. `' s/ L
- #define DMA_FN_OUT( `, ?: N5 u: {
- #endif
; a" D. Y# Y4 X, D" E: Z Q
! N) K0 v! d, N! l# V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 E8 j/ x' c; L6 q& i( D
- #define STATIC_SHIFT 3
$ k3 X9 i$ s3 c* E: i - #define TCINTEN_SHIFT 20% ~* d; C1 h7 U0 N |& x" g
- #define ITCINTEN_SHIFT 21& E6 ~4 ?7 D! |& ^
- #define TCCHEN_SHIFT 22! L( z. f' _, L) }$ b1 f2 Z
- #define ITCCHEN_SHIFT 23
4 w7 ?9 G. K! a3 c% Q5 |
5 o5 S- s7 [, v8 } O) ~6 E& p- static volatile int irqraised1 = 0;1 _/ M: u+ ~7 R. Y2 ^- i
- static volatile int irqraised2 = 0;
1 [* | z+ {; _4 t* P - ' N s( X2 B1 v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 n/ k2 s2 ^1 j/ V+ C; Y+ [3 V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. V7 D$ ]/ v/ y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ^( Z; a) `4 e% X) D: o
- 1 W& k6 u+ d7 X7 s
- dma_addr_t dmaphyssrc1 = 0;
' ^8 h$ @3 m( V7 T7 Q# B4 N - dma_addr_t dmaphyssrc2 = 0;
" d: J- L9 [( ^; `7 o/ L - dma_addr_t dmaphysdest1 = 0;6 g. o% m9 }8 J
- dma_addr_t dmaphysdest2 = 0;) B5 t/ S8 j4 N! B* K
6 D4 e2 d/ a. D4 ~+ ~" `( r4 q- char *dmabufsrc1 = NULL;
; T( q5 y* E0 H4 D, d* I - char *dmabufsrc2 = NULL;
4 J: }6 G4 ^5 i/ J - char *dmabufdest1 = NULL;
5 H! Y! l! X! u Z C - char *dmabufdest2 = NULL;! S4 r% r1 B& v/ X4 G
/ @/ z: g% Y* ]- static int acnt = 512;
! y" b- u w- K# s9 f0 s% b0 d - static int bcnt = 8;1 i1 q9 [8 J. [
- static int ccnt = 8;: d- Y2 d4 I1 F1 i) ]
- , a, t2 K6 X; b# ^+ L8 A7 [
- module_param(acnt, int, S_IRUGO);; ]' o- U8 V% A2 G; V8 o4 _# h# q
- module_param(bcnt, int, S_IRUGO);- @% J8 O* i* H9 M Z1 \
- module_param(ccnt, int, S_IRUGO);
复制代码 ; v) g( j2 e3 V3 }% z6 I& G( u
: ^6 ^7 f4 H# G* u9 z6 H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* o/ X' K' V" ^* ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 Q9 t q0 C7 v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( N% ]* a& C6 [
' b1 K0 _& t! B; X; [+ t6 z- y$ T! U+ O# W
|
|