|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 i# s3 |/ Z0 L9 m+ v
- [code]EDMA sample test application1 p8 Z. t5 g3 @
- /*4 E8 r6 ^2 \& m! ^1 e S# K
- * edma_test.c
: g5 o$ R/ `' m9 E( W8 v6 } - *' m. J# L: ^8 j6 S
- * brief EDMA3 Test Application
9 s( S, M* L2 Z - *
& @. Z& d2 J+ Q* z+ a4 I - * This file contains EDMA3 Test code.8 U4 t4 v" f. S
- *
. b9 F5 E2 I9 F4 V( ^8 A! w! c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. C6 `7 L/ {7 H0 L( D3 O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, t) S, K7 ~6 C
- * TO CHANGE.9 _# M! f9 H. ^$ ]: {
- *
: J+ A2 Y4 {+ k/ q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 h0 M- _) h7 _; K - *
* h6 c q( n8 R - * This program is free software; you can redistribute it and/or3 Q; h; r+ }6 o' o
- * modify it under the terms of the GNU General Public License as
2 w" w2 d6 i0 {4 @+ e t4 T - * published by the Free Software Foundation version 2.# s; K9 Q5 e: J! p4 _7 D, S
- *
6 _2 t* i- A8 Q# a0 ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 {' o+ ^; F ^4 c+ T- v - * kind, whether express or implied; without even the implied warranty
+ y5 d( j! x$ D2 `+ M/ B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; Q( u* ^; f2 P; I& ~- g - * GNU General Public License for more details.. X# Z9 H2 {; C1 w/ y
- */
: Y0 z% y. H5 l: f+ H. l - : n; T0 B( \4 q5 {) g
- #include <linux/module.h># T6 }1 Q1 @& t3 k1 O- N+ b7 w
- #include <linux/init.h>: B/ u! \7 ^' o$ V* k, P
- #include <linux/errno.h>7 |, Q- E x* _8 m( I6 ]
- #include <linux/types.h> u9 v, d1 ]+ X" o: v. R
- #include <linux/interrupt.h>1 c) J* r+ \; P( l5 |: q! j% R
- #include <asm/io.h>
- N; R! a; L: e3 z6 u9 v, Z - #include <linux/moduleparam.h>% b* O; Y; _' N' A- ^" q4 i# q
- #include <linux/sysctl.h>7 u+ j* t: q8 ~0 m# J+ V, j
- #include <linux/mm.h>
5 e; _. l6 O9 f3 a" H3 f( R: C9 h - #include <linux/dma-mapping.h>
$ F' p! _' `0 \: w- p3 Y - 8 w9 u& N2 @ a' N3 H
- #include <mach/memory.h>/ n4 E% |7 e$ q5 ~! j
- #include <mach/hardware.h>
, x5 Q% ` Y6 R2 s& g - #include <mach/irqs.h>3 l: V- w4 W5 U, S9 g2 G6 S
- #include <asm/hardware/edma.h>/ v& c4 o7 ?5 e3 ]' y& }8 W5 [
; |, L9 v, Y) Z+ x- #undef EDMA3_DEBUG: r2 K! J. B$ d- i6 z+ O
- /*#define EDMA3_DEBUG*/
/ h9 S ?2 l. v l$ ~, j4 \
2 y9 b2 r( d5 j) c8 R. h0 t- #ifdef EDMA3_DEBUG8 S3 C9 t9 B2 g, C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). e5 ` P0 {4 C! A& O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) M3 V8 l6 x; F6 g% c5 D6 v( S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, Y; k5 O; j. n3 x) `+ @& }! r1 r8 | - #else! ]6 ?( y8 R! |
- #define DMA_PRINTK( x... ), q6 F" X: t3 A) e$ `# m1 c4 j
- #define DMA_FN_IN
2 u! E. s4 [2 G8 z - #define DMA_FN_OUT: D* l' y. [- Z9 t" u# ]
- #endif& `6 h* Z: ~; E$ E% T
! p* @3 O1 s; Y0 M7 w s% z& ?& d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 z$ n6 b( c! h! B
- #define STATIC_SHIFT 3
/ N9 e; A- H! i8 z - #define TCINTEN_SHIFT 20
7 T. W1 @9 C8 \1 G; v - #define ITCINTEN_SHIFT 21$ P7 S4 S; N( D' A# {
- #define TCCHEN_SHIFT 22* w2 u( n5 t2 ^- O& D( I1 i! v
- #define ITCCHEN_SHIFT 23
$ f) o" ^& N5 \6 U3 i - , O7 N8 P: i9 C6 t
- static volatile int irqraised1 = 0;1 Y3 U* a* P: \
- static volatile int irqraised2 = 0;2 O$ X: X6 P: B* Q
9 `! ^9 }9 y$ E( v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% @- m) f* a! v5 `- v D% a1 O K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 I k- K4 ]3 s* W1 S g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- d$ X. f+ E# R9 h! o0 O
- & m$ R. e2 U; D5 b: f: X- i- P1 A6 h
- dma_addr_t dmaphyssrc1 = 0;. r8 ^6 V$ J$ h' ~) r0 h3 t( J
- dma_addr_t dmaphyssrc2 = 0;1 a! V1 [/ @9 g, f* a% w
- dma_addr_t dmaphysdest1 = 0;5 K- V, t% {. o
- dma_addr_t dmaphysdest2 = 0;) L) I% u) j0 I3 _3 D
: g/ E2 F% k6 e5 |: h1 S0 z( r- char *dmabufsrc1 = NULL;
! q3 e# _2 `' J. z, Y - char *dmabufsrc2 = NULL;6 X7 j6 _4 P/ w* K1 ^. M2 D
- char *dmabufdest1 = NULL;
[0 f. b& \4 y# w( w1 ]3 u - char *dmabufdest2 = NULL;$ v) v G5 s B; c* I( `8 Q
- ' T& a* v6 f1 w$ [1 g
- static int acnt = 512;
( o( m2 R0 i) S0 o) b - static int bcnt = 8;) K* ^ C$ ~' |8 H5 g' J
- static int ccnt = 8;) l' D3 k. D L# R- z- j
* e6 T! m, A/ J7 Q! F- module_param(acnt, int, S_IRUGO);
/ W" D" d3 i: o" W - module_param(bcnt, int, S_IRUGO);
6 m0 b8 y0 ]4 J- h" V$ s" \ - module_param(ccnt, int, S_IRUGO);
复制代码 " b2 s3 h# I$ A4 I; p* ]( W7 w
, O$ b* p8 K& ^5 W9 S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 v8 u( r7 ]7 }; G8 R* y! t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! R* n" F2 K, O& k" G' ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
}: R# x E- V
7 J! `) E4 L' X. E& |6 M( G i1 Z; y& Q9 g/ A
|
|