|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " ]; M4 M' J2 B) }! L
- [code]EDMA sample test application
7 a5 D+ M) A3 S; h. Z4 G! [, F - /*& w Y( U) U& Z* o
- * edma_test.c% s6 f) X, S2 T. G( u' x% Q9 b
- *2 [# }) F! \& y) M( `/ p; H
- * brief EDMA3 Test Application! s1 T, _4 r0 K2 g* `
- *
# w6 q, i2 `" F9 O1 v: b8 }0 J - * This file contains EDMA3 Test code.
" w; _' g+ Z0 C - *) C# A1 V3 S3 b( B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE l G) h* N6 E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ x' X! L+ @5 g: t! N( X+ V; ^ - * TO CHANGE.
, j6 @7 r! l: j' L" R6 B4 T - *
6 _; D3 t: o) i7 D1 G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 l7 R( H* |( Y# n, S. ^7 Q
- *
7 _. N9 P( t# k* [+ D# }; q - * This program is free software; you can redistribute it and/or! n& |: x/ ^$ G2 f3 ]6 y
- * modify it under the terms of the GNU General Public License as# A; z9 ^$ v$ }% |: p) p4 a; p2 U5 X
- * published by the Free Software Foundation version 2.
5 {. l1 C( p4 |+ {, u" H - *
7 O5 W/ l2 A, T+ H- k m0 `* e. v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- l: a: m8 R4 E
- * kind, whether express or implied; without even the implied warranty4 ^( l) Z. |: _# O( P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 E+ I* S) @2 r) W) l! w+ X* D
- * GNU General Public License for more details.
' y( B7 J$ G4 w% h: M r% n4 T - */+ t2 k) s. [4 ^9 x
- 8 f) y; l) U9 U2 y9 U
- #include <linux/module.h>' c4 T* G# `8 @! b( s
- #include <linux/init.h>9 \ H; Y" W! o
- #include <linux/errno.h>
! L0 a h; E, g6 Z6 a4 J - #include <linux/types.h>7 h5 |; M, U% {$ S/ L6 e v/ O2 M
- #include <linux/interrupt.h>
/ u; O/ N4 f! f5 H3 a - #include <asm/io.h>1 a* v1 q) a7 e2 K+ H! y
- #include <linux/moduleparam.h>; e, T5 _- p- K3 V* t! \/ e! u
- #include <linux/sysctl.h>
; m" V% o, ]& J$ W; u - #include <linux/mm.h>) A/ A# T+ w2 N3 x3 S/ P, V
- #include <linux/dma-mapping.h>
* w2 Q7 Y5 u2 P4 L* T/ l$ J - 7 U% L9 O& y5 T k
- #include <mach/memory.h>7 a; Y% e. _, l# L! Y7 h m
- #include <mach/hardware.h>
' {+ s' T5 H" i* \( M - #include <mach/irqs.h> I, f( ]4 T8 x" V! c
- #include <asm/hardware/edma.h>
& |7 E) \, O2 Y
" d2 K& X9 d8 N- #undef EDMA3_DEBUG
& g5 }! y5 l4 a/ `# h9 W - /*#define EDMA3_DEBUG*/
0 X3 g1 r B5 j8 `8 j+ Q
4 w# a; H3 M5 H2 N) p5 ]- #ifdef EDMA3_DEBUG
8 p9 Q$ T+ l* y* B" l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 K% [* ]! h( n7 z' E, f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): G9 A2 n, E8 M9 l" ~ e; J7 B! ^6 Q2 U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. E8 `6 ~5 X) T3 n h1 F - #else- @3 j: p& t. r" G9 z( T
- #define DMA_PRINTK( x... )0 v/ b$ `9 s9 z$ R: U8 p
- #define DMA_FN_IN
. A. C$ Z, O; ~; K: y7 J/ C* R - #define DMA_FN_OUT
: P* `+ r* P; v/ n5 V - #endif7 s4 ~; L. J; S: V' h% J. h/ H9 }
- , L1 T4 u5 ?5 S2 |5 q3 T; r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* O3 r/ a M h
- #define STATIC_SHIFT 3
( \: r2 f# t5 Z$ w: a# _ - #define TCINTEN_SHIFT 20; p! E$ b7 [" ~: i# J5 k5 l" @, k/ J
- #define ITCINTEN_SHIFT 21
5 F# B* r5 z/ c! E$ Z - #define TCCHEN_SHIFT 22/ C7 z# q% W7 n0 C3 M* P; B
- #define ITCCHEN_SHIFT 23
- Y4 q, r' }( U3 F9 w, G
4 ^" x/ e1 X L6 S9 Y% e0 Q- static volatile int irqraised1 = 0;- Y; R1 a0 X* x' }, [% N
- static volatile int irqraised2 = 0;+ `' h3 X1 Z% {5 Q
- 9 a: Z7 N% Q0 A4 D4 {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 O, I0 X6 y ?5 g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ [- L( @) `: }, \, ?, F' n% X2 A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 x/ j+ i/ W4 R8 |: ^5 x" J
6 o! Q" U: x3 e8 C# @! i' @- dma_addr_t dmaphyssrc1 = 0;
: W1 k/ X; L+ a% p, l - dma_addr_t dmaphyssrc2 = 0;
+ c: R/ j1 N" c+ ^; i e8 G3 T - dma_addr_t dmaphysdest1 = 0;6 ?2 ~) Q6 v5 F, F6 k( v: M
- dma_addr_t dmaphysdest2 = 0;% c! h: l4 v& g4 n i6 X' K
0 {& X2 `8 h% O- p- char *dmabufsrc1 = NULL;
8 [/ ~7 C0 W' x- m - char *dmabufsrc2 = NULL;
% Y8 t0 {0 O& \( W3 l - char *dmabufdest1 = NULL;6 e& b+ o1 T# N0 I( a" W# W
- char *dmabufdest2 = NULL;
& P- P8 g6 E0 U b8 d: H e
, ]/ k" r3 a0 ?1 c N- static int acnt = 512;( p% I- [5 \* {# Q1 ^
- static int bcnt = 8;9 N5 m6 X7 {6 ~: P1 z
- static int ccnt = 8;+ m" t7 {. \; v& d
- ; I$ r6 ?2 F1 Z- |4 R" f0 H
- module_param(acnt, int, S_IRUGO);" X( a+ Z* ]; q: [- N% c8 ]
- module_param(bcnt, int, S_IRUGO);
! S4 |2 T- L3 j, @& V - module_param(ccnt, int, S_IRUGO);
复制代码
$ w' W2 |& g! S( A0 _0 [# \& @2 W- w& B, i I& @/ g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, k, {8 I8 W- i. m, h, Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 F% S3 x" V. S+ n+ \; H) s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: }& I7 u" |$ f6 C& m
( h0 i7 I1 i+ h
4 C1 A+ n/ y; q& a/ U1 U& L
|
|