|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 D( A( Z, N$ r' d! {- [code]EDMA sample test application
/ g0 P6 B/ H. B% l - /*) r2 h1 o4 Y. E0 ?6 e+ D, X5 v
- * edma_test.c- ~) r$ i/ c! }: z t
- * \ e4 t0 ^+ d# n: y9 t
- * brief EDMA3 Test Application
; ?5 R z/ ~- D+ t3 M1 Z - *
' y# Q1 D" q. R - * This file contains EDMA3 Test code.
! G0 z: o q6 T4 x - *
( x0 F/ q1 ?4 _# E4 D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 Q' `. w3 L/ c1 n, r5 U6 H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 ~- _3 a5 _% |/ b - * TO CHANGE.
# I) ?$ F+ \4 u# F- Z - *0 C" J( C4 B" Q! E$ a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) D1 k1 z; t* D* ^; l" c
- *" j# x$ V. l' @: }; }
- * This program is free software; you can redistribute it and/or
, w' B8 ^& \* w0 i4 N$ Q - * modify it under the terms of the GNU General Public License as0 {0 n) H2 C0 h5 H9 t' ?5 e
- * published by the Free Software Foundation version 2.
7 C# |: f: \3 O: k' t - *' f4 L9 f0 a0 g/ b! K# r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! r5 n0 c# R2 Y. {( ^2 ] - * kind, whether express or implied; without even the implied warranty
6 ^1 {- r! z! _' {" ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! r6 K: ?7 X i9 e& \" c# e
- * GNU General Public License for more details.! b/ O. l5 I& P' r$ |5 Z8 e; ^
- */
! a1 v D. [. H/ j5 U
- c# A2 c2 }1 m0 [- #include <linux/module.h>' P' ~* V4 Z Z8 B5 a! `* e
- #include <linux/init.h>8 \7 z0 b& H* S* b' d! X
- #include <linux/errno.h>' L) L1 p6 @- _/ _( N9 `, F
- #include <linux/types.h>
, L( J4 r: X: h2 L r) _2 w! j - #include <linux/interrupt.h>. o; b+ K5 A% \ Y
- #include <asm/io.h>- e8 |2 D4 m( U$ `# g7 G
- #include <linux/moduleparam.h>
* P" a, A; ]3 a" s& ^ - #include <linux/sysctl.h>
. }& X5 z" W, _9 U1 Q - #include <linux/mm.h>
7 E1 ?( |3 d) @3 @. L* q+ W - #include <linux/dma-mapping.h>6 ^, d% e/ l3 W7 k, w
/ ?# V; x/ e C8 Y/ E# Z- #include <mach/memory.h>
0 ~! v6 O# h1 E+ X; R# F% p6 w - #include <mach/hardware.h>6 W5 Q# J" T+ y) j4 T2 F; A
- #include <mach/irqs.h>
" E, T' I: I; J( L: j" Q1 Q( A - #include <asm/hardware/edma.h>
, g) B& }5 j& X' L# q' }
$ @" a7 u( I8 \# \6 a4 R- #undef EDMA3_DEBUG4 E; I1 g( a/ D! G9 c' l8 ]
- /*#define EDMA3_DEBUG*/3 @% I o7 e+ }2 a6 i8 L; a
, l% x/ D4 h- Z3 t/ q- #ifdef EDMA3_DEBUG
0 W( v7 D2 b& J( ?7 p* Y; M6 f( m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ e3 G2 N; v5 p' n E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& c& q3 _( O" y6 v/ Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! z0 Q: K' r1 V
- #else3 g1 S( [! r! @; S5 ^- l' ]5 v
- #define DMA_PRINTK( x... )& a0 G# X6 g$ o" _& f
- #define DMA_FN_IN; ?5 O: L5 O D2 r$ t) K
- #define DMA_FN_OUT
, t# H6 c- f6 e4 P9 g' g - #endif' F0 {& P, Y, R5 Y! x" d
. e4 J6 q7 m' [0 e+ [. ]* ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( M! x% C5 R6 O7 ^3 E+ r- ?
- #define STATIC_SHIFT 3* {6 O" X8 s: Y/ t! \/ N6 A
- #define TCINTEN_SHIFT 20
o& S' K! }9 z/ R, H - #define ITCINTEN_SHIFT 21( X, _! E1 ?# H% U" Y
- #define TCCHEN_SHIFT 228 d k9 v7 A% w7 w. S& n7 L
- #define ITCCHEN_SHIFT 23
1 v6 H _% X8 U5 R( C
' [* ~; ?7 @9 e- static volatile int irqraised1 = 0;
0 ^- Q, a$ y8 S- T, S6 x$ S - static volatile int irqraised2 = 0;% a& ]7 T/ c( j+ |% \ |8 y% ^
- ' c8 ~: h: Q3 D3 i, }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% p* Z' G) S" N# T4 E9 ^1 V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ T# E0 f* ^; }, r& t3 @& _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 `" v6 x" f6 t+ Q: a
7 p) H0 X% E, }+ m/ L6 u) Q- dma_addr_t dmaphyssrc1 = 0;
% ^8 M9 K5 G7 n# U - dma_addr_t dmaphyssrc2 = 0;
6 h& k3 ]# @ n5 f3 }+ o$ K: { - dma_addr_t dmaphysdest1 = 0;
4 b" ]% O6 [8 k# ^ - dma_addr_t dmaphysdest2 = 0;( [7 w% ?: y4 y7 ~
- & u8 f9 H# F& t. Z2 S* [' _5 \
- char *dmabufsrc1 = NULL;( R( _4 X) g7 E5 o2 c2 } a
- char *dmabufsrc2 = NULL;/ P) p' a* @2 P3 h
- char *dmabufdest1 = NULL;4 D; n) {, ?4 @' a# T+ X
- char *dmabufdest2 = NULL;
! R. s4 H5 e4 U( S) d5 X! e
! Z* G9 ]8 H1 E+ V" X- static int acnt = 512;
0 \' f$ ?6 R4 m' x" Z7 e - static int bcnt = 8;
7 S! M; K6 C# h8 N# m& ~ - static int ccnt = 8;% B/ B# J7 p8 N1 V- k! \2 D' Y
- : `" X+ c' J8 o/ U5 t
- module_param(acnt, int, S_IRUGO);7 j9 F4 K; W9 N R& y' ?( @. \1 Q
- module_param(bcnt, int, S_IRUGO);! t. o2 E: v3 p/ q B) u
- module_param(ccnt, int, S_IRUGO);
复制代码 , t* }7 \3 j4 p; Z9 Q2 k% `
9 _) m- k, ]9 z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 F9 o( b6 I7 {1 M* ^* g: }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" m' u4 A4 t5 e) Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 r, T9 ^, t' a# u! I8 ~
/ d3 s2 D$ \8 ]6 h7 {+ z
: Z$ T9 E W. J& d* [ |
|