|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) q6 G L+ _) ]8 Y+ k* w5 N$ L
- [code]EDMA sample test application
7 V% W" w4 J: e0 ~8 ]2 j! v5 N3 G - /*/ b; ]* S1 Q. g; w2 v
- * edma_test.c- h3 h- X; m+ Q* J
- *
) j$ K6 K6 z* i8 O/ w# V, C - * brief EDMA3 Test Application
8 _' f' O" n: y! d - *. x& V' s# H) Z
- * This file contains EDMA3 Test code.
8 P2 o7 p4 u8 z - *
+ }( k0 l+ b1 F1 d2 x2 u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# z3 l7 c% r' ~ _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 ~! u8 b, c1 I# |
- * TO CHANGE.
+ l: I$ e0 x) G& q - *% N% t) ^: f( [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( y! s s6 ^" ^% [3 M P
- *: h& s! p0 F# V) S) m" a& _
- * This program is free software; you can redistribute it and/or& b# D8 A5 K+ f3 Q! f9 x; l Q
- * modify it under the terms of the GNU General Public License as" {+ \& G6 m, c, B2 N
- * published by the Free Software Foundation version 2.
% Q P. g, X" u- N* Q- f( A! I - *+ c" H2 ~: Q& j- L1 L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ v2 j# H+ }. d+ @) P
- * kind, whether express or implied; without even the implied warranty- v6 E$ j2 \# L* q7 z# i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 x3 Q* W6 T! I9 l) ]( S0 X" m3 ^ - * GNU General Public License for more details.
. I8 e3 F" ]7 o/ W% B - */& ~5 F( R7 y) p5 v( z
. A9 s6 o) l8 T; M6 m# d' ]- #include <linux/module.h>
2 }; _! L# }3 ]: F- Q - #include <linux/init.h>
* `6 h9 Y! v! D, M6 N2 O6 q. @; j - #include <linux/errno.h>
h" o6 e2 c5 h. A - #include <linux/types.h> e5 \5 g$ V, s, g/ c; P' m5 ` g
- #include <linux/interrupt.h># m0 o6 v; P) P2 w6 q! D$ e y3 `; z
- #include <asm/io.h>$ M! a* z! F# _/ o
- #include <linux/moduleparam.h>
( `- S- G" z4 n; t* [) s - #include <linux/sysctl.h>
$ C& D8 p& m1 j5 q0 W g - #include <linux/mm.h>
$ f3 G; a* l& N" `: c; g5 g - #include <linux/dma-mapping.h>
3 l: M' R# C* R8 o0 H. y - + f* Y- I* s: S6 o
- #include <mach/memory.h>
6 ~; H* L2 b% I0 x4 K - #include <mach/hardware.h>
; }; ~% z. m. W# \+ G6 | - #include <mach/irqs.h>
! z8 X7 Z6 _/ ?, c# g - #include <asm/hardware/edma.h>
{9 v2 v4 n' V2 {
8 M7 N$ U `" e+ T. _0 |- #undef EDMA3_DEBUG5 h" n" X2 E; i% e: C# f: h+ Z
- /*#define EDMA3_DEBUG*/+ f- v7 Z6 ]( J8 j
2 u4 A9 u% Z0 }2 v+ H8 h- #ifdef EDMA3_DEBUG- N7 i+ h: R: c% q0 U! e1 d1 ?$ F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( v. u. D5 ]; V" w4 K0 m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 Z6 [- R; ~* N% E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 B$ K- s0 H+ Z, x( ^" r2 ? - #else# G, ]# _& w. @, K( i
- #define DMA_PRINTK( x... )3 `9 W- x( X# x- S- }. O* y; r
- #define DMA_FN_IN% b) z4 j: c$ W' B5 j4 h. I
- #define DMA_FN_OUT
1 [, `" e) C3 [; q& F' e$ D - #endif
1 s. S6 W* C( o - - A$ z9 q: E H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); i7 ~: c4 q- B: N8 \9 |
- #define STATIC_SHIFT 3* O- X2 O7 y) s5 E; |
- #define TCINTEN_SHIFT 20 Z4 u1 F* Y# g! w% g7 W
- #define ITCINTEN_SHIFT 21
. ?: D( u3 E' y - #define TCCHEN_SHIFT 228 | F, _4 \3 l' h
- #define ITCCHEN_SHIFT 233 L N6 y+ A6 L, y, h( ?
- ; c" ^+ f: r9 v) i
- static volatile int irqraised1 = 0;3 C! J/ s/ ?* g J! e% d) P2 |4 P
- static volatile int irqraised2 = 0;
, |( ~) _& Y* N* | - + {" t2 M5 F# f0 t) T, L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 J1 h4 f V+ k& T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Q# A1 z+ [. r! t* o2 P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% _3 w3 r; O" M$ b
- & z; \% c% ?# a9 C! G( c* c
- dma_addr_t dmaphyssrc1 = 0;
' S/ f7 l/ { D - dma_addr_t dmaphyssrc2 = 0;7 K. u# T# } x3 F& E* X1 L. \
- dma_addr_t dmaphysdest1 = 0;
- r* q0 l, n! F3 g - dma_addr_t dmaphysdest2 = 0;
( e( {) ?$ F) g J( d, V
# M- |6 O5 J/ z% G% ^( i6 v( \5 D- char *dmabufsrc1 = NULL;
. O2 U. i/ d7 _. ^& L - char *dmabufsrc2 = NULL;
/ q. t/ T- w3 R - char *dmabufdest1 = NULL;
6 t- L5 Y! s5 y6 B0 h - char *dmabufdest2 = NULL;
+ V- u& j( m9 r
- \+ I0 [$ Q# n- D' j) C- O K' H" z I- static int acnt = 512;
; B0 D( e7 C+ F - static int bcnt = 8;
% n( M3 _' k6 R% O3 K; {+ N0 K: B - static int ccnt = 8;* u, q2 H0 ]) W# K) Z& Z2 u
+ v' ?5 @1 O8 W' f$ f' O- module_param(acnt, int, S_IRUGO);
) Q8 {. Z9 ?4 a6 [7 A - module_param(bcnt, int, S_IRUGO);" E- p/ x! j/ B7 B+ \7 {4 \1 w! F
- module_param(ccnt, int, S_IRUGO);
复制代码
, y, y7 v6 H @: K u; e2 C! n/ `0 s& [) `6 H3 {6 u% O2 \1 V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, j4 Q- Z5 H; W2 E& karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 O6 y- y. ]& z( r* L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: M2 M$ z r3 a7 N% R0 J
/ n5 i' m8 X m. W
. p: r0 e' R9 C. a9 E- i/ x |
|