|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- P' N4 b) n/ }/ c; A4 u0 B- R- [code]EDMA sample test application+ y: u, \/ `) y" k/ f1 W
- /*
& [: h, X5 n! `6 b8 v0 u - * edma_test.c
$ @& e' G: C; F: d/ U8 I1 d - *
& a7 _5 [! a+ o# I. ?4 ^( Q - * brief EDMA3 Test Application1 G8 K$ A2 g/ Z! ]0 K
- *! I4 f- V7 F9 s' m3 N
- * This file contains EDMA3 Test code.
: O. `. r. R# [. D% M9 q# o0 c - *
/ L. W; F' u! p8 m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# c# f$ k. I! Q* S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( H; k* i7 W5 o - * TO CHANGE.0 m& _6 L' w. {! J. U% q) \
- *
2 Z: h* n& w! U! n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( G% @( z( q4 |+ p% B4 O
- *3 X+ X# {% q8 \2 B/ W4 h" `1 W
- * This program is free software; you can redistribute it and/or
" C$ Y' _6 f0 W" B! E - * modify it under the terms of the GNU General Public License as" X D$ A, \8 N8 ] f* o! {0 o
- * published by the Free Software Foundation version 2.- y/ U, N' h/ f9 Y' W( F
- *
: U+ @% I+ p4 z7 L4 a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, f$ y5 |; J7 s2 D
- * kind, whether express or implied; without even the implied warranty
" ~0 G+ N$ q% o' I- w/ a4 f/ y, k* V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 F( c9 ?9 B* c* |7 e+ H
- * GNU General Public License for more details.2 O" _% @! A9 C! T& D8 s. [
- */
8 l8 I' c+ r2 M* \+ n p - 0 r% e2 Y- r1 P, t5 {3 {- S9 }
- #include <linux/module.h>
" ?" c7 }5 Y$ P! i - #include <linux/init.h>
9 Y: Z& U3 ` _ - #include <linux/errno.h># [! x, l, n5 ]3 I/ S
- #include <linux/types.h>/ H' D. K' g0 z% U8 t$ y5 j. v" i& U
- #include <linux/interrupt.h>8 e, g6 T' ~9 H4 T
- #include <asm/io.h>6 ^& Z" E% P% D, `# Y( S
- #include <linux/moduleparam.h>0 m7 X% U; H+ ], b8 j( u: r' t2 O
- #include <linux/sysctl.h>
. J8 ]$ L+ z" v& T4 }# x - #include <linux/mm.h>
. h6 ]! W; _$ ]% b7 Z* W - #include <linux/dma-mapping.h>
' Y+ @1 ^+ r9 |& C6 G
! ^% n5 K- g* x- `/ ~" A. `1 ^) u# M7 r- #include <mach/memory.h>. g$ d& j( Y% |
- #include <mach/hardware.h>5 y' w, N9 ^. U- Z
- #include <mach/irqs.h>
1 R, d( d9 n9 J0 s1 x' R - #include <asm/hardware/edma.h>9 O7 A, r$ x3 Y$ a3 X8 a& P! B; ]6 }
8 `; T2 C: R; _5 K/ C1 P: U- #undef EDMA3_DEBUG' k7 x' @& E5 Y9 e8 [! W* a) f
- /*#define EDMA3_DEBUG*/
% r* w, B5 S7 x W- `& _0 Z - ) {$ C3 q; j B0 q; E# p
- #ifdef EDMA3_DEBUG4 ?& J! u3 e f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ E! \# {2 l7 ^, Q K; F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" E! ?* g6 C }" z3 V9 H8 f- M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* s% B& c" a( q2 |" N* \
- #else
$ c* q) O4 \+ R* a; k2 @ - #define DMA_PRINTK( x... )) Q+ z; L% \- Z/ w6 R
- #define DMA_FN_IN
0 A# y: I1 Z3 ?) ?+ _( w- q - #define DMA_FN_OUT
9 n7 B: L) z7 x+ W$ v5 d - #endif9 d) [5 E3 i+ U, P
- 9 T; o% e8 Q1 F- q+ u! w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ c o7 y/ h2 w, B. X. h
- #define STATIC_SHIFT 38 k% c1 r( w: X; @' W6 A0 w- u5 v8 A
- #define TCINTEN_SHIFT 205 v/ S( l" @4 C7 ?
- #define ITCINTEN_SHIFT 21 Y6 i e2 w% M2 t8 m
- #define TCCHEN_SHIFT 22
- i5 F, C7 X A& z% v) ] - #define ITCCHEN_SHIFT 23
( ]' _( c O1 j) y5 O5 K
* m7 k& k! r# J* r8 B* N- static volatile int irqraised1 = 0;
' U" |1 C5 d! J3 j* } - static volatile int irqraised2 = 0;4 {- ?7 t5 m3 B2 P# O4 U
- 8 z9 K3 k1 T/ K L+ a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 I3 W2 U6 Q! ]- P1 O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ a7 ~4 ]' D2 Q7 }4 c2 ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) Y# ~0 g$ _; V) l" a - 2 c' c, i3 y6 r! p9 p: C- p
- dma_addr_t dmaphyssrc1 = 0;
" z5 r% V+ O( L - dma_addr_t dmaphyssrc2 = 0;
; U( `2 G; d$ \* S4 U. i2 k - dma_addr_t dmaphysdest1 = 0; s8 x: ?1 E: [
- dma_addr_t dmaphysdest2 = 0;
2 D2 V+ O9 g3 o6 n8 `4 ?! w
4 V' Z9 o0 r& e- char *dmabufsrc1 = NULL;
D7 v0 i7 i1 D) D2 X - char *dmabufsrc2 = NULL;
0 _3 I. a: U4 o; b4 w. L - char *dmabufdest1 = NULL;1 n4 D4 I, B) b9 h: H, c
- char *dmabufdest2 = NULL;
/ N* J+ m) U, I" F* L( p
' h$ l. k( p3 E% t- static int acnt = 512;' X! B Y5 y; q; `# G: f
- static int bcnt = 8;) R0 Q+ D V) u' L
- static int ccnt = 8;. G5 ~0 J& C% ^; n+ Z
+ l6 M0 N- t5 U: A! j3 |; j4 N; k' ?- module_param(acnt, int, S_IRUGO); J+ Y9 ?' M d( [ A
- module_param(bcnt, int, S_IRUGO);7 Z- d8 U7 p5 B5 U2 I% {5 q
- module_param(ccnt, int, S_IRUGO);
复制代码
, Q3 c6 x% x# r3 @
2 x) R$ T$ Z$ r& {: k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
x, v- D# q7 U$ z& S# ?7 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) J9 O, r8 D$ E# R+ [+ U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- i0 I8 f+ x! b7 n# T- H( A* a5 J/ X6 H' x; `
, l5 q. e% @# E
|
|