|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - \6 J4 k1 [- v) j0 ^
- [code]EDMA sample test application
! Z' Y; Q" e# i! p - /*, _0 e4 ~" Z! N5 r2 t1 d
- * edma_test.c
0 m- y3 f( m, Y | - *
c1 ?5 V0 {2 I7 g1 ]+ A - * brief EDMA3 Test Application/ }/ J# j) x* g6 l+ H7 R
- *
- {* r ^. F+ |1 _ - * This file contains EDMA3 Test code.
5 S0 \/ @# }; p( Q - *
. t% J% f0 G# i% I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ^2 J! P- {" @# a6 w% Z3 f3 _) n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 Z) g; J4 A4 R; r - * TO CHANGE.: v2 S) j$ p: Z7 m# C+ g
- *
# B0 M7 S# [- }6 n# |4 l8 I+ |# [8 T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 b t- ` B- U4 `/ X% L - *
/ h7 U/ y( S, N; i - * This program is free software; you can redistribute it and/or
' M4 X- r( N; W - * modify it under the terms of the GNU General Public License as
% M2 i, O/ o k7 n* V' |2 Q - * published by the Free Software Foundation version 2.
1 L/ e, d% z, e) A+ J; z7 T - *# c* [! @, j" Z/ }. |2 h. a# i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 t4 ^, u8 k4 o
- * kind, whether express or implied; without even the implied warranty' t' l3 |% ?$ k. {2 U# A2 l% W: Q, l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) x/ W8 |$ r5 I) [( _% F
- * GNU General Public License for more details.
- |) M2 ]8 b4 n/ a$ a - */6 y2 X* ^: W" u
( i0 d7 A1 ~: B& R G1 g9 ^+ c- #include <linux/module.h>
/ b9 B6 }( j+ `) ` - #include <linux/init.h>
6 @0 P9 F/ z+ F6 R - #include <linux/errno.h># A/ Y+ A: B5 {9 I* ^1 }
- #include <linux/types.h>9 p" Y% d( {, R0 K0 ^$ i! U
- #include <linux/interrupt.h>* @ U/ h3 E- U& j T4 G2 Y
- #include <asm/io.h>
+ \: h0 f5 m& D+ c; V* @+ k - #include <linux/moduleparam.h>3 N$ x- L; W( b- ~- a$ b" c
- #include <linux/sysctl.h>( p, S$ M B6 H4 G* D% q
- #include <linux/mm.h>
1 r @! `0 w7 ~ c; E1 g9 e% |6 B - #include <linux/dma-mapping.h>
6 ]) L5 T4 D5 d. Z( \3 ?* F% R - " E8 |2 J/ N8 g/ f
- #include <mach/memory.h>* h8 W$ v2 u0 l- w. p
- #include <mach/hardware.h>' U5 Y6 u; \2 i0 `) W1 ~2 U
- #include <mach/irqs.h>3 L2 t, ]5 S* O
- #include <asm/hardware/edma.h>
; r0 c# C. U( e/ `# o/ d+ b, J
6 H* F1 Z/ L# ~( l [7 Y$ l- #undef EDMA3_DEBUG9 Z2 W) M/ G$ N5 U) j
- /*#define EDMA3_DEBUG*/' C4 a2 a" q" q. _
- 7 G/ G1 \; L, C2 x: C- Z3 O
- #ifdef EDMA3_DEBUG& d1 V1 i; p) V1 X- O$ J! m5 G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 ]8 h- {+ w2 i8 o# v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" f+ k. j3 D% z- D# t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 R% t9 Y! B9 t, h3 z
- #else1 l& m# f9 H4 N5 Q" Y
- #define DMA_PRINTK( x... )
' O8 Y) ~5 v- V$ D* d( x4 ]3 [! p: I - #define DMA_FN_IN/ P5 E2 D6 g; ~) O' Q3 ?! D* S! P. [0 O
- #define DMA_FN_OUT
/ D/ K, d! D( i, U7 Z, Q. X0 N - #endif5 f/ W6 k; B( A: @: L4 z2 l& C
5 A; U! ^# f# U4 P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* i+ L" v( }! R3 y- S E/ ?. T% D - #define STATIC_SHIFT 3
4 f5 j7 I6 _, m - #define TCINTEN_SHIFT 20
# C }* F2 K+ Z! i - #define ITCINTEN_SHIFT 21
6 q7 @5 A, d. ]$ L# t - #define TCCHEN_SHIFT 22
+ Y- {, f+ ~3 E; z( M - #define ITCCHEN_SHIFT 234 J% V, O! c" ^
- 0 {1 R' e: f- L7 R+ n
- static volatile int irqraised1 = 0;3 b" b1 h* M2 U/ o \8 x) f
- static volatile int irqraised2 = 0;+ E' \+ s- F2 @# M+ A5 {% o2 o- Q1 x/ `
# B$ {$ O+ }1 _" c) Z5 _5 Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( Y) X6 _7 d$ S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: Q; F/ E( ^; V5 x' @9 A9 D: {8 e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 z2 M8 q' v6 X* p: P5 \% _1 ?2 l
- 0 J$ k/ Y5 m- N" N0 @8 M
- dma_addr_t dmaphyssrc1 = 0;
# I; c4 |7 D% y# ? - dma_addr_t dmaphyssrc2 = 0;
" L& w, J; v7 } - dma_addr_t dmaphysdest1 = 0;
9 m e+ \6 P( X% w+ h* C - dma_addr_t dmaphysdest2 = 0;6 N+ u& M$ r2 n+ B
- ( I& M5 s) H+ B$ A& |
- char *dmabufsrc1 = NULL;
% }: p" b& u, t* {9 L+ T - char *dmabufsrc2 = NULL;+ Z, ?) H; E, j9 b3 X, v/ R
- char *dmabufdest1 = NULL;/ V$ ?1 F$ z* ~6 w2 H
- char *dmabufdest2 = NULL;5 Z J5 R) G, Q H# V4 [: n
- 1 `, q& C0 J' A% N
- static int acnt = 512;
) i; {! M- {- x1 Z9 J( i - static int bcnt = 8;
" k. ^9 t, s$ }3 J) p - static int ccnt = 8;5 h. Z6 u6 z0 k6 K% q4 x
- / ~2 [5 N4 Z* E' f7 `
- module_param(acnt, int, S_IRUGO);7 {7 h" j! f+ J! h# @8 ]6 A; k
- module_param(bcnt, int, S_IRUGO);0 }4 F; A0 h0 U$ `. R: L
- module_param(ccnt, int, S_IRUGO);
复制代码
4 Q+ b ] s4 ~% w3 I
; h. p+ j7 Z# u8 J5 Q" P; I' K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ ~ W8 \' m. `- @; o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ a: P2 u& L2 X) f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ W; i2 o9 _! m% X5 |6 k0 l# A, O" \3 v& z
* d: F: Z% G3 O0 t& ^
|
|