|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 h0 e, f* j, s- [code]EDMA sample test application8 i8 H3 x$ B [ C! c/ W
- /*
* {4 O/ B1 W, |2 h" o! d9 g$ @ - * edma_test.c# u/ E9 [5 O6 F
- *4 D9 O7 N( O/ X. F4 X! G
- * brief EDMA3 Test Application
# n# X" N: \6 ^( @0 g" A4 w - *
3 W; ~% w, Z: M- `6 @ k - * This file contains EDMA3 Test code.
2 ?: k& f0 n8 Y2 D/ @) j% i* ] - *# ^+ y# Y, {3 ~7 C& @6 U
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 @2 O2 o* w# U2 C$ Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 U5 I% L2 c9 s" D% u6 p1 r) c
- * TO CHANGE.
; }- ?1 S: M: W0 i8 R3 D/ e* Z - *
' t( ^" v" z4 u, \9 z( Q- x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 O; b; q! c- S9 ]$ c( B
- *
. z' P6 |1 l0 U- l5 M. s$ @: u - * This program is free software; you can redistribute it and/or
/ N5 T3 _0 h7 {$ ^0 s; i$ m. D - * modify it under the terms of the GNU General Public License as
# [5 n" P5 Z' W. \ - * published by the Free Software Foundation version 2.
% g! a( a/ F# c4 ]& ^! V9 m - *3 f1 l. L F' e3 w) m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. l" B8 V" H) {/ A, Z7 s; } - * kind, whether express or implied; without even the implied warranty3 ` w% c4 N) m5 `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 {% |0 \ D7 Y% {0 Y/ y - * GNU General Public License for more details.: `! u) b' S+ j( j! i: g7 Z
- */2 |2 i* j z6 h1 S2 S9 w5 S
- ) C4 _% ]- Q8 f$ L' ]. d3 ~
- #include <linux/module.h>
) j: J3 `5 W5 o! A - #include <linux/init.h>
& z( s# Z6 g2 X: A+ N - #include <linux/errno.h>) J" W. B( g `8 J; j
- #include <linux/types.h>" Y3 E1 ]! N5 U
- #include <linux/interrupt.h>
5 r9 A) l" s2 ]6 P0 y$ e; k+ p - #include <asm/io.h>
6 T# W t2 @+ k6 T# q6 M3 N1 V - #include <linux/moduleparam.h>
: ?/ \6 t. S3 l - #include <linux/sysctl.h>
4 u, {4 ^7 r1 T - #include <linux/mm.h>! i6 r4 _( B# ~) V8 ^5 W& D
- #include <linux/dma-mapping.h>
8 W$ T' @- b8 p/ H- h' [
4 Z/ C2 n- {6 b' R# f- #include <mach/memory.h>
0 V% R' l* k8 R% u. W0 P3 s" I - #include <mach/hardware.h>
5 t5 {- `0 d M - #include <mach/irqs.h>" t. }6 K- e; D& i
- #include <asm/hardware/edma.h>0 ]- R! x$ {& O- x7 T
- # ~, o2 k) T" G, x3 t
- #undef EDMA3_DEBUG" o( ~0 u( ~2 ~) w% N. [" I; _ E
- /*#define EDMA3_DEBUG*/
- f0 Z4 Z3 C! F7 [$ D6 s - / S$ @7 A, }) y4 ?0 j/ T
- #ifdef EDMA3_DEBUG* \) `. i. V7 m# K* t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ f- u! U: M7 S) O1 A' M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 [- [* Z8 c1 b! e& G7 \# c8 G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 Z; T3 G" V2 m0 z1 Z. r
- #else: E; w, E8 s9 ?6 o8 C4 {) `
- #define DMA_PRINTK( x... )7 ] O0 `+ ]. n. r- D1 k* S+ D/ |" t' e
- #define DMA_FN_IN
7 h; x. o1 |" Q( ] - #define DMA_FN_OUT
% L2 f8 j$ @7 C: l - #endif7 n. j4 K8 R. j. H+ `1 C
- & l% ~# }4 n- q8 l6 M7 H3 k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) U3 C& P G D9 Y
- #define STATIC_SHIFT 3. Q8 N( c( Q1 V
- #define TCINTEN_SHIFT 205 |8 ?- H: C; Y! v
- #define ITCINTEN_SHIFT 21% @5 Y) h( p' W L$ U
- #define TCCHEN_SHIFT 22% u2 Z6 a# E. C+ e/ X
- #define ITCCHEN_SHIFT 23% o1 `6 H c, L
- ' S) H' B1 D) v" T# {# ?9 E
- static volatile int irqraised1 = 0;
; b, X W7 k, i# [. p% R$ F - static volatile int irqraised2 = 0;
$ A) w% Z! e. n - - F: H. L7 ]: s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 T4 Z# G a9 y, _+ p7 @# J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; J" m4 ?; \7 W5 i5 I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. c4 L7 `- k" W6 t
5 n6 W. g! u# k& A$ b6 U* f- dma_addr_t dmaphyssrc1 = 0;
) K3 y; H% f* O' ` - dma_addr_t dmaphyssrc2 = 0;
: R" z( y/ n8 ?% l - dma_addr_t dmaphysdest1 = 0;# g& L, R, a1 [ ]- G y+ @
- dma_addr_t dmaphysdest2 = 0;
1 a) P+ O' ?, |9 @5 P - ; H% K6 X) c7 l
- char *dmabufsrc1 = NULL;
+ [6 Z, } ?- G; _& P - char *dmabufsrc2 = NULL;
4 @0 L' Q c( {% S1 j6 L - char *dmabufdest1 = NULL;
- h+ ]: G& S; o9 P6 I5 i - char *dmabufdest2 = NULL;
* M3 a }8 o: r5 `4 r - ) D; _1 p- m0 j7 g) A6 S }
- static int acnt = 512;
7 t( y' C- B1 c+ R$ i) a- t, P - static int bcnt = 8;
/ n# g. I; x* D% W - static int ccnt = 8;
?+ p9 j2 x) v$ ]- G
' e7 ^# d+ W; U- }, Y& W5 ]4 ?- module_param(acnt, int, S_IRUGO);
0 R' x1 b9 c; n3 n7 Y: B - module_param(bcnt, int, S_IRUGO);4 R. Z+ N _2 ?) c" T9 l* J4 ^
- module_param(ccnt, int, S_IRUGO);
复制代码 4 ~5 H: g2 w! t
( @$ T" J7 o8 ^, M& s2 n9 b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, Q1 I8 w2 c0 I9 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( {/ W, i9 r2 u+ Q( [9 a# o t0 f# Q( _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ A5 O; |/ M' C1 V- t K
( q5 Y$ ?# n$ o$ Y# \: N( I! A
0 W4 ?* c" O! W+ t2 ^, Z: A5 h |
|