|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 C' A. R. h3 _6 z3 Z0 V- [code]EDMA sample test application
; ~( b" d3 Q9 f& u N - /*4 C; r0 Z8 q# ^1 _
- * edma_test.c
5 f' _; X5 l$ J$ A - *$ C' b& Q$ K0 M5 p
- * brief EDMA3 Test Application) p0 R0 V6 F: e& R) @ T0 a' U
- *
3 ~5 A7 i1 b) u& L: G/ T; k) y/ O - * This file contains EDMA3 Test code.# ]' A3 ~+ P& K" a% \! h$ H
- *$ T3 A5 d+ O0 g* ?: v4 d" M/ X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ L& O; t4 D! T5 P- u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# p0 q- |' k0 T" T0 n
- * TO CHANGE.& Y: T% J! e, m
- *
5 _: r2 @( j2 H0 D& V* i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 p) D, ~$ u/ e1 S - *3 Z# T( X' T5 E$ o* A, b
- * This program is free software; you can redistribute it and/or" i; w! j2 q( m" ^
- * modify it under the terms of the GNU General Public License as3 M; K c# I+ s$ B& l! ?+ U4 S* F: z
- * published by the Free Software Foundation version 2.+ ~5 F- |& l" E$ ~9 K! Z% P8 K, Z$ G
- *
- J: {, ]- i6 R( r. w3 [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! Z P1 s& C, J; Z
- * kind, whether express or implied; without even the implied warranty
. T% H7 ?% H( x2 P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 V, e; Y- y/ G) j - * GNU General Public License for more details.
5 Q0 n* m1 j; L; g+ `1 H) J8 \ - */
6 h# h& C. ^2 t, q3 W0 c5 f$ z - 1 | n3 c7 ^+ W* O2 S; ^
- #include <linux/module.h>
1 q j$ ]7 H& n, z( \8 y, | - #include <linux/init.h>0 H& r7 o4 X! N8 a
- #include <linux/errno.h>
% a# m/ w4 S7 l& V+ @6 E - #include <linux/types.h>' i/ t4 g2 P) O n- Y) C
- #include <linux/interrupt.h>
/ Q9 g, q+ V6 Z6 t2 H - #include <asm/io.h>
) N7 ]* S. B: {% ~ - #include <linux/moduleparam.h>
0 q' G. E9 ?8 g; ]& ^" E - #include <linux/sysctl.h>
! c3 {& P' D# O9 z! f* \ - #include <linux/mm.h>
# c( x0 Y- l F2 X W, M" k - #include <linux/dma-mapping.h>
b) {, u1 p2 F& a) ~9 C. ?0 m4 c& A - ; `! Q0 ^' j. A _
- #include <mach/memory.h>1 C: ]6 N. P" P: A$ W
- #include <mach/hardware.h>
j) z: s# A7 j2 U' y: O0 f - #include <mach/irqs.h>( C: a$ p$ Z" L; H
- #include <asm/hardware/edma.h>
+ F3 r% A7 A5 X3 r0 I* ] - . E8 F) @, r E* y
- #undef EDMA3_DEBUG X& _6 M( h& p2 _" |1 x
- /*#define EDMA3_DEBUG*/; ]0 F, `6 o! f* y+ p! S
- , T2 l7 y( @! P, d" R+ G, y# L
- #ifdef EDMA3_DEBUG( n& Z" E$ V+ M: e- |: ~6 m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 P) u: {7 H' ^1 v f/ E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 Y. V% E" w+ t- h/ |; V* Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ t) L6 t/ t7 J0 v - #else2 G# ]3 p, d. y8 J
- #define DMA_PRINTK( x... )
4 \2 Q" E/ U' g- c* i% a/ G - #define DMA_FN_IN
3 q9 I: `; k! v2 ~ - #define DMA_FN_OUT! K( X! F4 j4 C, J, K. @! y
- #endif/ r1 P' j, U' j4 p1 q
7 c* d1 [3 W/ R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ f0 d3 i5 \& |: M: s8 I - #define STATIC_SHIFT 3
! G$ r. |2 y, Y$ [2 b" m - #define TCINTEN_SHIFT 209 Z, ]: O' \& K' \
- #define ITCINTEN_SHIFT 21
- @ E- M u0 @2 b% h% Z& b - #define TCCHEN_SHIFT 22" e* l- v* ` l3 w9 n! k) H: y
- #define ITCCHEN_SHIFT 23
5 k+ \. q. L* D0 ~7 t7 r
! v1 i+ x9 H$ f' l+ T. a$ z" H- static volatile int irqraised1 = 0;
/ d u( S: r2 M+ @1 r7 B - static volatile int irqraised2 = 0;
& Q4 v# y, n ~/ k
9 p4 L L+ N7 E9 X) I! s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" S! N+ E+ D- B& } q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* D& s0 ], t/ ] H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* J( I0 x( y5 X% o
4 n1 x" s' j! m, b% A- dma_addr_t dmaphyssrc1 = 0;
" F$ h! R" I K - dma_addr_t dmaphyssrc2 = 0;' W0 n5 U2 F* D3 i- q3 C; Q9 D0 \% S
- dma_addr_t dmaphysdest1 = 0;+ y* `" X7 |- r% s1 y) R8 g
- dma_addr_t dmaphysdest2 = 0;: n% r. @ Z% w$ u, N
- ' x4 a9 Y4 c4 |
- char *dmabufsrc1 = NULL;
7 T& {* Q& W: m# q& _7 X/ g - char *dmabufsrc2 = NULL;/ c9 q9 }5 p. J, b: f8 |4 f; o
- char *dmabufdest1 = NULL;4 m! B3 s5 D1 Q6 } H; ]
- char *dmabufdest2 = NULL;. w' v7 ]; |5 p8 O: g
5 D$ P) a4 ?: b8 q2 `, s- static int acnt = 512;
8 s% M6 X1 p' E: k - static int bcnt = 8;
! O- E, k5 v8 R& \+ h& l1 v - static int ccnt = 8;
- D% _% X$ ~6 e7 N) \+ S - 4 V" `* \! o- O2 _6 y- [
- module_param(acnt, int, S_IRUGO);
; l. [6 W2 j3 O n - module_param(bcnt, int, S_IRUGO);
) J" m7 c* w8 K& c9 E& y# ~ - module_param(ccnt, int, S_IRUGO);
复制代码
$ Q3 n( q9 c @( z2 r
$ l+ {& ~/ S+ o6 U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ a% w* b: D( T. J; J% b5 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 g/ O3 V2 B r. H0 W4 {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; z7 ?' p4 r: F+ G+ f: ~% ]" m0 W, \# z% Y
) ]" Y6 C' D, p3 f1 B# _. ?
|
|