|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 U1 M' W$ h0 J8 @- [code]EDMA sample test application
; q# N; ~6 Q6 S( W - /*
( |, B1 K6 }3 N; x* X; d3 H - * edma_test.c2 A; l( E, a6 _ T
- *- n1 P: p5 W7 S& F! a* F5 }$ K9 Z
- * brief EDMA3 Test Application- b: N0 k( R. ~9 g0 Q3 h( N& l/ W
- *% }* B f) ^. H) Z
- * This file contains EDMA3 Test code.- E! q1 W5 f) ^$ l
- *' p0 }4 q \% E2 D. O+ Q: a3 K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 R. L. v5 d9 w$ p& u( v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* m9 s6 `; }, q. D1 w$ R
- * TO CHANGE.
! s7 Q' v3 v# x C8 Q$ p6 v V - *. l" m9 g2 Y7 E. Z0 O, w. s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- U: e+ u9 j. L' O3 S
- *3 X' a( ?" R0 h1 r+ N( H x% a
- * This program is free software; you can redistribute it and/or k8 Q; d* Y* Y$ X
- * modify it under the terms of the GNU General Public License as$ X, h/ H! p7 Q4 g9 T R: k
- * published by the Free Software Foundation version 2.' b- d% S3 l( ]6 U, u
- *+ _. u q! A6 T$ S8 K6 Y" w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any B3 r7 M I, B, Y
- * kind, whether express or implied; without even the implied warranty/ T( P; g8 [' B! ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ N2 G, A" [/ I0 u- X) l! V - * GNU General Public License for more details. Q z/ [8 i! Q+ ~1 K- X3 O
- */
: P4 x7 F; P& l7 U- F: r4 T8 V) S
6 y, g) ~. L) G1 L- #include <linux/module.h>$ C9 k, P5 F u3 ~* c$ C9 f% `
- #include <linux/init.h>
2 D, p# s0 ], z3 W' M' n - #include <linux/errno.h>( d4 X( x! V8 x- K
- #include <linux/types.h>
7 @/ W( | o, b) J# M' v) [ - #include <linux/interrupt.h>+ n7 c f8 x! L8 N& T
- #include <asm/io.h>( x$ q3 J' U) g
- #include <linux/moduleparam.h>; I$ u4 f# e2 y7 [4 m& S# D0 t
- #include <linux/sysctl.h>
% n/ j& E, i5 B0 T4 W5 o" K5 J9 P - #include <linux/mm.h>! Q% [; ?/ W! W/ O% P
- #include <linux/dma-mapping.h> U5 z( Y9 M- ]: N
' R5 A6 w' a6 X2 R' Q- #include <mach/memory.h>
1 u2 F( m% v5 R1 |/ A - #include <mach/hardware.h>0 Y. }3 @( _6 S( {7 X+ [% e- z
- #include <mach/irqs.h>- h& x# [6 J/ I+ c5 |
- #include <asm/hardware/edma.h>
* `4 k/ p. I- H8 D- M- x: f - ! v8 ]+ L, Y6 O& F. }4 a
- #undef EDMA3_DEBUG
+ c A% c! @; x) c# P - /*#define EDMA3_DEBUG*/
5 X% h+ C6 u; B6 J. e$ N! F - . h j! S( Q, d, N
- #ifdef EDMA3_DEBUG
/ F. W3 l; n4 z- s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! [+ s" k8 u* c3 ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) v6 m7 a s( r$ i# h2 }) C* u( C$ J - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): Q1 A$ {6 \) G4 T1 w- a0 e
- #else
6 M/ a3 b& v4 {& c3 M0 ]7 i - #define DMA_PRINTK( x... )4 M8 G4 K+ H. g$ b
- #define DMA_FN_IN8 ]- O, X$ ^# ~: X1 J( B8 j
- #define DMA_FN_OUT* v4 e" x5 [# u/ _, q5 h
- #endif4 j5 F' v+ ]; D. }5 e
8 F, u4 T5 H1 f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& N& [ w9 `. f3 e9 D, A J - #define STATIC_SHIFT 3" C) \4 |( e1 g0 T8 p
- #define TCINTEN_SHIFT 20' p* T2 y+ B5 A. k1 r
- #define ITCINTEN_SHIFT 217 f( H- H4 b0 g% ~% F
- #define TCCHEN_SHIFT 22+ |; D: a! s( U* {( G+ @
- #define ITCCHEN_SHIFT 23
8 e2 |' [6 w7 |7 ~( f
% G# U2 H3 x: _- J1 m" H7 I- static volatile int irqraised1 = 0;7 L5 R3 @- _. ?/ K: b2 y
- static volatile int irqraised2 = 0;
. } X. R8 O! U9 q; @7 `3 D% a - 2 C# ~ k& I6 X- b8 |) s" ~/ m) Z: x5 S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. \. e: ?3 ^3 u* ?3 E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ S* ]. A) g" Q l: \/ |& } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 @! n7 q% D8 t+ o% k; P) o7 S2 V3 S
9 ]7 P6 b$ w* g- dma_addr_t dmaphyssrc1 = 0;
0 D2 F/ J! {2 p - dma_addr_t dmaphyssrc2 = 0;
4 E6 |2 u5 G5 ] - dma_addr_t dmaphysdest1 = 0;
& ]7 v. i0 r( `7 @# y; p - dma_addr_t dmaphysdest2 = 0;' M5 @3 h2 `' \( U/ `; }' b
- ) V+ I+ o" l# L' z
- char *dmabufsrc1 = NULL;8 s' e5 l0 l5 {
- char *dmabufsrc2 = NULL;/ Q5 M0 c0 i- Q
- char *dmabufdest1 = NULL;+ ^0 H/ E" V }: r2 v
- char *dmabufdest2 = NULL;% C- z- m" Z" D4 _9 R
$ A$ s, ~0 C1 E8 v% B- static int acnt = 512;2 V% h8 j6 a2 a8 p# g
- static int bcnt = 8;6 a# Y" Z+ I$ A
- static int ccnt = 8;! [- f; H. g( S& Z! U: S# R9 p
$ A: {- d6 z% ~5 L- module_param(acnt, int, S_IRUGO);
3 [0 `* Y5 ]' e2 ?; ~8 \ - module_param(bcnt, int, S_IRUGO);
6 D1 p+ ~+ z! _7 H - module_param(ccnt, int, S_IRUGO);
复制代码
% d& M; P* ]! t* U& ~* m+ h7 \8 m M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, `% H( z8 v0 G, v8 }% iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 R' d" c( {/ H# L( p; ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) l# J4 c; j& t0 [$ q$ _. W3 L; s8 l* h% a, z# G
+ H0 z( ?) L {% X* f( m. m7 Y |
|