|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ v8 G, u7 r& ^5 M& b7 s0 s- [code]EDMA sample test application3 ~1 U: j9 O3 {
- /*5 l, G& ^$ o' P$ o
- * edma_test.c Y" @9 q, X+ g6 f1 k f, R
- *; p ]8 ?2 Q% k( e/ O' j$ o
- * brief EDMA3 Test Application
/ e2 Z& X' L: t* | - *! c$ Y+ p- Q9 B" v; _: \
- * This file contains EDMA3 Test code.- I1 `+ {' t* m6 n; g/ T
- *" i" W$ r& ^% S* t) V& D. _" V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. @5 s9 j. h, I7 S. k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 c" L7 `6 O D - * TO CHANGE.! O0 g% f: b3 |/ w" G1 Z
- *
* P7 @/ h+ r4 }' @' v' G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& i& ]( c- N& e3 B$ S6 M
- ** I2 k# V* n. K; k9 E/ a# M
- * This program is free software; you can redistribute it and/or* c! {, ?8 V, E3 U9 N; o
- * modify it under the terms of the GNU General Public License as
2 K* a* v0 d2 j" ?! {* H - * published by the Free Software Foundation version 2.
) @/ p; s2 R$ k6 m; e, {- `* i; M - *( E4 \# n/ l3 a2 e* c6 F' D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ y! C- }0 M8 E - * kind, whether express or implied; without even the implied warranty* v: H; S8 ~- p: d6 u: U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& W' o9 N' p/ e! C+ w% M; M - * GNU General Public License for more details.
, p4 Q9 p' f" B3 J8 W- u& r - */' ]! k7 r6 D, o/ I
- 9 M4 Y: H" t& v' t9 v& x
- #include <linux/module.h>
p5 i8 I: f; V: V - #include <linux/init.h>
/ B# J+ F: c' S6 { - #include <linux/errno.h>
, F) A* {5 B3 [! d% h) ~ - #include <linux/types.h>
+ O. m$ _/ u2 e4 F. n - #include <linux/interrupt.h>% @2 z: a% Z5 ]' g6 U& u9 `
- #include <asm/io.h>
! r' C e1 H* d! J! S6 a4 n - #include <linux/moduleparam.h>$ [3 k8 ^5 d Z7 O& F
- #include <linux/sysctl.h>
5 A& Q, m4 }; O& o; q! S - #include <linux/mm.h>: V ]$ g: Z0 E( V8 f8 R
- #include <linux/dma-mapping.h>" r8 k, z) q6 v% H# f" @
! B3 ~' V% P+ q8 N+ s- #include <mach/memory.h>: ?% y( q- B% ^" |# s+ F9 x& ^
- #include <mach/hardware.h>
6 ]0 M a6 I( l; q) u, w& W - #include <mach/irqs.h>8 X7 z0 e [; j9 h( P
- #include <asm/hardware/edma.h>
/ g6 J: Q- n, l7 X* @7 W: i - + S; g( T: K$ y$ Z! Q7 F
- #undef EDMA3_DEBUG
) b9 ~% s, m0 e4 c9 q6 O6 @ - /*#define EDMA3_DEBUG*/
. o$ }0 `+ b0 K4 u# U
3 ^; r7 l3 {: z4 R3 N- #ifdef EDMA3_DEBUG4 y* J- N- u. C8 Y' ~/ C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 a- _) U$ V6 y6 T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, K- E1 n* O, ^9 ~0 Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' s) Q' `1 s. E1 p9 X0 b) ?1 k# o6 v7 J
- #else9 m8 [3 v! f2 t4 C: m
- #define DMA_PRINTK( x... )' ^0 @. Z( C( F- t
- #define DMA_FN_IN0 V0 C9 v- g+ s, Z3 X
- #define DMA_FN_OUT
, K, c+ U' A/ X6 t8 J - #endif
8 [: C1 s3 d1 v9 ]/ n9 J$ w0 E
1 {- o) W! W) R% D- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* D7 o8 ?5 Z* f) [; ]: A2 W
- #define STATIC_SHIFT 3+ a1 [& V; D" B
- #define TCINTEN_SHIFT 20
B2 {) Z, N# {1 V. G - #define ITCINTEN_SHIFT 21: Q |! c) U9 A0 U2 K2 W e' S
- #define TCCHEN_SHIFT 22
! D) F+ Y! l- G - #define ITCCHEN_SHIFT 234 T" e# k3 v. h K% l8 ^
- 6 Z# l- t' e3 W7 I+ d8 S$ O9 |
- static volatile int irqraised1 = 0;( [# s/ z: W9 @
- static volatile int irqraised2 = 0;
- L' o/ t7 h, ^. I - , o- \! H9 |: a& w B6 X* f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! j0 S6 ?( M/ \2 P' |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* v. c" g. m& h+ p' R" c: R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' u. G( V: B3 ]+ S$ r9 K
8 }- F1 \; R. M! J# _' l; R- dma_addr_t dmaphyssrc1 = 0;( |* y' i' C; P& E7 i e8 e
- dma_addr_t dmaphyssrc2 = 0;8 U: c1 f! j: @/ u: V' Y2 G6 P. i
- dma_addr_t dmaphysdest1 = 0;
3 l% y: p, j8 r$ Y2 P. n3 u/ P - dma_addr_t dmaphysdest2 = 0;
6 I- z* A9 S6 j2 |6 q' a% J
6 ~, b, b3 y% m* T- char *dmabufsrc1 = NULL;
& `# G7 f1 W f5 }5 C$ @4 s - char *dmabufsrc2 = NULL;) e1 w. F6 [5 k: I
- char *dmabufdest1 = NULL;$ M3 `9 ]! C6 I# a! H
- char *dmabufdest2 = NULL;+ V9 O+ _* C2 a A
- $ w6 u" e* T: e( A0 y
- static int acnt = 512;
. x8 s( O# Y- a: F - static int bcnt = 8;4 J1 E u' ^0 q+ M, Z# \, j( s* ^
- static int ccnt = 8;9 m \0 _2 Y/ x- ]% t6 x% _4 k K
- 9 A8 @4 I% P2 e& ]' y4 _: w
- module_param(acnt, int, S_IRUGO);
& v G. ?9 `3 A - module_param(bcnt, int, S_IRUGO);
% g( p2 R" o- l* R - module_param(ccnt, int, S_IRUGO);
复制代码
% b) z! Z. I- l" E1 R) L
( n, h! l0 l. r' Z8 q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# w2 l7 p' Z$ h; J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; ~+ M8 p% K. l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ p3 z: Z& B; s8 |3 F
3 |$ j, B3 y& p- l
/ p S! C, k! z7 m5 |4 K |
|