|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! o I- F3 C: o7 |( D' @- [code]EDMA sample test application1 `! J0 T/ Y# E7 g( V$ G% i1 g
- /*
' ]4 }! }! k, U; b, ]% S - * edma_test.c
5 A( E, r/ S( F# O' H8 a& d - *
9 m; T: X1 H. L& G1 F - * brief EDMA3 Test Application9 Q |- I- i2 ^) z+ _; C/ u- U
- *
# H( I& T, Z" | - * This file contains EDMA3 Test code.
2 x) w h% r( I" s - *: V& g. F2 C; M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- w, ^9 c" Y" m2 o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 h; [2 q/ G/ p# t" n8 p$ `$ z- [" A - * TO CHANGE.8 u6 f3 `: X' l$ S7 ~8 x& H
- *
" Y; |& n" e8 x c. v* s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: Q5 s6 r8 f! Q2 {' k% J9 f- Z% k: q - *
1 Z5 c6 }) K, b% p - * This program is free software; you can redistribute it and/or. i. Z& _' M- \
- * modify it under the terms of the GNU General Public License as8 [- n# F7 S" W
- * published by the Free Software Foundation version 2.6 z; i; ~' X+ _% y2 r, S
- *# L( W6 C6 v o6 @9 v( c( ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& a" q$ X" B/ E4 f! A& P0 v - * kind, whether express or implied; without even the implied warranty% Q9 h5 P! e! [0 F- A4 i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- k8 d2 S3 O( f4 n- b
- * GNU General Public License for more details.
0 P, U/ J0 k. |3 | I# X- ^ - */
8 b# p. Q4 `! p# A
4 t A- l- l! p* G; R% w- #include <linux/module.h>
/ N% U1 i) ]2 ^( s- I - #include <linux/init.h>6 u a V/ l; w0 H
- #include <linux/errno.h> c, D( y! w; r3 S8 o! b# ?
- #include <linux/types.h>
6 P$ b% q) w$ m9 @ - #include <linux/interrupt.h>
, V6 I1 w b) @+ N" E5 |- E; y - #include <asm/io.h>9 @) H p: t! w5 ]+ |0 ^+ p
- #include <linux/moduleparam.h>' S) t' x; f" R* r4 O- X! v* P+ }* c
- #include <linux/sysctl.h>0 M0 ^: x* n# R2 }; W) G& Y4 z
- #include <linux/mm.h>
( u5 Y: F6 I6 }/ g2 j, q1 s - #include <linux/dma-mapping.h> \1 c( `& D3 U/ c0 m5 m
" i# m- i5 `1 Y+ Z6 h: P- #include <mach/memory.h>
3 L" s; n, [# k9 i& S9 g - #include <mach/hardware.h>
9 R) F) ~ B2 q x+ k' j - #include <mach/irqs.h>
- X9 U, K D( x9 W$ i9 A - #include <asm/hardware/edma.h>" P' e c" `7 y5 c8 i( Q: p$ J
- 1 t* S3 K# q$ S) X# s% `8 ^
- #undef EDMA3_DEBUG
( z' e: J, D7 T - /*#define EDMA3_DEBUG*/( D- C5 T) L' t" S. S# z! ^+ q, }
. b& n# i5 X$ ~+ A0 ?8 O- #ifdef EDMA3_DEBUG% i* j6 i r/ B" x4 Y9 u& T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ Q/ Y( ~; j) d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. _8 l/ L' z) Q. F6 M7 g# z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 n, s% m0 G+ Q7 f$ l2 s) R
- #else
" b- G! @/ L0 ^2 u$ L# o - #define DMA_PRINTK( x... )
- K2 @% e' l% B* y - #define DMA_FN_IN
: O# r3 ?/ o0 [+ c - #define DMA_FN_OUT
0 l i- Z& f* J4 X - #endif7 i( _4 g2 ~" R; T
- 1 I1 M& M7 |% r4 A+ Q/ K2 S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): L9 A7 Q! U( d$ \3 r# E1 y/ l3 U
- #define STATIC_SHIFT 3% P: d+ z2 ?! F9 C& v: R/ Y @: Q8 g
- #define TCINTEN_SHIFT 20/ z- s" y$ f4 s$ N4 F
- #define ITCINTEN_SHIFT 21, n0 t _+ v* S5 Z. F) y
- #define TCCHEN_SHIFT 22- [6 _5 O( L1 Q+ j8 Y% A
- #define ITCCHEN_SHIFT 23& C+ h$ U1 j+ ]6 S( O5 M6 t
- @8 E7 A! X/ Q9 z- static volatile int irqraised1 = 0;8 C! M: Q3 E4 e- {
- static volatile int irqraised2 = 0;! _8 A4 b' i- _" y9 Y( x8 z, L) ~
% _1 E: ?7 u/ a6 k' } i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% g. V, r( h/ ]& }! Z- _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ G( t; F& z5 G" F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' L4 r ~# v/ e, b( h
/ X/ a5 e* U3 A, y/ T, f: H3 c# U- dma_addr_t dmaphyssrc1 = 0;
- W. |1 w9 D$ E% L2 P: U - dma_addr_t dmaphyssrc2 = 0;
4 I0 H7 _# k U( k% L - dma_addr_t dmaphysdest1 = 0;+ k5 {7 G2 K! ~7 {
- dma_addr_t dmaphysdest2 = 0;
# \$ g8 C) E% m# `+ Z6 h- K5 } - # _8 V) L' g% F
- char *dmabufsrc1 = NULL;
9 I* e! W0 n" N' S0 z - char *dmabufsrc2 = NULL;9 e3 X9 d7 |- m* [; }
- char *dmabufdest1 = NULL;0 `% ^0 y' g& q6 d3 L% c
- char *dmabufdest2 = NULL;8 Z4 ]& {, H6 f
- 5 ]1 J3 _ b/ _$ p
- static int acnt = 512;
' }3 n+ Y$ S' {: U N1 ?5 c - static int bcnt = 8;
( {, Y! j Z; E9 X, E6 L - static int ccnt = 8;
8 F# J* s9 _/ _$ C8 k6 H$ f) ] - " V; n( v) r4 f0 Y+ z) n
- module_param(acnt, int, S_IRUGO);5 P. j$ D7 J7 W* v0 M& e; y4 w, Y) d
- module_param(bcnt, int, S_IRUGO);7 i/ U: U B) K! N$ i" ?
- module_param(ccnt, int, S_IRUGO);
复制代码 ( }6 H1 w1 P3 n N$ d
5 u& k+ j& l! P7 w" O7 s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" I% ?8 ]% K- F* t# k0 z5 V& O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. c \: p: W" E5 S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 |1 v: W9 f" S$ `0 `, p0 I% O* ?# F" w% h0 f
; E( |' h& D- y1 H5 e |
|