|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 g3 }" n; g& b% I2 V" h- [code]EDMA sample test application" b6 F. a4 U4 E& Z3 O' |
- /*
/ r. b3 o+ E) V4 N, \' V - * edma_test.c
! r: x0 s: P% J - *+ N& H# g$ u! C0 k% I
- * brief EDMA3 Test Application* c0 R/ f& F, f$ d
- ** L9 b4 g, M+ W: z p
- * This file contains EDMA3 Test code.
& d, v# F; R5 N" C! W6 W) u - *
" `7 ]: ?7 ^ Z' l4 K) y6 v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& S k( ?. i9 Q. C/ e- q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 U( L' P3 g" [) v5 G: a - * TO CHANGE.5 `6 h; p5 N( O* p% W0 G) e
- *9 [9 l8 w9 R: L. P) s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, j# C4 q, c4 ?
- *' U3 D2 a' G! Q b; o# S
- * This program is free software; you can redistribute it and/or
5 t4 z/ {# r5 e- u - * modify it under the terms of the GNU General Public License as
2 T: U7 a% T$ G* t4 L- ]# k - * published by the Free Software Foundation version 2.
1 j' [, f m4 n$ d) g. J; T! Z+ Z - ** ]; J1 x% ?% M6 x( Y O, _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# {' p" X2 w- X8 l+ _
- * kind, whether express or implied; without even the implied warranty; X+ T/ Z& ~ P; f. u( x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' q% x1 W' c H% e9 y6 }
- * GNU General Public License for more details.& g7 Q5 s: |- y& q. J3 T) P
- */3 a5 `0 p/ L. {, f Q$ A4 ^" s3 [7 A
- 6 h; N0 M# K' u1 P8 s J. N
- #include <linux/module.h>, y' C. H7 h) L- ]! `" p
- #include <linux/init.h>
0 G+ q" z' s1 g9 ?# B9 Q. D - #include <linux/errno.h>
1 H4 e% }; R5 e/ x: K - #include <linux/types.h>. \- V: N0 w, m* v% r
- #include <linux/interrupt.h>* i' h* n: O: i# b( E& S0 ?
- #include <asm/io.h>
9 m# @- v) l4 o* l4 n# ` - #include <linux/moduleparam.h>- b2 j: k$ k1 c& [" s$ O* H( y
- #include <linux/sysctl.h># n8 N! @8 z& V. o7 q. B
- #include <linux/mm.h>
5 N s: F/ B5 q+ J/ U - #include <linux/dma-mapping.h>
, x9 a2 N3 s0 w6 x' [6 H
# ]9 O+ |' F8 F& Q0 K- #include <mach/memory.h>
, ~. y6 ^9 y" I" W4 ]0 S - #include <mach/hardware.h>) `0 O. b b7 E3 r8 p
- #include <mach/irqs.h>) q% K; S m& A' G/ r% @1 [! Y3 _9 w8 N
- #include <asm/hardware/edma.h>
& ^1 ^- B& s6 h* x+ ]2 c1 \3 E
3 Q/ A2 q, C* q- F( D" D- #undef EDMA3_DEBUG5 }1 z6 P. Y0 T- s
- /*#define EDMA3_DEBUG*/
, G2 M! ~" g7 F, W8 [& S - 8 o- t+ M5 P/ H5 q
- #ifdef EDMA3_DEBUG4 K9 F& ^) i: M* Y/ b" g3 W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" Q8 L. a- F. b2 H2 V: V% G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: s. K4 L" b) o5 ^ o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" _2 _4 [" ~- C8 n+ R8 [
- #else
- t e9 u! ~7 m2 C# F ^& ?- {, x - #define DMA_PRINTK( x... )
- z! R9 Q( K( \3 D) `: J" c - #define DMA_FN_IN" X9 A$ n3 G1 n' T5 s" v; V* F
- #define DMA_FN_OUT
! J- Q5 d; d; P# ]( C3 [0 Y; a9 }+ b' s& a - #endif- L: B2 a# ?: A# [) p2 e
- + l8 L5 _- R+ g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ {9 \4 _ ~& t& |2 c
- #define STATIC_SHIFT 3$ F% z3 }0 }5 _% u: N
- #define TCINTEN_SHIFT 20
* P* j: O1 w4 C# Z6 F) N - #define ITCINTEN_SHIFT 21
$ ?+ P$ a: V+ G0 P2 i0 z$ d - #define TCCHEN_SHIFT 22
3 I: C* P5 s+ E6 Y- Y' [ - #define ITCCHEN_SHIFT 238 u0 V0 w- l& y$ @
; n3 A% B# \' _. f# G3 {- R- static volatile int irqraised1 = 0;
! P; _6 D' L( K: _ - static volatile int irqraised2 = 0;
% `1 x: W6 `$ a0 S' |3 ]5 [+ p - ( ~* J3 }& R+ \7 E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. w; d- m9 q7 \/ D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 G# f7 |+ N6 \9 G! z" A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 b& h8 r2 n6 J6 Y
" t5 ]) E! V3 K6 P+ S6 U! D L, l- dma_addr_t dmaphyssrc1 = 0;1 i3 @6 O* v, k% n4 R0 f, @) o
- dma_addr_t dmaphyssrc2 = 0;
- t6 O$ ]+ e/ b) f - dma_addr_t dmaphysdest1 = 0;. A5 d% [. Z; n7 u9 h% J2 Z
- dma_addr_t dmaphysdest2 = 0;! j2 G- P; p4 N& v
- 7 W( j% X2 b M3 q; G0 K! v
- char *dmabufsrc1 = NULL;% B$ s2 @9 R/ F+ T! }
- char *dmabufsrc2 = NULL;
- P) d! Y4 c+ x: h" h3 ` _ ^ - char *dmabufdest1 = NULL;2 T/ C. i! T/ A/ O0 w8 d7 w- M
- char *dmabufdest2 = NULL;9 ~( [; O# q3 _: S6 Q# r
- 1 H' Y" C$ N1 ]% u
- static int acnt = 512;, h' D* e" i k4 v* A
- static int bcnt = 8;
7 D. O$ y- v6 q* D0 W; ? - static int ccnt = 8;
1 G9 `6 M$ N3 G2 g' z" s - `2 k; I2 C3 j/ a; C, c, t
- module_param(acnt, int, S_IRUGO);0 d3 [- n: P& k. t( E. |+ x# Z- J
- module_param(bcnt, int, S_IRUGO);; U7 s' n1 J8 H- a
- module_param(ccnt, int, S_IRUGO);
复制代码
) @. E: b+ s. @+ u- g/ M( Q* H, L# G7 H9 A6 A& J# ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: k$ B3 U3 i; a! C7 carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* l1 [& f. [' z" g/ R& {" v$ D+ T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 ], b/ K' q6 o; z7 `' u4 T( [% { d L7 C0 R
& v$ u! ~9 A1 _7 a0 n3 E( r |
|