|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ m5 ]& w( C% _; ~, V/ H* C# P- [code]EDMA sample test application
5 j6 X, U4 A1 n9 w: {* S0 k% p - /*
. A5 z/ ]+ V. T: m! a# k - * edma_test.c- |$ u0 D6 Y( P" z2 ?
- *# [( l" B/ C, n' B
- * brief EDMA3 Test Application
8 q: T, D ?. d& Z; M - *- v3 E. N, `% a& L4 k9 ~
- * This file contains EDMA3 Test code.; o/ N. N: S: W9 p* E
- *2 r5 s2 x- c" W$ D7 l- x* r3 y) n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" b- p! u/ j: W8 M9 `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' T: E$ h3 v* G; g
- * TO CHANGE.9 I( G& @0 [, Y* M
- *1 t. @7 m, z( q d0 x6 u% C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" p, u* `% S9 e/ U
- *( d# v9 U6 Z. S3 V/ @
- * This program is free software; you can redistribute it and/or- B& ]0 S( ~* o4 R( }
- * modify it under the terms of the GNU General Public License as
4 [+ g: n. y0 _ - * published by the Free Software Foundation version 2.
/ X3 m/ G: v2 g - *; P8 L& m1 o+ N$ z) [0 W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 {: {3 b+ `" K6 d6 q8 y( M( T
- * kind, whether express or implied; without even the implied warranty& ]$ Q0 q- j& @7 f& ]0 v# b0 `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- X6 U. \4 x v
- * GNU General Public License for more details.
+ q a) p, V# }, Q5 k - */' }5 g( b7 S$ h( w( G8 K
% d+ V+ M5 b$ O- #include <linux/module.h>
" u+ X% v( M+ E( U% i3 d, d% y - #include <linux/init.h>9 ~+ l8 l# b9 D- f& R/ L% L7 P
- #include <linux/errno.h>
$ h9 l+ x) ~3 t/ h - #include <linux/types.h>
- f6 d, x) e8 |0 K( q - #include <linux/interrupt.h>
; I7 L* R% B6 H0 P - #include <asm/io.h>+ z* Y# m1 {* ]& A
- #include <linux/moduleparam.h>
8 @% C1 W o3 Y4 ]+ E5 ]/ ` - #include <linux/sysctl.h>5 p5 S; U% l% N7 |2 Q3 s
- #include <linux/mm.h>; P/ B; Z! _4 O/ X! z7 M
- #include <linux/dma-mapping.h>- {5 T) ~ ~8 R5 t
% c" h8 H" v- o2 Q4 J- #include <mach/memory.h>) u& J5 l7 d% o- W9 S- L. {. E
- #include <mach/hardware.h>; y$ d' \7 i6 h! u( G
- #include <mach/irqs.h>
r& g7 n7 T: v w - #include <asm/hardware/edma.h>. f; Y- j/ `( z! y; \& H0 v0 E3 d
- 5 T% K ?: M1 T9 F" D/ Z) \
- #undef EDMA3_DEBUG
5 o" i% S; G& y* I. _, y, Q8 w - /*#define EDMA3_DEBUG*/
' V* _* C8 o2 i2 X2 [* F \
" ]5 [" [0 k; I- #ifdef EDMA3_DEBUG% V, M6 r; u# x8 N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% x1 k2 u. {9 T0 ]* k5 k% z; u1 |$ X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 h" e. e0 F5 \* B* Q- x2 ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 K* Q/ X9 ?( K; a0 `
- #else
/ H& B8 r8 |- O( m3 R3 e3 U, G - #define DMA_PRINTK( x... )7 [# H) b# L: A$ I; d7 T" l
- #define DMA_FN_IN- {" N7 T b( L' p7 Z! _! X- K; J
- #define DMA_FN_OUT! {. F: U& V& K( K+ Q- x$ ^7 g% G! A
- #endif/ N! @1 A4 m8 t& x( P3 |
- 9 w( t. K" O# }$ ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 Q! a. K6 ?3 j! A - #define STATIC_SHIFT 3
& C. n8 x0 K7 I/ V$ p - #define TCINTEN_SHIFT 206 [8 u( e) g V( O! ? Y% |
- #define ITCINTEN_SHIFT 21
; F" L& U; t- o! Z6 L: y" D - #define TCCHEN_SHIFT 22
3 X% c9 g& F9 K7 X5 \% K3 n% B - #define ITCCHEN_SHIFT 23' u) O0 L u& G" j# h n2 l
- & o' m& N# i% w! d9 X3 J9 s5 J; l
- static volatile int irqraised1 = 0;
; l. B" _: \. \$ h3 V - static volatile int irqraised2 = 0;
" A: l7 U( y5 F- `1 {2 U f; j
+ y3 ?$ X7 ?7 C) V: D/ ]3 e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 M+ y' Y' \1 U8 b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); r9 v3 }! z. E6 z) t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- b ` j* t4 R4 b" s) S
2 f- K; L7 }1 c% k3 g4 y( y- dma_addr_t dmaphyssrc1 = 0;2 @& ]# |5 v; k0 I3 H1 h
- dma_addr_t dmaphyssrc2 = 0;
: D' w1 `* k5 v8 ^# L - dma_addr_t dmaphysdest1 = 0;/ _' V) I; k& g U
- dma_addr_t dmaphysdest2 = 0;4 U W9 a! {" i
- ( D5 M" O( j- ~
- char *dmabufsrc1 = NULL;3 D$ P* ^# @0 u0 E% N
- char *dmabufsrc2 = NULL;7 p# Y5 R3 B, K7 @ {8 d
- char *dmabufdest1 = NULL;( U& H9 y- v" s1 p; s' `
- char *dmabufdest2 = NULL;4 G, c0 i0 l' U/ L
% \0 v' }) M/ J! m& X* ~- static int acnt = 512;
5 z$ f. x _! ]9 |2 O" [ - static int bcnt = 8;. B" [+ S) E0 q9 e& I( [9 [
- static int ccnt = 8;7 X* N( f" [+ U5 u, X; U# P
. V, }; K: I: P2 x- module_param(acnt, int, S_IRUGO);/ W) A7 u9 P/ L
- module_param(bcnt, int, S_IRUGO);9 O( M, k4 x9 R0 p
- module_param(ccnt, int, S_IRUGO);
复制代码 t; s" ?. R. }! P: S! n" l4 U
) j* n( X* T+ s8 w& q, p* g6 D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. E# j8 t0 L: S; _( b+ Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
|0 f4 i+ Z8 j, g; F* @" D2 X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 N7 v* J6 D% L& c
9 h F! f4 `) \1 W" \/ p
) G' {/ a$ } W' [
|
|