|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
D2 N2 |0 ?$ Q! k- [code]EDMA sample test application
V% @- F2 G! P2 {& p( o: k - /*7 x) @* ^1 N9 u! Z5 G9 H# q$ F
- * edma_test.c5 p. v6 r9 p H$ F3 ?
- *
, G0 D2 y( G& p+ i. J" {2 l - * brief EDMA3 Test Application
& t8 Y( L. @5 k& `" l - *0 E, j4 P$ l! x5 @. v& z
- * This file contains EDMA3 Test code.
! I3 X6 c O8 I8 l8 S5 a5 J - *. [ z: p( X: K* _2 F4 H7 V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; Q v8 {: _) x* u1 L2 h- g3 Z7 W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 W" h" _; s+ s/ }9 k* U% x ]+ y
- * TO CHANGE.7 G) N' Q6 @/ U
- *9 j/ {0 |8 w7 _, ?# l8 e' N% d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 \' [* g( R2 ?- g) G# P: ~9 Z - *
- W B$ Q7 C: D- @4 ?" }' C# F - * This program is free software; you can redistribute it and/or
M+ H+ t ?2 R7 x+ |! ^ - * modify it under the terms of the GNU General Public License as
g; ]0 L& Q F3 y5 D, u - * published by the Free Software Foundation version 2.
`7 @; a Q* `( r$ ^- o. m4 W - *" q* _9 N+ m4 l. d, X, ]6 g* ^$ V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) ?9 N. z6 v: a' ~2 l - * kind, whether express or implied; without even the implied warranty
1 ]& ?. F! t- q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
[! H0 m, X9 H9 z. T" Z( @ - * GNU General Public License for more details.
+ \( H0 a4 c, q' D- k# N. O - */- O% g8 ~( J, t5 F/ t, k" }% G+ N3 g
- 8 S" u1 e! C: B- ]7 {8 J7 L
- #include <linux/module.h>3 X1 j- M; w& J2 l7 ~" o: s" z, x
- #include <linux/init.h> f8 U5 [" Y& t2 I; X' x+ N( p1 w/ p
- #include <linux/errno.h>: |0 O* G" S) n( o5 l$ X$ D- }
- #include <linux/types.h>
; E7 |+ C0 h( c, {! T) O - #include <linux/interrupt.h>& a2 s% `! h0 O8 y' o4 r, j/ l2 ^, U
- #include <asm/io.h>
6 y# U! r( G; J; F6 c2 E& K% @" Z - #include <linux/moduleparam.h>: e9 c. \' F- B) v
- #include <linux/sysctl.h>! X1 c6 ~2 |# W& ]5 y$ _
- #include <linux/mm.h>
0 K$ E% z" U/ M2 R& g5 v" g J - #include <linux/dma-mapping.h>
6 L, |! P% H4 o: w y
$ \/ l2 V" f1 C- #include <mach/memory.h>* ^ ]8 r5 b7 \4 A9 N) B
- #include <mach/hardware.h>; X- u) [2 Z/ I: w" w0 V* t
- #include <mach/irqs.h>& G: L7 o! M) x$ Y+ Q: V
- #include <asm/hardware/edma.h>
+ r; q# }/ j. W/ J
8 G+ a& r: ?$ q8 h0 ]# \- #undef EDMA3_DEBUG3 r! D$ s1 ]7 ^1 w6 t
- /*#define EDMA3_DEBUG*/
* `- u$ R, e" g3 y* Z' F$ Q0 I - * p! \( g8 ?( M" d$ j/ h
- #ifdef EDMA3_DEBUG
/ {! k3 {! R; R3 H2 ?( p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% ~9 g* m# { M8 v5 S# Q% A) w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). U. m x7 ^2 b( k6 ~" {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 w( K' } H' Z1 U1 H4 s4 |1 |
- #else4 Z( k6 M# P! M* H
- #define DMA_PRINTK( x... )
. S, `+ _& Q# H7 t# r - #define DMA_FN_IN
- I O7 O0 s% O9 U/ F: I- V. l( k - #define DMA_FN_OUT
6 B% ^2 L; B( C: v! b6 l6 |/ B+ a) u - #endif
" V b1 z- Y' v6 h8 U C, S1 B& I
% g& L+ z2 `5 W* \$ P# P. q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ }: Z7 U/ @0 q1 I/ s/ o* z" ^4 E
- #define STATIC_SHIFT 3
% N/ B, D3 h$ J5 x: `4 e - #define TCINTEN_SHIFT 20
5 d- g4 Z% Z3 w5 c K - #define ITCINTEN_SHIFT 210 z0 L) ]* Y, w6 E
- #define TCCHEN_SHIFT 22
5 F$ k6 F+ p5 }4 k - #define ITCCHEN_SHIFT 23- Q2 |4 @4 ^4 `8 |' J+ U- g: K
% ~/ x1 h7 p) I9 o5 p) L+ `2 q" X0 t- static volatile int irqraised1 = 0;0 m# h9 b! ?( l9 t# S* R8 M5 o
- static volatile int irqraised2 = 0;
( \9 y" ~, e. G' x- x+ y - 2 `2 s; O% L% o/ g" j. H! B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" l+ P, O6 m& b0 D# O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ~, \. F3 f1 u, J2 d/ L# Q2 Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- v# X# E0 E( m* _
- P: L8 C" p, L# R% N( v6 {
- dma_addr_t dmaphyssrc1 = 0;
. \1 Y/ f0 r/ G1 ^) D - dma_addr_t dmaphyssrc2 = 0;
* h: M) U0 ~9 k - dma_addr_t dmaphysdest1 = 0;4 |% a# y4 u9 K# T5 W
- dma_addr_t dmaphysdest2 = 0;9 x( M# F7 p7 o6 M
. {+ N6 V2 @2 W- char *dmabufsrc1 = NULL;1 G7 o: K7 B. \; x+ n5 f' `" e9 v
- char *dmabufsrc2 = NULL;' L! `/ ^0 X- o* n
- char *dmabufdest1 = NULL;
" O1 w: Q8 ~0 W0 {4 P8 z, Q - char *dmabufdest2 = NULL;' |( f5 I/ ~) R4 h- H2 P
& v2 G5 V0 Y& ]$ S- static int acnt = 512;
0 [* a6 `6 a; Y. ~0 q S - static int bcnt = 8;# L& q8 M/ |( ?/ P. ^
- static int ccnt = 8;1 z; A& d7 n- h& F, @' |/ ?2 ~9 k
- O2 } _, j! b2 z, A. H5 ~8 T5 y
- module_param(acnt, int, S_IRUGO);7 O8 T, H5 G& I
- module_param(bcnt, int, S_IRUGO);
$ \7 ^* h3 k+ b3 Q( U - module_param(ccnt, int, S_IRUGO);
复制代码 , n6 W" D5 m5 F& ~" N/ Q# `) J! a
) a/ b1 z/ s" c+ H W4 s" |" ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 I1 p9 v/ L4 b' Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 j+ T! F4 F- T) e8 W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 Z; M& x; T# I& X; ?
! J* |# G% M' `/ L& c" y
1 d- c: G; ^- s/ g! V; o |
|