|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% m0 Q/ D# ?) H) F5 X- p5 ]- [code]EDMA sample test application Y8 C8 g& f/ l) x5 `
- /*5 u5 w& n) V4 R/ |+ F, D: V. a$ {
- * edma_test.c
2 P) d' Q# H+ C( P: ^ c6 ]7 Q+ l; B% H - *
& A; t8 A+ \- q5 b5 U8 }2 A - * brief EDMA3 Test Application
4 }3 Q8 Y8 d# y& g1 S - *+ }) i5 Z% G7 v U
- * This file contains EDMA3 Test code.* m2 S E! E+ O8 r
- *
& i u9 n5 }1 _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, {1 p5 ~# A4 G4 @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" n* w8 f I, ` - * TO CHANGE.+ u) i8 t) B4 x Q
- *
: Q3 p, w5 ~: X9 u1 C/ X! a) N! ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( M" h& d4 v3 Q) O1 U* G1 @0 M
- *8 c9 K$ j8 E4 Z: r' w
- * This program is free software; you can redistribute it and/or
+ J' z( f7 r% x3 h - * modify it under the terms of the GNU General Public License as( N6 U8 B/ p( U( {& |- N7 T/ i
- * published by the Free Software Foundation version 2.
1 a9 L+ x% d7 ~ - *& g. ~! U% U0 S4 l' w9 X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 w9 c' K7 `% F- X/ i
- * kind, whether express or implied; without even the implied warranty
' O# P A0 n& T: j5 L5 V( k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 Y- s% u( O. B7 A# g/ ~# s
- * GNU General Public License for more details.
2 i& z* a# I& A7 h+ l6 q( U2 s - */4 m8 k P4 L4 L
B# p% u: o& F- #include <linux/module.h>
; X" X. y2 `0 U0 h- N+ t* y: H - #include <linux/init.h>% T$ }: n( k3 E5 a/ _
- #include <linux/errno.h>
! R$ N; u' E4 p0 y6 f. m5 H - #include <linux/types.h>8 w) c$ s' ?; E- [) N
- #include <linux/interrupt.h>
1 i T" Q0 w5 x) B/ @0 M - #include <asm/io.h>
' {0 a4 }) p8 O# U) @ - #include <linux/moduleparam.h>
: T8 c J! F# Y( D- d' ? - #include <linux/sysctl.h>
0 L' g$ R& ?* E( k2 @ O5 l( @ - #include <linux/mm.h>
; p9 ~) x/ o5 c+ u& g - #include <linux/dma-mapping.h>' A- o1 z; Z2 S) _& U6 z
" a3 o9 l/ l1 j6 w3 ^: S; H- #include <mach/memory.h>4 l: e" }* j% ]: {
- #include <mach/hardware.h>2 S( b% q0 j; |/ h! \* N! {" Y
- #include <mach/irqs.h>
7 @4 ~. ]9 r5 K6 }1 W$ Q) c - #include <asm/hardware/edma.h>; M0 V0 E& W; C) O& @/ x
- & u, Z7 P8 t3 S2 `8 K$ z: K
- #undef EDMA3_DEBUG
7 A1 c1 O- }' `# [ - /*#define EDMA3_DEBUG*/- M6 v% o$ Y h7 U9 g
- 7 Y6 [2 R) g. Y* b# o+ {; f
- #ifdef EDMA3_DEBUG1 K9 _ M7 ~8 H7 v$ n/ S! U1 \! L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ T3 v: u8 Y5 n: i4 N! ]- [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); r% d/ Q3 g) j: w! l0 y6 @7 `4 i" g V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), \% c" w( x9 _& j% y3 ]
- #else
$ G* q6 Q9 s+ z- c! b - #define DMA_PRINTK( x... )
! r7 H2 d0 b% ^2 N! p4 x7 C6 j - #define DMA_FN_IN
' O! G" M% Y1 i6 G/ Y - #define DMA_FN_OUT% _- S* H( }3 F; J* W" i
- #endif3 w- K \" x; `7 W- K
- - e4 H8 l" B& ^* E; V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), z8 x3 ^- M$ a ], v4 b5 n
- #define STATIC_SHIFT 3
# _; T! g& E( l L9 `: g% g3 ~ - #define TCINTEN_SHIFT 208 ^/ F% r* \; i$ v
- #define ITCINTEN_SHIFT 21
1 i9 J7 A% Y+ W6 p - #define TCCHEN_SHIFT 22
" t3 U. J Q+ k9 p# k( a3 ?6 K5 f - #define ITCCHEN_SHIFT 234 q# L4 y0 {1 i
- 8 [6 k& w( a8 d/ N: U+ q. z
- static volatile int irqraised1 = 0;+ {8 l" E, s# M3 u# q( k8 }
- static volatile int irqraised2 = 0;
8 o' l& O- D; q0 s: I8 s% b - 0 l7 o. v" x6 R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ a" G, Z, z5 Q- G7 K v4 x- T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" K+ C6 t I" X9 R$ p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 p$ n( j9 t6 n% _5 G5 T! t - 7 _/ |& P1 j9 T: T: g
- dma_addr_t dmaphyssrc1 = 0;
I9 L4 h( x" }* `" q - dma_addr_t dmaphyssrc2 = 0;
[* S4 m7 U7 f5 K: s2 }1 \ - dma_addr_t dmaphysdest1 = 0;7 w; x0 p& L6 F6 u: V
- dma_addr_t dmaphysdest2 = 0;
4 O) j- M ]( Y0 e - - {0 }% b" u @; S* ]
- char *dmabufsrc1 = NULL;/ R& G5 l" x1 E y* P
- char *dmabufsrc2 = NULL;+ x, j& M* V/ F6 N
- char *dmabufdest1 = NULL;( K4 _ X5 D$ X$ d
- char *dmabufdest2 = NULL;# K9 H; O' Z* `3 h1 u
- * R' j. x d" K9 e- [/ m
- static int acnt = 512;
0 ~; `, l* e; F2 r% Q) J9 ^ - static int bcnt = 8;
2 k. f. K; u; |4 t/ ]5 [( r - static int ccnt = 8;
$ T5 P0 K7 e9 B
) P- q: Y4 T; s# f3 [- module_param(acnt, int, S_IRUGO);
' a1 |' |0 }2 i# t* P - module_param(bcnt, int, S_IRUGO);
! v$ @( V6 E1 u/ }7 O4 V6 z - module_param(ccnt, int, S_IRUGO);
复制代码 ( p3 W/ J! `) T# M/ [
5 B# t& r; j* l' G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
|, A- i9 r9 j0 c8 X$ garm-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 k' B- b& w+ y; n' Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ H9 r, j0 C+ W
9 X! ^9 g6 | m( r9 M7 \) l G# { B+ |, A |0 B" z6 W
|
|