|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 \3 U1 J; ]1 i9 T" a- [code]EDMA sample test application
$ @! p3 ~3 x& B! F0 h - /*! b7 D% X) N# b. t8 v- [
- * edma_test.c t5 L# L! L1 ]! k: d4 L/ c
- *& p0 u( P" ?, y
- * brief EDMA3 Test Application; b1 j- Y* g Y/ q
- *0 v, |( E+ ^+ [7 I. |8 b
- * This file contains EDMA3 Test code.1 @7 o& S; I" Q8 o$ Q3 I0 F
- ** p: D2 {+ g; m- T: w6 @+ O( K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) v) D# V3 [# G% c5 v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" n4 a4 p& K- J. U' F - * TO CHANGE.# A* h9 m0 b2 b9 o
- *
( N( x. Z" {# J+ C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' a* [, B% {' {! C - *: D) x2 J5 S* q
- * This program is free software; you can redistribute it and/or |: Z/ n" z( O$ I) m& q2 v
- * modify it under the terms of the GNU General Public License as
& `5 y* I1 s7 U- Z( _- |( u5 r) |0 s - * published by the Free Software Foundation version 2.
% k( N, t+ O: G* `/ f6 ]8 h3 f - *
, Z- H* j, x( a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 @. ~; N- p! k; K5 k: u
- * kind, whether express or implied; without even the implied warranty0 P9 S, k& @; Y8 l& ]2 B% v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( `" w" q' ~* z7 H! a3 t* ] - * GNU General Public License for more details.+ @( F9 P Q5 f' t+ y
- */
* q* O! K% Z) W* A# [6 h - / M) O2 z0 C* a) A7 _7 t* W: m
- #include <linux/module.h>
5 ^9 m+ D: Y/ k! h/ W3 Q( _ ? - #include <linux/init.h>' {& v" |% `# i5 S
- #include <linux/errno.h>& E& E$ V9 p; R8 R
- #include <linux/types.h>, m; \1 _* o$ y3 K. f
- #include <linux/interrupt.h>2 K5 }" K- n) @9 q9 m. j8 |
- #include <asm/io.h>
. }; E' \" Z& ~8 S4 c( s0 R2 r' Z - #include <linux/moduleparam.h>$ Q4 B* u3 I* w
- #include <linux/sysctl.h>, m: C( A4 u, h
- #include <linux/mm.h>
E( ^5 P" q' e/ u/ y - #include <linux/dma-mapping.h>( M& d6 |8 I, ^. J, H& t8 [
- : e$ x8 b+ C. u5 k; t7 u) Z' T) {! y* s
- #include <mach/memory.h>
+ }( m$ y4 P) E; N - #include <mach/hardware.h>6 S- Q" b' `; p& V9 d/ [
- #include <mach/irqs.h>. ^& V7 A/ i7 F' q3 ]$ c7 G4 `9 o7 _
- #include <asm/hardware/edma.h>1 m. I# x# l; M+ X
- % e* q" a7 D% W$ L; ]% g1 b, C
- #undef EDMA3_DEBUG1 m, d& o" ?* U, @6 Y
- /*#define EDMA3_DEBUG*/' Y6 S' g4 ?, t
7 Z2 p; K8 C& `9 |- #ifdef EDMA3_DEBUG
! p3 J# \% }3 m& k6 U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- Z0 I ~/ J. } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* ]" K6 m5 P# z# Q* g) s0 }* E& i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ X# _1 O- w# k# x# y( O
- #else3 y! C1 u: ~, Y" z7 ^
- #define DMA_PRINTK( x... )
& ]" @; b. U: R" p+ e' `' V$ E - #define DMA_FN_IN
. Z% w1 Y( B& p. m1 v - #define DMA_FN_OUT1 H1 @* q9 z& C! V( w6 y1 R
- #endif; }! `$ j+ ?+ x1 D- I
9 Q" r S- }) ]& X- #define MAX_DMA_TRANSFER_IN_BYTES (32768): `% H! W J( g; y- D4 f
- #define STATIC_SHIFT 3
) d l) l8 g1 [- S2 ]2 V/ o! ] - #define TCINTEN_SHIFT 20
% X& E3 f; Z2 g* }0 q: e# q5 D( W - #define ITCINTEN_SHIFT 21
# v6 U4 m8 s) _) C8 h- @: F8 L" B' t% ` - #define TCCHEN_SHIFT 222 C3 F6 h% I) W5 X
- #define ITCCHEN_SHIFT 23
7 W- { K2 i1 H
. F& I; d5 c# u- static volatile int irqraised1 = 0;
& O d6 ?8 ]2 k7 ~' I' k& j9 O. U, H( w, U - static volatile int irqraised2 = 0;4 `/ a$ y9 T$ [7 B& k- j. R( l
- 9 \! z4 k; o8 B' h/ r) @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 Z/ ]# t" T* E: w: N( ^2 Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 }; P# n9 E4 }% D1 v/ w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% i, Y" |; F# @* R2 ]6 }
1 ^6 y# ^ h% D3 F) l$ y, m- dma_addr_t dmaphyssrc1 = 0;& ^* H9 c5 y2 v; {8 e- c. ^) \1 K
- dma_addr_t dmaphyssrc2 = 0;9 J5 P$ P. c0 q% }! x' m
- dma_addr_t dmaphysdest1 = 0;) L; X' O3 O t' b% \ }
- dma_addr_t dmaphysdest2 = 0;! m# B: t v5 u, _8 Y
2 P/ @, @! C7 R n! K- char *dmabufsrc1 = NULL;
: l+ h% |7 A/ Z) j6 c0 w9 b - char *dmabufsrc2 = NULL;) J- E. N5 T& C2 p
- char *dmabufdest1 = NULL;% k$ O* r! u: \) Y( [% w& n
- char *dmabufdest2 = NULL;9 [: f; d) \: L
- # Y+ c% W- c" u7 o
- static int acnt = 512;
8 J7 Q) X, g, F: V1 L+ m+ S8 f, y - static int bcnt = 8;- T) S1 @+ }8 m
- static int ccnt = 8;5 N. D9 f9 t" P! Q6 n
- " H' ~ Y1 t( @6 e% q3 c; o
- module_param(acnt, int, S_IRUGO);- E0 D! q" ]2 l
- module_param(bcnt, int, S_IRUGO);
4 u3 A' E% J" n0 N" }7 C - module_param(ccnt, int, S_IRUGO);
复制代码 - ]4 _2 y1 _* l }1 |" H) u( _
4 ~, r' i! x4 h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 o- G* Q8 P& U8 B# Z/ Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% c6 b, g# e! K! ] k$ X, H% J+ _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; h: n: g3 }4 B
, \3 D% d) {& S0 ~! G" p; X3 y1 m, j7 O5 Y T$ ?
|
|