|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 p/ L( O3 `1 z, |/ B P- c
- [code]EDMA sample test application6 h( d7 f9 p# x1 L
- /*
5 n5 }% J7 a) v% Y- L# j - * edma_test.c+ Z* ~& |1 a r
- *) }. F' e9 p3 o* ^+ T
- * brief EDMA3 Test Application# Q7 C4 D* u, c% J1 [
- *
/ q) @: L6 G2 i" V - * This file contains EDMA3 Test code.
1 q9 {7 X, p* p0 \ - *
- G8 A1 Z/ U) u: ?: M% O0 b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' T, R1 e2 d2 ^0 q) p D3 e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ _, r6 H& ?& L1 j0 i6 J. D* ~- b - * TO CHANGE./ ?( p# X0 y2 T' f: x4 O& n$ h2 ^
- *) L; _, R _- q5 T2 K9 k$ T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: \% S5 F1 ~! n7 Q) H5 k1 _( ?1 ~* r
- *
8 w/ w* J! \- y% O: W: g - * This program is free software; you can redistribute it and/or
6 X! |0 V/ c$ S! C4 L - * modify it under the terms of the GNU General Public License as2 w' c9 I. e+ o: s4 X; U
- * published by the Free Software Foundation version 2.
2 |! a/ x$ \" k - *' f/ X# N% B, e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; `! `/ ?& b, n* h: I4 i
- * kind, whether express or implied; without even the implied warranty
9 Y; h: U& a) @4 ^0 ~1 C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
C# O# y- R7 T: N - * GNU General Public License for more details.
& M# C) X, q7 J4 Y - */
9 @% L& l! Q. `7 U5 Z% f' \
% k4 `* Q% E+ o- #include <linux/module.h>
% A) s, @( h& H3 R# R1 i) E9 ? - #include <linux/init.h>
: v! U5 Q; Q& g, Z5 n - #include <linux/errno.h>" X6 u f+ p$ s; p4 y
- #include <linux/types.h>- ?" x6 T% Y2 F7 o v6 Z7 [
- #include <linux/interrupt.h>
0 f V) D* P1 G1 E - #include <asm/io.h>$ D& B/ u% Z4 H5 U7 P
- #include <linux/moduleparam.h>
, K* `. j. o/ X7 L, Z - #include <linux/sysctl.h>! {; m4 k( x& A7 Q( ^
- #include <linux/mm.h>0 g g8 G% }& M3 |, w2 r$ S' P
- #include <linux/dma-mapping.h>+ b* s, M6 V1 F8 v9 v
- 3 K8 K4 k" o6 J0 t# C3 W' A
- #include <mach/memory.h>
! ^5 {% G3 A+ h; s - #include <mach/hardware.h>
9 Q, H& i+ B2 F& | - #include <mach/irqs.h>+ \' }" w" z1 z/ c5 u1 w
- #include <asm/hardware/edma.h>, S, U) J5 D* S
; K2 ~/ k8 J: a7 v+ k- #undef EDMA3_DEBUG' P& j( s1 Y2 @& O, `$ \; u
- /*#define EDMA3_DEBUG*/$ U" W$ P/ e1 M2 E T
- w% Y6 B$ Q+ h$ j5 w1 [- #ifdef EDMA3_DEBUG
3 p( l8 y; p: s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- C+ d/ S C3 S6 [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* S- R4 F2 g+ A- u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 S% a9 k. u/ F% f/ ^/ J! L
- #else
4 Y% |: c0 D8 G6 u% ? - #define DMA_PRINTK( x... )5 n0 i) v: v' {, N/ g2 G
- #define DMA_FN_IN
& f2 E" P0 O8 T% F! e# S, S h+ g - #define DMA_FN_OUT# e, q! x9 I$ C, o- D& p8 J
- #endif" t% I X) a/ \
- + _5 M+ R: R7 i8 I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 k& @' D- _1 v% s - #define STATIC_SHIFT 3
9 l/ K, b' e+ Z& t0 z' C8 p - #define TCINTEN_SHIFT 20* W6 P+ @6 }* S2 T' |; _( \
- #define ITCINTEN_SHIFT 210 t* k' q, q8 ~: P
- #define TCCHEN_SHIFT 22( O* r5 u$ d+ ]' d1 R+ i
- #define ITCCHEN_SHIFT 23$ K' K; l) c( \( S) G6 X( @# g
0 q7 C5 [& p" G5 q9 {( z3 W- static volatile int irqraised1 = 0;) _" j/ a# M: B" o
- static volatile int irqraised2 = 0;
" L1 f) O. d. d9 X* w4 j
$ q9 E( t; Y7 E4 f8 n5 R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 g( T- J" l) u4 ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 A$ B. m' N l/ M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 T( }8 X% T0 s# m - & H$ L0 k- |# t% C3 ?
- dma_addr_t dmaphyssrc1 = 0;, r, Q1 P1 o) l/ ]& Q2 v3 e
- dma_addr_t dmaphyssrc2 = 0;
2 Y- w5 I9 u+ y8 ^' B+ V - dma_addr_t dmaphysdest1 = 0;' ]5 a5 L# E# k: |# P K( f7 {
- dma_addr_t dmaphysdest2 = 0;
& M; s4 o7 |& z/ G* ~& U
8 e, }3 Y5 S! L' W5 X- char *dmabufsrc1 = NULL;
# D8 n7 |$ W: O# y- z0 o% l - char *dmabufsrc2 = NULL;3 u4 y' a- \% C: r# ^, L( W
- char *dmabufdest1 = NULL;
" N. k+ D9 M7 l) V. Z$ ~9 P; ` - char *dmabufdest2 = NULL;5 z( M \# T* g+ h6 s$ x
' d, w' c, l6 ^% p6 \& a- static int acnt = 512;4 A$ S' `( J. g ?, u: U0 t
- static int bcnt = 8;; D8 @ \/ D. p4 {. ]
- static int ccnt = 8;
1 g+ c* G, g' e - % x/ H2 a" f# @$ s- B
- module_param(acnt, int, S_IRUGO);
- x5 r( N9 ?( b% \8 J2 } - module_param(bcnt, int, S_IRUGO);
9 f, w; e2 H" P - module_param(ccnt, int, S_IRUGO);
复制代码
{* R/ G: f: q* H' d. d* @3 l% H/ S; r J; E' r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 ?+ o( C3 O9 larm-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 q- P& r$ k" i$ U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: x+ Y0 G, N7 I- u$ ]
9 y- u1 S3 J4 K$ v$ X0 I3 D/ Y- l% _8 N) U
|
|