|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% R! n+ G9 [9 y* l- [code]EDMA sample test application U M6 v( }4 a0 `
- /* G9 K& G" ~& u8 x0 o- M
- * edma_test.c$ T6 j7 T) |# r8 s5 d1 K
- *
* b! I: L% q: M% X - * brief EDMA3 Test Application
3 O% I+ E2 m. H - *
2 D8 I4 i. D0 L) g6 [+ l5 S - * This file contains EDMA3 Test code.( J! s" v' }! k; k1 t% x
- *
9 m3 E7 n3 }& i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ w( z5 m# D( H& P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 q d3 i8 f% d' c. w
- * TO CHANGE.2 [6 F& s# Q4 m7 @! `1 z
- *+ K! L( N$ u! t7 W" L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 _6 a" @* t4 O5 d
- *
+ z1 E: D. ~+ e; r, b3 h3 ~/ n - * This program is free software; you can redistribute it and/or
; f5 x9 B" M; ~$ k7 X/ e - * modify it under the terms of the GNU General Public License as
. n, t- t3 ]7 P7 H& t - * published by the Free Software Foundation version 2.
( c# z! X6 Q# T8 k# U% V - *3 h/ j. B% J( s6 b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 @# \' B! g0 P3 c, `
- * kind, whether express or implied; without even the implied warranty( N2 i6 S b9 O! v. X2 E* m% c s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" T1 d# X$ S: n3 B. b% Q7 v
- * GNU General Public License for more details.& t" E9 a0 x6 A. C1 P6 c2 p
- */
0 s9 |- |6 u/ T - + h4 x" r/ a- @( r! P% u
- #include <linux/module.h>
, [) l/ z% L3 X0 T - #include <linux/init.h>6 E/ Z. D& o% s
- #include <linux/errno.h>
# p- D9 I6 V. N0 q! \# s% p6 p - #include <linux/types.h>0 B6 G1 n6 I; h" b: ]5 n. A8 t
- #include <linux/interrupt.h>" K+ K2 c/ c- Z; G1 x
- #include <asm/io.h>
! L' e/ R; g, w- Y9 Z8 S' p1 t5 N - #include <linux/moduleparam.h>
0 [8 z! K7 z4 d2 X, C; \. z/ ^% r - #include <linux/sysctl.h>( v. E, R8 A/ J
- #include <linux/mm.h>. [+ Y7 n( o4 T9 ?. _
- #include <linux/dma-mapping.h>: `9 p" @) Z+ V5 b, ?
. o7 A6 q$ t+ b7 ~- #include <mach/memory.h>
# i' @# [% V; Z W3 x - #include <mach/hardware.h>
: ]& J' X0 a5 o4 `. ~ - #include <mach/irqs.h>* c) B4 m& w5 T$ y% s% K
- #include <asm/hardware/edma.h>5 j( Z% c! {! {& `, c% @
- $ z9 E. J1 K% [
- #undef EDMA3_DEBUG
% n9 i4 ?+ k n - /*#define EDMA3_DEBUG*/
! p" f0 d2 W9 x$ T - , ?! I& w, f# s4 j. z: v" a0 `
- #ifdef EDMA3_DEBUG3 D4 l9 d" o1 `% F/ D" W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% E1 @+ U! _; k0 m3 D) g c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 D/ W* i4 T7 {8 z# ` R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; i" Z/ _+ T) }% g& ~4 J - #else
; L# T* y* n5 n7 w. v% v - #define DMA_PRINTK( x... )
6 x9 t! z+ F! B% u" N( P& e - #define DMA_FN_IN2 z X' P5 P- E* _9 u1 `
- #define DMA_FN_OUT
3 n. O+ z& h( Q4 e1 `, [ - #endif# G! i$ P( C7 H7 k, n3 Y+ x
- 7 m4 G4 Q0 j& k7 l6 Q0 _ r3 N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% z& C- ~" ~" n: V7 C* d4 q
- #define STATIC_SHIFT 32 Q% P" R6 S; _* o
- #define TCINTEN_SHIFT 206 w& V2 V) |2 A. V( ~# ^
- #define ITCINTEN_SHIFT 21
$ w e" n1 y. i - #define TCCHEN_SHIFT 22
9 }/ U' ]- ~5 I! S, g8 ~ - #define ITCCHEN_SHIFT 23) H& d- Z2 o, [1 r3 y4 h
: K6 J1 c: Y! X/ {, W5 j& a$ M- static volatile int irqraised1 = 0;
% V/ v: J8 \5 n( R6 E* v) u' h - static volatile int irqraised2 = 0;
5 z, P. o& V7 \* B# J/ {% E* S - : k0 q+ }0 Y! Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 E" N; |! H1 L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ l5 ?: F' I B4 U6 s6 Y# @2 [. M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: n- [3 I1 E* f: k) m) k - 4 J- U5 o6 P8 C4 `
- dma_addr_t dmaphyssrc1 = 0;4 ^4 v: L6 D; q9 [; k0 t3 Q
- dma_addr_t dmaphyssrc2 = 0;
, j, ?+ ]. u/ s) E9 d - dma_addr_t dmaphysdest1 = 0;5 F, S! J: `, ]; _* u
- dma_addr_t dmaphysdest2 = 0;
. `; l4 e& Z* W: ~) v: t0 @* N
2 d& g5 I$ t- s1 J2 I& L: h* A- char *dmabufsrc1 = NULL;
8 ^4 J1 F: g j6 s0 [; ] - char *dmabufsrc2 = NULL;' g: p: g+ Y i( v
- char *dmabufdest1 = NULL;
$ f# {) r% T2 q. ?+ R' y( d3 r - char *dmabufdest2 = NULL;
( i' V/ J2 O7 o# e - % M, N2 a2 m* t6 c+ v+ ~
- static int acnt = 512;
7 G$ d3 A+ M: `' U* y+ m - static int bcnt = 8;
" ?/ G5 M: X0 t1 h, } - static int ccnt = 8;
7 j) J5 L. }$ K4 R( I0 \5 x% T
/ _4 M s0 ~0 S$ g9 j$ V* Y% _- module_param(acnt, int, S_IRUGO);
7 R2 N3 _# }5 V# W% w8 l - module_param(bcnt, int, S_IRUGO);- p* J2 l( H" g! m+ K7 R6 f
- module_param(ccnt, int, S_IRUGO);
复制代码 ! r# m3 G5 w3 Q, G: T. V5 L( G
" e+ c& f/ Q' ?! q& s0 w9 w# T% K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ r" H3 S/ g* v d$ N# Z; ^
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 C' ^5 Y9 j8 f9 G P7 D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 e0 l* X( R$ ]2 u% i
7 M+ X# v/ L0 u( j& d
) Q. c1 T' J% b/ T6 Q- j
|
|