|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - Z6 x1 {+ a- @4 P: W
- [code]EDMA sample test application
( K0 W: H1 V# ^4 t' x( N - /*
9 M* T1 h( w. a2 e5 Q1 u0 a* ]2 D( N - * edma_test.c$ d& u S. `# h D, g) N
- *
X8 j' `) [+ B7 z( Q - * brief EDMA3 Test Application2 x1 t8 [" {# [+ Y: B
- *
R* f$ X+ C" r }7 s% o$ G, N7 x - * This file contains EDMA3 Test code.
# z0 j% W/ \; n; | - *7 ?9 E1 G/ g9 i4 v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 [) Y+ n, c# B& s' K* q$ w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, K: V) @2 Z1 x - * TO CHANGE.! Y% q& {9 w5 i5 t: e" N. D
- *
# U/ ] Y' J1 l) A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 G5 x8 k6 d9 }5 Z* w7 A - *! n4 [) K3 o) d6 C/ z! X( L$ V
- * This program is free software; you can redistribute it and/or
1 R& y& x8 J/ \1 T8 |( U - * modify it under the terms of the GNU General Public License as& x4 w5 ?" W9 `# q+ L0 K' f. v
- * published by the Free Software Foundation version 2.- Y4 _ ~9 v% {5 [
- *
& C1 A$ e7 M. c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 y& l& D; N$ Y1 |) a9 t' e% `
- * kind, whether express or implied; without even the implied warranty0 f+ R) Z5 v1 H: i0 [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 i6 Q9 @+ Y* P- J6 l5 F' [7 F$ `6 A - * GNU General Public License for more details.3 M# N& m1 r, Y! s3 q
- */$ n, k9 C6 o5 k# i& m- C' d$ F$ d3 e( E7 o
- + `0 F! h: C- I
- #include <linux/module.h>
! f. h4 m5 ^: F8 s* ~ - #include <linux/init.h>" D; I0 G2 d! f# _2 G
- #include <linux/errno.h>" k( z3 M% } R c
- #include <linux/types.h>
' L r* \2 Z' Z# Z - #include <linux/interrupt.h>
4 @9 |9 r/ g- y9 x* l - #include <asm/io.h>
\1 |; W! J) W6 z7 ^, _ f - #include <linux/moduleparam.h>5 R. I1 J9 {/ V
- #include <linux/sysctl.h>- ?1 Z N! g; ]% U9 k" R
- #include <linux/mm.h>3 Z0 g1 _! R4 o* `) k7 w9 G" D
- #include <linux/dma-mapping.h>
5 Z* [3 J* ?1 t* M
3 U; v* v5 @# c8 i' @0 B- #include <mach/memory.h>
1 R' @# y1 C# C0 _# _ - #include <mach/hardware.h> Q2 r$ j% K# F% ?- y
- #include <mach/irqs.h>
1 \$ d* x( a0 |' ^0 r - #include <asm/hardware/edma.h>
# X/ w3 G1 p& ?7 z
5 f9 K$ }# Z' R( N- #undef EDMA3_DEBUG8 Y# v* c' ^& J) W: K5 J
- /*#define EDMA3_DEBUG*/! g" b3 s% a! _
- ; V2 z( p I; a4 q# d3 ]& u
- #ifdef EDMA3_DEBUG
6 V1 V. ?( y7 N6 L( v A/ } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 E1 B, v6 ]2 h$ o( g: p/ ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# r% j/ v& L: z1 I% K, O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ a7 c* m* V% S9 {) @1 H
- #else) ]. Z3 Q- h9 y& \' c
- #define DMA_PRINTK( x... )( q6 r9 H5 v8 x" g8 e) d" n
- #define DMA_FN_IN$ y) m* F5 `/ Z
- #define DMA_FN_OUT3 k1 R4 i. a. \, p/ f0 y" J- \
- #endif1 \3 ^ S1 r% k1 M4 m; ?2 r* }
- : S5 X( a W6 P: @0 g* J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 Q: j, J6 Y4 \# {, n5 l) r: _+ V
- #define STATIC_SHIFT 3
9 q$ I' R! m- S- @# D. @. @- d - #define TCINTEN_SHIFT 20
5 J$ p R) G; [, D5 L" v0 L - #define ITCINTEN_SHIFT 215 P `: X. t& v& }
- #define TCCHEN_SHIFT 22
2 v6 y$ f0 c! H. O! i+ M - #define ITCCHEN_SHIFT 23
; u3 o6 h; P9 n) J7 v - * u2 n7 k6 b1 A
- static volatile int irqraised1 = 0; q9 \$ {% E& P/ E5 Z2 S
- static volatile int irqraised2 = 0;
, V# C. S6 _2 E. `, I
+ f, y6 V: S8 w2 K" e) t; }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 W" R( `: ?6 [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 c, V$ T. P9 L3 b. ~, G w( z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, H, f- F1 q( f6 S - % z- Z, v, d" H# J0 Z
- dma_addr_t dmaphyssrc1 = 0;3 V- d |, r7 x/ {- e; c
- dma_addr_t dmaphyssrc2 = 0;. n7 E; j, _1 {! ^ m& d! n* o
- dma_addr_t dmaphysdest1 = 0;
8 y* V; i* o. x - dma_addr_t dmaphysdest2 = 0;& G z8 h0 D7 k% S
3 r5 n! i$ ~- r2 H5 q- char *dmabufsrc1 = NULL;- R/ _! X- \8 V
- char *dmabufsrc2 = NULL;
3 \3 z/ f0 O. S/ T9 i' ^ - char *dmabufdest1 = NULL;
4 \% [, t* {& L6 u& m7 v - char *dmabufdest2 = NULL;
( R, a5 R% V( a: r+ q" G - 4 ^/ V6 s' l" F' d
- static int acnt = 512;
& [" ^0 L4 M. I6 m9 g - static int bcnt = 8;$ i9 J! c, _# k6 O& u8 R& l
- static int ccnt = 8;& C+ b) F9 B( w# m" q" k5 l/ v8 C
Z& M3 b& g0 F: F- module_param(acnt, int, S_IRUGO);
6 V. R, G! t, [ - module_param(bcnt, int, S_IRUGO);
! o f% G3 k$ z, ^( B6 I4 ] - module_param(ccnt, int, S_IRUGO);
复制代码 $ s9 @+ }6 B4 B& K9 u
3 k3 L1 c3 M& Q% T2 X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 Y" s; g+ J3 G. A9 M& carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 g' d+ S% v* Q: y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- I% P# @- g; T# r ~( b3 D
- ]! }6 S G5 O" G& O" R6 Y
. H# e6 C1 j( ~0 ` |
|