|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 N5 P) F- n" W2 i) K) N, r- [code]EDMA sample test application# _4 }5 L$ [) j/ w- m5 N
- /*
: s# F! a2 I- \5 [: m2 x- Z - * edma_test.c
* l' u- Q! f( S; f - *6 [ s8 i2 ^* j) R) k
- * brief EDMA3 Test Application+ J9 n3 A: n4 ~: @3 V
- *
: ]" h: @( ?- h. f' b - * This file contains EDMA3 Test code.
& @. j% R8 Y5 r# ]+ ]: _ - *
. y! J2 l( W% K' d7 ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# Y# |$ J0 C) u8 b9 E' {( H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ A: @) z+ ]( |0 I9 Q; K0 ` D" N - * TO CHANGE.) s7 A+ ^% }. F+ g
- *6 ?6 p% h3 h3 A4 F* n$ f. w. o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ e2 n0 Y3 v# R- Y
- *8 y& Z+ u$ F- o/ @, M
- * This program is free software; you can redistribute it and/or
; P1 L( | }2 x2 ^ - * modify it under the terms of the GNU General Public License as
: \8 j Z1 h: ~# R+ q - * published by the Free Software Foundation version 2.
8 W0 v$ c1 o L - *; v/ Y! M E) [& ~5 _1 \& l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 t! D- T5 @& X8 q4 U; r0 l - * kind, whether express or implied; without even the implied warranty
8 G [7 w' d5 f3 e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- s7 [7 v. Y- R3 V$ Q - * GNU General Public License for more details.' R1 m9 t# J$ I2 H: p9 a; \
- */: t; e- v0 i" t& T/ d( L6 b7 C0 [2 ]
) S. I; ~7 ^0 ], c! ^* R& r8 _" A- #include <linux/module.h>
2 f$ v# k* f# |5 F: ^ - #include <linux/init.h>
1 y$ R8 }- |% `& E% S# E- u - #include <linux/errno.h>. Y' h+ |3 f8 z# C1 W
- #include <linux/types.h>
; i* U2 }2 e5 x: o& g9 p7 { - #include <linux/interrupt.h>
1 E4 j0 z; C7 s$ s' v - #include <asm/io.h>
* ~6 m" u/ K o: o) V2 g, N5 X - #include <linux/moduleparam.h>
$ Z* i) X/ B8 \) m6 x8 O - #include <linux/sysctl.h>
9 q( m( J9 y I, a& @1 \ - #include <linux/mm.h>) i6 x8 F3 b) E( P; n0 i
- #include <linux/dma-mapping.h>4 r3 R+ y# K1 m9 |; M
8 @( \ E2 N1 O [, i" X- #include <mach/memory.h>6 A- Q0 V; H3 B" o/ `# B& G
- #include <mach/hardware.h>: H) l, ~# k1 a* j/ p, I/ H3 a
- #include <mach/irqs.h>% Q! \' E6 J3 E$ M" Y
- #include <asm/hardware/edma.h>
, K- a1 p2 D4 @- I- m$ `+ c! E - " v" ]3 i! ~* S( \
- #undef EDMA3_DEBUG
7 s' t S% e3 p9 Q8 O - /*#define EDMA3_DEBUG*/) O- c/ v- ^/ O
- 0 x; x; I1 O. D& F0 o: T
- #ifdef EDMA3_DEBUG
4 }. |1 E, _: I6 Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! c* K# U" L4 q# _7 [& K; q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* [( n0 V" k- v U/ J3 ]1 Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 Q h% ]' S. D% H/ Q3 ^" o$ V* k6 A
- #else, P$ z( ?. O5 n+ G
- #define DMA_PRINTK( x... )
3 c8 n6 X, ^" q - #define DMA_FN_IN9 ~- ]+ g% q" H/ K: F! w! `
- #define DMA_FN_OUT0 n) q, M# b. D5 L, |6 G; x
- #endif
! f, f* f4 ~: z$ {- H
5 v1 N/ F3 J% D, _+ ]; @! u& h4 O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 p; k! C, Q% X0 z7 p0 T - #define STATIC_SHIFT 3
2 e) d( r" v; o3 e' |& u2 `# A - #define TCINTEN_SHIFT 206 z/ B1 a- d5 e& S9 L
- #define ITCINTEN_SHIFT 21
: K. D/ [( C; b/ p - #define TCCHEN_SHIFT 229 ^# X6 l, Y% E. v$ l; R
- #define ITCCHEN_SHIFT 23
6 t H+ t7 |5 ]& a9 U) _! a - + @; U* V* ], m4 e- Q
- static volatile int irqraised1 = 0;
5 g6 q2 [' Y, A e3 S! S1 l - static volatile int irqraised2 = 0;
( Z+ T- C4 t4 h3 I' v$ b - * V8 r- i* R& }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. l+ Y7 |4 B3 k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ N6 Z8 o) d) t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 c, n# {9 u- x3 O6 L. O
; s. X" K ?- N2 L$ L- dma_addr_t dmaphyssrc1 = 0;
8 G. x' T" t8 v5 R - dma_addr_t dmaphyssrc2 = 0;7 A; j" y, Z7 h! S* S
- dma_addr_t dmaphysdest1 = 0;5 o. H0 _5 k z& Y+ z7 ]
- dma_addr_t dmaphysdest2 = 0;2 Y2 ^% L1 O& n0 Q4 K
- , ?2 b( F8 g2 u/ V/ K! ?
- char *dmabufsrc1 = NULL;
$ |' K* K W7 s - char *dmabufsrc2 = NULL;9 X( a6 f( J6 ]9 S, u0 y
- char *dmabufdest1 = NULL;2 r* E. N+ g: Q
- char *dmabufdest2 = NULL;
) g6 ]6 B- d" c: o% c; R) |
; `! @: M' W8 p- static int acnt = 512;
; y6 |2 ?2 T" ^6 r) U* S9 y - static int bcnt = 8;
: {+ d( O f7 N$ V0 M - static int ccnt = 8;
* v- p6 R6 }, ~ - + m0 z0 H' _5 j5 n
- module_param(acnt, int, S_IRUGO);
) |6 s" \6 z2 b) c/ _+ Y$ R* W) e - module_param(bcnt, int, S_IRUGO);+ z# K. q" k8 H! e) U3 K) ?
- module_param(ccnt, int, S_IRUGO);
复制代码 ( g) Q0 c' p5 ^
/ J4 Q& o( ]4 q/ @7 `% Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ J' \* ~" [5 z& n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" m( }3 e1 c6 P7 j7 s K+ d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( e, K; g1 k$ n
. O+ i8 |1 L5 t& Q: g$ B2 ?
' A2 Y4 j3 g3 N1 h' A$ W# j |
|