|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 {! S, U- q2 r3 ?; V1 C, m. X; J7 t" C
- [code]EDMA sample test application
$ O! p6 T( {( S7 M8 s* b1 T( K - /*
7 }9 ^1 ^6 t$ k$ ~, @& F - * edma_test.c
% O' y1 P1 a- ]% {- t& K0 C" p - *
5 r( q: N, F. U$ ]* _ U - * brief EDMA3 Test Application
0 x: [! t" b0 T7 Q5 T- o - *
; e/ \) w$ J& J* I( }9 w! Q/ | - * This file contains EDMA3 Test code.% F8 Y% ~; s S7 g# B# h2 k5 A: k
- *- r1 S: D; I X; P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( }4 {( p! |: d A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 K( E! ]: b- g' Z2 | r1 I( H - * TO CHANGE.6 I4 q. n5 Z6 d, [3 H
- *
8 M- ~, Y( \$ }7 ]9 [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, X( M. v2 |3 m( i1 N2 w/ V6 Y - *
4 e8 E9 @5 k2 x; h' }2 r6 D4 @- Z - * This program is free software; you can redistribute it and/or5 u$ k* o- ?" `/ r3 K# v6 ]
- * modify it under the terms of the GNU General Public License as% G. o8 q/ p" {6 X; `
- * published by the Free Software Foundation version 2. f3 v- N2 C3 T4 J
- *
+ T+ k$ {) m/ | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 }% i; F L4 k* P2 o# z
- * kind, whether express or implied; without even the implied warranty% \4 @+ ^3 a" w& E6 U+ a" Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: W o8 n8 r# }. ?; F: W
- * GNU General Public License for more details.$ `# W9 `% E# Y/ V& G9 u1 z
- */
. Z$ Y5 P* I! E5 r: P, S8 `9 h* y - - _7 ~8 ~* [9 r2 b- W8 U3 R1 [
- #include <linux/module.h>
8 x) M! G$ r% d$ m N - #include <linux/init.h>+ {* y8 ]4 e7 S4 u# j3 A8 L7 v4 g
- #include <linux/errno.h>9 c F! z) B7 u5 \, p* _
- #include <linux/types.h>
; Y- L0 }. ^ Z8 y- D) X$ A - #include <linux/interrupt.h>
, C7 s$ \% N8 o2 C: L! c - #include <asm/io.h>
' \/ a" L& V5 [4 ? - #include <linux/moduleparam.h>
9 C+ [; ^% J" d7 v4 R - #include <linux/sysctl.h>
9 _: J$ [/ `3 h) g - #include <linux/mm.h>
5 Y P/ ?2 c$ i: ? - #include <linux/dma-mapping.h>% A$ g1 ^( u: b% M8 |
- & S/ ]" P! ?( _9 h, t
- #include <mach/memory.h>
$ Y4 j7 d; B4 V2 g( v - #include <mach/hardware.h>
5 X- C7 c2 ~3 d# n - #include <mach/irqs.h>5 ^$ e/ ]6 t5 y# K( O
- #include <asm/hardware/edma.h>
( ?3 o0 n" c% h9 l - " m4 \) a; w5 [# p' q6 ]8 C+ A( h
- #undef EDMA3_DEBUG
! U7 C8 h. k# q( ^0 f - /*#define EDMA3_DEBUG*// T4 D) M$ O Q$ ?' X. ?
- , ?2 _% |' N: k7 S) H) t; |
- #ifdef EDMA3_DEBUG' N: {9 l x, j. L& F W/ {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 a2 e1 U7 O( p# ~0 B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" H, j h O5 W* P% f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 Y( U; X$ A1 `% c# j
- #else
0 y( L/ e+ E4 O7 C( b - #define DMA_PRINTK( x... )4 Q* s+ i' u# G" a3 o n
- #define DMA_FN_IN
/ J3 O3 n Z: U+ s g5 o - #define DMA_FN_OUT! K+ q8 w/ c1 w0 f2 d& k' H
- #endif
K6 A. ?% t b7 N/ e
7 z0 X# I/ M0 u- F$ |, v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 E9 D: b" k/ ]" d8 ` - #define STATIC_SHIFT 3
& n; o7 E1 k; s8 f% H3 N9 Z4 b: H# k - #define TCINTEN_SHIFT 20
9 X( G' K2 [ c8 f% N, [ - #define ITCINTEN_SHIFT 21( m X5 V. r1 A- w' L
- #define TCCHEN_SHIFT 22
, [% u* g& }; p) m3 Q3 p - #define ITCCHEN_SHIFT 23' Q0 ?. h) b" h$ o$ q4 F4 Y
- ! t6 {% h% X) Q2 J) C
- static volatile int irqraised1 = 0;& L0 x# s9 z2 P0 R! ]2 J. p4 B
- static volatile int irqraised2 = 0;
1 P. O" ^9 D& D+ f, k - - m, n6 i5 Q3 J, C9 y! Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# A, I6 T- ^! `" b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; X: w: \# E- L3 t1 c0 E n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) ?* b% e& a8 [/ h
5 V( }; u; s' }% W, E( P5 `) e S2 I- dma_addr_t dmaphyssrc1 = 0;
i. |5 i) K* C v6 l( W; d - dma_addr_t dmaphyssrc2 = 0;7 j0 q5 m( X! @# T5 |1 X
- dma_addr_t dmaphysdest1 = 0;
6 V; Z; M" i- k' l2 F/ V+ W5 ^ - dma_addr_t dmaphysdest2 = 0;
, f5 _$ N3 R6 h$ C+ ^: q - 6 c* U4 _+ k/ c9 U; i- F
- char *dmabufsrc1 = NULL;
3 \& z0 w! L- V - char *dmabufsrc2 = NULL;
n, T* U) K6 \6 I. r - char *dmabufdest1 = NULL;5 Z: C9 J# Z6 z6 K0 f
- char *dmabufdest2 = NULL;$ M5 a* n6 _, T7 X
5 D8 p" A. F; F- static int acnt = 512;
3 ]0 c/ y+ w! Z - static int bcnt = 8;
) C7 X) _- `: x& n% O0 r - static int ccnt = 8;+ C# z& v* C# G
+ s- w* l: s( k: v( L* D- module_param(acnt, int, S_IRUGO);
5 s' d/ |. G5 G$ n, h/ f - module_param(bcnt, int, S_IRUGO);/ E1 R! i/ w/ y% G
- module_param(ccnt, int, S_IRUGO);
复制代码
% s2 q. D& M0 s4 J- E* O& c0 T
3 s, `2 _0 C5 J2 Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, ^/ U7 }, c$ I2 ~3 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) x( o! q C ?6 h# z4 k1 w6 N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. B' [+ L3 i4 M% p! N/ r0 p0 q+ V+ o* R0 d! k5 k; e: u% x: ^% n
% N# t: b! h- ?% L& {% o6 {( B. k |
|