|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 J* K% l5 [7 @- s# K* y1 d( A
- [code]EDMA sample test application
6 R" D: O, T2 {) _ - /*0 t2 E8 t# a \$ t2 M. s% ]+ a
- * edma_test.c
9 ]$ T6 l6 {$ i6 n/ A - *
) ^8 | `3 t0 l* y' k - * brief EDMA3 Test Application5 }4 P; X+ X" s, W
- *
2 e) V8 R, M' S7 u) Y - * This file contains EDMA3 Test code.; y/ k6 x. N% d* {
- *
! J# n/ _' w5 O) B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! F+ W/ c7 b5 h. k3 @9 O2 ?1 n. G4 u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, k* Z( B% q5 s r+ q* ^' x - * TO CHANGE.
: s3 A6 P& |' F, X5 E1 D - *0 ?0 ^* z( ^! O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ O2 Y; d! p& j |' x# i- _ - *
& }7 ^3 X: K0 j, ?6 g$ T" d; q7 M' I7 y - * This program is free software; you can redistribute it and/or
" I) D3 _# [: N: P# |, _ - * modify it under the terms of the GNU General Public License as
! {& D: L' L& v7 K3 M - * published by the Free Software Foundation version 2.+ F7 P$ _- a' @8 ]" j7 Z0 c
- *; z& | l* h% `* s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 D, h' `+ g' e# C a
- * kind, whether express or implied; without even the implied warranty1 X. `3 P" I J9 [/ ?9 I9 E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& F. U; r; j+ r& }
- * GNU General Public License for more details.& S# K6 D, e# S5 q. N) N) n$ o
- */7 B2 @5 p% C- v/ w- ]6 G
- ( ]8 Z" w4 o9 x$ y
- #include <linux/module.h>* p: C6 W+ U1 Y4 x% I, j
- #include <linux/init.h>+ P8 a7 r2 i) |6 g
- #include <linux/errno.h>* a; H4 u: h9 {8 e9 `: Q# |" f
- #include <linux/types.h>( \( N# c8 `6 L. A
- #include <linux/interrupt.h>: P j0 L5 \# _: ~ n9 S6 e8 L) |
- #include <asm/io.h>/ l* W, P' U, x" Q( k
- #include <linux/moduleparam.h>, `. w$ ~. i. Q8 ]/ W; Z% o
- #include <linux/sysctl.h>
1 I! A5 w' _9 s' g; @; W - #include <linux/mm.h>
) k J6 R" j2 i - #include <linux/dma-mapping.h>" h& h- Z* A8 h# T8 G; H
- 4 v2 ~/ ]9 C0 o% ?) ^
- #include <mach/memory.h>3 L# k& |" }# N& J) d
- #include <mach/hardware.h>) j* q! v) n/ R8 Y
- #include <mach/irqs.h>
( h* O. n, l: U6 O( D* W0 G - #include <asm/hardware/edma.h>5 N( ?& o6 k m6 M
. ^1 `7 c( u5 l1 R# A# t( ]- #undef EDMA3_DEBUG
0 [) q" U( K" }. q7 r7 l( u - /*#define EDMA3_DEBUG*/
7 s5 U' R. m+ H, P& Q' J' v4 [
7 }% r+ ^ `1 s, S: }9 B- #ifdef EDMA3_DEBUG! x" ^' l2 I! z r9 j, i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 G# z* A6 s- d) E% C! @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 w1 k% C4 b: u$ y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, f" P; y7 i2 h: m& }% a4 _, P - #else
: A- M8 P) [ r - #define DMA_PRINTK( x... )
' ?0 \- U! D) E& B! {; U S - #define DMA_FN_IN2 M4 I4 w% y3 d0 U& Z& D
- #define DMA_FN_OUT d: P- x5 m- @
- #endif
9 q" b' v) x% P - 7 L3 m! M7 L* \1 A* ]/ {8 A% M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. b2 K4 L" ` E! O- ~ - #define STATIC_SHIFT 3) h: R7 }9 e( Q# o3 z, f4 |
- #define TCINTEN_SHIFT 202 L1 l5 {5 g @& R
- #define ITCINTEN_SHIFT 216 z2 r/ Q) @# S. S
- #define TCCHEN_SHIFT 228 F5 ?' E; Q2 R; | o
- #define ITCCHEN_SHIFT 23
# {6 I. Y$ ^/ J. W; x
+ O. Q# H% R8 Q- static volatile int irqraised1 = 0;
( b5 y+ ]$ p. P7 V7 d - static volatile int irqraised2 = 0;6 Q) L3 t) K' Y" ~
5 J! [8 p3 h+ M1 r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; Z: O- ~1 {& s# B- I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" l# p" S, G& v2 V* V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- G8 L* U! j4 |# U6 M5 I1 X
# K# J6 u* v, u' E. \" s D6 P- dma_addr_t dmaphyssrc1 = 0;& r/ |' W v/ w$ b( Q- b0 x
- dma_addr_t dmaphyssrc2 = 0;
) N2 k I. r! \5 s - dma_addr_t dmaphysdest1 = 0;8 v8 P# h$ M" K7 X4 {
- dma_addr_t dmaphysdest2 = 0;8 K+ {# s! k: ?, y
' `- G7 w) k. m, t; P0 P& z! c+ J- char *dmabufsrc1 = NULL;6 S; m+ K, f+ g& O/ V2 f
- char *dmabufsrc2 = NULL;, m* D9 \2 I& ^3 _, F
- char *dmabufdest1 = NULL;$ {8 D Z* }: g. i
- char *dmabufdest2 = NULL;! `. i+ M% E4 ~7 _9 b$ s
( s0 N( F7 A4 [. S3 A- static int acnt = 512;5 l' {3 K8 i# l+ H: Z! u3 g; U; m6 L
- static int bcnt = 8;7 L q* J; E2 s5 p# L9 R6 f
- static int ccnt = 8;- Y3 J6 I9 ]5 x: i6 b# h6 |
5 r( N. Z, q0 N1 e6 H! j% ]0 }- module_param(acnt, int, S_IRUGO);1 B {4 p' K3 Z& h2 P; e
- module_param(bcnt, int, S_IRUGO);
, h8 [/ q/ z# } i# z: B$ b - module_param(ccnt, int, S_IRUGO);
复制代码
9 I# p2 U7 c& G) d4 x( Y( g. Q" I/ O) ^; h$ C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 l/ ~ r% `- w' e' r- D' zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, {3 e1 J* S& @- n d% q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 A* v1 ^( _- Z& A. e
1 {. d% J0 u \: `6 M H4 w
1 R: C' [8 F, E) J: V! d |
|