|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; k5 @9 z7 W( p0 Y# D4 Q% Q/ d- [code]EDMA sample test application
0 l, b7 i! i$ y - /*
9 M0 s% M, X) c& \ - * edma_test.c
+ B. ?% w# y+ {9 b - *
# n4 _0 f0 x: E. |9 K - * brief EDMA3 Test Application( ^% R' j1 J- C( k, t' I
- *
. Z$ k1 ]1 a; Y7 R4 _/ q - * This file contains EDMA3 Test code.
+ `3 Z4 x7 ^, j - *
+ U; v( @3 B" r5 ~4 V6 v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 V5 q& C" @7 v+ \/ b7 L0 R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 L0 K% l8 B: n. s - * TO CHANGE.
% ~1 W6 e9 o$ M/ r) l - *
2 E& Z- {/ b' p( n `% T6 j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' \- h6 p; U( m
- *
( U) ~& r/ e/ G& R - * This program is free software; you can redistribute it and/or
2 L5 V- x5 x8 k - * modify it under the terms of the GNU General Public License as/ @* L- e$ u4 A
- * published by the Free Software Foundation version 2. x i! a# [6 u
- *8 ^3 m- `# b: A/ r& \" v, u! m% k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ P2 @5 i( s* ~3 x# j0 I3 \ - * kind, whether express or implied; without even the implied warranty
$ }% w1 p1 m o! |6 P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; i( ]4 H% B% I* q% o' _. m
- * GNU General Public License for more details.- ~" r0 r; z$ Y, D( ]$ t O$ ]: K5 Q
- */
4 s0 F5 D* z" m+ p6 m, w
2 ?- v# t& n: Q7 ]3 _- #include <linux/module.h>
+ `7 I" n7 V! O' _* G - #include <linux/init.h>) d% X7 |) o2 A! ]. g! p
- #include <linux/errno.h>
+ ~: @/ m" U4 L! `4 S [ - #include <linux/types.h>
! y% F1 R% H' J3 C - #include <linux/interrupt.h>; K& Q0 ~8 x5 O. Z: H# H
- #include <asm/io.h>
+ A" V6 x6 u/ `* ]" h - #include <linux/moduleparam.h>
5 r4 D6 d6 V3 ~ C - #include <linux/sysctl.h>
! u% s4 Y( E/ V) P/ p( U - #include <linux/mm.h>
/ b1 z% y7 W2 Y: z - #include <linux/dma-mapping.h>9 G% q6 a, s# N
- ( }# `7 J1 s+ P: D3 J
- #include <mach/memory.h>5 C! j( X9 ~ v) W' r/ b# X
- #include <mach/hardware.h>
% n( E! d4 J5 z1 k- v, W# o - #include <mach/irqs.h>' ?( v1 d/ f# r2 I, L f
- #include <asm/hardware/edma.h>% a5 [$ C6 F4 k7 p
- 7 s7 R4 n+ @+ i! b6 `/ x
- #undef EDMA3_DEBUG: w9 l& L, D2 O1 d3 v7 T$ ^/ N0 e9 a
- /*#define EDMA3_DEBUG*/8 n- m$ }& V. N1 h( I, f
- 9 h+ \% z8 k3 D+ C( b+ e
- #ifdef EDMA3_DEBUG
* ?3 J8 z1 X- z3 k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% V% M& M% r1 P, |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 W* s7 z' X3 R6 O+ @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 w7 i, u: i/ u9 ~ - #else
' V, t0 U5 Y1 N( h( A# b; e - #define DMA_PRINTK( x... )
, T- X3 |# b+ h- u - #define DMA_FN_IN
+ ?, n: U0 L5 K% G$ Y, W9 E4 P* l8 X - #define DMA_FN_OUT: @/ b! t2 u" S* p" {; X
- #endif
/ v0 b# Y* w0 `9 ]$ Z - $ P3 y: d. L0 f7 E, c- E/ |. X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( a2 L) q5 `- K) z- T0 L
- #define STATIC_SHIFT 3
4 J7 f! f9 e* z - #define TCINTEN_SHIFT 20
x) G) s# R/ j - #define ITCINTEN_SHIFT 215 t0 C9 E/ n) M* p: h1 f$ L
- #define TCCHEN_SHIFT 22: K, l! Q- C- g' @7 p
- #define ITCCHEN_SHIFT 23
0 B' |0 K3 F! X! E/ a; x
& t6 s" I+ s5 M% `4 c9 H! S# K' j% |- static volatile int irqraised1 = 0;
5 I. x- n A0 K# i* T, l1 a - static volatile int irqraised2 = 0; @& O/ | G6 E$ P, r
. l- }/ ]! _; ]6 i0 B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" R5 d7 \3 [8 P9 n" b; X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* X3 `! y( ~0 e9 s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ?9 T- |' f5 x5 a3 ~4 [# Z
# C n, ^9 \0 r' P- dma_addr_t dmaphyssrc1 = 0;
3 o, V7 {5 o% l. ?6 G$ ~: b5 Q - dma_addr_t dmaphyssrc2 = 0;
; A6 p0 e, w4 ?( A - dma_addr_t dmaphysdest1 = 0;) X7 H, T5 r* w# R5 L
- dma_addr_t dmaphysdest2 = 0;
, k1 T/ R( d: t, p7 E- G - / t0 a8 T' s: m5 F5 Z
- char *dmabufsrc1 = NULL;
' U9 h- N9 @' _5 P& p& A2 h6 a: x - char *dmabufsrc2 = NULL;9 b9 E. m! }: b, P
- char *dmabufdest1 = NULL;) N6 E) Z3 a# ^0 z3 E3 n% S
- char *dmabufdest2 = NULL;
$ E& k0 \7 B% ^. `* C- [$ E
" q2 i6 v5 @+ v) R% ]- static int acnt = 512;6 I) u2 {5 L7 c
- static int bcnt = 8;3 \9 r8 h B7 \9 w7 H! V! B- i7 w
- static int ccnt = 8;
/ u8 _) A$ E" A( x3 t
$ C8 C& ^# E% _% h- A" V9 f6 F- module_param(acnt, int, S_IRUGO);! e6 h* Z+ ~, F: K9 o% m
- module_param(bcnt, int, S_IRUGO);
; M5 v1 J$ l$ W5 N9 P - module_param(ccnt, int, S_IRUGO);
复制代码 $ E9 S- t; Z/ N3 K4 X$ w
2 r! }- U5 F# o) v- f3 b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 z4 i9 P' l/ qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( J9 U5 v/ B+ |" }" n( x- h2 y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 e' Z- `4 ]: H. }1 v! }8 d2 D+ B4 R) m( d" b( X' d
3 p8 j0 f5 g7 e r# C |
|