|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % S7 V) y6 f/ @; Z% h7 f& k
- [code]EDMA sample test application
: T, l. b+ B3 E0 n- c; g - /*% u2 T; ^4 g5 X O/ S
- * edma_test.c3 O1 M6 z# @- D3 L
- *
7 i# |/ f' D3 ^/ k+ b - * brief EDMA3 Test Application
8 b f8 s6 ]0 b& \ - *
* V1 H: L1 p3 T1 K% @+ @" V& D _ - * This file contains EDMA3 Test code., m6 ^9 Y, K0 @+ c' h7 |
- *
0 ]6 Y/ w' [8 a5 D4 I) O. { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 M, `& e9 d5 S: J: q j' H |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& B, a$ ]; K1 `+ _+ e) q
- * TO CHANGE.5 q5 y1 w$ T( ?+ N( A
- *+ N' z- R- O* o0 B, `" `% P' U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 B( h6 k6 K7 p' Y/ V, i
- *+ u e( ^: h% m& J8 T; c4 K4 b
- * This program is free software; you can redistribute it and/or
0 T3 h4 ?# v' k# p( r0 E# z - * modify it under the terms of the GNU General Public License as
( P( s% a' E+ L7 [# M# o - * published by the Free Software Foundation version 2.! P; J. y. T; S3 i# K4 s
- *' Z4 n, e# r) Q0 Z6 f( L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) v J1 \3 R* o) T7 Z! r - * kind, whether express or implied; without even the implied warranty
, z/ ?* N; d, K, e7 c0 A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 }3 l. \2 M' f: K6 B& j - * GNU General Public License for more details. {, W) k: `5 ?" P0 _/ O
- */$ P/ U- B% E& [% k0 m2 j/ H' j
- $ \3 @8 m/ i1 \
- #include <linux/module.h>
L% ~- r4 T/ c, { - #include <linux/init.h>
5 E l* A1 J/ d% F- l: u { - #include <linux/errno.h>
, A+ K! d3 a5 D- x4 N8 \ - #include <linux/types.h># u2 y7 a& Q% b2 r8 M% v& [" `
- #include <linux/interrupt.h>7 i- p- _7 I2 Y8 A ]
- #include <asm/io.h>
7 X( @! P- B- q1 n - #include <linux/moduleparam.h>5 v% M$ b) i7 Y' @: |, A
- #include <linux/sysctl.h>( q! ^6 R8 i9 B/ G' g; f. M
- #include <linux/mm.h>
; p4 E. r4 w! V, k - #include <linux/dma-mapping.h>9 j b( G4 c9 T& `6 o) U5 z! h
, Q4 K6 z. n& r+ L- #include <mach/memory.h>
! Q- C; ^$ Y! C0 ?7 d' H - #include <mach/hardware.h>* ~2 v5 h" z. z2 D
- #include <mach/irqs.h>
; {$ ^$ C0 i, p5 }$ q9 C* w2 L5 } - #include <asm/hardware/edma.h>9 i% r* @+ m! b' n) T% ?( U
! a" I1 X. R) V0 l; B- #undef EDMA3_DEBUG
" P2 _3 u* |- y7 O# \% t - /*#define EDMA3_DEBUG*/
+ a1 l5 A" Z2 i - " u2 K1 g% N7 F) {3 _) `5 Y$ X+ r
- #ifdef EDMA3_DEBUG
) d7 D2 k! h; R5 ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! g5 m5 ]7 W$ e8 N0 L9 S9 z0 o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, X8 G& w; C) q) f$ _6 A; J, a8 @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
M2 G: Y, B5 m4 {9 Q - #else3 y% X+ x0 R; ?! ~+ Z
- #define DMA_PRINTK( x... )
; X+ e0 G/ f! X& g; p - #define DMA_FN_IN
9 [1 _: y) Y# n8 e - #define DMA_FN_OUT( ^- a4 w3 S/ ?0 m# ~7 u
- #endif
( j' W, _, G+ J - , F9 v( S- P, k" I$ n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 n4 E. a% K, ?4 O, G# z
- #define STATIC_SHIFT 3
8 A! {6 d- P l. T! }* f4 ] - #define TCINTEN_SHIFT 20
/ ~* N! F2 `$ F: z, |7 [- k - #define ITCINTEN_SHIFT 219 q6 ~2 W- G! N$ I3 M
- #define TCCHEN_SHIFT 22
n. H E6 Q- T# X6 X - #define ITCCHEN_SHIFT 23
3 J: T% `/ S1 {* F2 j( r) D% v) O( e - 8 q5 w9 @2 }- `: I u3 g
- static volatile int irqraised1 = 0;: W* A: @# w+ H( ^) ?- S
- static volatile int irqraised2 = 0;" M3 n5 q& e8 [/ {$ c4 Y# [
- # c3 I+ n5 |9 V! T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 p& L: e. N u. S2 d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, _5 E, N& W- W' O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ Q1 o3 M5 x7 m; b
3 T: O1 _7 R. m8 K- dma_addr_t dmaphyssrc1 = 0;5 A4 R( q; y9 m
- dma_addr_t dmaphyssrc2 = 0;6 `' A. |8 N- v" X5 _5 \9 w
- dma_addr_t dmaphysdest1 = 0;
4 C* Y: l& J" ]# }, M3 o - dma_addr_t dmaphysdest2 = 0;
8 `+ w- T, g2 a; K) S% H
2 D- c! x" F* \5 j$ t, B# R, F# O: s" S" R- char *dmabufsrc1 = NULL;2 t7 B( b. U. Q# p/ Q
- char *dmabufsrc2 = NULL;. A" O d# G& u, i
- char *dmabufdest1 = NULL;
3 w/ d- Z! P; j9 j7 A - char *dmabufdest2 = NULL;
4 ~2 [2 G/ ?+ J) [) d - 5 {9 I* |( j9 h0 d
- static int acnt = 512;
/ N. u1 H" T6 b - static int bcnt = 8;% q/ N' \. g' Y
- static int ccnt = 8;' q/ _( B9 s- D. T4 k
- % ^1 n3 c- n- ?! s% F" D! e- _
- module_param(acnt, int, S_IRUGO);) q `, |- P- l4 F
- module_param(bcnt, int, S_IRUGO);$ }) n; A* D% g+ R
- module_param(ccnt, int, S_IRUGO);
复制代码 - b( b7 o0 h5 `! e. o
" n6 T4 O$ e, r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; A: ~. [& |" C/ ~/ q0 ~- G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, u& X; U6 B3 s8 J# ?: G7 V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; _$ P7 b; m9 E1 o! s
+ s0 C1 d. Q2 F5 S* `# }( S* `3 e: F
|
|