|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) i8 F) b5 r" c, r) p! n: ]. |7 h
- [code]EDMA sample test application R0 ^) k' {, ?$ r6 x: `
- /*- ^6 I. `% f( T/ F
- * edma_test.c3 X. e; a1 Q! p+ J6 R
- *6 I, W& r6 q. z. w5 d. D! n# |) u
- * brief EDMA3 Test Application1 ]/ S! H' O$ Z" v
- * K/ j1 |% Y+ N0 o9 g: k1 v- N' N2 x
- * This file contains EDMA3 Test code.
' o, ^4 u: T: ~6 c, F - *7 m U3 _+ W6 \, \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 i# N7 x6 u Z% V9 _# A3 O5 B$ E% W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, H7 P# [3 H5 H2 { - * TO CHANGE.
! g7 N: Q6 y$ k: F* } - *
; {6 X1 T6 N0 S/ W7 `( e% m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( [" p7 F. |$ |6 ?4 u - *; v9 `- `& j+ H4 q& _- f
- * This program is free software; you can redistribute it and/or
' }- O3 \! k p9 R9 t" q2 ] - * modify it under the terms of the GNU General Public License as/ d. ^: ~, g( M1 j& A/ T
- * published by the Free Software Foundation version 2.2 M) J2 l: l2 W( M5 E. s0 O
- *9 A3 T% y0 G5 M* u- _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 _; g6 G e$ J5 O: Z% N! r - * kind, whether express or implied; without even the implied warranty5 _* y9 G$ N. f0 B8 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 U3 [: u/ ?/ k4 @: w - * GNU General Public License for more details.
/ z7 L! w% w% _0 d0 a9 p - */
3 c" I3 t8 ~0 ?' b8 I - L4 j0 ]' ^; F' N9 b: a
- #include <linux/module.h>
4 b& f) f' b) F9 H0 {# Y - #include <linux/init.h>8 S( x2 K7 Z1 e' K
- #include <linux/errno.h>! K4 r" W6 a* f3 s# C
- #include <linux/types.h>
9 ?) s1 J9 C6 \; N" k - #include <linux/interrupt.h>
J- W% |& Y. [ o0 \' O% p% j - #include <asm/io.h>
( N) {7 [& Y) ^- ]$ I, c& H. B - #include <linux/moduleparam.h>
* k4 o& s$ P9 C7 @ - #include <linux/sysctl.h>% I5 b/ |: ^! a
- #include <linux/mm.h> [# `4 B4 n) z5 N) U8 l( W
- #include <linux/dma-mapping.h>
/ v2 w( z) x# Y' N( Q( T+ |
: Z" x* s7 [. ^% y0 Y- #include <mach/memory.h>
( ?% r* o- f( A! ^7 e - #include <mach/hardware.h>
- p1 ?3 U$ D* U( H - #include <mach/irqs.h>5 e, F: U' ]% i: A" L6 w8 y
- #include <asm/hardware/edma.h># f1 V1 Q/ \) r% Q6 B' j
2 s( c# p% r; ~9 e8 K- #undef EDMA3_DEBUG
- V. m v# s# E" ?" @ - /*#define EDMA3_DEBUG*/6 ] W& `0 w! K# o6 d l
- : \; ?# R% y1 A- I2 ?
- #ifdef EDMA3_DEBUG+ Z# L1 V+ W- C: L: h6 [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 t( ~/ x6 O$ M, j$ i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 y, r; U% z1 Q: o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 n! m) x* Z" X* G* I8 ` - #else, G$ t# g: ~5 |; r5 y
- #define DMA_PRINTK( x... ): g% m4 I4 D' d% o% `, M
- #define DMA_FN_IN
. H! G: K9 y1 @6 m% O" y- c0 p - #define DMA_FN_OUT4 V2 n t r$ b5 ?
- #endif+ O8 W0 U/ Z8 J8 p
5 j' K: j# t9 G$ B- T) U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ k x! r% k6 b7 U6 j
- #define STATIC_SHIFT 3
4 r" X3 n3 b. [( O! { - #define TCINTEN_SHIFT 20
) K! b& R7 D3 v7 M) ~ - #define ITCINTEN_SHIFT 21' I& I1 K$ H8 }' I6 _2 b
- #define TCCHEN_SHIFT 22/ P/ f$ v9 B$ }1 r! m
- #define ITCCHEN_SHIFT 23% x8 m7 N, L# `( I7 q8 u
. J3 u9 d A% {. y- static volatile int irqraised1 = 0;
+ Y# Y3 m: v/ G3 X - static volatile int irqraised2 = 0;! h0 W6 ^! [: o9 X
- $ h d4 C' s& t* {: k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 |4 z9 ~7 a g: G" {" w h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! M$ C1 }5 D' x; U7 c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ^: o. u1 Y. s5 A& o0 X9 N7 s
& M, c$ G& }4 t9 M- dma_addr_t dmaphyssrc1 = 0;
4 R5 p! c' D/ E' D: ] - dma_addr_t dmaphyssrc2 = 0;$ S h$ P3 m% `( I0 b! w$ q
- dma_addr_t dmaphysdest1 = 0;
, S S' X( Z, s+ ~7 ]: J - dma_addr_t dmaphysdest2 = 0;' a1 \+ ^/ K7 \( I
( l6 I3 h$ l& k+ O/ A- char *dmabufsrc1 = NULL;! \- N, S6 ^7 y/ i2 B Y6 f/ h
- char *dmabufsrc2 = NULL;; E( V- K6 p7 B/ j6 ^! l+ r3 P: E% R
- char *dmabufdest1 = NULL;
$ `6 g9 v2 k" `% K* P" y - char *dmabufdest2 = NULL; H; G+ M; n: t" O
8 E0 K |( R! p: M4 v( A- J- static int acnt = 512;
% ~1 O( t) J! l a( N - static int bcnt = 8;' l/ r( G1 _4 z: Q7 N. I$ y1 J5 K
- static int ccnt = 8;4 B3 m4 @' V9 e/ ?7 q
- % k4 Z1 N$ g! [/ G8 d
- module_param(acnt, int, S_IRUGO);
T/ h& j+ ~ [8 |) D6 ` - module_param(bcnt, int, S_IRUGO);
" S. Z+ t S9 G8 d% R! ?& A' |; Y- O - module_param(ccnt, int, S_IRUGO);
复制代码
7 |! d8 ]; I: g( Q5 d. B- C
' [9 {" l9 ]" L% S5 q5 N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: M6 C6 R0 e3 l' n6 L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 Y3 @4 i# u1 q _8 H, ^" M' z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 T3 w: p l* b0 f* v# Q3 V
S$ m' W, G2 o5 B6 r9 Q2 C2 W( K9 h# {% ], O
|
|