|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # \% G' D+ l0 A7 p; T! y) q
- [code]EDMA sample test application
% ?0 o6 |5 i L) J2 ] a - /*
b$ b5 A/ J* m - * edma_test.c' V! Z6 }0 D- p. j# l, d
- *
; W& g4 s7 W9 p) ^1 n/ }% Y Q - * brief EDMA3 Test Application
& d0 [8 ?# U2 P& V; i: |& X. z2 @ - *
1 S! j6 S$ |' h1 w6 Q - * This file contains EDMA3 Test code.3 k6 s' z4 Q F
- *6 B/ _6 A9 B. ?; ^, p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 y( Y' |- `6 m6 s( K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& Y) h0 E2 T( F! z5 `$ }; K - * TO CHANGE.
/ q1 {" Q4 R* _8 X! X! V) k/ d - *8 C0 g3 [0 y6 Q; t! [& o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ k1 q' b! d2 v" a& U% ] - *
6 N! J# T7 I5 V6 ?! [ - * This program is free software; you can redistribute it and/or& \9 N3 ]2 m* A& l7 Z) {+ e. a) C9 f5 C& b
- * modify it under the terms of the GNU General Public License as
: b' Y+ E; Z0 I0 V - * published by the Free Software Foundation version 2.) A) c1 n2 @; l+ ]& G9 o
- *
2 x/ S: |& A3 u- v9 g1 u3 k$ y9 T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. d( F4 S8 n! W% [3 l& n
- * kind, whether express or implied; without even the implied warranty
% z8 n2 B6 e* O- [5 x, H6 B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 `) _1 S- t8 Z
- * GNU General Public License for more details.
0 t" u2 R# K* [7 I - */
% a: d4 }) N' g6 R6 D
+ A- P) [$ ^( P }# Z. a' H- #include <linux/module.h>
( a; B/ l6 z, H' @6 I - #include <linux/init.h>% B6 }" S9 }, y' J
- #include <linux/errno.h>4 s' w& L* S" E9 t4 y) n8 H' X
- #include <linux/types.h>7 t M" A7 E5 l1 W. {4 i; P7 ?
- #include <linux/interrupt.h>
6 U+ W+ l# {9 \ - #include <asm/io.h>' ?% C- Z: z: A0 Z* ?7 r
- #include <linux/moduleparam.h>. H% Z% T7 B5 e. c9 j
- #include <linux/sysctl.h>
$ z+ _9 @, @. f/ V, j1 A* f7 ^ - #include <linux/mm.h>
! d, g3 b6 D1 |! V7 @+ k0 y3 N" l - #include <linux/dma-mapping.h>8 J! q, D# C2 T$ a0 ~5 Q: |7 T# T
& y% H* I" I+ K5 b- #include <mach/memory.h>1 m8 `' l, x( g" o* S/ V. ^/ }! B5 [
- #include <mach/hardware.h>
( v1 j% U% I, v2 A - #include <mach/irqs.h>% J9 t& s: z3 o1 D6 K
- #include <asm/hardware/edma.h>/ U+ y' ?/ I( I) S
4 I5 ]+ H8 y* g/ u5 s. S- #undef EDMA3_DEBUG! y' |* F! K" h' w# S4 K1 g8 {
- /*#define EDMA3_DEBUG*/
- ~6 x: ?/ Y2 N5 _1 c; v/ r" e1 g3 u
z, K' E0 C+ t1 H* V- #ifdef EDMA3_DEBUG
4 \2 w4 o9 Q8 G, v( F3 h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 G! W& h: s6 r' `" i6 x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& k/ k* A1 F9 D; l# n; M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. d+ B# d/ o6 g( [ - #else
9 A0 G& \3 z& a - #define DMA_PRINTK( x... )
9 C% Q5 c; { I, D H/ L! E - #define DMA_FN_IN& m- I" w1 w( |8 w+ J# w
- #define DMA_FN_OUT
% n3 a8 M7 m" P% D/ v' k$ M0 p. o - #endif
, @2 K: `) h) V - ; Q2 c% i$ f! i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 {7 E Q `$ A1 J- z
- #define STATIC_SHIFT 3
2 b0 l6 H7 e6 j6 \' a' Y( Z; Z - #define TCINTEN_SHIFT 20" i9 Z" l# u& y! s; p" Q$ [& u) W
- #define ITCINTEN_SHIFT 21
/ D4 \9 |$ a& ~4 X% ^# K - #define TCCHEN_SHIFT 22
/ {7 B5 w' [! B' D# [0 i7 V - #define ITCCHEN_SHIFT 23
( r" }* l) D/ M# L; x8 b! a - ( w" n" N- w. S! b0 c. x
- static volatile int irqraised1 = 0;
7 H6 c9 O+ @3 ?' a/ f - static volatile int irqraised2 = 0;9 E0 T+ _' |, u+ e+ f/ a' w9 \
; x- ^$ j6 r7 J- n2 {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( G* O" l) M. }1 j% @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ W o: w( _; l9 @! ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 j6 T3 v# ?, U; @
- x# U; |8 P* O2 T- dma_addr_t dmaphyssrc1 = 0;8 t- T7 d9 W9 X+ E
- dma_addr_t dmaphyssrc2 = 0;
% |# _% N& j7 V- O* M7 }- m - dma_addr_t dmaphysdest1 = 0;
) F$ S F2 U- M$ A4 o/ J& m" A- I - dma_addr_t dmaphysdest2 = 0;5 H* L. ~& E2 V" _
: u2 A4 O7 B% O u- char *dmabufsrc1 = NULL;5 z/ A4 X; L0 ?- b5 ]0 W) ?2 T
- char *dmabufsrc2 = NULL;2 r$ R3 I, y6 {' k% b
- char *dmabufdest1 = NULL;) @5 l( _3 { \: B: N- K. E
- char *dmabufdest2 = NULL;+ V6 w: q! k1 Q8 N: C' \
- ) i: T6 p" f" z$ n
- static int acnt = 512;( t T, p: o6 S
- static int bcnt = 8;
6 i( F/ c4 L S% O* S4 b: L - static int ccnt = 8;
0 R; w; u! o) k: C
7 u% |% S8 Z: c% d; z, U& @- module_param(acnt, int, S_IRUGO);. X6 y9 S9 ]' m5 q) E0 n: {5 V
- module_param(bcnt, int, S_IRUGO);# h8 p: H W# X
- module_param(ccnt, int, S_IRUGO);
复制代码
Z7 t" C! k- i
( V5 R+ V: Z. ^2 `6 x: z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ h% Z* S- t* _6 Y! S/ Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 o. d" [) |4 Q% P0 t6 i0 `* g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 R3 w6 g+ w0 j7 x4 T# ]. i
+ {4 r# X- s$ ?7 w# C
8 P5 o( g7 U$ d6 z
|
|