|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 L( E( D5 ?% ~$ a4 c! l- [code]EDMA sample test application
. G9 f7 R8 l. m7 z5 ~ - /*9 P. q7 h. y; e X# _# g9 E' _+ W1 m
- * edma_test.c* N. a R& [7 b+ D% \, c! b: w! h! j
- *
m. Z$ D5 o' u8 S - * brief EDMA3 Test Application9 [: c/ c( e6 A+ N
- */ {8 Q1 B. U' i4 h; s F, g
- * This file contains EDMA3 Test code.) K4 {( q2 B# E/ k
- *1 x5 i0 K; m: j- R# U! a# U1 V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE z' t& d# `0 |' \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ n6 T! I& U6 {5 Y% k+ m
- * TO CHANGE.
3 E, z, d+ Q2 H. u - *
( {& u4 p! M2 {: P% M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 f6 Y6 H9 `0 d* o! w3 Z - ** M, h9 W9 }! ~( H; D4 `& }
- * This program is free software; you can redistribute it and/or
$ _) p+ F# ^1 U - * modify it under the terms of the GNU General Public License as
& `# J$ F$ p/ w/ ^$ p8 k& b - * published by the Free Software Foundation version 2.
' @, H- N' U [( ? - *
- g4 @4 x! F* a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, U6 A- ?, {9 [# ^5 A! r
- * kind, whether express or implied; without even the implied warranty
6 N- G0 ?8 D" v! y9 P0 d0 { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# t. x1 B' Z5 a% W0 d - * GNU General Public License for more details.7 C+ {4 u% ~% ?! D& t; X
- */2 R% k) h! `% V G
( d( b6 C! _2 G- E _6 J) R- #include <linux/module.h>
# @# L- ^1 X& }; b - #include <linux/init.h>
& V7 ^) W2 Z. q% f7 C# S7 h - #include <linux/errno.h>2 O! j+ y. {5 |5 e( e3 g
- #include <linux/types.h>
& h1 M; m {) T6 I p5 ? - #include <linux/interrupt.h> L( W! K0 R$ u$ \' {: ?- M
- #include <asm/io.h>8 V) r8 T" g% S! K0 b' p( m
- #include <linux/moduleparam.h>
E; g* D/ J [" x5 Y Y - #include <linux/sysctl.h>, \$ V; v6 o8 c. i! i' n- {3 v
- #include <linux/mm.h>
; X' r( k* Z+ o( ]) E - #include <linux/dma-mapping.h>
( K. z+ \5 T0 x) Z. E% u! k6 Y
; A, A% x L, ~& N- #include <mach/memory.h>
- B, g( d3 h: p9 b' @# L, D6 U9 ?, W - #include <mach/hardware.h>( B6 _7 p4 E5 v! q. M5 k9 g8 `5 q
- #include <mach/irqs.h>! I! a; W& F I8 \0 w1 Z
- #include <asm/hardware/edma.h>
6 K. o$ d/ C/ M9 m5 V3 \4 g
1 h1 X6 q* Q3 a- #undef EDMA3_DEBUG
# p. d3 v7 O8 Q2 d1 d - /*#define EDMA3_DEBUG*/: `' W+ [7 N) Z8 A" A1 {1 q$ \) C
- 1 i. \' l. T1 k* ]
- #ifdef EDMA3_DEBUG+ `7 a. u: F4 y8 y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* I: B3 c, L+ t; n$ q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' k/ @: }6 {* e m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" P6 N9 W9 C# P# k- m$ H0 `% d; \1 D" S' H - #else% ? c/ k% Z6 t, O* G3 c
- #define DMA_PRINTK( x... )
' K: [4 v& G% g* M) T2 v - #define DMA_FN_IN. }$ {+ d# n+ m0 d$ \' @% E* G
- #define DMA_FN_OUT% j, ]) {" m: E% ]
- #endif
) ~/ s$ J4 R( Q" `1 h9 X4 M+ I - / ^+ M! C e9 o' o/ K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ M+ K1 Z8 t& J! [
- #define STATIC_SHIFT 3
' C; x n k( Q' X0 f3 o/ D; v - #define TCINTEN_SHIFT 20+ Q# H2 f, d k% X3 t) i% j
- #define ITCINTEN_SHIFT 21
% |$ D( H# Z3 R. n" {6 h - #define TCCHEN_SHIFT 22
" q/ L8 J8 \% G& M% N7 C% |& P1 a7 x$ P - #define ITCCHEN_SHIFT 23
$ U1 m* P' }- j! Y! r& f
6 ]4 Y* b% B: ] o$ t- static volatile int irqraised1 = 0;
0 H+ @# m+ `3 t# N" c& U - static volatile int irqraised2 = 0;& F7 M& ?" v2 ~. T
& ~+ N, k/ q( }* t- i- A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% X( w- ]% e0 n5 W6 P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, z7 h( H4 \" A/ ^, a8 G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); @" k8 h% N) ~- c% a
- b$ J" Y3 ~% \/ Z: L3 J7 H: s
- dma_addr_t dmaphyssrc1 = 0;
~9 d# |1 x+ l0 P* d) [+ B# ] - dma_addr_t dmaphyssrc2 = 0;
5 m; G" @6 Z2 F1 g9 P - dma_addr_t dmaphysdest1 = 0;' ^+ b. R' h( `
- dma_addr_t dmaphysdest2 = 0;1 P* O' ?5 `: N P% l% A
8 k2 q# `1 H' B: ]: T# p; A- char *dmabufsrc1 = NULL;1 q) o" Z/ U) ~8 u
- char *dmabufsrc2 = NULL;* l) M7 q/ G- I" Y6 U/ W$ W
- char *dmabufdest1 = NULL;
/ {! Q9 w+ e# ^4 e) p - char *dmabufdest2 = NULL;
7 b+ z: |% o; |* j% K; r. F
[& H4 v8 _4 C+ \- static int acnt = 512;
7 @1 G% N" C' w/ e& Y - static int bcnt = 8;, Q. X4 C5 i4 |' T& u
- static int ccnt = 8;
& v6 j6 v! f* h9 A% d7 q# ~) Y5 ]
" x: I) ^1 t, p: F! o% t" _- module_param(acnt, int, S_IRUGO);
! y9 q# ^# a2 M9 V: k w% R0 W - module_param(bcnt, int, S_IRUGO);
3 y! F% m( Z) h. ^% A [ - module_param(ccnt, int, S_IRUGO);
复制代码 3 y- V$ _2 t, i0 f
B& g* r H" B$ x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; m1 o, O8 ]' J: d; j5 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 O$ z4 Z9 w, M+ O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 w) v# t/ |6 ^: X+ @1 d. `8 a) m. |# K) Z7 u' l
$ S5 x" I* }+ L' t; E4 _
|
|