|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; H: P6 Q2 A0 k D* ^* a
- [code]EDMA sample test application
) e/ ?' e& d5 i - /*) w* n- J4 v2 F4 G
- * edma_test.c
4 U" h/ a3 I* d! s- S - *+ v+ q! `" a+ p7 o" j0 `7 v' `8 X9 V
- * brief EDMA3 Test Application8 e8 n5 l7 L5 _' g1 P
- * {* y' P6 y7 B6 A/ V% B7 k6 `* U( Q
- * This file contains EDMA3 Test code.0 g: E: P8 |. e* X8 S* w3 ]
- *1 F6 L' Y8 H/ G7 j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 } @& M4 {4 E5 c& N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 n3 _: t. g" v; s* K0 N
- * TO CHANGE.
) q. l9 Q) q q - *+ V1 L' L% V4 B3 l# |5 f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; g! B Y3 {2 r# Q4 N
- *
$ ?4 i4 R, B, l0 w7 B - * This program is free software; you can redistribute it and/or
% C1 X' }2 h/ C' o3 q, p6 ~6 D - * modify it under the terms of the GNU General Public License as
: l1 d5 v1 R& f$ m$ |2 r6 h' } - * published by the Free Software Foundation version 2." Y s5 R- b7 \+ F8 g5 J- y
- *1 G3 Z" d* i4 Y: K4 {6 u; i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. n' D+ K% I; ?# d - * kind, whether express or implied; without even the implied warranty) P* A2 d- N9 G0 j |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% N) z7 }$ Y. K) e0 q2 `
- * GNU General Public License for more details.+ {# c2 b0 n' q- W2 h
- */
% ~2 `' ^ S$ Z: T4 x
8 t6 n* l7 l9 n, f- #include <linux/module.h>! F* B* s1 E+ ]" @5 q: I
- #include <linux/init.h># k: K1 g \* R; P# a
- #include <linux/errno.h>1 y* u S9 M/ H% O5 Y* t7 J, k- e
- #include <linux/types.h>
2 g8 }0 p" P- V' [ - #include <linux/interrupt.h>, P1 }1 f8 d, g: i% k
- #include <asm/io.h>8 e$ J1 H9 |0 s! m
- #include <linux/moduleparam.h>
& t& \( S* f9 C: H, }0 Z: V, p - #include <linux/sysctl.h>
* }1 s2 S# o9 v5 G1 N$ \! D- p - #include <linux/mm.h>
- I/ E+ g6 h: v, R/ I' h+ Y4 ]* Z' W - #include <linux/dma-mapping.h>" D' F& c- a% S2 {
' N& |5 C! J, }6 F0 L6 j2 v3 Y- #include <mach/memory.h>
# e/ Z X! ?/ J/ C8 I8 V - #include <mach/hardware.h>
+ m: h& z N2 }0 J/ D2 _9 t4 l - #include <mach/irqs.h>
" ?/ N& ]# a+ R" X* Q4 d- m1 u - #include <asm/hardware/edma.h>
( A A" X1 v; _0 ~! m - $ w1 c* Z) y# G3 k( {! p
- #undef EDMA3_DEBUG% `& S9 u1 F- v4 z
- /*#define EDMA3_DEBUG*/" V. P, [) }% {4 X7 ?- I
4 C+ q9 k4 k) i% c1 S2 F- #ifdef EDMA3_DEBUG" \3 P6 a* l2 a1 y0 z/ @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 r, i$ u, r l' B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- @ `- `) r5 m: O- C2 @0 E! H5 l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 k" D8 \' i/ s- d: Z6 g - #else
$ D6 X w3 n. z6 v, [ - #define DMA_PRINTK( x... )9 Y' p* w! q3 H) E
- #define DMA_FN_IN& s% A6 w7 S8 O4 f" u
- #define DMA_FN_OUT# J8 ], z v& o
- #endif3 x7 z, T% s2 X2 w3 [
: o- E1 D6 q: F* E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. b6 S1 Y" C; }9 z8 ^ - #define STATIC_SHIFT 33 U9 I7 l2 t% s6 o( {
- #define TCINTEN_SHIFT 20
- r5 F0 Z. m5 d% m5 Z8 T - #define ITCINTEN_SHIFT 21
) O( G8 g4 M1 e; x2 N9 l) m4 ? - #define TCCHEN_SHIFT 22
; o f4 u% c; Q$ G) n- a# o - #define ITCCHEN_SHIFT 23
w, `/ i% r4 W; ~ - & C) [' v# \" B! Y/ F% M0 p
- static volatile int irqraised1 = 0;/ z3 y+ E' k- L/ p9 H7 [
- static volatile int irqraised2 = 0;
9 Z+ h2 B5 H$ r% B& ~# C5 c& a( g. X
0 M. ^" V( H& @( k+ J% P" s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 v$ j0 e; p! H7 I _& o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) N, v; s5 r( j" L# s N4 _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! A# @5 [8 L" f. E
8 i5 ~ B# h. w/ P4 O: W' i- dma_addr_t dmaphyssrc1 = 0;
1 k- M6 L7 {5 ^, I6 W6 w( ` - dma_addr_t dmaphyssrc2 = 0;' T( ?$ d* R6 A* a2 i" P1 o9 f
- dma_addr_t dmaphysdest1 = 0;
# O( P- t+ f g8 v% @. L5 i - dma_addr_t dmaphysdest2 = 0;* D, t, _# p% D2 X, k4 e
- 8 a5 [9 l- q( A: X! R
- char *dmabufsrc1 = NULL;
% f3 N. o$ S( D) z - char *dmabufsrc2 = NULL;/ u+ Y5 g/ }. N2 U
- char *dmabufdest1 = NULL;
Q) A* l& z8 T$ g2 I5 k1 k - char *dmabufdest2 = NULL;
! v. ]4 i) K6 b# \
: e% c; w) V/ q. e2 X- static int acnt = 512;% c! m: k( t% K* c- B
- static int bcnt = 8;3 V3 U+ @- R, F
- static int ccnt = 8;
+ [, m7 ]) Q6 R# R - % [% W6 Y8 h4 L* r9 b% f. h
- module_param(acnt, int, S_IRUGO);
9 S/ T7 ^: S" I - module_param(bcnt, int, S_IRUGO);
9 @+ S! y+ ^, N- l1 O) P - module_param(ccnt, int, S_IRUGO);
复制代码
, @0 e6 ~# z6 y1 `7 Q- J8 U; Z8 R, J& _7 F. J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( G. j/ ~# }) S7 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 V5 Z- U% [( m" @" V: A* m4 i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 d5 R7 @0 o4 d+ I1 ~+ p2 i X/ ^' P" X u( r8 H7 R
- n! Q5 n" f" d( O9 D7 f
|
|