|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / m) R. [; e* T& e- @
- [code]EDMA sample test application
: c7 e: P7 ^7 H) ?, Y& @; b) L - /*
' G+ T" @$ ~$ A9 O - * edma_test.c
% Q1 }/ U8 ~& d$ W. s5 a - *
4 K2 y1 Z1 d: ^! X. ]+ G# N - * brief EDMA3 Test Application" h9 u) r! H; s& m+ T' b9 @
- *
( L- P* g+ k i5 A( C - * This file contains EDMA3 Test code.
" U/ f/ E7 T7 {- \2 U - *
8 W# H0 l7 _9 ]. K' J/ O( L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ \2 j' P$ t3 _0 T, G2 ^$ p, N; | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, ~! x1 w6 F2 Q2 N* x% ^! I2 ?6 H6 h2 n
- * TO CHANGE.+ x5 K% W) S: B4 p+ [
- *
& u3 s( ^$ S7 L3 f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- v7 |, x" H' R
- *
: ~( u! i# P1 m2 n& U. x - * This program is free software; you can redistribute it and/or
" N! V" N( R% q4 J( N; e3 J! { - * modify it under the terms of the GNU General Public License as
( C& c; G! v& i% \ - * published by the Free Software Foundation version 2.
3 B% c; ^8 z- b4 j: m* e! V( M - *1 y: @: ~+ z0 e- t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, L$ x* h* C$ m. B" h) Q6 ^ - * kind, whether express or implied; without even the implied warranty5 W4 U2 _: V. r# M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ K, y# m# G' O. V0 M1 ]7 y' v
- * GNU General Public License for more details.
5 q6 z/ I3 H6 f8 r8 [/ j) x7 ? - */: e6 w5 L; i% f
- 0 f+ ?$ F d0 W
- #include <linux/module.h>0 G9 O7 U; V( r. s- n2 w% d" h
- #include <linux/init.h>
: \3 Z8 z8 i, v - #include <linux/errno.h>1 T1 b' U' v" t8 H5 d2 B
- #include <linux/types.h>8 K6 Z; v! |* r; u6 |6 p
- #include <linux/interrupt.h>
6 X% w2 ~+ t' u% [, A/ `6 m# N - #include <asm/io.h>1 u; p; D A. L; ^, t9 b' G
- #include <linux/moduleparam.h>: W" l) d6 i# j L
- #include <linux/sysctl.h>
8 B }3 d! e; l8 i! o Y - #include <linux/mm.h>1 R' w$ {( v/ s! w" f2 T4 f3 l0 O& a
- #include <linux/dma-mapping.h>2 u. |8 L' p* A; h) _' S
' P4 r, B) L s9 ~& @: a% e/ |- #include <mach/memory.h>1 a+ }9 m- T$ Z. m: C& O
- #include <mach/hardware.h>
3 g% i% o8 t0 f6 k0 e& x - #include <mach/irqs.h>0 ?- P; N3 I' j |' I
- #include <asm/hardware/edma.h>
6 t% f2 Q6 Z5 {* I0 z - ! g, _+ L2 c R( ?; J; ~% ^# D
- #undef EDMA3_DEBUG
) @" J4 f% V' I6 ` - /*#define EDMA3_DEBUG*/: M" E0 L F1 m1 @9 i' E4 s; Q
2 @/ u$ |8 d6 g8 E- f- #ifdef EDMA3_DEBUG# z) K2 s7 w. X5 x5 q) ?* s/ ~7 R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 O' j: i1 E3 b1 ?" o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): R. N2 z. l# A7 _# s9 N* G; J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), H) ]" i: g$ z6 i( t" N( @: n
- #else6 Q" _- f% _3 G) i; A1 \! i7 o
- #define DMA_PRINTK( x... ) w+ B: b' e, o
- #define DMA_FN_IN
) G' G, u+ n4 F) m% Y( j- D: s3 K% @ - #define DMA_FN_OUT
1 R$ l, K) }& d. w0 l6 P9 }* r - #endif1 \% s, B4 w- G! I2 U6 u+ R- _
+ d* E, R9 C- T. ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: p( |5 Z0 |! U8 P5 i" w - #define STATIC_SHIFT 3" d9 ]* w, d" T/ G: R: X
- #define TCINTEN_SHIFT 20 }6 x# N; B) u4 S* R6 C
- #define ITCINTEN_SHIFT 21
" o- z5 o7 I/ Q; ` - #define TCCHEN_SHIFT 22/ `, h" w1 d$ i
- #define ITCCHEN_SHIFT 23) i- i% g3 S5 I' c; h* k
- 4 _. c- V5 F+ A4 v
- static volatile int irqraised1 = 0;
- l- b4 r; Z& C) U - static volatile int irqraised2 = 0;
, |( y: d7 `* u7 D# d0 M3 } - + b7 T @2 ]' T; y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* Y; Q6 U) }! z/ T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 i$ E) v& a0 a9 O# s) U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* q+ H* u1 q# U$ o% n: D$ k! B7 b. I2 k
8 ^( m: O1 L4 z* S- dma_addr_t dmaphyssrc1 = 0;
; y% x" e) M0 n6 o* g - dma_addr_t dmaphyssrc2 = 0;) C* s8 ~$ ?# K
- dma_addr_t dmaphysdest1 = 0;
! p4 F. b |: N6 O! p( V! K* } - dma_addr_t dmaphysdest2 = 0;
! P7 q6 s {% C8 [+ Q7 |( L - + b$ ?4 T8 I- [4 y
- char *dmabufsrc1 = NULL; _2 o9 H$ z, [6 v
- char *dmabufsrc2 = NULL;* S4 {0 Q T- ?( n
- char *dmabufdest1 = NULL;
, ~& v) f/ m( h) C- m; J - char *dmabufdest2 = NULL;
2 \% f F1 x, @6 P" O) P3 e( ^# H
6 _# \: \& c4 @1 G8 }% v( R- static int acnt = 512;! ?& o. i5 ^" f/ P
- static int bcnt = 8;
V9 m" Y; E/ C; R - static int ccnt = 8;) I8 K- r$ a- A
) g6 v" u) T8 y1 E2 g* ~- module_param(acnt, int, S_IRUGO);$ U1 E# ?1 F. B$ J6 j, e
- module_param(bcnt, int, S_IRUGO);6 u1 s; I3 D) Q" s: g
- module_param(ccnt, int, S_IRUGO);
复制代码
& m) e' `* T# w3 E& j+ W
3 [, ]+ C* h' ?" k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& `$ A7 L' m2 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; @6 \+ l) I, C/ Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' B8 m5 O& y/ x& Z7 \
% `5 u c* P# z& Q) h6 T* n* x# M3 T6 u# ~. C' @5 \
|
|