|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 O* J8 B' U: T- h+ Q1 d$ ]- [code]EDMA sample test application$ x; E* D. \* Q
- /*
3 a- K" f- R# ~- ` - * edma_test.c
% s! P1 J$ K! p. {' r - *
) C- g" h1 ^* G% I. p6 _ - * brief EDMA3 Test Application
! V, B8 W1 d2 M4 T" w' ? - * W5 X8 X9 [/ P* i
- * This file contains EDMA3 Test code., M4 h4 ^6 v* B/ Z
- *) C! `+ {1 Q% ]" T3 }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: X3 I/ w5 F8 e" [+ h; a; h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. g# g; E, {1 K( y
- * TO CHANGE.
7 o3 g: ^, x A) ^ - *8 }& u" D9 L8 }* v* @# z# C. A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 I$ m: U, W+ W. A
- *, w/ U* F7 G9 a% T; `6 E
- * This program is free software; you can redistribute it and/or* g7 X# ]3 F1 A% s8 Y, }, { S
- * modify it under the terms of the GNU General Public License as
" c4 D8 F) y$ V - * published by the Free Software Foundation version 2.
! F" |- _3 k6 G/ h6 w& K' e" x$ P - *
. y( J6 }( l0 ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 A( ~5 K! ^/ c& t+ y - * kind, whether express or implied; without even the implied warranty: R U) H% Q: X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 w0 a. v" b9 z0 ]5 V
- * GNU General Public License for more details.
$ B! l/ y3 ?8 o+ M0 L0 e2 h - */; b ^8 N/ Y8 I6 m/ @) N
- 0 f* h4 t+ i% S
- #include <linux/module.h>
6 o [1 J; _# S4 F9 k5 v R1 u - #include <linux/init.h>
4 g% Q+ r+ ^. Y) \ - #include <linux/errno.h>: |: l' T9 l. C8 j( Q/ e; W; \
- #include <linux/types.h>
/ t* E1 e% ~# D! v - #include <linux/interrupt.h>
% e' n r* ]# q4 S+ @7 N, p: k- U& D - #include <asm/io.h>
( ?) N" D$ ^% h" } - #include <linux/moduleparam.h>& z5 b# v a2 ^2 e
- #include <linux/sysctl.h>
2 q+ U' C, ~( X) d9 B, @6 d - #include <linux/mm.h>5 c/ i3 o1 x' }' l$ B" j8 j
- #include <linux/dma-mapping.h>) ^9 L8 q% u& r9 O6 a& m2 B# x4 O
3 g2 T. C5 ]+ Q+ T b6 _( T6 u- #include <mach/memory.h>6 E5 i& D- h: l3 t( D7 B
- #include <mach/hardware.h>
1 b7 @; a1 _8 }6 r6 z - #include <mach/irqs.h>( @% @$ K. G: \! M# T W4 s
- #include <asm/hardware/edma.h>
3 i/ k& T7 Q- M - 7 j1 `% A& ]& Z7 Y; G
- #undef EDMA3_DEBUG
8 U; C( C5 N9 I2 Y - /*#define EDMA3_DEBUG*/5 _# t" p: B3 E* l7 g6 U0 d7 X! [$ ~
- # D# A( {9 y3 g; s/ `# ~7 ]( G; c+ x
- #ifdef EDMA3_DEBUG
, [9 j+ _; X. l# U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 Q2 A- W8 S% i2 W3 y9 t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* U- \7 q. Z4 d) t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' @8 Q. x6 S- a7 x, n
- #else6 w5 `' _+ c7 y
- #define DMA_PRINTK( x... )( d7 ]" s5 t+ e
- #define DMA_FN_IN8 {6 C! ^$ O( k6 N1 k
- #define DMA_FN_OUT m$ w7 h# R, s# u: O
- #endif! C7 I& B0 `; c
) Y0 I/ ?+ U, I( U: S% Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# ^! p3 P# Q9 X: t% T
- #define STATIC_SHIFT 3
( G0 ^: a6 R: R# x! |$ E - #define TCINTEN_SHIFT 20- n+ B% o' P0 W
- #define ITCINTEN_SHIFT 21. e6 \- O/ [! _ J. p2 |" i: S5 q! Z
- #define TCCHEN_SHIFT 224 K- ?' I* u( u
- #define ITCCHEN_SHIFT 23$ s8 K9 q* U7 {9 r$ ]( l
! q* E1 N0 E' ]1 Q- C- static volatile int irqraised1 = 0;
9 \, w! z8 Q% f) g* N - static volatile int irqraised2 = 0;# V5 k7 |2 i8 n7 Q
) B( i: w" \+ x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) f c# \6 ]% ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" X# X/ u! k7 P8 j, J+ t: I; S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 `1 x& O- b; m4 w
- 0 B7 `; i: T5 ]& Q f4 _) u
- dma_addr_t dmaphyssrc1 = 0;
+ W4 H( o* _0 v - dma_addr_t dmaphyssrc2 = 0;
. A* B+ g0 z6 I; O- l - dma_addr_t dmaphysdest1 = 0;
) g* @& y1 O& [ - dma_addr_t dmaphysdest2 = 0;- {% q! f& Z# n" r
- 1 T1 l8 f$ Z+ E+ o& `
- char *dmabufsrc1 = NULL;, F" F& v2 u$ |( C, S4 V' x9 ]
- char *dmabufsrc2 = NULL;
7 |' }: x0 B7 _ - char *dmabufdest1 = NULL;
8 [* e" Y/ ^) @; t& e - char *dmabufdest2 = NULL;) h5 Q+ J1 l- S; }
- & v* |$ Y$ V* [( O
- static int acnt = 512;
( ]2 S$ T* T/ {9 r v( b& M- V# c - static int bcnt = 8;
, s6 G( }% u0 w* h - static int ccnt = 8;
3 [1 I. _0 {3 V0 w2 L* y8 w( i
0 [8 b0 Q* |8 y/ {' U7 y) o- module_param(acnt, int, S_IRUGO);
- Q7 ^2 M+ p9 b0 S) G - module_param(bcnt, int, S_IRUGO);' C Y% d+ j5 g: B! j
- module_param(ccnt, int, S_IRUGO);
复制代码
( b& Y7 E4 T: f: g0 p4 ]' |9 y/ O4 C, J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ X3 x$ D$ x! I5 @ x& earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: q- z+ c' p2 ]) R9 {. `6 r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 v0 _; K+ b* ]- R, r& I, {1 y
# }9 i0 N _& k0 }6 Q
# r! ~8 K1 ?4 M; C: u: ^ Z
|
|