|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; F% K- f9 r2 j) E9 N, m
- [code]EDMA sample test application
4 z6 X( t! L& [( l$ E6 t - /*
2 Z+ P4 G4 T" l/ | - * edma_test.c
$ m6 e8 p3 F& E/ G4 Q8 O: a, Q - *' Y' |! `7 J& b: N* @( |' S) k
- * brief EDMA3 Test Application. P/ d' o6 n w% u, U8 i
- *
3 {+ U7 h2 D: f' ?# }. _3 Z( p8 g - * This file contains EDMA3 Test code.& ]+ y. u8 ?) d
- *
# J6 M0 C' e& H& L/ D8 S4 ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, z4 n# h- A0 W$ u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 R k; X- Z2 d+ _9 e& y" M
- * TO CHANGE.
1 B* T$ L' d% U; @ - *0 o9 M) U6 l( O8 K X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- k: @1 D9 f+ i# e - *8 z0 P# O, a; u$ k) R, `
- * This program is free software; you can redistribute it and/or
Q2 |) \2 j1 x% o - * modify it under the terms of the GNU General Public License as
. U" \9 n+ U* z. x - * published by the Free Software Foundation version 2.
0 W+ a' k* P7 N4 K' N - *! l( ~9 m' f$ `" r9 B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' |, U6 v) D2 t4 {: y" V1 g: Z - * kind, whether express or implied; without even the implied warranty% `2 @( ~: b9 A5 y) {* V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& q: w9 s* w, g2 L) i
- * GNU General Public License for more details./ Y: U9 a( F( s$ r
- */
+ [% _8 G9 z2 E4 J4 X, C. {( `3 E) x - 3 F% [% k3 t: _; Q1 x$ G# _, U
- #include <linux/module.h>
/ {, u {3 F9 Y# f- | - #include <linux/init.h>
" S$ g0 ~' o; ^7 M8 G/ I" s S9 l - #include <linux/errno.h>- d) p# G P' w
- #include <linux/types.h>
' K5 x% L2 w/ C3 V# O- O# T* P0 c - #include <linux/interrupt.h>
; S( M4 o* i6 |5 Y7 j - #include <asm/io.h>: {, ?" u: l6 `# p. m
- #include <linux/moduleparam.h>' p0 b0 x( \& j6 |% S/ r/ [
- #include <linux/sysctl.h>
- l2 o2 s/ G2 h- u7 a# X - #include <linux/mm.h>; l; a* \. b0 B+ y. m* y" A
- #include <linux/dma-mapping.h>
# c5 s4 @7 \: i% y/ w" {
0 c, _7 Z* f2 V$ u: _! x- [- #include <mach/memory.h>
* Z2 L; J' G. i$ c - #include <mach/hardware.h>0 d( y, K2 K# J% b$ y
- #include <mach/irqs.h>. n* l9 Y5 S+ ^$ Q4 y6 ]6 P( o
- #include <asm/hardware/edma.h>, F5 q0 \. e, l6 _9 s3 B% ]
- 0 C% n# X) _, W: k
- #undef EDMA3_DEBUG+ Q4 }7 H5 Z9 c# D
- /*#define EDMA3_DEBUG*/
3 [; I, A: P6 ^$ d+ w! t o; D - ' z$ R. v" F2 ]- c: q0 y* C
- #ifdef EDMA3_DEBUG" k) ~9 M8 N4 k! l$ \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) w+ F. M: \! V8 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& b6 N* i* Y8 O: g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ @8 ^ h3 j2 |* |
- #else
4 M+ |7 Q1 y8 E: M - #define DMA_PRINTK( x... )& ?" M6 K! x, T1 G7 B5 @0 l
- #define DMA_FN_IN
9 U- g: p; x9 ?6 F6 T4 h7 t - #define DMA_FN_OUT0 O' p. U {- i7 `1 w3 L" S% s
- #endif
5 f6 l- X6 F+ k; a7 n - L9 M$ N+ D B8 h0 u, P" }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 Q8 s$ K( n' v: Q. K7 A D
- #define STATIC_SHIFT 3, r. H0 ~& m9 Z& U, k! M- f' R
- #define TCINTEN_SHIFT 204 w6 H" e: P+ ]; m
- #define ITCINTEN_SHIFT 21+ O" N1 V# G# ?+ w. [
- #define TCCHEN_SHIFT 229 G7 X, L' ^& a, q/ r- x6 z" n
- #define ITCCHEN_SHIFT 23- ]8 e. r% A. l' N: h, D
- f+ ^0 H* ]2 m0 M0 H7 q i- static volatile int irqraised1 = 0;
2 F- X- ?( K! k+ x$ A8 q - static volatile int irqraised2 = 0;
+ E' a/ e4 h% d - 7 C" k1 a/ A% D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 \8 @/ b# I- X& j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) U% Y4 N1 j$ W4 ~- Q) G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; n. E, T: }; b4 p8 d6 \1 D
/ g2 V1 J; F+ Y `$ W- dma_addr_t dmaphyssrc1 = 0;9 E& O8 o# s: k0 \! |* Z; i& Q
- dma_addr_t dmaphyssrc2 = 0;% v7 d+ R3 `" {/ G
- dma_addr_t dmaphysdest1 = 0;
3 r( L; y/ v+ W$ h" O - dma_addr_t dmaphysdest2 = 0;
) J+ l3 Y8 N; v& v/ r! D- J; L
1 h5 p+ Z+ P+ v) F' ^- char *dmabufsrc1 = NULL;- O$ V/ V2 N6 @# _+ t5 k
- char *dmabufsrc2 = NULL;
3 r% G1 S& ~7 x, L4 a. k' ` - char *dmabufdest1 = NULL;6 m: F, R. I' t/ k" l
- char *dmabufdest2 = NULL;
# C! V% n1 q: i
$ z5 C/ W! j+ I: j- static int acnt = 512;& e+ C) q' r( b# ?2 L) P
- static int bcnt = 8;
/ V: e% [8 n1 a+ m/ K - static int ccnt = 8;
; Q8 t0 L. U1 o" w3 A9 |+ s- Z - 4 b6 r% G. {8 C/ l
- module_param(acnt, int, S_IRUGO);
- s" h* _' V( e$ B; l - module_param(bcnt, int, S_IRUGO);
. c* X% Q+ S* B - module_param(ccnt, int, S_IRUGO);
复制代码 ! y/ K. C/ T6 X& B
& s& c% E8 L, _) c$ z* b* k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% ]# @5 j% C# w2 A k7 n( c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ ~' y+ s$ L/ y: T+ |+ T/ |( r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 Q2 P. P" m. Y8 R% O
8 m3 E: }5 o3 W; v- A: d" A: y! n1 I4 C, {
|
|