|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. F7 {+ K! E1 s n- [code]EDMA sample test application, f. }: X' b7 V: @! D' E* q
- /*
; g( `6 e4 v6 y7 F0 _1 P - * edma_test.c/ P6 h+ l! \) N, Q3 t5 C( b$ h J
- *
( S" r. Y* T# e - * brief EDMA3 Test Application9 }* _+ h' C5 r
- *
6 L% a/ w' ^9 [* z: e( F, u - * This file contains EDMA3 Test code.& j1 U; l! \4 ?- G0 K- b1 }* `
- ** G: n- Z6 c: V9 b* {! w3 ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* f- W. d: d7 e/ M0 z7 N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. c" s+ W; D# q$ O2 q3 h
- * TO CHANGE.
% H: v5 N5 `9 u% @4 x- z8 P9 i2 D' ~* i - *. Z2 p2 t* M' {0 G/ ~( O6 N" g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! W8 p; w1 Y+ E6 q/ G% _7 A
- *
( ]! n2 U/ P" A$ M Y! G - * This program is free software; you can redistribute it and/or9 l' ] j- t$ s, m" B( P" X2 k$ @
- * modify it under the terms of the GNU General Public License as
$ P: Y2 ~5 m5 {$ ?6 D0 y: L - * published by the Free Software Foundation version 2.5 m$ j" Q$ H) R8 a& v/ B
- *
# W; z+ r' n& \5 J6 K/ D' [) v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* ?! q x" G/ x3 z& l - * kind, whether express or implied; without even the implied warranty
?) {* L: t5 J3 d3 k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 F6 B$ I8 s: {! }' s! Z: `+ [' q, p0 D; V - * GNU General Public License for more details.
6 D: a# S: x. v7 ?$ _5 Z& V0 _' E - */
# g5 |7 p3 A3 m: v6 N" [ - 6 c' s( H% A1 w# `/ {8 B
- #include <linux/module.h>- Y; x% j) g# l. a9 k
- #include <linux/init.h>1 Z U. C: j) D; L8 ~ s
- #include <linux/errno.h>& J2 c+ Y: s8 {+ G- b( Q# s$ c
- #include <linux/types.h>
/ K' y; u( [( @& v8 J# d5 Y$ Z8 O2 ^ - #include <linux/interrupt.h>
7 i$ l: k. h8 Y/ t/ F - #include <asm/io.h>) ~7 g; D$ t% R
- #include <linux/moduleparam.h>4 ?2 H0 }8 } A
- #include <linux/sysctl.h>- C, ?/ h0 v. s: W. P$ j
- #include <linux/mm.h>! ^; s( R/ n' `+ D8 Q& X* K
- #include <linux/dma-mapping.h>: L' V: v7 l, J1 P
0 \; L' C9 z1 R+ {. P, g% |3 {- #include <mach/memory.h>
8 ]+ Z- I1 \6 J2 r5 X - #include <mach/hardware.h>: C6 B4 O+ m1 `( j4 ^) |$ @! V4 P
- #include <mach/irqs.h>
; _" Z9 c+ y5 ?2 w3 | - #include <asm/hardware/edma.h>
( f, k' f# |6 ]7 x6 B, p5 V3 h
0 M) g6 E# Z! d2 I- z* f4 V- #undef EDMA3_DEBUG* O* O; Y1 _7 t i4 Q
- /*#define EDMA3_DEBUG*/
- Y6 b! v' u7 O9 ?3 j- }2 W
/ X) C- E* I7 K; }* h- #ifdef EDMA3_DEBUG
6 @6 S% Q# H/ V U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& `: }1 N2 K; ?. ?0 J) B% c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 s* R4 r) A) L/ y- X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: O# ~& E( j$ I \ - #else
+ l. g! `& v. O - #define DMA_PRINTK( x... )1 j' [9 R: o9 w8 y
- #define DMA_FN_IN
Y _, G2 E, { - #define DMA_FN_OUT% N; @2 [* s: e
- #endif
6 o/ F$ w# K- N3 W6 o
; n( P+ ?/ P3 L, J9 X5 h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# [8 Y8 ]+ @) ]5 y, ]4 K& m - #define STATIC_SHIFT 3
1 R- {8 e/ E4 K! A: l - #define TCINTEN_SHIFT 20
+ d1 M* s) m0 u - #define ITCINTEN_SHIFT 213 r% z: T1 ?, R8 X- Z9 q
- #define TCCHEN_SHIFT 22
) a2 m9 h4 Q0 @% _# _3 N - #define ITCCHEN_SHIFT 233 ?. w3 K% e0 k( L% m
3 C7 @& q1 J; [! d% C$ y; h* P- static volatile int irqraised1 = 0;6 `$ w- M1 r6 q
- static volatile int irqraised2 = 0;) Q: f6 p& u8 h. ?
- 9 h b$ W( I4 F! z* J& z% o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 k( \& ?0 M) _$ b7 b1 P$ J% \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; U! l+ \% t+ n& A/ W7 h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, A) g5 c0 p: G. N
2 a6 A' {& ~" Q: I& x- dma_addr_t dmaphyssrc1 = 0;
4 l9 c/ K5 R5 I) e/ N7 l$ v - dma_addr_t dmaphyssrc2 = 0;! G4 c( E) r* p/ `* v
- dma_addr_t dmaphysdest1 = 0;
S* v6 f9 x' L& E0 V |& H0 O5 n4 g - dma_addr_t dmaphysdest2 = 0;" }! O3 \2 ], x% P2 w0 n
- & Q; D/ \$ v! n
- char *dmabufsrc1 = NULL;
/ p& S5 s! ` I2 n8 X - char *dmabufsrc2 = NULL;1 {4 x# J. K4 V5 q$ [! I
- char *dmabufdest1 = NULL;' W& n0 @" Z+ U o# _( N" _9 ^
- char *dmabufdest2 = NULL;
; e0 [$ l% [* o: F
0 e" u5 M; N7 D. d2 O3 q- static int acnt = 512;
. y& A5 l0 a6 _6 m3 W - static int bcnt = 8;
0 \) w6 J( k1 k6 R - static int ccnt = 8;) K8 ?. g+ \8 l3 d0 C
X, O. a: Z" d9 R. c4 ]0 V& f6 ?- module_param(acnt, int, S_IRUGO);
* `# y4 m7 l' e$ _! @3 D - module_param(bcnt, int, S_IRUGO);" ~# P4 f; M7 p& {; U
- module_param(ccnt, int, S_IRUGO);
复制代码
8 G! ^4 w% K* \% z+ Y6 F. [3 j& U, g3 G4 |& {! j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 |& Q8 d$ H! T* Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- X, C7 y3 A; f" F7 C) `7 Y, M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- F! N9 e2 G+ e- h
2 Y1 {, M1 _4 i% Y" \6 e/ q a- o9 X. _' S- e& L( v
|
|