|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - V; r. P, C/ ? _ W; D9 v+ e A" c
- [code]EDMA sample test application
( c" L/ n6 f$ P& P% F H U; B9 ^ - /*, u$ r" }7 u- q; R7 ~; }
- * edma_test.c# m' R- o2 P* e! L" K
- *
: t6 o( C* \! W* z - * brief EDMA3 Test Application6 d0 f. w) Q/ r; r
- *
; k: Y& X+ i( w& l. G3 a5 N+ l: K L - * This file contains EDMA3 Test code.
" \$ J3 w5 a; k+ p - *
: E3 b+ s! }# p2 i" ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
w$ H/ w* w* l2 p4 P; _" b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( p* b, z) p- e0 j3 h6 V+ I5 m
- * TO CHANGE.2 D9 P/ @4 B/ U4 o7 z9 L2 D
- *) ]) k7 U; Y2 Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
v% f6 D8 p& [1 v - *
7 ]0 S: u! j0 S7 B - * This program is free software; you can redistribute it and/or
: T/ |) E9 G: U/ _/ c8 Q; o - * modify it under the terms of the GNU General Public License as: z0 \' P9 g+ O' {
- * published by the Free Software Foundation version 2.
& W6 F) b1 f; B2 S, p9 r - *
$ J' V! C6 Q! p4 x6 N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 ^4 O8 _* P' q6 u7 B% D
- * kind, whether express or implied; without even the implied warranty4 C3 @" ?) a2 r0 n. J$ _" C2 \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, D, q2 R3 ^4 L- o1 g7 f' ^
- * GNU General Public License for more details./ x: |) Z6 b7 D4 X0 {
- */
0 a- s7 d/ X+ a; y
7 x$ o& C/ V. l* V1 l/ e1 v |- d- #include <linux/module.h>+ Q8 `" X5 z2 ?# i0 v3 O( u3 n3 q
- #include <linux/init.h>
4 g4 ]0 J' M/ { - #include <linux/errno.h>
+ ]% a# y: w+ T+ s! b% J+ U - #include <linux/types.h>$ l# h5 i' c& h4 G4 N: |
- #include <linux/interrupt.h>
) K0 E& b/ R! X% R - #include <asm/io.h>
6 t, B: Q2 J C7 ?, f - #include <linux/moduleparam.h>
1 A3 K j- F: A( x' m$ N - #include <linux/sysctl.h>$ {1 @# T1 C, B. }- G: y
- #include <linux/mm.h>
/ V0 E6 p) _' S. n - #include <linux/dma-mapping.h>
* s' d7 z' Z& A$ p- |
: E' t3 f; H; M5 ~- #include <mach/memory.h>
# N5 M7 F2 I8 @1 i - #include <mach/hardware.h>/ M# M5 |1 ^& z4 H2 [8 ^1 M
- #include <mach/irqs.h>. k4 w7 p" ^/ X( ^ M9 f; \
- #include <asm/hardware/edma.h>
- O. D( @$ w9 q$ [, G1 H( \ - ! p; g& v9 K6 n
- #undef EDMA3_DEBUG0 E) g( m: ~* C2 M! D
- /*#define EDMA3_DEBUG*/* x1 B" l# n/ \8 x! G
- y7 y- k- u8 Y" a5 H: w
- #ifdef EDMA3_DEBUG
+ f% n' A/ o: D/ _5 i) L( K% q+ n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), z% b/ q) B- k( H$ y; P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' \ X! t, k/ N! R! h9 m; G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) H- c8 T6 T1 j# J3 p4 i - #else
& d* K" D9 q; |% ~ - #define DMA_PRINTK( x... )
* Y4 |* y# M" s1 s) V - #define DMA_FN_IN
" f% Q% E7 z; Y m& E - #define DMA_FN_OUT
; D9 X( T; V0 f$ I5 e' n - #endif3 e3 Y2 d0 L' F, S
- 7 P) G5 u/ y: l' l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). H/ Z. Z$ i; n
- #define STATIC_SHIFT 35 b% \2 J/ X6 L+ C* ^$ U4 c
- #define TCINTEN_SHIFT 20; S$ T) k3 L' I: ?( D. O! K( M
- #define ITCINTEN_SHIFT 21. T T5 x3 J3 o9 X7 Q/ l
- #define TCCHEN_SHIFT 22+ o A6 n& v5 f8 W
- #define ITCCHEN_SHIFT 23# {& k: ~. c1 _
* g: t7 t. k0 ?4 M) ?) E- static volatile int irqraised1 = 0;
- _" {" o& A6 E8 {0 Y1 l - static volatile int irqraised2 = 0;
' _- Y# e- o1 s" P2 e - w8 J) ~6 e6 H0 n, W+ z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ^! d' z) S* }8 Y1 q$ c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: x2 u4 P% d& k. k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! I, K X; W5 @1 {+ `) J
& f( f. i) ?1 ~7 _! a% j- dma_addr_t dmaphyssrc1 = 0;" K0 D% |# z: p) b) m! u
- dma_addr_t dmaphyssrc2 = 0;
( S0 x& D' X( X6 { - dma_addr_t dmaphysdest1 = 0;
% k5 g3 p7 s4 P- v1 O7 M/ u: T - dma_addr_t dmaphysdest2 = 0;
( |1 j3 g5 T \* s; d( m' R - # ^' K ?6 Q# v+ j# Q
- char *dmabufsrc1 = NULL;
: R s6 t0 e0 o, v& E3 g' T; r - char *dmabufsrc2 = NULL;% I. h9 b& N+ M8 o: @ E# N7 t$ D
- char *dmabufdest1 = NULL;
' z2 j" k" ^" u- Y - char *dmabufdest2 = NULL;
6 a& M' j+ m9 b' v; t6 X [8 k
, g2 d$ e4 l+ f& X- static int acnt = 512;* O; H+ _0 K& o: d' y
- static int bcnt = 8;% v- u! U5 r! f& s2 L( I
- static int ccnt = 8;7 N% }7 ^( v& D& ~" f: o- T
6 P5 B$ d7 O8 z7 b* [% O" V. M' S' a- module_param(acnt, int, S_IRUGO);
; L9 U' y" D3 T: S. [8 a& V _ - module_param(bcnt, int, S_IRUGO);
, r( h. h9 K% E6 ]/ u- M2 w1 X - module_param(ccnt, int, S_IRUGO);
复制代码
- X6 a& b8 L! A- O3 A K5 E, v1 _# o$ q. e) U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 r* }4 ^$ O {, k! `2 F( l$ y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 I! x- O4 H" L) H+ T! H& C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, ~2 q6 |7 |0 n! u D& _1 N" D, B6 g* F W) p
5 |& N/ R: H6 M$ K/ \7 L0 u/ O0 @0 f |
|