|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # H- f$ q+ G/ C8 t& q9 w4 i! K
- [code]EDMA sample test application% k3 h3 O5 L+ k8 x4 C, O) I
- /*5 r5 \& k9 a5 ~ h' j, Z
- * edma_test.c
5 ^: p7 p0 D& }! @( q. _ - *6 P% W* i( g. Q6 ^% h
- * brief EDMA3 Test Application
7 Z# w+ I2 L5 X1 i( [, Q% R0 e. G - *, P2 L% B) h7 A, C& `( f# K
- * This file contains EDMA3 Test code.
* z# Q' T* D) h8 u2 R - *& B& g& S# H" @0 u: f# }1 k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, V4 S* d0 r4 C6 H# L3 } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ e# d2 n) X6 X8 y0 ]. U - * TO CHANGE.
1 J9 v: `8 N# o; `$ X: v4 x8 B - *
3 h6 T% U! Z% z, t: R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- L( a; ]" D* A( u
- *2 B. m# J3 S: f, P8 k( H) M
- * This program is free software; you can redistribute it and/or1 J0 c) K9 X x- p. b+ N
- * modify it under the terms of the GNU General Public License as
) \' c8 W3 g6 g4 ^$ F' x - * published by the Free Software Foundation version 2.* x8 l- Q$ \3 d' X
- *: | `: e6 Y- G1 i9 H6 o9 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 Q6 {* F- u9 A! B( s( C' \ - * kind, whether express or implied; without even the implied warranty
2 Z6 d4 R) ~! P- } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. z' p7 [! Y0 {2 S5 J% {, K& g: z1 S; S - * GNU General Public License for more details.+ T) ], u' E+ I. h* r0 {
- */
- e+ @% [# E9 I4 s) X6 ?
. l, }' N4 Y: {! }7 k- #include <linux/module.h>
2 m0 R3 K% t* M. B' [ - #include <linux/init.h># C+ M4 u+ f! u& ?* k. z3 d, H" M) d
- #include <linux/errno.h>
3 V2 {7 M+ k# U9 [( v2 g- x( b: S - #include <linux/types.h>& v$ y6 T8 I! A7 i; A' \3 E
- #include <linux/interrupt.h>9 H$ q& X: X, @. K
- #include <asm/io.h>' h* ?8 I( S$ g- L
- #include <linux/moduleparam.h>
! p7 `1 E! }/ K- o* b$ j `. K - #include <linux/sysctl.h>; ~* u2 {' I: z) @( L3 _! P
- #include <linux/mm.h>
: ?4 j% m4 H3 f2 v" Z1 B( G - #include <linux/dma-mapping.h>& i: E" \6 E9 W ~9 M$ H
- 3 w1 k5 @$ e% k L8 L- F
- #include <mach/memory.h>9 u+ Z$ f! i9 J( b. s4 f& R* M( r1 {- Z
- #include <mach/hardware.h>
" q$ y. }# \3 z1 l" v( w8 { - #include <mach/irqs.h>
+ |* K- J( N5 v7 X9 ^ B8 N - #include <asm/hardware/edma.h>
1 c' M0 a8 ?( U/ q$ m; | ` - f2 T) x9 B$ q% F
- #undef EDMA3_DEBUG
! t& { j L6 D - /*#define EDMA3_DEBUG*/
% K% t$ s4 g7 L' }) `% J - * [! A9 s' w0 j% D) o2 P
- #ifdef EDMA3_DEBUG
0 r/ d! M5 t6 O) b9 P, v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& ]* r7 ]3 f' J8 L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 f5 ]/ I- t* r+ A; `) f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ h4 A" b4 h! \$ S0 D$ F
- #else
* ^" ^9 d( x7 f+ p0 {0 y2 R5 I8 g - #define DMA_PRINTK( x... )
2 e: M; B; v: w! y/ j - #define DMA_FN_IN: Z( w) W" m* Z7 @5 X8 X
- #define DMA_FN_OUT3 e- _0 q( \2 e6 U" m! ^6 j
- #endif8 {8 H- R4 f6 t" s% m: q
$ o6 i1 H8 u+ O. d, S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 J5 j2 N. I$ g" Z) Z0 m* ~" a - #define STATIC_SHIFT 3
$ X+ t/ D1 [# k! t4 f: D& H3 Y: b4 C - #define TCINTEN_SHIFT 20- b3 t7 Z3 V9 @3 {2 h2 z3 w% r
- #define ITCINTEN_SHIFT 21, S6 m0 _+ h- b9 G+ _; y
- #define TCCHEN_SHIFT 22
, d3 \+ A- p X# J9 B - #define ITCCHEN_SHIFT 23
' E! p3 f. U* d
) L6 d4 {8 ] H3 O# L$ I- static volatile int irqraised1 = 0;
! B/ D1 W. b' J; C1 g - static volatile int irqraised2 = 0;
; l5 O& i% Y( g0 Z! b: f! B, j" d
/ a( j+ y. D6 U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- h* Y" G( P* o. f7 o3 ~# h% z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 ~4 [8 H! P7 ]" r5 Y, M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 z- B6 p+ u& Q# N7 V4 n
- & o1 K' D% F' a4 X* {
- dma_addr_t dmaphyssrc1 = 0;
/ {* X8 J7 u8 T# z& r4 M* r) E - dma_addr_t dmaphyssrc2 = 0;
) C8 B: \% I$ S - dma_addr_t dmaphysdest1 = 0;
* m/ V+ l% W; M) a, t - dma_addr_t dmaphysdest2 = 0;1 \, |6 G J3 d2 N
6 P6 t# l' Y" M8 L" X( O- char *dmabufsrc1 = NULL;/ O5 y, A& E, M( G
- char *dmabufsrc2 = NULL;
2 s# Y* m0 H6 g; @% O) ] - char *dmabufdest1 = NULL;
: U4 n9 d; o6 F/ @: u3 z - char *dmabufdest2 = NULL;
+ \9 C) v- i6 e: R
& [* ?( W; S+ w- static int acnt = 512;
3 U, j* v/ J+ ?3 y7 s - static int bcnt = 8;$ F* y% z4 J$ \6 V: O- I
- static int ccnt = 8;
6 I) P' c& j/ Z$ Z/ T% B
+ P% K/ Z/ i7 p# L- module_param(acnt, int, S_IRUGO);( N8 l" P1 F( L, G7 X6 s4 G9 b5 f
- module_param(bcnt, int, S_IRUGO);
7 d; U' J0 h+ b - module_param(ccnt, int, S_IRUGO);
复制代码
9 I$ H( J: p# ^. X" E+ O% d
9 E) ~3 a2 Y6 c1 d- \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( w, F5 E+ T" F' ^' E; ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ e ^+ F( W5 o" n: u. N* |. \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( U. `% f3 f+ C" M9 X2 a
- ^5 X* b8 F& S; G9 i: }2 @" v9 F7 W/ r/ T; s
|
|