|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - h' c: h5 Y0 C' h
- [code]EDMA sample test application U7 h' o1 A1 o1 {! l' o
- /*! x( c" f. O4 c3 f& e/ B. @- j( _
- * edma_test.c
" c# H# M/ b# a6 d2 U; O2 U3 ? - *
2 m9 V: r5 A" C* Y" M$ X - * brief EDMA3 Test Application
/ j0 l5 `- O) V5 G& S+ o - *) i3 d6 i3 h2 P& N4 r, e; Y! f
- * This file contains EDMA3 Test code.; ^9 ]# k0 T: |1 ~$ ]3 L7 N3 E
- *! z% E( W$ \4 t. \% C; U2 h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ C1 K' g0 I1 s" r0 y* q" _' E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT \) P9 b- O7 y( @, n
- * TO CHANGE.' u3 Z4 S9 o. U3 z
- *, w1 M% z* N6 E5 l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# G/ Z( |$ a) l: D! D) E/ N
- *; B' r5 M1 }# c! Y, q
- * This program is free software; you can redistribute it and/or" o$ h l: y. e
- * modify it under the terms of the GNU General Public License as
1 B( _( o. z: f - * published by the Free Software Foundation version 2.
8 d6 m( m& F" d) W; L- b - * H2 p3 }* Z; C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! `* Y# ]; a2 |7 K* d
- * kind, whether express or implied; without even the implied warranty+ q( Z1 ~9 W0 L$ `# z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' p+ n% P( a8 p: t( a |0 N - * GNU General Public License for more details.
- z4 I9 V. Z" F9 U - */
1 ]: G: [' O8 a* V s5 }
$ _( H, G; R4 s- #include <linux/module.h>
7 D, Y* t, R- Z. y0 x& {+ N - #include <linux/init.h>
1 G2 e$ G5 B+ K' k! F( C8 ` - #include <linux/errno.h>2 s6 j" e3 E' X: Q% q
- #include <linux/types.h>
' T1 P. U+ P" ]: p5 I% W% m! ?3 X8 i6 h2 ` - #include <linux/interrupt.h>
6 z4 \ `7 d' `5 [ - #include <asm/io.h>
- i Y$ }$ P# X0 e9 I5 f - #include <linux/moduleparam.h>0 |* ^5 G$ L: q0 O) O0 N
- #include <linux/sysctl.h>8 x( x N; f; \4 k( k
- #include <linux/mm.h>
! k6 t8 f! S% k+ H+ z+ h. d - #include <linux/dma-mapping.h>
1 n( n S8 r6 _) f2 [+ [/ D" G
2 j+ w" r/ G( Z- #include <mach/memory.h>
& I& ^! j) o6 H2 ^, b6 `3 R - #include <mach/hardware.h>
' n( F1 W! l8 t& N8 e9 K3 [0 ^ - #include <mach/irqs.h>3 c( v' e* T: D4 h( G' ?; [
- #include <asm/hardware/edma.h>4 c8 n# F: H' a! J/ `6 \/ h
9 S( V- V y' X+ m. S- #undef EDMA3_DEBUG% V6 P) y% \8 H6 b9 O1 @. n2 @
- /*#define EDMA3_DEBUG*/ z& {( `5 V# p1 l5 C
7 a8 F" N) `8 I0 P- #ifdef EDMA3_DEBUG! n; G# t6 F2 N+ W; N( u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% \ J5 P) F# Y) Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* F* ^" I, h ?+ I \6 T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 h8 G" V8 t L; o# ~" L2 P( S, e2 i - #else
0 ?% X: S( Y9 P4 {5 @; V' ^6 A+ Q - #define DMA_PRINTK( x... )
1 y( W1 ^- Z5 A, T% c2 f T. { - #define DMA_FN_IN$ j; f5 E) C4 f6 {$ A/ Z/ D6 {2 H
- #define DMA_FN_OUT: V5 i1 S5 ^4 Q* C
- #endif
) i" Q( f9 `# ?/ P& Y0 e
& z! h W, t6 C+ C# r6 h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# P: E% u% [5 V' e) b - #define STATIC_SHIFT 3
, S9 J0 d' M: @/ J* X - #define TCINTEN_SHIFT 20
s J ?) M2 C, J - #define ITCINTEN_SHIFT 218 M! Z, }3 R" c% F
- #define TCCHEN_SHIFT 22
5 ~1 d- v# ~3 D/ O0 s4 j8 `3 i - #define ITCCHEN_SHIFT 23. l( z4 S. w( G& J+ k
- O c. c$ |' @' ?
- static volatile int irqraised1 = 0;
7 r* k6 }( u* p6 f( k - static volatile int irqraised2 = 0;( h6 \2 s8 ]( v! n* a. ~
/ _6 P' q5 \. t0 D" _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 V* N, p5 v7 }. T0 h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ?: _1 B* z6 z7 Q) H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" G( |" J" t3 ~& W4 W+ {. v* R
- R5 ?% n: y/ K0 n( @, \, g9 f( r/ l% O
- dma_addr_t dmaphyssrc1 = 0; J0 Y; q1 i- L* {. ~2 K$ E6 T5 Z# _' f
- dma_addr_t dmaphyssrc2 = 0;
, x. Y2 M- c3 q- E) H2 @: } - dma_addr_t dmaphysdest1 = 0;" i1 X/ L& W/ ?
- dma_addr_t dmaphysdest2 = 0;
- t' |" x" }( p# F - 6 q8 T- v% S7 v8 K B. T
- char *dmabufsrc1 = NULL;$ Q. ]/ s, {0 ^" P- a
- char *dmabufsrc2 = NULL;
7 {+ H( }/ Y' \- n3 o - char *dmabufdest1 = NULL;% g( S; h+ N9 @% }# d; z
- char *dmabufdest2 = NULL;
) ~' X/ F6 a* @4 t7 p' V# b - t' F2 ^' K. M% f9 N/ o: o
- static int acnt = 512;
. Q) c. d8 \8 x) R - static int bcnt = 8;
" u1 x- f& \6 f0 f8 v, v4 k1 M - static int ccnt = 8;4 e$ l9 I! }' q+ e0 {% x
- + Q8 l; C9 N. \
- module_param(acnt, int, S_IRUGO);& q; K0 @" E( ]( Z/ [' M' B
- module_param(bcnt, int, S_IRUGO);( n" ~! N. z* M1 j5 q0 a. I
- module_param(ccnt, int, S_IRUGO);
复制代码 % Q+ N! P6 p4 O5 h
2 [! ^% u/ @( L, T5 u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& S7 l3 Y9 q& narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! n9 h& p) W9 D4 C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! O8 P; s! u" h: \
. ?! O* H, O9 O0 g; r0 a8 R$ S$ _9 a- M0 Y& O
|
|