|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ X# z/ o3 l$ y0 V9 L' g3 P( I
- [code]EDMA sample test application7 j2 _* e& ]6 S: G$ I q5 r+ ?
- /*
) _' g6 F0 K( V2 ? - * edma_test.c
7 G" m7 Z* g$ L k& O - *. G" G5 A3 {+ ~* w. @6 }- |$ M9 ]
- * brief EDMA3 Test Application
5 ], j9 b4 m- ~$ c' | - *1 _) H8 g! e' S
- * This file contains EDMA3 Test code.
2 ^! }7 g1 s# g6 g! {! Z9 I- y$ }0 O- K! Q - *
: c; R% h7 i9 `1 S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# r0 ?% W0 t( q1 a& \& x" A# ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" `; g/ `* V$ r2 B% {8 n7 o
- * TO CHANGE.
. j/ I/ ?6 U8 T - *
# O1 X& `7 z7 _2 R2 S+ d* j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ G1 D- e! w, v
- *
# D; j: X: `7 {# |2 j& y - * This program is free software; you can redistribute it and/or, N' A+ ?( c% c/ Q: B( N7 n
- * modify it under the terms of the GNU General Public License as& s$ n8 I& S3 G: K; N
- * published by the Free Software Foundation version 2.
) M+ W/ v1 C. e# X9 i9 {1 n& J - *
F& i* V( F: q& [! G: d1 N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 ~ O0 k* I5 J. _% o1 k+ ^1 h- W J - * kind, whether express or implied; without even the implied warranty9 x) L& L/ T& K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ X! ^1 C7 X7 q/ N+ V
- * GNU General Public License for more details.
' Z% C5 U3 ]1 v ` X; Q' a' `0 n) f - *// @5 p- M! V- j. Z
& [2 O& p$ ~; u5 D8 d% l2 X+ n- #include <linux/module.h>0 z3 m, z, Z/ E# U
- #include <linux/init.h>
/ v7 r9 L& X& p& w8 q - #include <linux/errno.h>' O$ R. g% z* Y; X9 i4 ^# G
- #include <linux/types.h>; V. Z4 c" k( G: P, c; G# e8 W
- #include <linux/interrupt.h>
$ h9 `# M' N: K - #include <asm/io.h>
. B P+ I$ L9 U7 t, j/ G* U8 u - #include <linux/moduleparam.h>% {4 X4 \6 ^, M3 p( l- P; c
- #include <linux/sysctl.h>
, ?2 E$ A6 f: B8 a+ ^) v - #include <linux/mm.h>/ |" L7 K9 `5 x9 s9 L; T
- #include <linux/dma-mapping.h>% `! m4 i0 i: w" i4 g7 [
- H2 O" a! o7 d% f
- #include <mach/memory.h>
0 `1 y* _+ d9 u2 t - #include <mach/hardware.h>" R" l! B( B5 z1 i0 n1 Z; A% k
- #include <mach/irqs.h>; y4 _1 R. R/ y
- #include <asm/hardware/edma.h>, D4 t9 e" |! [1 e4 |# e, d
- m1 I+ p0 I$ W
- #undef EDMA3_DEBUG
- E* `( U: d0 ]6 U5 { - /*#define EDMA3_DEBUG*/6 D$ z' V. Y1 W
- ( e/ F" O* R; E8 P; ^& l
- #ifdef EDMA3_DEBUG G" |! J* @) ]3 Q1 H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# v. j2 v6 O$ P& [0 Y" \( ~" [! [7 I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 }- |0 x/ D" @1 ^$ u' ^6 | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% S9 Q% X0 x9 i
- #else
1 l' _* Q6 Z' u4 t - #define DMA_PRINTK( x... )
( T/ O8 v( {# t! {; `& T( h - #define DMA_FN_IN0 F* R; M' {( Z# {. ?
- #define DMA_FN_OUT
- E, L, |9 b) o! C2 |8 b - #endif
- Z) r# V4 U g' a - 1 x% \5 i, f' x. r0 V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% ] v% D% [6 I% T' \1 A
- #define STATIC_SHIFT 3
# x5 M- t- T' K% p3 K - #define TCINTEN_SHIFT 20
9 N. g2 c7 n% d' s" g4 x; o' s - #define ITCINTEN_SHIFT 21
* M& |& a- r/ q9 T0 a$ \" o - #define TCCHEN_SHIFT 22
& P& I1 U+ M4 N1 d* m( O - #define ITCCHEN_SHIFT 23/ S3 W& a. l; W; [2 [
( { G. e5 T' b) Q$ C4 ^5 S- static volatile int irqraised1 = 0;
% S2 j) V$ P" K7 M - static volatile int irqraised2 = 0;9 F5 r+ q8 u% G0 a3 W0 d) d
- 7 x1 @8 P- M3 E; I8 Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( S( n3 F4 h" u1 O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, {& X1 ?4 b* R# Z$ S; m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 L7 F# A% |5 B" b1 ?# M" I
- , H* k Z j [
- dma_addr_t dmaphyssrc1 = 0;! p# z) s2 a9 Z
- dma_addr_t dmaphyssrc2 = 0;
! } u4 X; I! c - dma_addr_t dmaphysdest1 = 0;) L" y1 L# @) t! R7 {7 R2 B: ~
- dma_addr_t dmaphysdest2 = 0;! |0 c# t. }/ ?/ C& H4 F
* |# |9 t0 d' E( [! E q% n- char *dmabufsrc1 = NULL;
. U+ e7 n( c2 p- o( N9 w, t% O - char *dmabufsrc2 = NULL;
9 x) d) q) q) u. N" j - char *dmabufdest1 = NULL;9 ~8 e& [0 s v9 I4 t
- char *dmabufdest2 = NULL;& |0 _/ o! n4 g, \
- , |8 b9 w! L! \+ g- X7 s
- static int acnt = 512;9 ^) D( h5 ]& |( C1 `
- static int bcnt = 8;
' c# c6 P+ b3 g8 t - static int ccnt = 8;
* |6 u/ o6 v8 M5 q4 o/ c
E) U3 i: d4 X3 E2 f! J- module_param(acnt, int, S_IRUGO);* o% \8 I* M% v! ?9 T8 T) P
- module_param(bcnt, int, S_IRUGO);2 D( w( K! a1 s7 q' _/ f2 i
- module_param(ccnt, int, S_IRUGO);
复制代码 : ?8 r) R5 g. Q# p4 t
3 i( r: W% u5 \6 u- Z6 M* m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# M- Z" O' `1 Z9 D+ n2 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( T7 P" z; Y l S' E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: C) a; h0 K$ d' w8 q
$ x4 k& d. r- ~( w' B3 T( M
. P# c0 f# d8 f+ D |
|