|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . i" _5 f# b! B/ l+ ?
- [code]EDMA sample test application& u, O9 X7 l+ x: z: E t0 F/ u
- /*
, I# {) V Q+ R7 u. M - * edma_test.c
' y' A& a! A/ K - *
$ j% p: E6 l9 X K; {$ q6 Y# ^& p. Y - * brief EDMA3 Test Application
9 \0 P9 ^: X+ n: B( l2 s, u5 F - *
7 @+ B5 C' a2 U0 q% k6 ~$ j - * This file contains EDMA3 Test code.
* o! b6 p$ s* y4 U. w - *
$ I$ L5 E' @* o1 J; W5 w" h' d) q3 c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 z/ ?$ i: _% y r! S, k$ r B* p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 \: o, p5 p8 u( A3 x+ O - * TO CHANGE., U4 \) n/ ]# W& u
- *6 R/ A" ?( {( |. S( c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 k! O. |: V) e( c) [ - *7 w `5 j! G- J8 w
- * This program is free software; you can redistribute it and/or" y* W# W9 {) j& W: S5 u
- * modify it under the terms of the GNU General Public License as
5 D: }7 v: r; X2 Y) W# Y2 H0 U g - * published by the Free Software Foundation version 2.9 a% q' i- {: H @ s
- *
+ ?# V( l. S' e' p: L$ u8 a8 ~3 R5 k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 D1 G# w8 f+ w9 g/ R
- * kind, whether express or implied; without even the implied warranty+ y5 j* q/ |% P5 q6 i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 h2 u7 W! f5 k4 @% h
- * GNU General Public License for more details.
" A+ h1 W$ W* \" j6 S6 w! d5 a% { - */& H" P! j" v+ a1 w: L9 ^- b [
4 M$ s: @4 {% ~# D3 F" \" X- #include <linux/module.h>; A+ U8 d+ F! h+ K& D+ A
- #include <linux/init.h>
& q6 A8 x( E% N7 N" k, B# v - #include <linux/errno.h>) P$ [6 y' O) B& \+ M+ d' v7 [) J/ G
- #include <linux/types.h>
! F1 ?7 O5 U7 w- P7 C5 r: P2 [ - #include <linux/interrupt.h># t9 |- O! D- h0 Q" G
- #include <asm/io.h>
- X O# J$ c" r# N- v, ]5 { N - #include <linux/moduleparam.h>
1 e3 s8 {7 [3 f' t% } - #include <linux/sysctl.h>9 l3 W9 T7 S! M0 {4 \7 c
- #include <linux/mm.h>
$ `9 ^4 R+ |8 V( K1 Y - #include <linux/dma-mapping.h>) m/ ]; b+ c) b8 h) o, f
; }9 d) T7 }, p- #include <mach/memory.h> L0 U. T% v: W1 U( n0 Y
- #include <mach/hardware.h>8 g5 \4 {% e( G# U) u- [9 u D
- #include <mach/irqs.h>
% j7 n, O, p6 s2 z - #include <asm/hardware/edma.h>
0 t, s% h$ \& ^/ {6 F
1 m3 ?3 q; u* j) a$ d- #undef EDMA3_DEBUG2 J9 c( P- U3 J% w
- /*#define EDMA3_DEBUG*/8 G4 `4 `* m4 c3 Q$ W1 F- u- ]
) r! y" H2 {% \7 N# G5 b, `, x- #ifdef EDMA3_DEBUG
( H$ K! T5 ]: v0 Q$ ]( ~1 Z" z8 w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 T$ e r' ^% M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* U( y3 _* g, d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 _1 q/ E4 z% V7 S6 e" ?8 ^ r: M - #else
+ [& S4 |* w1 P" ~9 G( M - #define DMA_PRINTK( x... )0 B, e+ P0 \0 M) ?6 G% }
- #define DMA_FN_IN% ?# z# { j/ D+ j6 G
- #define DMA_FN_OUT' |, ~- Z4 ?; ]0 K
- #endif0 P7 q& ~6 O2 c1 t( J! s
- / j0 F0 E# \ Z i- j4 d6 g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% p7 a: q- L {1 q( R
- #define STATIC_SHIFT 3+ f' N# U4 p+ F9 y
- #define TCINTEN_SHIFT 20
; ?) x, b* V- c* U/ |6 { - #define ITCINTEN_SHIFT 21
W3 e" J3 ^- i/ Z# n0 w% K6 ~5 L - #define TCCHEN_SHIFT 22( B' c1 \+ }- J
- #define ITCCHEN_SHIFT 23. {( p) T3 k% o* U# ?' s i1 T
3 `, ~' V3 ^2 [" N! G; H- static volatile int irqraised1 = 0; _7 D; t8 P% z( A
- static volatile int irqraised2 = 0;! q+ Q9 i+ E) g( i, @% E, d& U
3 C. Y# O4 L5 m: p; s3 J4 w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 G7 x& z- y( W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& U& D* @: G( w1 h1 A+ C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, D: F( N x! h/ b% O - * U) j6 K* m. O" L0 `: Y9 e1 a) v1 s4 N
- dma_addr_t dmaphyssrc1 = 0;
. {+ q+ d! K; H9 P1 q. V$ o4 \% ? - dma_addr_t dmaphyssrc2 = 0;
5 C( s7 x% h _8 \) z: E; B8 ?) | - dma_addr_t dmaphysdest1 = 0;/ H4 T Z& u& g3 `, d
- dma_addr_t dmaphysdest2 = 0;
- q- r+ [5 X2 o" o - ; f w+ a& x, x' y6 U' F
- char *dmabufsrc1 = NULL;) t6 h+ i) }! I5 s5 @0 P1 b
- char *dmabufsrc2 = NULL;
" M Y$ }9 E4 \6 [& C, { - char *dmabufdest1 = NULL;
( Y5 ^+ @- Y; c3 O# ` O v' B; Z4 v - char *dmabufdest2 = NULL;
+ _4 f. S1 u8 Q3 e9 }+ w - 4 ~5 C/ ?7 T, t% _* ` v7 f
- static int acnt = 512;* R. I# ]1 r. u4 |( R
- static int bcnt = 8;/ T q* _9 y# v4 O/ ]0 r
- static int ccnt = 8;
, U# V6 l2 ?/ v4 B1 E& S - / B) y0 E; J" B7 h: W( m
- module_param(acnt, int, S_IRUGO);
1 N5 W: w8 @# R - module_param(bcnt, int, S_IRUGO);1 Z, v7 g$ E9 Z* S
- module_param(ccnt, int, S_IRUGO);
复制代码 ) y; A% Z9 L# c) @) c
( p5 h8 n! G' Y. d- J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- l% s- a1 S; j8 B. n9 Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. [. b% U) ?# }3 F9 C. @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 X W) o6 m7 s) [0 N7 z0 K2 S$ E/ l
2 i+ p9 c" @9 B# N" T. Q" U/ g
|
|