|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' s7 v' n8 a/ s9 y; [- [code]EDMA sample test application
' ?+ k( L5 W, m( W' x0 [ - /*
1 J8 ?0 i z$ w8 C' Y( I9 U - * edma_test.c6 F- Z/ W+ m6 e
- *
/ f' @; z6 |. N - * brief EDMA3 Test Application9 {6 \; f( ]+ D* P( u
- *
1 |% R1 e8 p7 b6 k U+ B: q - * This file contains EDMA3 Test code.
0 q; v" V3 U* c. ] - ** e8 [7 |1 n! o- `% D6 }" N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE B* D/ x: t: B1 o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) p& V' d! V2 L" R0 ~7 e3 Z- p - * TO CHANGE.
% T& I7 B) N- Z" ] - *
% p, P u# S! ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ V# T6 D2 g% R' ^' u$ ^; W
- *& z' @. ? D; E. [! i# v" V- e) D
- * This program is free software; you can redistribute it and/or
2 l4 l; c1 N8 ?; S) B - * modify it under the terms of the GNU General Public License as3 M3 t- q4 Y* h$ A8 [6 I
- * published by the Free Software Foundation version 2.6 g( E9 T2 M- Y
- *. V5 ?3 D; O0 D) t* a, ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 H( H' v9 B* y6 P& z5 ^ - * kind, whether express or implied; without even the implied warranty, a; z, U I1 \- ^* ^2 b# Q3 P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) |* y! D, q2 t# f% u0 C/ ?+ M$ t - * GNU General Public License for more details.
) {" I& W$ Q1 Q4 z9 p+ v+ K: D - */" W' t- y3 t: ~5 Z: ^+ D, S& J
- ) l: F9 l0 @' c9 J4 Q) V
- #include <linux/module.h>
) U+ ~" O9 @' e# A& f" H - #include <linux/init.h>2 q- P; o* p# U
- #include <linux/errno.h>
; n& U O6 G3 a* z6 F4 m9 Q( f - #include <linux/types.h>
* p# T$ q0 {: Y! t( L- ^3 J+ i% Y - #include <linux/interrupt.h>/ D6 l' I# t3 D- n- x$ z' u
- #include <asm/io.h>
+ N6 N) A; L6 u3 b, k( n. f$ A* U - #include <linux/moduleparam.h># y* z8 D7 D6 | q4 T6 Y
- #include <linux/sysctl.h>
" J, }, L7 q1 n - #include <linux/mm.h>5 N" L/ L1 \+ W# a$ a* H5 [
- #include <linux/dma-mapping.h>8 ?# U% t: _9 ?" z8 a0 O8 s; ?1 S
l; B3 | w5 E6 M) k/ q. v- #include <mach/memory.h>0 O2 Q0 R% u" O* g% u6 d
- #include <mach/hardware.h>
) R5 h2 D; F1 L - #include <mach/irqs.h>
$ S; t. C+ _% w. f- [$ w - #include <asm/hardware/edma.h>
& l5 H$ j5 j; Y4 ?& k% T1 ?$ [
7 Z6 z1 n i( j, }- #undef EDMA3_DEBUG
3 b' V0 V) e' z+ A7 n1 D - /*#define EDMA3_DEBUG*/
; o: |: i8 {7 e6 q" y - 8 X' A+ K" H) q; T2 W+ o$ ?& {# t
- #ifdef EDMA3_DEBUG* I) H; L, f0 Q0 u: h! g# N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 Z/ C( g- a1 o, \' C6 e1 U" }* L/ R4 p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ y0 H$ j6 O8 s* ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) C9 b6 Y2 A) m: c0 x6 c - #else
1 b( Q6 N1 e: N - #define DMA_PRINTK( x... )
( w* c, A x: w" \: a - #define DMA_FN_IN1 Y4 O: \$ q: Q* h/ y+ l
- #define DMA_FN_OUT" V2 W6 D6 k1 B3 o/ Q) B
- #endif
; U: g- y/ Y4 X& a8 C
( E; i) P/ e! M' a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ V4 x/ N4 _4 P5 w5 `* ^) M4 V0 L+ G
- #define STATIC_SHIFT 36 b; k$ v: ` m( J6 z% z/ U0 \
- #define TCINTEN_SHIFT 20
' W& m: S4 C) o# } - #define ITCINTEN_SHIFT 21
/ Z9 \, Y, P% e0 t2 z" j" x/ l9 _ - #define TCCHEN_SHIFT 22# A' q1 l* D, H+ \0 p+ R0 ~
- #define ITCCHEN_SHIFT 23! q# O' k! {% U9 R, y ^
- / _8 [4 z2 C& f ^- q4 L
- static volatile int irqraised1 = 0;
" q4 L+ f1 E+ W* N - static volatile int irqraised2 = 0;
- x; Z7 V9 h* B; S1 c5 p, Y
~) T/ U4 Y! `+ X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# d) D2 [ h( A. K3 } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 f: H/ l* r4 _$ I& ], j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 o$ i( Y9 h, U6 U9 @! T Z0 _ - % i' k- X8 Y! D# V/ \1 H+ `8 K! u
- dma_addr_t dmaphyssrc1 = 0;
2 H9 t+ _# Y8 t! | n - dma_addr_t dmaphyssrc2 = 0;
5 t( }+ x, D% q: w& ? - dma_addr_t dmaphysdest1 = 0;
! v% t0 G+ p3 u9 f \ - dma_addr_t dmaphysdest2 = 0;# i5 C4 t0 w6 }: F; @ ^
- % V6 u+ F$ A8 K6 Y! Y6 ?" G
- char *dmabufsrc1 = NULL;
5 t2 U' [' a9 C: {; p6 \- W - char *dmabufsrc2 = NULL;4 |" N& ~" w9 j1 E( V1 V& V
- char *dmabufdest1 = NULL;2 ~2 l$ n& u4 F7 m# J
- char *dmabufdest2 = NULL;
5 ]6 J& d3 a# B/ q @
9 b- @5 `4 W$ x: O- static int acnt = 512;* l& X f+ x) d# u, ]
- static int bcnt = 8;
, ?6 E+ n/ e0 l( i4 m7 T - static int ccnt = 8;
7 r) z; I5 f" ]/ g$ s, E; a! ^ - ! H( ~& P) a1 B# g% f/ L
- module_param(acnt, int, S_IRUGO);3 Z$ L" j: Q5 F
- module_param(bcnt, int, S_IRUGO);
; r5 }6 N0 @) I- i: h3 U. O4 D' g - module_param(ccnt, int, S_IRUGO);
复制代码 % P/ t% X( G/ O2 O5 D: G
+ r, V5 T( h+ w0 P7 L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' U N9 f, s2 {: C8 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% t7 w$ T; S0 A: N4 L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; z6 C6 H. y! V& W+ o
6 @' f$ m% B% U X; J
5 K, g$ o7 Z0 `' j# `0 c( `' q, L
|
|