|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 [, G$ V% E7 L$ T' X
- [code]EDMA sample test application, R4 @& Y* U9 z% X
- /*; b3 f7 |+ u4 X1 D2 g
- * edma_test.c* ?" Z9 G8 d5 {4 e
- *( x6 n' C. ~ w* S% C( G3 m
- * brief EDMA3 Test Application
- q* c4 Q0 f, p" P9 ~+ k8 v% z; ]& L - *
# D. d# I) A& W1 G2 I' ^ - * This file contains EDMA3 Test code.
# F4 U6 F5 v* x2 h1 u - *
# _2 Q" E3 M' d+ { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 U: S0 L2 H, a& @) k+ [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! e+ M/ F) o0 S' v) Q5 ^) @
- * TO CHANGE.
# a) n& c/ P" b- y5 h& @ - *
$ y4 x7 X, A! d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 M1 c8 m* ^- v0 w, A - *
9 @# _/ p. m% p% L4 N$ v: J8 u - * This program is free software; you can redistribute it and/or- ]3 C7 \& Y" y8 G+ c5 o6 ~
- * modify it under the terms of the GNU General Public License as
0 g9 H7 c S7 h! g - * published by the Free Software Foundation version 2.
/ |4 }* e* r" u" J - *8 S8 u1 D+ T- P+ f$ O; ^# v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ q$ X4 K# ?4 ~
- * kind, whether express or implied; without even the implied warranty9 N) }, ?+ \: \+ l% T8 G( j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: a2 |- j2 m, F* f% b4 e( O) a! Q - * GNU General Public License for more details.% y! K9 l. x/ h) n+ N
- */
. P+ X# q; l; L* m' r# _3 ?% L* v7 X, a - 3 ~( M* Z5 ?: w2 v! u+ x) O
- #include <linux/module.h>
" O( L5 `5 `2 @ - #include <linux/init.h>
9 }: C4 q( T# v; D- u, r1 q. H. | - #include <linux/errno.h>
* N* T% r$ g- D |, E - #include <linux/types.h>, x8 v! t4 u5 v/ \5 e
- #include <linux/interrupt.h>
0 G2 L3 O+ Q6 p( L - #include <asm/io.h>$ v7 o( e2 M5 E3 o' }* G
- #include <linux/moduleparam.h>
! V6 M) e {8 P) | L - #include <linux/sysctl.h>2 k: ]9 ` |% o. f# R6 E
- #include <linux/mm.h>
, V! D/ p) }: p - #include <linux/dma-mapping.h>: l* F6 g {7 I# n
) X# P0 }& D2 m8 a- #include <mach/memory.h> z' ]! m5 Y, y5 x2 C. X
- #include <mach/hardware.h>8 ]7 e6 g f4 g' l" m* O `
- #include <mach/irqs.h>6 b9 |. W+ j+ t& E8 N
- #include <asm/hardware/edma.h>
1 l& I5 ?8 ]0 I2 M
/ a9 O: K1 n6 g% b. }: B) w) X0 W- #undef EDMA3_DEBUG. N+ M/ [( ^# H% V8 y% `9 e5 r
- /*#define EDMA3_DEBUG*/
/ r4 g) x% w5 W
8 T+ E0 q/ t+ J, {- v/ C* ]- #ifdef EDMA3_DEBUG/ l# W. |. f4 ?% Y3 e; ]( e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 @4 f" e+ J6 c* r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, C1 m; t5 h9 K2 |8 z; ^$ A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& ]/ h8 b+ q' X5 `7 \( h
- #else2 I1 ]- t; M) [
- #define DMA_PRINTK( x... )
, _( Y8 x/ M. k9 b8 n - #define DMA_FN_IN
5 v2 s# }2 e/ \2 U# K - #define DMA_FN_OUT$ J& _' Z9 i' C# j9 m( l* J
- #endif$ \0 X, p" p0 O0 i5 |) _6 R6 C- [* ]
! f8 g9 x; b3 P0 O6 v) Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ f% f9 @9 K2 G
- #define STATIC_SHIFT 30 P3 ^3 s: `' X* X
- #define TCINTEN_SHIFT 20
- k% z/ v2 J6 h- l - #define ITCINTEN_SHIFT 21
9 w4 c% W" W- _8 H8 f5 q* g - #define TCCHEN_SHIFT 228 N, G( T3 t, a9 {" N: S* v
- #define ITCCHEN_SHIFT 234 @2 N" m1 O, D* ?4 W9 u; S
- " x7 `+ x3 a8 H% @5 k! j
- static volatile int irqraised1 = 0;
% _- b$ z% T& t2 z" }/ G. F - static volatile int irqraised2 = 0;6 y# o# z4 p5 B5 m) A7 M5 H- E! K
- 4 ^1 Q5 `0 {% ~1 j# Y- \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- u) f: d# I* P/ }( z- |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. R1 ~2 g' D, l' [( ^/ ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: q3 G& x/ x8 J& p
- % R. U! W- X* p; M% W5 i
- dma_addr_t dmaphyssrc1 = 0;
2 J6 f8 n& Q7 Q, _! W( E& f - dma_addr_t dmaphyssrc2 = 0;7 i* W- N- M' Q% z- P. y% p
- dma_addr_t dmaphysdest1 = 0;1 Z( _# X4 d9 q6 W
- dma_addr_t dmaphysdest2 = 0;5 r2 i! h+ K& i, \! f
- / J! S( R' U3 V: @5 h
- char *dmabufsrc1 = NULL;* k5 q/ T, l* \# C1 y3 h9 B" p [
- char *dmabufsrc2 = NULL;
0 V' Q) O* l+ R& u9 h - char *dmabufdest1 = NULL;
. s& h; q# D+ D4 K1 G% H. ]2 y - char *dmabufdest2 = NULL;
{) ?: W$ R- m0 ]4 H
- `/ a" x$ W" h) T; x- static int acnt = 512;" s9 }! f2 H4 `; v/ x
- static int bcnt = 8;' G- N& r5 D" m0 D+ y8 m
- static int ccnt = 8;
" ?; ^3 F! w8 n - 7 g9 c3 ^; p9 E0 @9 x n& {1 Z
- module_param(acnt, int, S_IRUGO);
* V% m& x% l: V* h6 G5 h' X( O* V - module_param(bcnt, int, S_IRUGO);( Z2 P( o9 d9 Z$ P5 l2 B% y
- module_param(ccnt, int, S_IRUGO);
复制代码 / t- O' u1 q( K( V
; D2 H+ b; f2 N5 ~! ^3 S. R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 Q8 G& n7 G' ]+ c( I+ H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! I. n6 t% l" Q. C& e$ e( l) w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, j& t& h3 \) B/ Z% l
) I& d+ d$ s1 ~$ L; b. _- R0 @, W: V( g
|
|