|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # o. d/ `: F8 z j6 K2 d
- [code]EDMA sample test application
@5 R+ G( u: H$ \& [6 [ - /*
. w) n3 h% {& g - * edma_test.c1 B P: ^* @# }+ W+ N
- *
* b x& M2 N: J( w% F) g: V- b - * brief EDMA3 Test Application7 v- ?' g3 d( h4 d* S9 t
- *9 D2 p3 c3 N9 G( r/ r D& T
- * This file contains EDMA3 Test code.$ i$ s2 W9 P6 ~
- *
+ w, V1 h% o& A- |+ N e2 B' D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% b# V V: N3 H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 X1 i T8 E G2 E! i
- * TO CHANGE.
' A# k; ?' [! D+ O5 | - *. c" ~1 V, X: }! L4 `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 c5 O6 c0 k6 J3 `( {# k2 F$ \
- *
1 O- M3 O6 d$ m \3 V a8 n - * This program is free software; you can redistribute it and/or
7 U' B, N- y5 b0 p( t$ E - * modify it under the terms of the GNU General Public License as
' ~4 E( y: A4 }1 ` - * published by the Free Software Foundation version 2.6 V& N; Q2 H: I
- *9 e g* n" C; x! Q: M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! p4 O9 g1 [! y6 V: W - * kind, whether express or implied; without even the implied warranty. Q% l; w4 h$ b' L' l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 ]: L0 p/ z/ v c! m* s- V - * GNU General Public License for more details.
9 X/ x" y+ U- @6 x9 B4 Z - */8 R- X+ ]' N; w( W2 E+ V
- ! u: b1 o$ D7 x
- #include <linux/module.h>
" s' O. A; i8 `% H1 f( v% C% j - #include <linux/init.h>0 b. p4 v2 L' ?* @# `0 d
- #include <linux/errno.h>
. b1 b! l: j h! ^5 J* _) ` - #include <linux/types.h>
: T6 y5 w, W6 b - #include <linux/interrupt.h>+ J- n: ~7 P; h/ @' U; Y
- #include <asm/io.h>
6 F2 r1 H8 I$ n; ]& N - #include <linux/moduleparam.h>
3 W8 r" w9 n5 A& K# \* q* g0 g; Q - #include <linux/sysctl.h>
2 J2 V3 F0 I: p( l4 C* W D - #include <linux/mm.h>
% }+ Z1 r5 W5 x/ K7 A! ~9 s - #include <linux/dma-mapping.h>8 y& _5 T# m- p/ N1 C) j
- 4 J; ~0 @ L: _8 }* E5 N' v9 F5 f
- #include <mach/memory.h>
' h$ o2 U2 ?9 L$ N' ]2 w! U' E - #include <mach/hardware.h>
2 N+ I* @& \+ ^8 J7 W3 o. u5 b - #include <mach/irqs.h>3 F8 I3 v) ?0 F0 Z3 N0 e
- #include <asm/hardware/edma.h>: R9 v/ ^8 \8 s
- & F% w# `3 ~: g0 a+ N) R* f9 W
- #undef EDMA3_DEBUG8 E; h X" }8 R2 p& X9 w; ` {
- /*#define EDMA3_DEBUG*/: O: i8 \7 F) _" q6 }$ S; z
- 2 e" S0 w# j6 ~+ g% i
- #ifdef EDMA3_DEBUG9 z, U" l9 M1 X" m2 M& R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 O8 D, y. ?- Z, L6 q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' ]2 h* {& d( r F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 Y* [6 f ~+ m& Z - #else* y, P( R0 ^7 K+ d7 }3 L& _ d1 j7 p
- #define DMA_PRINTK( x... )
' g# ~, n3 e* e' W8 v7 k1 q - #define DMA_FN_IN9 x0 o! a9 n& _3 k7 C4 t
- #define DMA_FN_OUT
' v+ f& C/ o7 F) T' m# \- t, y - #endif
: |) ~5 {2 r$ T7 ~4 p! i" `
4 y$ V @# O1 N" ?, e2 l" h7 f6 U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& Z3 Z- S _3 o2 O+ j7 N0 y
- #define STATIC_SHIFT 3
% n: L6 u: `1 P7 k( W8 G - #define TCINTEN_SHIFT 20+ q7 w$ `- ~) Q
- #define ITCINTEN_SHIFT 21
# ?) ]' o/ b/ C2 F8 C% F - #define TCCHEN_SHIFT 223 O, y( J* R! N2 B5 F/ b
- #define ITCCHEN_SHIFT 23" z: Q$ p1 G! S) b" Z# m0 r$ t. Q
- ; H( B. s) H& N( I. j
- static volatile int irqraised1 = 0;, ^' ~$ R: q" ~! P
- static volatile int irqraised2 = 0;+ m0 s0 p, p/ _( y1 X: y+ ?, {% {
- 3 y; W/ F r+ A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ P! c; ]9 I; K" I; `: g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: s) e& {' v9 O' w$ I% a) o; G9 g9 U4 `, c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 V$ [0 l" _# b& g/ y; T
4 W, x. q; B# \* u' A. m% T- dma_addr_t dmaphyssrc1 = 0;
- w( b/ i, d* i' v/ x1 ^1 {5 H - dma_addr_t dmaphyssrc2 = 0;
7 g' C2 J4 T# B% T, ? - dma_addr_t dmaphysdest1 = 0;
& y: I7 A7 o# _8 ^8 [: ~; {# U+ X - dma_addr_t dmaphysdest2 = 0;
9 x2 @- j$ G7 W* H0 y - 4 a7 u' w3 z9 m! }7 Y
- char *dmabufsrc1 = NULL;( e4 r H* {3 {: H$ ]
- char *dmabufsrc2 = NULL;
) c( z6 V" F. A( D& a0 D - char *dmabufdest1 = NULL;3 Q1 o( t5 o+ S% _
- char *dmabufdest2 = NULL;% k5 c( O8 E' ?0 l! F t8 o. [
9 O7 N8 H' H7 m4 Q/ ^- static int acnt = 512;
( P1 [! G( N& h. e - static int bcnt = 8;
, h4 j, V/ k9 k8 Y$ d- q* Z2 w7 e - static int ccnt = 8;
8 E& V" H7 g+ w, o$ ]) F$ @# R7 {
0 _/ e, U! B Q9 O5 l0 A- module_param(acnt, int, S_IRUGO);
3 M! X3 r1 c# { N8 U. \. I - module_param(bcnt, int, S_IRUGO);
8 m* g' ^ x4 F- |% H. p- j/ J - module_param(ccnt, int, S_IRUGO);
复制代码
* ?4 U( w+ w9 F* r: I; T6 E0 ^! A. G6 l2 |+ A/ Z1 C5 z% {# [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; g; m5 a. w9 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: f% @6 E, F: T( h$ l* b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 p+ P# O7 X: M7 O8 N. q/ i( X" j
2 M1 @9 {" a' O% U! I, @
4 H0 j+ b2 \. r& E8 s |
|