|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 [. W% v4 G& x @4 J: V$ }) D- [code]EDMA sample test application
) w# k- o" F" f - /*; ^1 \; U0 t0 D" F% X" ^ Y+ D
- * edma_test.c
. C' r& j- Q7 V. r: B) @1 _; n - *
* f! @& x! W6 g7 L - * brief EDMA3 Test Application! R3 e# a) y( o5 T6 F0 m
- *" w0 k/ Y {, [; K% o( X
- * This file contains EDMA3 Test code.* Y: Q$ W/ Q# O) {) ~
- *0 k! q; n- ?; L9 r$ E& _$ b& A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& p! G8 s$ F7 M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; C" a; X1 n0 ? r0 ` u# g - * TO CHANGE.3 h! }' Y# s# P, l |0 {- A N4 h
- *5 w- P% K( `& `# r: C: j; ~2 E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* b- l/ r) p/ ~" L) B, f
- *1 w, _2 V# }6 B! D, I4 T
- * This program is free software; you can redistribute it and/or$ `: R9 J4 ]$ G0 E' Z( Y
- * modify it under the terms of the GNU General Public License as: {$ G2 C0 Y4 l6 }5 s
- * published by the Free Software Foundation version 2.( C$ J \# E! ~4 ^; p
- *
- X0 }. F; N5 Y3 O- D5 N6 j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 m1 F/ y3 W! E) `5 i, o( l - * kind, whether express or implied; without even the implied warranty7 \9 D1 ?, ^; m. H! b/ x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* E# k$ n. x6 Z @; C
- * GNU General Public License for more details.
: E8 M% s2 L8 e8 t& `/ h - */
; m+ z% a& m$ o1 a - ) A! W4 {/ X, U j% R9 C" w1 @$ I
- #include <linux/module.h>
, R3 r% I" j& ?' I2 N. v - #include <linux/init.h>/ k. N- p$ `. U7 a) ?
- #include <linux/errno.h>& B/ M4 m% _, G5 w$ K
- #include <linux/types.h>6 {9 T: t6 U8 |" c1 @; R
- #include <linux/interrupt.h>$ {5 ?. u: i# m+ O' h8 H; U; C" d
- #include <asm/io.h>. P. s6 b: U3 O4 } [
- #include <linux/moduleparam.h>& c1 N2 x2 {* C: T/ h
- #include <linux/sysctl.h>5 ?; ]( N: ^2 ?2 N" N; o9 B% G% b
- #include <linux/mm.h>
$ ^0 \" s: P1 x$ t: r - #include <linux/dma-mapping.h>
0 H5 x' n& {) c/ T7 [ V: E - ; I, [: ?* P/ D
- #include <mach/memory.h>' P# y# V; r+ a9 i. C
- #include <mach/hardware.h>3 U9 g/ f# j6 T. x5 ~8 n
- #include <mach/irqs.h>
% O3 m$ C0 x& h) L g - #include <asm/hardware/edma.h>' h6 N( q+ | T0 n I! b
7 H/ V# B0 R+ a6 ~- #undef EDMA3_DEBUG
1 N* L3 V0 u* o" v5 b' X* u - /*#define EDMA3_DEBUG*/
3 ^1 c H7 A( S
N! f8 B7 N; G. ?. v- #ifdef EDMA3_DEBUG
7 U: E& U! r% v: j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 b( m. C* H: ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! \# w2 R2 J7 V+ \' A n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& F( t; a" D7 S8 d, @
- #else
9 Y; A9 G6 s* U: W! w - #define DMA_PRINTK( x... )1 P9 K; D/ o7 U" k: n
- #define DMA_FN_IN1 [& B3 \$ W+ s3 r/ b
- #define DMA_FN_OUT
1 A, T. a- C$ x- ~* V4 `7 D - #endif5 S: ] W% f* U1 v# e. X
- & V" K( D' W: t B3 c0 O" D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 j T- \& _! p; e. E - #define STATIC_SHIFT 3
, A) l* \: |( w/ y - #define TCINTEN_SHIFT 20
. I6 S( a9 O, Z9 o# ~; |5 u9 z - #define ITCINTEN_SHIFT 21
, @( |5 |8 x: X, C' _* e5 V6 h& X - #define TCCHEN_SHIFT 22
* v( d3 W5 U& |! |" R0 ^) P3 C - #define ITCCHEN_SHIFT 23
% F: c, D# M# D' W) v, X1 S
6 |0 l0 z& ]$ Q' z# e- static volatile int irqraised1 = 0;
+ c' D# }5 i' C8 c! l, s - static volatile int irqraised2 = 0;
9 {! V7 P. S, n5 ?: E. \3 {2 Q4 M% C
" ^( l" }1 R, x/ X Z; x- _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 G5 ?5 {) V. n+ i* P4 o: j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* q/ G) O ?" v! ?- I5 N" c+ j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, N- Y: Q6 A) @* N- z+ d
7 L" @: n1 `6 D% r0 S- dma_addr_t dmaphyssrc1 = 0;
# _, f% ?) x J - dma_addr_t dmaphyssrc2 = 0;
8 H" l5 g9 Z6 X) O/ j) I" q - dma_addr_t dmaphysdest1 = 0;$ w/ Z# I; C5 T: `4 A1 f' t9 ^" }2 n. }
- dma_addr_t dmaphysdest2 = 0;
" \; M& i: E9 t2 X g6 s
) W' o. P8 k( K1 }% R1 s5 r# b- char *dmabufsrc1 = NULL;2 M4 d% L8 s3 o' ^
- char *dmabufsrc2 = NULL;) w. e( [' t C( }( V7 R4 B
- char *dmabufdest1 = NULL;
$ {, ?1 S7 `2 F H& q9 G. A - char *dmabufdest2 = NULL;
6 }, [ ~* H& c2 A6 {
# L; O- g% H" @1 D p; v1 I: t/ u% J- static int acnt = 512;
* D$ E" j# q. d& d) c% a( O - static int bcnt = 8;4 h1 }4 X8 x. w5 }8 j" u
- static int ccnt = 8;
( M" q# P0 c& L8 _) E& r
( A( ^9 d; @0 \8 Q- module_param(acnt, int, S_IRUGO);" U9 S5 M# [% A, {) |
- module_param(bcnt, int, S_IRUGO);( X& C3 \9 g$ _" p6 [- R
- module_param(ccnt, int, S_IRUGO);
复制代码 0 H) k% s1 k* P0 ?1 u! E: ]
; G1 B* v: x" \2 \3 t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" J- O0 u* b2 M8 M0 k- Q5 U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 V0 h3 `. M/ b5 ~7 q' e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: f. Y f- d3 E( j# e; g: N
0 n/ @! g! r* `2 Y# d2 I2 O* E; G* W; c- q I* [
|
|