|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " p- C9 ?7 v3 K8 w n
- [code]EDMA sample test application
5 a& p; a& x8 m; i: p - /*+ e5 T' j; F( P: d4 ^/ b
- * edma_test.c
+ Y1 X0 }: ]/ _8 k- T# l - *; q5 M% A6 t' S' U+ h5 I0 {
- * brief EDMA3 Test Application" L1 d8 v, }! F2 _+ v3 Y
- *# V2 z8 A/ W( Q
- * This file contains EDMA3 Test code.- s9 l- B; z+ x* d% e c
- *
1 T) \/ Q, O3 P3 ~4 I3 q" a5 N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& d) A' Q2 e/ _* b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% K% P6 Y; E0 x c! V - * TO CHANGE.# N" O2 O$ r1 w8 A4 k
- *
6 P. k: o! ^ p* W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ d0 ?1 o6 j0 \ W" W# X' }9 I4 H - *5 [# w0 y% _9 i% ^, R2 \" l
- * This program is free software; you can redistribute it and/or* [3 q$ |8 ^8 G! s8 l
- * modify it under the terms of the GNU General Public License as
6 Y Q( }- a8 W+ F4 r3 a8 { - * published by the Free Software Foundation version 2.0 B. E2 K7 ^: v( N; |7 z. a
- * a% v- t/ d! t) x/ m; D" e+ e% S2 k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) |9 i9 ?3 `3 } g& m U `
- * kind, whether express or implied; without even the implied warranty5 ]$ k0 o# j: k3 | p# T. l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ E4 }4 P2 b5 ]# o+ I+ H$ M9 K - * GNU General Public License for more details.( M! L$ x& m8 o& i
- */- a5 x# A1 y( e7 M* o% n
- 4 u& f6 j& _/ s
- #include <linux/module.h>. ^# @/ ?* Q- J) b
- #include <linux/init.h>0 ~7 e- Q5 f( ]; j
- #include <linux/errno.h>2 T2 K7 S/ \& c2 R, j
- #include <linux/types.h>4 E I) O( p; I. Z% g- I. X; h0 m+ z# |
- #include <linux/interrupt.h>3 N4 F# q; j' K' Z9 g) Q
- #include <asm/io.h>
/ Z2 X6 ]2 l% A) d9 B+ H" w' ^ - #include <linux/moduleparam.h>6 ?& y; ^# l2 l
- #include <linux/sysctl.h>
; K$ a" _$ ? T# v - #include <linux/mm.h>
t: R9 [2 e" D8 Y: g1 ] - #include <linux/dma-mapping.h>$ O4 N2 W: e4 d9 J* z
1 L4 P" R7 r# H- #include <mach/memory.h>2 i! E7 ?9 ~) X' ~% J5 t
- #include <mach/hardware.h>
" [ E) k& ], j* u- k' [1 m( W/ w - #include <mach/irqs.h>
1 J9 j! M/ `. q: J6 y6 {! l; l - #include <asm/hardware/edma.h>8 t- w) f& ~) i5 e) M$ o
- ( O. n9 ^4 ~6 |$ _& |5 q
- #undef EDMA3_DEBUG6 U. M) Y7 H) I) B8 C5 Z! s+ n
- /*#define EDMA3_DEBUG*/ e1 C; K0 f/ _. [4 f8 k* M" J$ l
1 h& B& \, w' Q& l- #ifdef EDMA3_DEBUG( Q+ U* O* c7 ^3 Z' ~3 w- ~# n3 I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! b A8 w" A2 c* Q! p$ @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 |7 b+ ~* l8 L$ f: b+ w c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 E8 E) \) n5 O - #else1 w1 [2 c g8 ~7 e
- #define DMA_PRINTK( x... )& e8 L( a/ E5 A; T4 [' f0 R9 D* F
- #define DMA_FN_IN
1 e6 K. L F2 J( D - #define DMA_FN_OUT
$ v( p, l: O9 I; a - #endif/ Q8 c- q5 _8 Z, K5 O5 h2 e) T
- + d, {2 u4 T& T) T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# w7 U2 ^9 |& r0 B: t - #define STATIC_SHIFT 36 n6 q2 R% g( c* x% L& T8 N+ Z
- #define TCINTEN_SHIFT 20
2 O* c- [" U# w5 f1 @- } - #define ITCINTEN_SHIFT 21
9 ?2 k+ n( j6 |* t - #define TCCHEN_SHIFT 22
: O* w* w- ?2 D6 B1 {- f% s& V - #define ITCCHEN_SHIFT 23
6 t; z, F$ Z. A) ?, ]
. _% |( [2 Y: i7 _- static volatile int irqraised1 = 0;
* G+ N+ M4 s% f$ H - static volatile int irqraised2 = 0;
# }, Y0 v9 O7 z+ d) F! P$ c
; I, Z+ m! }% R/ I: h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 E, G% m* C: c7 U8 o { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: z1 x. d- b) n1 z2 C1 C3 |! t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 u! {, [! L$ i) D5 j
2 E8 F8 _% g& {6 K% W- dma_addr_t dmaphyssrc1 = 0;
, `% }4 Q4 l' f- ]. i# i - dma_addr_t dmaphyssrc2 = 0;
& m0 e& j; P5 \/ I | U! d - dma_addr_t dmaphysdest1 = 0;3 h' u' s( u) E6 x
- dma_addr_t dmaphysdest2 = 0;
( p' h9 K1 ]5 g
' I! ~+ [6 P# E" B( r2 K( ^& w* ~- char *dmabufsrc1 = NULL;" h) x& F$ u8 x, ?9 q
- char *dmabufsrc2 = NULL;/ ~0 X2 O8 X# `* j5 C0 g/ B
- char *dmabufdest1 = NULL;2 ]7 Z2 d v5 I- J N$ a6 k3 C2 U
- char *dmabufdest2 = NULL;- V3 d; q1 H: @/ M) ?. o9 x% e
- ( w# G' { v: g$ q7 r! x' C
- static int acnt = 512;- r) c6 h$ m& ~' u2 o& F0 b
- static int bcnt = 8;
9 P( {" c* V3 Y! k. u. o8 X - static int ccnt = 8;# G9 d& G, L8 a* P+ H# ?
- 0 e! L# C$ G, o+ K& A: e
- module_param(acnt, int, S_IRUGO);
Y# w+ m* G2 I" l - module_param(bcnt, int, S_IRUGO);. p/ \: T2 i5 x! R7 h5 F# b
- module_param(ccnt, int, S_IRUGO);
复制代码 ( j0 Y1 m7 d1 R f W J
. B: d5 @$ @) b7 W0 D K( r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 f. b; K5 b, i9 _$ q' Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: S3 j+ u1 d B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ p6 P+ ]! S8 D! x$ A- t; R* @
( D0 @/ b* H" {+ C' S A; I9 t, r2 J! c/ }6 l
|
|