|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 _! q6 l7 F/ _1 ~9 A! P
- [code]EDMA sample test application" D+ H& r, J1 X/ r
- /*
: k+ \% |& J* g( ^ Z9 \/ v6 |2 Q# O - * edma_test.c1 c, o) \9 ^! ^* e
- *
" z2 B7 ]' L( _8 j( Y9 @ - * brief EDMA3 Test Application* P( W7 T' ~) q6 e5 [: Q
- *
( d3 [: C1 O9 ?* | - * This file contains EDMA3 Test code.) n3 C8 K* t0 A( \: J7 I5 y0 p
- *3 V, S. C, T, K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% ]5 v$ x! ~8 b1 Q% b4 _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. S& m% R# d$ p6 E4 m
- * TO CHANGE.- R* d5 G7 X2 ?, P+ |9 B
- *0 c( c4 ?! ]7 h+ [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 c5 j8 O' _) R2 U7 |. D
- *! n n( s5 h9 p9 P2 j
- * This program is free software; you can redistribute it and/or
8 ~2 ]$ i" Q5 E - * modify it under the terms of the GNU General Public License as% n/ A7 S; t5 U9 m, `
- * published by the Free Software Foundation version 2.
! o( v; i4 z9 i6 N - *
% v5 ~- S" Y6 W& G) y9 p3 r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 C7 \* B0 u4 d" |" a
- * kind, whether express or implied; without even the implied warranty
7 f& x) \2 t. e: v0 P9 C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 D: i' @, ^6 ?% b6 m - * GNU General Public License for more details.
: |- N- d; k/ Y+ J, S; u y; F - */( }( }+ R# v! s# n9 h4 y
- 5 o" e! n2 P% ?: w1 |; p
- #include <linux/module.h>3 n, m, f, ~" @6 ~" K. f
- #include <linux/init.h>
- W5 S7 C2 S3 }: L" U - #include <linux/errno.h>
! l# w% t( s) j' K5 C: \ - #include <linux/types.h>
/ t4 Q* ?- Q/ Q6 E" ^5 o( H' U) k - #include <linux/interrupt.h>4 B) O( V8 [$ S% `
- #include <asm/io.h>
' |# e0 `' [) c$ e' K3 K - #include <linux/moduleparam.h>: A6 h1 y! u3 M
- #include <linux/sysctl.h>
* [8 j/ R4 _8 X! |9 s0 V - #include <linux/mm.h>8 F0 M8 Z- k8 n$ A/ {
- #include <linux/dma-mapping.h>
) Y. a: V J4 J6 t - 7 M5 ^$ ?6 P3 M: Q8 P' Z8 B
- #include <mach/memory.h>
4 x0 {& O' W" ` g0 _9 `3 A; f - #include <mach/hardware.h>; i6 h) S% d' @& v
- #include <mach/irqs.h> _5 [% Z$ z7 _) V
- #include <asm/hardware/edma.h>
: q( o7 [3 y/ i/ s* W( e3 k! X - " W p" W6 ~ ?% O
- #undef EDMA3_DEBUG- i5 T7 ^* {6 r5 \+ d! R
- /*#define EDMA3_DEBUG*/1 j9 v1 M, k/ j& c' O' j8 U- Q
; {; ~: ^3 @! ]# I |- r5 V. z- #ifdef EDMA3_DEBUG+ O5 m0 Y$ r" ]8 ]' ?- s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# o) a7 }- u6 B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ _0 v( R" t4 |0 |( T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% o- |9 l/ J8 t0 f, ^! C# P
- #else8 [4 e+ y( {5 W/ D) ]* G; `
- #define DMA_PRINTK( x... )( Z; T) i3 V C2 F' d2 M. A4 z
- #define DMA_FN_IN
6 R! O% `# ?6 B8 I7 t# E1 @9 m) n - #define DMA_FN_OUT
' r5 F- ~+ O3 k( ~ - #endif2 O. y% t, g5 K, T
- Z" B4 _$ A1 [/ ? F* ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 w0 w% o8 w; Z* l! R$ _ n - #define STATIC_SHIFT 3
8 [1 J3 g& u' I _ - #define TCINTEN_SHIFT 20
# S. V' M. i* M& i' y - #define ITCINTEN_SHIFT 21 X+ `, C* Y' G) ]! Q
- #define TCCHEN_SHIFT 22
+ y- Z$ Q% T( Y q0 E5 v [ - #define ITCCHEN_SHIFT 23
/ \. G, Z5 R9 _. i) a2 f1 b# J
5 z2 ?* `* x) O5 R: H1 w9 \- static volatile int irqraised1 = 0;
8 U" t& P- w3 b: | - static volatile int irqraised2 = 0;
3 T- n G! w. Z1 X7 a
5 b+ |# F% q: ~, ^3 y7 b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ B/ _3 F/ E# h8 h* D, R0 V: ^+ p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 c3 u2 K6 c/ D' C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 j0 W! y: F( j2 e( E+ K
9 V: p$ | c2 p( h8 b- dma_addr_t dmaphyssrc1 = 0;8 [7 o* N1 S* I! l5 i/ A) e" X- e
- dma_addr_t dmaphyssrc2 = 0;
/ q$ `* B* t- _( L; {/ Y - dma_addr_t dmaphysdest1 = 0;
8 o' \7 y# I1 H4 L) X k1 S - dma_addr_t dmaphysdest2 = 0;
( b# y# I$ u0 E( s$ ^+ G
% g" m) C' G/ K) u4 A: w, M- char *dmabufsrc1 = NULL;
7 {5 c4 @$ j! `* W9 s" N - char *dmabufsrc2 = NULL;
! i4 z9 _8 |' i - char *dmabufdest1 = NULL;
" N5 \) | D! F! k* o/ ^ - char *dmabufdest2 = NULL;
, e* ~5 V( E0 P7 V - 1 ^: U' p& |8 q; e {
- static int acnt = 512;. a F! V) u, u) c+ |3 Q [4 Q& A
- static int bcnt = 8;
4 B, [( Q! k, y - static int ccnt = 8;
0 Y) X0 Q, L# G* }- N, T$ W - 2 @! d0 x7 I' ?# V3 i
- module_param(acnt, int, S_IRUGO);
* A+ _; [; P- [ x# L% Z - module_param(bcnt, int, S_IRUGO);! _& g. Q; R& r& Q3 V; b
- module_param(ccnt, int, S_IRUGO);
复制代码 ; R d- J9 @1 {) F6 p
5 L: t' I4 K$ C: v- j% p4 W% [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! z3 I* O2 X% q% M$ Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* v9 R7 h& M" o8 m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* F/ f: N: z! I- O& x
( W8 \7 v( K8 B9 X4 _# t6 U0 ~, \8 c) O+ O
|
|