|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 A1 n( w: O t1 @8 ]
- [code]EDMA sample test application& p8 J& S* t' F F9 {; \* F' e
- /*
$ x ~0 @; q+ G: w* t% C' q - * edma_test.c
. P# v$ N; f& H7 y/ i3 l3 } - *7 Y, E& A( {6 }: K
- * brief EDMA3 Test Application& \ g( D% O+ v9 ~2 l, q. `
- *
0 u1 `- L. c, c; G0 R - * This file contains EDMA3 Test code.6 D. V- ~' |9 K; I& k' v
- ** M4 P# a/ N& u: q- H0 T9 p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 x$ r, }3 ]" d" u8 K: X1 i, V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( ~: ]5 f0 [5 C* \. e - * TO CHANGE.
! {8 `0 W! c4 D. v: A# a1 V - *" ?7 X0 ]2 P- u3 W1 R- J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. W0 o' O1 a. I* a# R% _' h - *
4 y% {6 H( f4 [+ _2 [ - * This program is free software; you can redistribute it and/or
9 w4 h0 N) C& W) n6 @: X5 F - * modify it under the terms of the GNU General Public License as
3 r4 [9 i# Q3 _2 V' W. F0 X2 D - * published by the Free Software Foundation version 2.
: x# H' @4 U! l& q. T) u - *
! {4 {' L2 y- g# X; @4 s2 F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 \( D" l7 y" P C& l& V0 U
- * kind, whether express or implied; without even the implied warranty [* |3 J# D; p7 [8 t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 K$ }& L+ l1 {; s
- * GNU General Public License for more details.
( v0 w+ K ]) z% |1 y4 }, t - */
: ^6 w- f0 S7 K1 l) e
% G& q2 _. ^ f* S9 B- #include <linux/module.h>
( s2 \; a6 S4 F3 W& G; ]" h0 n - #include <linux/init.h>
3 K3 Y0 M( g* @# T% I/ z - #include <linux/errno.h>; ^6 J' Q" I2 S2 ]
- #include <linux/types.h>
" O6 ^6 M5 y6 B6 ` - #include <linux/interrupt.h>' J! h! h7 V) ]1 T/ g+ x
- #include <asm/io.h>
! r! B- R' X$ b( U5 j - #include <linux/moduleparam.h>' e: y" m- r% i& k; h; j
- #include <linux/sysctl.h>; u1 L7 L: \! I% b
- #include <linux/mm.h># F& L3 G; w2 R! t) n F3 B
- #include <linux/dma-mapping.h>2 j8 K1 [" C' N. }
0 V% L# c1 o* R6 |) `- #include <mach/memory.h>2 k* F/ ~9 Y- Y/ W- s7 ]" T
- #include <mach/hardware.h>
) `' g5 s# Q; j2 { - #include <mach/irqs.h>
3 n' v5 p3 I9 n" i$ ? - #include <asm/hardware/edma.h>/ V% c6 D+ F- I6 w) M$ A( u; d' i
6 f$ _+ w( h5 Q; T- #undef EDMA3_DEBUG
7 d" ? V' Z- n% o; Z; M# ] - /*#define EDMA3_DEBUG*/
, r5 h; U$ T* ~. \% w5 [- x# M
8 u( v, l9 e( ?- #ifdef EDMA3_DEBUG- i0 S6 y0 G' S% g1 M0 J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) S8 l. b. D2 p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 l% Y% S) C2 T J - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ E2 \6 L; r7 U$ n( i7 J! X# f6 r# z - #else
% n# v; c) d+ A3 h a - #define DMA_PRINTK( x... )
( q3 U g8 A: c: W. O - #define DMA_FN_IN# u) p" }' J4 b" A2 K/ Z4 L9 J
- #define DMA_FN_OUT
; S- k0 D7 S2 g+ s - #endif
+ X/ q7 N" C! _; P: ~4 O - $ [9 f2 ~$ a" y) y N r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" {0 t$ f' R* V* J
- #define STATIC_SHIFT 3! R, s9 Z2 x- M& r, d
- #define TCINTEN_SHIFT 20. S8 U; M- U2 p
- #define ITCINTEN_SHIFT 21 R+ m7 v* _ y2 w' w" ~
- #define TCCHEN_SHIFT 22' n' | X4 i. T' Q
- #define ITCCHEN_SHIFT 23+ b- v$ J( W# F; S/ s
- : ^5 e/ E0 [" g% p
- static volatile int irqraised1 = 0;$ F) T) Y2 j4 y1 Z A6 d0 q6 v$ S
- static volatile int irqraised2 = 0;$ Q; S2 q- R7 i# [! f, f
- `1 v# Q3 N! M. G d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! `4 J1 k$ b8 A. a" {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 M3 M) w; R, ]% q4 M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! |9 d b; o ~3 p' M1 r
( r; q( }5 c& g% |+ p4 }6 g- dma_addr_t dmaphyssrc1 = 0;
% t4 X# {, n/ t" B - dma_addr_t dmaphyssrc2 = 0;3 B, F- G0 t6 F9 E- X3 X
- dma_addr_t dmaphysdest1 = 0;
, q& c# B; x* J4 y {9 D2 a - dma_addr_t dmaphysdest2 = 0;4 {& n0 t8 Q) I+ ~, E4 v
- ) L. b* s8 T+ }/ n6 g* P
- char *dmabufsrc1 = NULL;4 n7 |% l" k7 w( @9 n" U" _$ O
- char *dmabufsrc2 = NULL;$ p9 B6 h$ l6 F, K
- char *dmabufdest1 = NULL;" {( _9 x i2 G: \3 T. O
- char *dmabufdest2 = NULL;
& V1 v. g/ {9 B: X$ o" Q - & c q* C1 i& j$ J1 u5 l
- static int acnt = 512;+ n( V# H) t/ ]7 Y& s$ V9 u- `3 t" i
- static int bcnt = 8;+ d' ~/ ^ x* E1 B
- static int ccnt = 8;
& B2 W6 t! i" v0 A
7 V" l9 A: I; i- r- module_param(acnt, int, S_IRUGO);
: O% k. N9 x2 E$ ? - module_param(bcnt, int, S_IRUGO);
2 u5 c( ~9 N; u! `' a/ a& B - module_param(ccnt, int, S_IRUGO);
复制代码 - C8 `0 {/ o7 ^1 {( q
% M3 C s. M- z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( p4 L, p4 m# R& ^0 w: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ Z; ~8 F% h% X! D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* z5 G8 s* ^ q
7 d5 X$ |; M) E& n# ?) W& t
4 P o% R% e r! r* y, A; _* G |
|