|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" Z% V0 y0 t0 c) B$ g5 u5 ~! Q- [code]EDMA sample test application
+ N2 o: T; a' c% ~3 D - /*
: p! U! w: I7 K, Q/ _* a0 D9 y& o# g7 L - * edma_test.c
* r3 _0 X/ p$ k) o - *
) r' v+ {6 |5 f1 U - * brief EDMA3 Test Application: x- k0 F6 U% _' u; j
- *, w$ O" ^' m9 @
- * This file contains EDMA3 Test code.# Y0 a, {! T8 P% W3 O
- *8 F2 Y2 n! J3 r7 X* j8 m6 K: R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 ~: N' l! e. b, }& T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% N8 W# r+ Q* y. Y - * TO CHANGE.# {; x- L/ j) t$ ?# ^! z2 d
- *
. h# x4 q- \) h7 W3 Z! e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
{% c7 h$ G/ x9 a; [: j - *
+ I: N h$ H0 ^% A5 Y - * This program is free software; you can redistribute it and/or
- W8 \# Z: C5 X0 |! [( x - * modify it under the terms of the GNU General Public License as! g, K. b4 C6 t5 V
- * published by the Free Software Foundation version 2.: b' K9 d2 m5 m
- *; g3 N! c* x5 k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! q% s2 Z& Q0 J0 p" h( c
- * kind, whether express or implied; without even the implied warranty5 F) Y! \9 P+ C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: R$ v: K9 k- l" R d7 n% U
- * GNU General Public License for more details.; ?) ^) ~: w2 y- ?9 t" K
- */ D. m% V+ C; f. r6 }2 H
- # T* v$ d. [2 C4 R
- #include <linux/module.h>; ^: v) | \4 t, J, S# @. Q
- #include <linux/init.h>
( p" d$ h6 R G+ E( f1 n$ b - #include <linux/errno.h>! p. D4 A1 o# O. L3 }+ I! d
- #include <linux/types.h>+ D5 z3 t. k/ `4 e2 f; }$ m9 e
- #include <linux/interrupt.h>) `! m) }( F: J W" {( o
- #include <asm/io.h>
+ ?4 H% b4 I9 c' S1 k6 K - #include <linux/moduleparam.h>& R3 D. D: J+ S! x) v
- #include <linux/sysctl.h>
9 n3 L2 U) q. C$ V( W - #include <linux/mm.h>
, F: @& y' c# o$ |1 d - #include <linux/dma-mapping.h>
, h8 e" u. Z" V& t* O' s - ( W1 K* m0 h A' K! s* m
- #include <mach/memory.h>
! l5 k I# w! M8 o - #include <mach/hardware.h>
5 }, x' _2 X% R# s - #include <mach/irqs.h>
3 P, |) I% S0 Z$ Z. l - #include <asm/hardware/edma.h>
! P4 Z1 u9 d3 o" c6 \9 d5 U) I
- C5 t1 P* K$ _. p9 ]- #undef EDMA3_DEBUG. e8 Y8 H- R6 M/ P# z' {" [: Z
- /*#define EDMA3_DEBUG*/) _* w% Y" N. X+ H7 r2 u
- ; [# _: j! {$ |! H7 L1 t
- #ifdef EDMA3_DEBUG1 ]4 e; k4 K$ v% X" Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! T8 c$ V1 O3 [1 L9 S* C1 O- e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. @5 K& \3 k: k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ g! i' [; E7 Y h
- #else5 E; z+ r, q/ D; S
- #define DMA_PRINTK( x... )
4 k# J# g4 r3 h3 ^* J - #define DMA_FN_IN* L p1 ^! ]" T) q( T; l* H0 I
- #define DMA_FN_OUT. X+ ] n# h' C1 a$ U* F: u( v
- #endif! U. z4 \- }+ D
- ; w. `: ]- M1 ^& g, ]2 Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 g/ e: H1 }/ h6 | - #define STATIC_SHIFT 3
+ l* Y% y! t; j* p6 s% w- z* g - #define TCINTEN_SHIFT 20
. O: J0 y# G2 A) M* Y - #define ITCINTEN_SHIFT 21
, e7 a' c# w6 o7 n6 | - #define TCCHEN_SHIFT 22
% E, Z; U, [& [, t - #define ITCCHEN_SHIFT 23' r9 I4 U) V6 N! m& w I
5 ~ g* x/ u$ Q1 p$ |9 r- static volatile int irqraised1 = 0;3 ~, D2 Z. q. `% @
- static volatile int irqraised2 = 0;% o- I" D& {( t; Z7 ?
) p" t$ ]5 k* }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 G4 k4 ^% Q @% e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. a( B) H; X$ j* W& t0 U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 c1 E# d3 c a& Z+ J% I' I, ]1 u
& r) J2 u) q; D; L- g+ \- dma_addr_t dmaphyssrc1 = 0;6 @- k1 J; Y' R8 ~$ g: Q' M
- dma_addr_t dmaphyssrc2 = 0;5 n9 b' v; p: X
- dma_addr_t dmaphysdest1 = 0; g& E7 i0 H4 e. P: @# f
- dma_addr_t dmaphysdest2 = 0;
7 B4 Q( z- o" `! ~; l( `, a0 q$ \
, }' Z2 C: a/ s6 Q( U7 b& ^1 o- char *dmabufsrc1 = NULL;% Q: w8 J8 v& V& [
- char *dmabufsrc2 = NULL;
. E2 m/ F& `. B0 b - char *dmabufdest1 = NULL;
' p! V1 M- j* V5 i - char *dmabufdest2 = NULL;
2 \, q# O# I; Y% J; H. w' n4 c, |
2 W9 R+ I4 l4 P: i7 @6 A! }: s- static int acnt = 512;, y! r" D1 n) J& J; z$ f
- static int bcnt = 8;# H4 m( f' x" a
- static int ccnt = 8;
0 e/ u# {1 O1 p( _1 ` - % m0 a7 }; a* X+ D( [
- module_param(acnt, int, S_IRUGO);! f6 A; K" n1 X) i: W/ q
- module_param(bcnt, int, S_IRUGO);8 y0 t& C( s7 |0 N& B
- module_param(ccnt, int, S_IRUGO);
复制代码
- U" I! z+ b) E$ g9 d" r
4 J- p2 X, x! w& Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' X+ `2 Y x3 I, M- y- F& A" Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 H$ s9 ~# y/ S- O; ]5 A B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) ~: B" U# a. n
% S+ T/ d! ?# J& B0 S, U& z
. u6 A- ]3 q" e8 q* c$ ^ |
|