|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + S" O4 J. Z2 z# h* Z
- [code]EDMA sample test application3 V0 o' P' F# _& l( U. u9 M3 z
- /*
8 t+ S- X! h ~2 `: I0 p - * edma_test.c
' x. i' P$ Z1 r - *
: {) B5 z9 H" |+ `% A - * brief EDMA3 Test Application
+ V @8 D& {/ ], I" T. p - *2 P' ~5 T: `2 ^4 o/ K7 W% [
- * This file contains EDMA3 Test code.
# [. c* Y* f5 N+ J - */ d" c8 i( w/ G4 {: }. ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, Q" J5 C2 E9 p5 g7 Q7 G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 c! c: ?. J: \
- * TO CHANGE.
+ b/ Z/ m2 a) P. `: ] - *4 A% X1 {; j* \- u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" {( M7 e, j* P& r6 Q4 R/ }
- *$ R6 a* c7 I- X9 g8 F: X" y9 L
- * This program is free software; you can redistribute it and/or
# O, o0 n" A" U& [ - * modify it under the terms of the GNU General Public License as
% ]. N9 O# Y/ a- V v& U ] - * published by the Free Software Foundation version 2.# U, S: m4 i/ \& X) T% k
- *( g! f3 D* W" q% G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& c1 o+ T% g! d* q+ Y
- * kind, whether express or implied; without even the implied warranty
' D" G/ k7 j- b! I) h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, d% J! q, a& x# a0 ` - * GNU General Public License for more details.9 C- A* T) y/ W7 k- N
- */" [( n+ g0 |/ h3 Z/ E$ U
- , u j+ N6 f0 c0 F6 T5 B9 O1 V
- #include <linux/module.h>; R5 x3 v, l9 U- M" {! d
- #include <linux/init.h>
5 G/ A4 S1 H0 M" @; P - #include <linux/errno.h>: O5 i. i$ M/ v" k/ A
- #include <linux/types.h>
- o& @- s5 g, t' l% v7 Y" B - #include <linux/interrupt.h>. O- g* L; u8 o- J
- #include <asm/io.h>
' _6 f( L# D1 e% r - #include <linux/moduleparam.h>
4 Q8 s3 v/ k, G5 u) p - #include <linux/sysctl.h>5 n1 N- V$ K& l
- #include <linux/mm.h>
" y+ F' n7 v# Q: J# x8 Q+ [ - #include <linux/dma-mapping.h>4 P1 W9 v! g2 x; E# A, @* _+ L
! E0 }- K/ Y8 \4 a- #include <mach/memory.h>: X) R* e: V2 z7 { S
- #include <mach/hardware.h>+ s' p: z, x: c% L. _& s
- #include <mach/irqs.h>- M4 i! ~3 Y1 L/ `' H
- #include <asm/hardware/edma.h>, y+ R7 t8 _/ |
- + ?! `$ M. |1 k+ J, l
- #undef EDMA3_DEBUG
4 ^; k/ p% H( @: b) l1 [% H' n - /*#define EDMA3_DEBUG*/5 s4 ` b& f% P, _$ T
- & k$ W! M9 e T& g
- #ifdef EDMA3_DEBUG: H% N# {7 a& T$ X r4 b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 Y0 u: w, \8 n& n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- B9 m+ C' ?$ g2 z$ b6 R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) I- }5 ], R! [ D
- #else- Y, o" _$ z: K. m+ O2 M% i) [
- #define DMA_PRINTK( x... ), F+ ~8 W" q5 f: N0 \
- #define DMA_FN_IN
; k3 F w* K4 }# f8 q M8 O - #define DMA_FN_OUT
6 P/ Z- R8 {$ }$ _0 s - #endif0 d8 N9 z, r: l, |, ?( a
) A* q' o5 x6 k1 Y4 a6 G9 E; E/ X1 z8 [' B- #define MAX_DMA_TRANSFER_IN_BYTES (32768); _2 x+ N9 q9 M; u/ ?: ~, X4 { ^
- #define STATIC_SHIFT 36 E$ m3 {0 O$ U2 n
- #define TCINTEN_SHIFT 20( x- I* p. d: G9 |5 Y7 o) x
- #define ITCINTEN_SHIFT 21
1 C6 X# g6 f) k: A2 _ - #define TCCHEN_SHIFT 22
0 u& b& u* }- _2 P2 I: h: a - #define ITCCHEN_SHIFT 23
8 M o# y' F& b% t - 5 ]3 j3 I; \6 n
- static volatile int irqraised1 = 0;3 L# V/ X' T8 }
- static volatile int irqraised2 = 0;$ R }2 t7 V8 R) W
/ X" A8 m3 t2 U# ]$ |: y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& ?% b; A2 B7 R# x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ g1 V9 T1 Q! @6 m3 O3 _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 }0 P, x! B8 T- h7 C0 n
4 N. H5 |+ b1 H4 E" R% K; [- dma_addr_t dmaphyssrc1 = 0;9 F; N F' h* s
- dma_addr_t dmaphyssrc2 = 0;
# C: K1 A* D& q1 @9 g0 x4 v3 V - dma_addr_t dmaphysdest1 = 0;
# |% ~. O% x4 U: c/ {' k9 w. [ - dma_addr_t dmaphysdest2 = 0;; z4 T4 a9 j S6 s: C5 Y8 W
- # c& j9 U0 ~/ P0 n
- char *dmabufsrc1 = NULL;
+ u# _2 K' ^" p0 T0 D8 G* ] - char *dmabufsrc2 = NULL;' I+ g" l9 {# s' Z1 l
- char *dmabufdest1 = NULL;
) f B5 Y' a$ t: u8 q - char *dmabufdest2 = NULL;" \2 X% E) D5 M. s( T
' o( K/ l/ r2 t: K, P' s+ H% _- static int acnt = 512;
) h0 A2 N: ^' T7 H& G - static int bcnt = 8;
0 `) A9 {8 v7 f/ S# T - static int ccnt = 8;5 K; ~8 f- m) F
- % H5 z) E( K0 g3 N, w) y
- module_param(acnt, int, S_IRUGO);
( l+ _& `0 O* h9 n A - module_param(bcnt, int, S_IRUGO);
. H; C/ ?7 v3 x' ?& e7 \ - module_param(ccnt, int, S_IRUGO);
复制代码 1 j" `( N* D$ |2 i2 U% A' F% u; ]
]) s+ j+ ?2 c! u# ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 Q# i$ I: `8 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 a2 b) x/ N. H0 G1 F( T/ ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: x' P, \# ^4 ~: X
# b+ j/ ?& _+ k
4 W+ Z2 }2 x1 \+ ]/ x |
|