|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 L7 J R. V ]& r y l5 T% G
- [code]EDMA sample test application' u# R$ @$ _6 J) `$ x! f
- /*
1 ~3 B2 I2 e4 ]; F; b9 s - * edma_test.c5 d+ w, G2 o. u8 y
- *
2 X; a4 a6 Q( U; `, d* m6 b% b1 P8 X - * brief EDMA3 Test Application
+ n }3 C; e/ Z. v1 [2 B2 I - *
0 A9 H# C" I: o- D, U* I1 P: W - * This file contains EDMA3 Test code.
& \" H3 V( k& l* h+ [6 w3 l" `/ c9 `9 z - *
& ^$ D7 i2 F8 j: B: G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 p, Q* N/ R& y$ i+ w1 X; a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 J1 h; _/ W! `+ _* T; l - * TO CHANGE.
8 S3 Y( |% q5 O" h - *
" Y! a9 w) j1 q8 A/ l) ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& I9 z7 ^: a4 L; G. N2 c
- *
# v1 s6 `4 h! {, J* W3 j B - * This program is free software; you can redistribute it and/or
3 a/ v J9 C+ g4 ^ ^ - * modify it under the terms of the GNU General Public License as8 b9 M1 v u, p- x: o
- * published by the Free Software Foundation version 2.
) m0 L7 S% y* M8 v3 w8 h - *
! Y$ i. J1 a7 W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 }' W; j' c$ o% r p( f$ o a% E
- * kind, whether express or implied; without even the implied warranty
" Q' y- `. _+ p9 m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 J& ~, l% ?7 J/ m+ u" U
- * GNU General Public License for more details.2 Q! X' D# | f
- */5 B. E1 ~ b" n% `8 W, }2 U( X" ^
- % F2 H* I8 L0 `4 }4 M
- #include <linux/module.h>) L0 _2 k' p& B5 Z2 f T# s
- #include <linux/init.h>( ]' L% N- V5 N. f1 @& i
- #include <linux/errno.h>
3 E) ^+ O/ b8 j" P% }# k, C9 y7 H - #include <linux/types.h>
2 p2 |; V# `. ^ - #include <linux/interrupt.h>! L$ j! K' X9 Q/ q) [1 I9 F6 @; y
- #include <asm/io.h>
7 G( o( V2 {% V# t3 |0 |" Q) N" O - #include <linux/moduleparam.h>; B$ l- W0 B: m4 u
- #include <linux/sysctl.h>7 [3 g- c& M$ b' H
- #include <linux/mm.h>& I3 g5 V( _! m
- #include <linux/dma-mapping.h>
; r& {9 S$ P5 H: j
$ B: v) p) c6 I- #include <mach/memory.h>
. q4 S" m- `* @. V1 Y - #include <mach/hardware.h>
1 i O. l8 Z3 e5 g; @* | - #include <mach/irqs.h>
2 k! t) U" `% p - #include <asm/hardware/edma.h>' X1 s: {) F* @" ]! x4 k
- 2 [0 F) q' }# Q
- #undef EDMA3_DEBUG
8 e( ~- _4 A& W6 | - /*#define EDMA3_DEBUG*/( V" I t3 a; K7 f
- 5 u) s; Z- U2 |/ ~1 w
- #ifdef EDMA3_DEBUG
5 m" W0 g6 S1 I X" Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 ~$ H: T0 x2 d! V& l F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% X& L6 Q) T- S( @; w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 k4 Q4 g7 P2 e$ I; m1 W% S" ?$ f8 p - #else
2 `) p* [# ~, u( `& B' q0 Z; U - #define DMA_PRINTK( x... )3 G* I$ Q1 t1 Q# O2 S/ {! r
- #define DMA_FN_IN
! Z- L" }8 H1 O! f& D; [ - #define DMA_FN_OUT
/ X7 u* E) b0 d: a& V - #endif0 i3 l/ D0 \& C/ w; n7 D
- ) A& K, d4 R* [4 L- g+ c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 r$ s8 w! x+ ? - #define STATIC_SHIFT 3
: C+ S9 Y( l5 Q; P/ E - #define TCINTEN_SHIFT 20+ D) G( E# A2 E6 M
- #define ITCINTEN_SHIFT 21* V) I, t0 r+ j6 E1 f
- #define TCCHEN_SHIFT 22
4 f1 \- D8 q, x6 P* c - #define ITCCHEN_SHIFT 234 n+ i4 E+ s, s$ L1 W p5 y
- 3 o: f6 S' @7 n" D- J O
- static volatile int irqraised1 = 0;/ }5 { B/ X: h9 o- t
- static volatile int irqraised2 = 0;3 y% g( U2 @# Z( P' Y% x& o: c( ^
- : B7 n5 |) ~8 U. m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- y( M$ V0 E2 I7 `) Y( V1 _3 u3 p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, b- h; [/ o6 k! z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) e# Y. z8 {* N" Z; k$ N
1 w! m# |/ C9 E T, o- dma_addr_t dmaphyssrc1 = 0;" }1 v' U$ P2 B ^/ S# H/ K! e/ P) `
- dma_addr_t dmaphyssrc2 = 0;
0 P* y( a7 M" o: y" r2 S& O - dma_addr_t dmaphysdest1 = 0;
9 n/ i$ \) y# P8 z9 Y - dma_addr_t dmaphysdest2 = 0;
/ N4 _) N) ?) C- y% f$ @0 d, E# e - + R. {8 _/ p9 G
- char *dmabufsrc1 = NULL;& f4 K) H# A$ ], }" p% H
- char *dmabufsrc2 = NULL;
* d* o& Z, e+ ], C) k: S; w/ @! N - char *dmabufdest1 = NULL;
?2 X! D( u4 O - char *dmabufdest2 = NULL;
: K D# V8 W7 ]% l7 G5 V
* G9 m6 [5 X) H5 k8 J! _* L$ N- static int acnt = 512;
7 L) h6 p. t6 l0 Q - static int bcnt = 8;5 l C- V. t" R. m8 K
- static int ccnt = 8;
. W5 a0 }& c0 @" m
) v ^1 V: ~. O( z4 j- module_param(acnt, int, S_IRUGO);$ h/ u# H! `/ d$ V- \! o
- module_param(bcnt, int, S_IRUGO);
{( }* f- Y% i ~ - module_param(ccnt, int, S_IRUGO);
复制代码 : z# i4 m% r+ G" g$ z1 M
+ h+ K3 @" [* b7 Q% k3 F7 q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ I% Q, h7 B! ]8 F$ N0 f& L, [" ~- J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: M! a9 G! O% {' i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 a9 T3 \$ G3 ?% B6 n. l
7 ~( x) o' h, r& v& D
! D) q+ U4 l9 U2 b9 y7 a |
|