|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 r1 w, R, A1 R$ k8 l
- [code]EDMA sample test application2 |3 h" y* S! Z
- /*9 B) k: i+ d3 W8 D4 a3 {
- * edma_test.c
' H2 g) r9 B8 w1 F) k& o; Y b - *" a! n4 C* `, F! U% ^5 b+ s' r8 ]
- * brief EDMA3 Test Application) k: L0 C6 ]+ |
- *
3 r6 Q+ Z( s# \ - * This file contains EDMA3 Test code.' U+ G/ C5 E A! p) E
- *6 i+ y/ w/ l& I8 n, k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 L" j! H* x' f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' K6 v- m ?# X8 @% K3 A
- * TO CHANGE.0 w. E8 [) E2 g# j# _- a
- *
5 ]1 L* P ~9 ~9 A. P0 d5 m9 ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 ^7 `% f( d% s6 Y$ K' b7 @
- *' L X8 s! L; D6 x5 |
- * This program is free software; you can redistribute it and/or
6 m! n2 M1 |% t! [* j4 a: n - * modify it under the terms of the GNU General Public License as; v, G9 y2 s" d& ]
- * published by the Free Software Foundation version 2.$ T' y, C1 H+ {3 ]1 G
- *( c& Z9 J' F' N4 R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ a3 `. ~+ ^7 j* k& D2 K$ u% z
- * kind, whether express or implied; without even the implied warranty
7 s0 r, H" g: U, m- V8 x% l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# ~. T$ @& M9 P( W - * GNU General Public License for more details.
& w- \- C, U9 b+ ^* j5 c) i7 Q - *// Z- Z( Q8 B3 {8 _ F6 I
( B" D4 _' F9 U: t5 ]- #include <linux/module.h>
3 M; X' I* S! \2 m1 q6 C! W - #include <linux/init.h>6 O7 l* n9 f& R, q
- #include <linux/errno.h>
- m( U4 G S# m" {% N# y0 [ - #include <linux/types.h>! n, l+ g' Q- h, F, M- V8 X! a
- #include <linux/interrupt.h>3 ^+ G1 d7 p; g3 t7 s4 @% \1 e! h
- #include <asm/io.h>
1 v1 S9 h6 S4 g4 T; G - #include <linux/moduleparam.h>
/ r' T: P1 f! T+ u1 }2 Z4 v" T - #include <linux/sysctl.h>
% u) P+ F4 Q! S( N* W& n/ O- E - #include <linux/mm.h>
/ @% q* u1 c, m+ W4 X - #include <linux/dma-mapping.h>
9 S! @# y: o6 `
: U! G7 w- \; g5 d/ d7 M% f- #include <mach/memory.h>( t" L6 V4 O% w" P% s- F
- #include <mach/hardware.h>4 x! V6 n% s0 t4 D I; m% n3 p
- #include <mach/irqs.h>( r1 a0 T3 I# _/ a
- #include <asm/hardware/edma.h>; w; U3 Z3 i# R
- 2 R+ Q0 g6 z: `' M9 H" G
- #undef EDMA3_DEBUG
4 q d6 @3 E/ i* Z3 R% g: F; w - /*#define EDMA3_DEBUG*/
7 ?2 ~3 u( u( ^/ W) ^
: e' N4 b" K8 Q( A/ E6 b4 d, s5 V5 k- #ifdef EDMA3_DEBUG
, L& m8 N) v4 A& \: V0 K. C2 R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 _$ G/ d- o- b0 u7 H0 L! D. g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" |1 ]& `0 x6 S7 p. I8 v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' c; |: Y0 A, D/ A( g4 h8 C1 ^( w - #else7 a! J# G" |6 z8 @% Y N" i8 @
- #define DMA_PRINTK( x... )
9 P1 r8 l& B5 E/ s& ~ - #define DMA_FN_IN! ?# e* j1 u+ M: x3 z
- #define DMA_FN_OUT
; p2 k) F) |( D( v5 v! w - #endif
5 i) n* v- t- V/ h - $ m3 U$ z x3 P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 }$ S6 W8 D0 M. X
- #define STATIC_SHIFT 3" I3 Q" [' M5 l0 @% [
- #define TCINTEN_SHIFT 20% j1 U+ Q6 u7 w. @# n( o1 l
- #define ITCINTEN_SHIFT 21
+ A' M8 Q3 H# D- ^3 r# H - #define TCCHEN_SHIFT 22
& T/ T) B9 M7 M m+ P - #define ITCCHEN_SHIFT 23
! v' }( p' ]+ C1 K/ T) d - 4 Y/ d' u' t' l% s/ q$ g
- static volatile int irqraised1 = 0;* X8 i" c4 S0 T3 C0 `% b$ p: P
- static volatile int irqraised2 = 0;
2 n( P- v \6 m) t0 e - 9 t& H* b* @2 p t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 \; U) q( s/ F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( m! S) o# S) K9 P: e$ [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( }: Q3 Y1 l' b3 x0 x2 v! e% P
. S% ?" |0 {" y- dma_addr_t dmaphyssrc1 = 0;
/ T4 ]& F% W* [" a) ] - dma_addr_t dmaphyssrc2 = 0;7 v u+ s7 c1 T: t/ n# e4 _
- dma_addr_t dmaphysdest1 = 0;9 G/ y. S& N J% v7 v
- dma_addr_t dmaphysdest2 = 0;
! z: k# v$ ]) h8 a2 k2 ?
. z: M9 x) {. f9 v. J- s2 B; n' c- char *dmabufsrc1 = NULL;- ~6 H7 U- B: F$ u) x
- char *dmabufsrc2 = NULL;
* v+ W8 g' G0 X& ~ - char *dmabufdest1 = NULL;) H! ?6 R! T% G& n4 V
- char *dmabufdest2 = NULL;) ]1 C& X5 H1 G8 A# s! f( `
- ; s& x' u1 l1 t& t
- static int acnt = 512;% n K9 k2 Q: T1 C L7 E- j( O3 v D0 `
- static int bcnt = 8;% \( R2 y7 G) T( a, n
- static int ccnt = 8;1 E2 k. m, G; R8 @6 q3 W# U, ^
2 M3 M( e- [- t, @ c$ k2 a3 r# g) |- module_param(acnt, int, S_IRUGO);
+ _7 q. w$ E, n+ b: @ - module_param(bcnt, int, S_IRUGO);
- S: ?" S/ E& ~ c- E2 C - module_param(ccnt, int, S_IRUGO);
复制代码 3 K$ S* x0 @0 @7 K& ^
) C' s) X2 Y5 e( z1 m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# w8 d2 r ?- s3 A1 I2 ]& parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 {6 Z" }; N2 C! b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% Z1 J6 o0 e! c
$ N4 U% I2 X l/ v2 g \* E4 d6 G( `
|
|