|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 x* ]# ^6 j( z% s. X! W5 z) c) E
- [code]EDMA sample test application6 G, F" @0 @$ k
- /*+ n! {; _7 c% K4 b" N
- * edma_test.c
( O& `$ {9 M/ q1 O1 X/ U8 S - *) q1 y) \0 A2 Z1 y" f
- * brief EDMA3 Test Application
+ I4 a, w( E/ F5 o* ]: G7 Q - */ L- P/ N, U& W3 g
- * This file contains EDMA3 Test code.* P8 k* w4 C) E
- * ^2 X6 M) `% o) @/ _1 H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 {9 L% d# `. P- |+ ]& G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 e4 }) @9 x1 P0 p, M3 x0 ?3 y - * TO CHANGE.8 Q$ Z, p$ M$ h6 H, k, n
- *' F4 j- T4 } D% ?/ d9 c, }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 r {, }# z# C
- *" S: s$ D, g0 V: t% w1 A1 e
- * This program is free software; you can redistribute it and/or' h$ s# ~2 Q2 }" G
- * modify it under the terms of the GNU General Public License as
- B: P2 [ u, V6 ^: M- \5 x5 ^2 U - * published by the Free Software Foundation version 2.
" Y# r' u# \9 W# f& u - *( `8 ?' i0 l% G1 F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" d" J5 K5 y) S
- * kind, whether express or implied; without even the implied warranty% w, M: q/ D$ G% J$ U4 f# O9 N b Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% r& C2 R$ @ C* s) l" j) D% I - * GNU General Public License for more details.6 N2 S9 O: b* z% o
- */
! j% s* v( e* n& k# L5 v - 1 R7 R" i& K3 R+ N3 _" x
- #include <linux/module.h># w8 q) D; H! U/ [' c- } K
- #include <linux/init.h>, _' |4 d9 _ y) G# F& U9 f: v
- #include <linux/errno.h>
* a: v. \; d4 h8 X0 K& \7 M2 m - #include <linux/types.h>
0 ~! w0 J* Q5 `1 d% {. ] - #include <linux/interrupt.h>" B! P8 m6 ~$ w: u, j; _+ T) q$ R( B
- #include <asm/io.h>
7 F: o; j7 t2 o. ` - #include <linux/moduleparam.h>
- [! z' {9 _: X - #include <linux/sysctl.h>
; t. E2 F3 u& m; ?; |- x6 Q - #include <linux/mm.h>
. c# A7 f" g0 b! V* j. [* ~ - #include <linux/dma-mapping.h>
) V1 L1 O- f) L* Y A; Q) q
! Y& `% o6 x$ t# N' ]- #include <mach/memory.h>( j$ @# U/ Z: T2 p+ h2 S8 M
- #include <mach/hardware.h>
. L% y* t0 E$ U& C - #include <mach/irqs.h>
- _! N5 P( D! H, d5 Z5 Z - #include <asm/hardware/edma.h>8 m6 u: [. E* |( H. z% G/ Y9 i
9 ^) }# w1 d# |7 ?( P/ X- #undef EDMA3_DEBUG: O1 d" ^& P! u
- /*#define EDMA3_DEBUG*/
7 A4 |( M/ x! ^% k& L5 ]/ }
# p, L8 b$ |9 v! _; y3 o- #ifdef EDMA3_DEBUG! E: W, Y% S- n8 V B5 d G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 ^& Y" y: f+ F+ Z) a7 T9 Y2 M U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( K1 W# [2 C8 B( D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 ?4 q9 p$ G; Z# k - #else
/ j8 d6 u0 y$ S& F- O1 O' { - #define DMA_PRINTK( x... )8 n( F W. m. c
- #define DMA_FN_IN! s$ A( m! f7 ?8 P, Q- l
- #define DMA_FN_OUT
* M$ {9 D: [" j( H - #endif
3 D K5 Z; V- G
7 T; P3 q5 K/ w$ h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 `3 G4 A! M+ ?' V) N! v
- #define STATIC_SHIFT 31 ?2 [0 `* U' ]! |
- #define TCINTEN_SHIFT 20
: s, Y- t3 Y5 A0 |( }1 L - #define ITCINTEN_SHIFT 21) p1 l. }- p3 F
- #define TCCHEN_SHIFT 22
) g2 \/ l0 D9 U - #define ITCCHEN_SHIFT 23& `3 q) j: |- B2 u- A! R
- 9 C# d$ V7 U3 ~# u1 X( n) p
- static volatile int irqraised1 = 0;
% ^( V6 O- H6 c6 i$ M9 q' d - static volatile int irqraised2 = 0;
" z J8 S+ e0 w0 A - - l m+ B* W: v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; D4 J1 Q, F0 i1 N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 z& k! T9 W; Z# p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; r9 Q6 x) w6 L7 X9 o8 P
- : {3 c m$ c$ |$ k9 v, H4 t
- dma_addr_t dmaphyssrc1 = 0;6 a8 b3 J1 ?3 ], M6 i
- dma_addr_t dmaphyssrc2 = 0;& h+ m* x* n3 q/ B
- dma_addr_t dmaphysdest1 = 0;
- Y ~" j) I7 a - dma_addr_t dmaphysdest2 = 0;0 O( I( ?( D/ |' p2 a- B! R0 |* t
, x# ~. Y5 U# j' G+ u- a* G' y- char *dmabufsrc1 = NULL;. T9 f8 [4 r, ]- d
- char *dmabufsrc2 = NULL;
" P$ C, y! ^0 y: g7 c. M/ S - char *dmabufdest1 = NULL;
: S: r7 k0 G6 ]/ ]; z - char *dmabufdest2 = NULL;
8 H2 d1 h; n- S9 Q: d; g% u - 4 K1 M2 n! `0 ?8 g& Y: k1 A" K9 R
- static int acnt = 512;
- ]. I6 B; W' f; Y - static int bcnt = 8;
8 f1 J% j) T5 b8 R0 P - static int ccnt = 8;. b4 q5 N: W9 `
- 7 |6 n! l0 c( l! o' Y! [
- module_param(acnt, int, S_IRUGO);$ B/ |5 z' _, I3 W8 v7 s5 ~
- module_param(bcnt, int, S_IRUGO);& R: ?& J( D# @+ V- b9 x
- module_param(ccnt, int, S_IRUGO);
复制代码 % g4 U0 @9 R u' B, w/ l6 O6 r
( }6 m" P5 Y) H0 F- k4 D* ]5 G- ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 K: A. W1 f( H2 v) ~* b8 P+ q: n# T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) K0 c1 r V& x$ k% O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 b! P( g1 ]$ t
( J+ b) P( I) c K
1 L5 Y+ P' b9 l% E1 t! L9 O
|
|