|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) K1 e5 F9 T% B* g# w; c
- [code]EDMA sample test application" _+ s4 r# ~8 O8 g
- /*5 @& \, E2 P) C. `# m
- * edma_test.c8 ^6 Y/ Q6 t$ N- S1 ~' R
- *$ j1 @1 S* ^- ~9 T! h# R
- * brief EDMA3 Test Application& F0 p2 S" m. J r
- * ]$ y j5 b- z) S; D6 `
- * This file contains EDMA3 Test code.2 [8 h6 R8 i: O7 E/ F" M
- *
0 R8 n w% u: ~5 H+ ^: h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" a7 @8 R5 v0 |8 x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& A: v% ^4 X0 h. @! W2 k5 @8 b8 P - * TO CHANGE.
. O& W. q% Y+ P! O/ H/ J' `% J# s - *1 q1 }# J! F, s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 w. g) F5 e8 b$ w- u5 e - *+ }# L; i; \; n1 \
- * This program is free software; you can redistribute it and/or
8 ? u4 j! h9 F" J; o f5 p+ x* h5 v- O - * modify it under the terms of the GNU General Public License as9 s% P2 b! c8 Q( Q: \, K
- * published by the Free Software Foundation version 2.- t& @# j6 a* @ M* ?& p7 b1 \
- *
& B, Y( p6 |3 m% ~1 y+ ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 v* M1 c* g' ?3 t
- * kind, whether express or implied; without even the implied warranty
" [5 B/ @) \0 ^+ ]" Y* X4 Q0 f; Z) n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 \% }* C; f2 [, `# \: W: y) R
- * GNU General Public License for more details.4 Y. j- b3 ?$ O; U- w
- */
0 ]( O0 d) i6 V5 f6 [7 G - 3 z! e. _. S7 Y& K% J8 `
- #include <linux/module.h>& s1 p+ a/ V2 d0 {9 K' k: g
- #include <linux/init.h>6 x+ d: F2 i, Z
- #include <linux/errno.h>9 |$ C6 V; f; K5 X" z& Z/ Q) c
- #include <linux/types.h>% W- b7 u: n! p' x( p& G% N- v
- #include <linux/interrupt.h>
) @% B, ^0 @3 B - #include <asm/io.h>& Y+ w/ P3 H. g$ W
- #include <linux/moduleparam.h>7 H0 l. U; t: W7 b( c
- #include <linux/sysctl.h>
3 M) p' H [0 j- h - #include <linux/mm.h>
- o6 c1 n$ O. W7 G+ p% f - #include <linux/dma-mapping.h># O. `/ W2 r( w
- ' W1 D! o% K: M! ?
- #include <mach/memory.h>/ v, R, o# ~! `* B
- #include <mach/hardware.h>
0 {) b) F* z: R: Y - #include <mach/irqs.h>( w8 g: }5 z9 i
- #include <asm/hardware/edma.h>- @: B3 Y: G3 }# t9 T$ i1 o$ \; s
- * l# A P- M' @2 Q) o: g2 ~8 U
- #undef EDMA3_DEBUG+ n2 z; R9 q" ]% N+ P9 E3 X$ b
- /*#define EDMA3_DEBUG*/
- y3 f7 i; H- o" l - 0 U! V* O. N% m
- #ifdef EDMA3_DEBUG
* v* z \. D6 L& L3 y' O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ g/ P. F, |! s. R* t% u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) ^; |( _- U9 O) z$ K, u8 @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 N1 U: ` X9 z! e5 o& j9 v+ D6 k
- #else; Z- O# z' \$ \/ b; l) ~* f
- #define DMA_PRINTK( x... )
2 t5 i6 S7 d% k4 p. G - #define DMA_FN_IN
" N5 N+ }* r4 W9 g( m) y4 ]5 V - #define DMA_FN_OUT; M- q* Y# f. a
- #endif
, N% K+ O7 d7 e" T6 h) z% v) E
4 N M0 V& o: I: E# w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 q u1 t' F2 B# ], M - #define STATIC_SHIFT 3
" [9 Z# Z- P- p1 f - #define TCINTEN_SHIFT 20# f2 ~9 h- T+ @. m
- #define ITCINTEN_SHIFT 21+ O& Y c0 {$ d
- #define TCCHEN_SHIFT 22; J S! o1 I7 J! e5 P: E
- #define ITCCHEN_SHIFT 23: [" l5 @: k$ ]
- : @3 }7 s. {* P2 R/ i
- static volatile int irqraised1 = 0;' j/ V. _; \8 w; _; a/ I
- static volatile int irqraised2 = 0;
. T; A4 z( y! V5 p - + T: n- `, f0 G! G2 s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) e: T; y, V7 p0 W f# ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( M; Z* B0 V& [% E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 F2 @9 i+ U1 k# x' o
- * c2 n x- _0 h
- dma_addr_t dmaphyssrc1 = 0;
$ N. N) k1 e1 m0 e/ E - dma_addr_t dmaphyssrc2 = 0;
5 T( F9 D ?" Y1 H! r. K - dma_addr_t dmaphysdest1 = 0;
( ^4 `6 Q# x" n, c* l - dma_addr_t dmaphysdest2 = 0;
- O- X6 \& ], ^7 A
$ U( [" H$ ^$ W* j- char *dmabufsrc1 = NULL;3 ~6 B; ^* W) F5 k+ v
- char *dmabufsrc2 = NULL;# e5 C6 F/ C* W- j( l- [
- char *dmabufdest1 = NULL;
I1 c9 w( S6 G, J% M - char *dmabufdest2 = NULL;
% o' A2 }4 Y5 `/ w* t5 g+ N
7 n6 s3 x4 K5 I9 Z& f- static int acnt = 512;# r Q( P3 A, e( T) j
- static int bcnt = 8;
- g: X9 ]* c S6 H2 d - static int ccnt = 8;
0 |5 F. `- W5 I" r9 t7 a+ q - 5 b6 t/ O5 H$ b5 g+ p: X" Q( j
- module_param(acnt, int, S_IRUGO);9 \0 v: H1 ~( F$ F7 I8 _9 A+ S4 {6 l v
- module_param(bcnt, int, S_IRUGO);
" h2 u& [( }6 F+ h - module_param(ccnt, int, S_IRUGO);
复制代码 # P4 } ?0 S3 E( \7 J3 F
2 [1 _2 p+ |( h0 z1 S# I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. C# e4 n7 H: J+ G7 D0 ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
I4 {: E% F+ c3 V# T) C0 W2 I" ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 x' z% n0 a( W' Q8 a4 U9 _; E0 o3 s
' X3 R* E/ t. A+ F a+ V4 h7 \& s6 ?& [' @2 v0 n( b
|
|