|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : _8 s( w% |! a2 f* A J
- [code]EDMA sample test application( O' Q* [; o, H! A7 n6 I
- /*: p( M9 d [* ?: o
- * edma_test.c
& z6 V+ ] b. H6 p4 J - *
% s M% e6 C7 j) V5 h- @2 J - * brief EDMA3 Test Application1 L' }) ^+ R. h6 M* V& e- S8 y5 z8 z
- *1 [3 U5 d. M) E' e5 Y+ ~
- * This file contains EDMA3 Test code.
/ P/ _4 r2 B: n( c - *
* J3 ~- K, [! O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- q% A( G/ V" j9 h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 \, |) H, |8 U
- * TO CHANGE.
" x& z# u. E( q7 }6 Q - *2 u) E4 Z2 r: d. A& } I' m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: Z, x6 g, @1 e' |. y* {5 d
- *
1 d+ b: p4 g6 d' q, _' O - * This program is free software; you can redistribute it and/or
4 C+ g) t2 M5 ~$ u5 ? - * modify it under the terms of the GNU General Public License as
: T$ w, G: x( Y9 ~4 b7 M* h - * published by the Free Software Foundation version 2.
$ K/ d- g$ _0 k( e: J( a. L - * j4 Z3 K1 _! {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) V' ] k, c; _ - * kind, whether express or implied; without even the implied warranty: k i( A, @" d0 S; f5 Y& H% V. ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 P' ~1 k7 s6 X/ I" u; Q1 f9 W% Q3 B - * GNU General Public License for more details.! N5 e; n; x/ K3 c$ ^1 x' [
- */! @) H, c- c8 ^
- $ K6 k9 `% ?8 I2 H. G0 f5 D
- #include <linux/module.h>
! f! h7 p* u# F+ B, p2 T' k - #include <linux/init.h>1 g2 F7 O/ t9 n8 D# O% L! }' H
- #include <linux/errno.h>+ w( m0 y6 C/ ^$ U8 Z% F9 R
- #include <linux/types.h>
1 O+ A& z6 |; m - #include <linux/interrupt.h>
7 W( p [9 } w0 }5 ? - #include <asm/io.h>
( L# K& G; L! |) r4 B - #include <linux/moduleparam.h>
$ R$ D& l# B1 q8 |' _0 j- b2 X - #include <linux/sysctl.h>
% x6 W# g+ ^0 N3 ] - #include <linux/mm.h>$ c6 j4 u( x: R! v
- #include <linux/dma-mapping.h>" p- M+ q, K# I
" O* D: b( I8 d: U" m& u- #include <mach/memory.h>2 S( Q- k5 M" ~2 ?' U, n
- #include <mach/hardware.h>
2 ?; X; b6 X! [ z+ e* Q& F5 a - #include <mach/irqs.h>
6 d U r' [# J; E8 _+ a - #include <asm/hardware/edma.h>: D3 G# N y, n: l$ |8 Y
- ( Q& H- X# h3 W7 I# r8 i- n+ O8 A: e
- #undef EDMA3_DEBUG
$ o7 J" |' C! A, U9 L - /*#define EDMA3_DEBUG*/
2 N" L. o3 t2 b W9 x# `6 ^
! G2 u# ]* [" d C, X5 Y8 l- #ifdef EDMA3_DEBUG
5 k- t4 K' k" J+ I/ o, }: S& b& |$ H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 _7 Y& p4 } I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 M p9 _/ [0 C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- a C% g( |% R: E! l* D
- #else! [+ L8 W' o6 N; Y3 a, S
- #define DMA_PRINTK( x... )" o" M2 ?6 ~( D- {# w& n
- #define DMA_FN_IN
" Q0 O7 L4 @+ d: h* r3 N8 e - #define DMA_FN_OUT
5 q% |, J5 a. s9 ^* Y. G' t9 I - #endif
6 Q) B) B3 m- @3 `) h. m0 U6 M/ s - 0 S2 ?7 ]5 R& u7 B! b; U9 C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ w$ F! }* k7 @2 Y: U - #define STATIC_SHIFT 3: Z7 |8 E; |5 C% Z# v5 B
- #define TCINTEN_SHIFT 20' n& Z5 C0 J3 I/ a
- #define ITCINTEN_SHIFT 21
9 P( `. |% s. o1 J2 Z - #define TCCHEN_SHIFT 22
0 B* M$ T, w7 m9 x0 n - #define ITCCHEN_SHIFT 23
% n7 @; F& ?: d6 V( q
% C l, ~# |; u2 i* g- static volatile int irqraised1 = 0;! I& O! K% u9 P) `
- static volatile int irqraised2 = 0;+ c( b q( f$ i5 L- M# X
. K/ [; z5 C3 X% F! @0 V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) S' H5 C7 q- s' E7 V& r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 @: U- W" O- U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 J/ P' H! X# l7 Z; n
" K1 {. B, q8 Y0 P$ }3 w0 X- dma_addr_t dmaphyssrc1 = 0;3 h- N, }: V* ]) F
- dma_addr_t dmaphyssrc2 = 0;
* C3 U( {/ R+ P. H - dma_addr_t dmaphysdest1 = 0;& i4 F3 U8 {- L2 q$ D. Z1 c/ D$ X$ q
- dma_addr_t dmaphysdest2 = 0;+ q! O' x. i; F' ]
; R0 \( t/ L2 d" W- char *dmabufsrc1 = NULL;
8 I7 x4 @& @8 V1 w - char *dmabufsrc2 = NULL;
* `0 y3 G; u, J* r - char *dmabufdest1 = NULL;' Y' N0 ^3 r+ N! F
- char *dmabufdest2 = NULL;
+ }. k( a. H) ~; K Z) O! n
& h1 l1 ^ ]6 c% _+ m `! Q5 Q- static int acnt = 512;- a' l# m5 O( x
- static int bcnt = 8;
( T% v6 k/ Z' N7 ^+ c - static int ccnt = 8;
8 O+ i0 d$ R- A8 o0 @' P# J
$ {7 N& M+ ~! Q- module_param(acnt, int, S_IRUGO);" d, T k9 m/ D2 w
- module_param(bcnt, int, S_IRUGO);/ R, ]3 B+ _" g% j8 o% g/ p
- module_param(ccnt, int, S_IRUGO);
复制代码
* ^( X# Y/ J) x( X& g8 Q& E9 M- }, N* h9 y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' |# z6 h/ M1 ^; C1 E A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 g0 ~( s4 u/ c+ }9 _4 |" Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ @0 m e& P3 [. L. a/ {/ O
- G( t" x# s8 i1 v" f
, l2 H, P+ T% C |
|