|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 g' Q6 G7 ~" s' V- H# i- [code]EDMA sample test application( B6 p& o8 R: A$ X. n6 L
- /*
: q6 d: J1 T* @9 X - * edma_test.c8 w/ V) e" C* w( ?8 R
- *
- q% u; i' I* i# o. Q# K& E) b. i. m - * brief EDMA3 Test Application
9 ]7 P% D5 U0 T, o - *2 I3 |/ I& X0 J6 i2 P, C
- * This file contains EDMA3 Test code.1 A6 A! R7 y, m- J6 m
- */ V$ P: @5 k1 _& G' [: k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 k+ \: _7 z' V3 ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ `' [( C+ Y$ s/ K% ^2 q
- * TO CHANGE. | o9 Y; G% O4 o- N
- *6 t! y. u) j2 i& f4 g5 n/ D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 A( S% O1 p6 T/ B9 G# w - *
: E0 ^) d$ c, x8 m9 g - * This program is free software; you can redistribute it and/or
, \2 ?* [! e1 ] - * modify it under the terms of the GNU General Public License as G* J0 ^7 O( c6 s* y
- * published by the Free Software Foundation version 2.
$ g& M! a- J2 T% X( o9 K* V - *4 B) Y8 l3 o: `+ i0 K( ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: b; \; j4 U0 m. S3 i% a! T
- * kind, whether express or implied; without even the implied warranty3 |6 d; m; k" }/ C) O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ e) r u' i4 V
- * GNU General Public License for more details.6 y0 w- A$ U+ ]
- */0 K( j H3 }0 ^; T4 w" b
; D# r, Q6 B6 f! C2 U- #include <linux/module.h>
5 i) M5 [* c. y8 J- ^+ u+ n( D0 | - #include <linux/init.h>+ L E- ]) E$ |; L6 V
- #include <linux/errno.h>
6 l5 ?. u$ }3 T& x$ l$ \ - #include <linux/types.h>% \. H7 I: n& f
- #include <linux/interrupt.h>9 N% J' y6 Q) G
- #include <asm/io.h>
5 i8 U, }$ g1 ?( f* Z! K/ | - #include <linux/moduleparam.h>
0 t* Y/ i2 e c - #include <linux/sysctl.h>
6 F5 | g+ w1 y/ Z: ?3 M9 j - #include <linux/mm.h>
/ S9 ?0 R% S! ]) s0 G' Q - #include <linux/dma-mapping.h>/ s, `0 l q% ~& F
% Z2 I/ j# E) r( @0 {: Y1 q( i- b- #include <mach/memory.h>$ Y$ L& C, N* G; B2 L- F
- #include <mach/hardware.h>
0 L9 o7 h. _ v! U, r - #include <mach/irqs.h>$ t0 c" @8 ~1 _) M/ d' q
- #include <asm/hardware/edma.h>( R" j1 S$ d* v
6 [7 E* t- n: k% H( ^0 G- #undef EDMA3_DEBUG
; w1 ^; r/ h; m7 }8 z @ - /*#define EDMA3_DEBUG*/
, k O( C! c. e0 W% T/ Z1 M* y - j: r3 m0 L" S. y$ S3 u) T$ u
- #ifdef EDMA3_DEBUG
# G- T. y6 }- u1 M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ n: r. Z5 d0 a+ u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 ^6 U' `/ O+ G3 F) _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& n: P! a$ I' m) D: X - #else
$ Y0 b3 s# S/ ~5 Q9 ~8 Q" [7 w8 [ - #define DMA_PRINTK( x... )( o* o) b" P8 z1 f
- #define DMA_FN_IN8 g! u, ]& l/ H+ Q+ i& I
- #define DMA_FN_OUT' ?- m+ S8 \. I6 Y) ]0 B) ?
- #endif$ N t6 Q# ~/ ]' ~' t# v* V6 a
- 9 v& u) ]6 F6 X1 u9 g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& P& K" A2 J/ u - #define STATIC_SHIFT 3* w; j$ E* [' R8 P; Q0 I4 q- m
- #define TCINTEN_SHIFT 20
* s/ p; b' f) I7 r: v - #define ITCINTEN_SHIFT 21; Q% X7 f, T2 [9 a/ ]
- #define TCCHEN_SHIFT 227 V7 _6 \) c! B$ u6 `* k$ d
- #define ITCCHEN_SHIFT 23
6 b1 s' \& [5 n) J Q - # x) m- D: T5 A! a. j" T" M: Y
- static volatile int irqraised1 = 0;4 y) ~: u$ ?! r
- static volatile int irqraised2 = 0;3 ?# a- E9 K+ x/ H- V2 D
; f+ A' w+ o2 o6 N$ ]4 q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 b! \3 V8 z) X) c/ X1 ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 @: B |' }7 f7 J2 @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& ?0 `+ J5 p' Y( v - , C, ^' H2 i& \
- dma_addr_t dmaphyssrc1 = 0;
0 g! R5 o! J& j- V4 o% F/ l: t - dma_addr_t dmaphyssrc2 = 0; q- W+ f: @* a$ W' x
- dma_addr_t dmaphysdest1 = 0;. N5 v" g; [! t7 S% N
- dma_addr_t dmaphysdest2 = 0;
1 [/ f1 K! v" T% y Q% J4 E( f u- C8 J - 3 z5 V P8 w; _/ t
- char *dmabufsrc1 = NULL;
" w+ v0 z# S& \ - char *dmabufsrc2 = NULL;; @" g! B. c0 }. C+ ?
- char *dmabufdest1 = NULL;
6 D6 h {/ X/ p' y7 b - char *dmabufdest2 = NULL;4 M+ s7 i8 r9 b+ F
/ U7 _* r$ J* N) H! _- @1 L$ Q- static int acnt = 512;/ E9 t2 h4 v, O
- static int bcnt = 8;( w, J+ T4 j: p }/ u& y; U7 l& W
- static int ccnt = 8;
- l) l1 U8 P. @, W ]+ H3 S/ _ - & r4 \6 l7 G2 |6 f T
- module_param(acnt, int, S_IRUGO);
y6 C3 ]- u: e3 x - module_param(bcnt, int, S_IRUGO);4 Y# |! ~2 [2 y* p. k
- module_param(ccnt, int, S_IRUGO);
复制代码 ' ~9 h# f B& T [8 e% M X$ d
+ M9 B- n' u* N' q- ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 ~' x" `, r$ I+ v% H3 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: H' z5 v& W: A" o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ C) L7 |7 [5 ^ ? N$ D) {# S* Q6 `9 U- J, j {
5 d; G6 `1 V- C! t
|
|