|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 F2 j7 s+ y K( C5 j- Z- [code]EDMA sample test application! u5 J2 ^5 |. v9 x. A* v8 q6 Y
- /*
: w; D" t A+ L5 V5 I: ~/ Q - * edma_test.c
. ]* L# s" a' Z- d/ e S5 t7 h - *- B( m; a4 t) T
- * brief EDMA3 Test Application! I' b: q/ D |* a; Z5 l' B6 }, r( F
- *# @$ G1 p# t) p2 O' [; ^+ V9 Z
- * This file contains EDMA3 Test code.* k* O7 g, p% T
- *7 Q7 g# ?; _1 J7 X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ }* _) d! Z+ W) v) J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; s6 o5 w( @6 W4 n Q - * TO CHANGE.! d5 D/ \7 t3 W! ?
- *
$ {0 |6 o T, h# R) @7 V% x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 N# I; z% G6 a' X& W5 { - *
$ `0 M/ p! m9 P- X5 y4 P - * This program is free software; you can redistribute it and/or
( l. _$ |! S. b$ E% X' _! O - * modify it under the terms of the GNU General Public License as
8 O6 R/ [; C. P" U9 X - * published by the Free Software Foundation version 2.* d( A1 L; f2 S7 u! u* t5 m
- *
5 P( F: f+ o; a/ U0 u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ k( ]: s% b8 c* s. n
- * kind, whether express or implied; without even the implied warranty
& H( [3 r8 z r2 K1 Q8 q) b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 P- W- p& n; h' _5 U
- * GNU General Public License for more details.) X2 g# j( M+ H
- */
0 k* h: @5 _7 }$ y( A
: ~% Y* J! u' D; i' Y1 X- #include <linux/module.h>) C+ r8 S' n1 X9 r5 P: K5 k
- #include <linux/init.h>
" [: A N, s9 B$ c* P# p1 @& { - #include <linux/errno.h>
% W" {. K" E1 T( l' W% [' | - #include <linux/types.h>, G- T9 W) ` S% f0 G8 z' R
- #include <linux/interrupt.h>) s D6 s" j/ P( b1 s" a: N
- #include <asm/io.h>6 u9 O- ? t' d+ D p5 X$ V
- #include <linux/moduleparam.h>6 ~* S" A& j- y9 S J! B0 t
- #include <linux/sysctl.h>& \! ~- S l) @3 \( P/ r! F
- #include <linux/mm.h>8 B# S. y9 u: A) m
- #include <linux/dma-mapping.h>, }" B; s9 b7 M. h! ^' Q0 e8 z/ }5 r+ H8 y
$ p7 B) W, M Q* v% a2 ?- #include <mach/memory.h>
& I! a% t7 Z, I8 F; L$ P - #include <mach/hardware.h>8 z* ]- W: t: ]# U& I; h7 S
- #include <mach/irqs.h>
- P$ Z* t3 V) I - #include <asm/hardware/edma.h>
" e( Z: D V% L+ m' N& c4 e5 B% V' Q - , v0 ]2 l! E. y1 U# J+ ]9 B0 n
- #undef EDMA3_DEBUG
0 |+ {9 U( w$ }% j1 v( I7 I Q - /*#define EDMA3_DEBUG*/
* k2 a% N$ c4 R: Z( V8 n h" G: D8 k) A - & k+ v& C" [/ w8 `7 z1 H
- #ifdef EDMA3_DEBUG
* M% c* H- o/ C- b& j8 ~2 X* b. A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): Z/ u+ N3 A+ ^0 b. P. J# O2 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 z& i% f8 O7 C3 ?- ^. I2 n O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ J, v; e6 t5 E( E, F1 }3 E& m - #else9 \7 \5 Z6 Z8 }& a
- #define DMA_PRINTK( x... )5 P7 T& ~9 N0 W
- #define DMA_FN_IN
/ C8 J3 u$ {! l. @' f0 h - #define DMA_FN_OUT6 s- Z* E6 e% L3 P& W6 D# n. @6 y
- #endif
4 I9 T L$ @$ z8 c, b2 i. c - ' H& R# O' h+ \3 E. |' f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& Y% D0 h$ F$ w" Q
- #define STATIC_SHIFT 3
' I& c7 m+ Y! L9 {3 s6 y) V: `. W - #define TCINTEN_SHIFT 204 E0 g2 B$ u7 |% W
- #define ITCINTEN_SHIFT 21 j; A0 v3 p! T, a2 q2 w, W
- #define TCCHEN_SHIFT 22
- b/ P8 k |- i - #define ITCCHEN_SHIFT 232 t9 x' G# e% t( Z' T* y q% N
a% x( |$ A/ I' U% I. r3 m# H- static volatile int irqraised1 = 0;- S) ^) m8 Y" h$ w, r& h
- static volatile int irqraised2 = 0;$ r p! [4 D+ M; ^# c- `
- 6 {, }: J, r' I% G5 w+ x; V6 M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# V! j9 C4 v( r7 p$ X: Z& u! m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! z+ ]4 W: s% B/ b5 Y$ d/ l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: p. o3 C+ N1 F7 `+ }8 ]( N
# d$ r! P* R* P/ K' {- dma_addr_t dmaphyssrc1 = 0;+ l: Q- `9 l$ X/ x, _% [9 A
- dma_addr_t dmaphyssrc2 = 0;
8 X9 y. ]* l% v - dma_addr_t dmaphysdest1 = 0;
- o% ?; [8 ^! G$ l5 T - dma_addr_t dmaphysdest2 = 0;
- O$ `) q9 w, P( K - : `7 a( d" e! `; o9 t, V( E; ?
- char *dmabufsrc1 = NULL;
! w" P/ f7 K! j5 v9 f - char *dmabufsrc2 = NULL;" T* }( ^ u9 ~* [* W( o, A& a
- char *dmabufdest1 = NULL;
/ R0 N( v& A0 T! ]! Z5 n - char *dmabufdest2 = NULL;1 B- c3 D9 C9 V
- v5 U; ]+ D4 Z2 b- static int acnt = 512;# o$ G6 C. t% L r
- static int bcnt = 8;( |2 o! k+ O6 J
- static int ccnt = 8;4 O9 K* B, J+ N2 i* |) G7 ?) t% H
3 m/ C- C8 t. i: H k* d- module_param(acnt, int, S_IRUGO);
: ?- R! V5 x* x. ]7 K% |" u - module_param(bcnt, int, S_IRUGO);
% \2 l4 A& L& ]4 ~& N+ A! O2 G - module_param(ccnt, int, S_IRUGO);
复制代码
1 C# j6 r% L6 ], T8 B0 w
6 j# k9 G( l3 ~& O% w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( y. O' n7 o8 M& }7 f3 I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- V. Z7 S0 V" l, X" Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 V/ C6 h3 X3 d6 M/ Y# t- G
9 C9 G8 n7 V( c8 M% d8 e, [4 Q+ [' S: W5 V8 i& b/ s
|
|