|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 e8 f6 a* E1 o! n' ~- b
- [code]EDMA sample test application- O8 F: e( T7 a) U
- /*
) ]/ P/ v1 J% I6 m) z( y - * edma_test.c2 `5 {' ^8 S; j9 c; M
- *
: v" X+ z$ a9 W" k - * brief EDMA3 Test Application
1 j" Z d, b" H. X4 A% |: W - *4 E" N) Z; x- f
- * This file contains EDMA3 Test code.
+ [0 }3 E, i6 J - *
. N3 k8 A* t8 M1 g# g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# C2 i$ m3 M b" S" K) L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# v+ f' y* V( x
- * TO CHANGE.
! C' P( T2 ]2 n& Y! i' {# `& V - ** N# u0 ~* `* a& P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. P& }6 |* V% [6 U8 b8 h
- *1 c3 m8 }- e3 ?7 I7 H; |
- * This program is free software; you can redistribute it and/or
[! @$ |2 F) u v) X - * modify it under the terms of the GNU General Public License as
0 o& i& }* m" T. _' s - * published by the Free Software Foundation version 2.$ A7 T" [, _+ `& u! J8 X+ ~1 P0 C6 [$ K
- *1 A. K( q+ G% R- O! i$ w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' q, t, F4 O4 L2 ?; I( F' g
- * kind, whether express or implied; without even the implied warranty
: f! B: r( R: p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. h* o1 j' }& B( Z3 _- Y) i( Y - * GNU General Public License for more details.- `% I. w5 e2 D( j
- */
) i# _* C( J4 X+ w
0 h/ ? m+ q. G q9 Z/ c; h- #include <linux/module.h>
7 [9 K+ }3 L& X; P6 d3 r - #include <linux/init.h>
5 J+ m8 _- A' b* P! b! e - #include <linux/errno.h>4 r0 w( O* k/ i
- #include <linux/types.h>" z, }0 N; C* A/ r8 F
- #include <linux/interrupt.h>/ p9 S1 [: x! G7 J. l
- #include <asm/io.h>
2 I) ~0 n$ h' T. A - #include <linux/moduleparam.h>8 Y) |1 ]" ` Y* x2 \9 e
- #include <linux/sysctl.h>
! A* d" `4 j# j- v/ X8 c4 \. t - #include <linux/mm.h>% l% s- w* I$ _6 ~, q& l% }
- #include <linux/dma-mapping.h>
$ H# n! B0 h* E+ h) h8 P
, k& r7 H' O& ^* O- Y6 s% I! u+ g$ ?- #include <mach/memory.h>
4 n4 G' A/ b) S" E& c - #include <mach/hardware.h>3 V) m: w) c/ W; l8 S+ }
- #include <mach/irqs.h>
- Z0 N6 M, v/ _ - #include <asm/hardware/edma.h>0 k7 z+ e' r/ k7 R4 M
- ' `( P7 M5 y% I' X
- #undef EDMA3_DEBUG6 u% y0 x l% u |+ K" C
- /*#define EDMA3_DEBUG*/# |5 E, m6 A" e0 u; w" u9 i& T
" z) z$ [3 G) L! O' A9 P/ [- #ifdef EDMA3_DEBUG
0 O8 G/ w8 V% ^7 k3 B0 J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" g! T* K, {5 X8 u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 J: E4 o" j/ V2 h( z! t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 v7 l/ I+ h% A% Z - #else4 N6 o" h7 q+ f# l% n& |
- #define DMA_PRINTK( x... )( V9 B. S( _5 N) V6 M1 J( L
- #define DMA_FN_IN
8 }; z2 K @& E1 \ - #define DMA_FN_OUT
3 Y% ?$ k- D& {1 p" {: k& ` - #endif% B+ h4 x$ d. E- N
& w. Q9 b& ?* M6 Z0 I1 h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# Y. b- d/ y: @" C& I ^, ~
- #define STATIC_SHIFT 3
' M' V# h6 a0 i: a - #define TCINTEN_SHIFT 207 Q0 {* Y- @$ M4 v6 b) E2 L. T' ?
- #define ITCINTEN_SHIFT 215 x8 }$ u* O5 m6 f# n9 c& d
- #define TCCHEN_SHIFT 224 o* _, u0 G; L& b" `# c
- #define ITCCHEN_SHIFT 23/ V7 D2 b: l& L
- : L, ]& C- \- _ M- y+ u
- static volatile int irqraised1 = 0;( d" D$ M8 k8 Q
- static volatile int irqraised2 = 0;
' s- n2 J; l( Y- ^ q! I
* S* B+ }; m. S! t! Y! q* p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& q) |" N5 [$ ~/ K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& {0 x: t, [5 E3 p2 N% y+ d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& d9 |% m5 V: O9 H* Y! H, W/ @
# l/ C( F" q3 w( H* w, m- dma_addr_t dmaphyssrc1 = 0;6 h7 ]/ n6 Y& e! G1 s% c1 N& J" h
- dma_addr_t dmaphyssrc2 = 0;
' {5 [( D8 {" u6 L9 h9 s - dma_addr_t dmaphysdest1 = 0;9 t8 A1 ^# S1 K8 Y4 U9 W" d
- dma_addr_t dmaphysdest2 = 0;5 `6 B* O5 U0 I3 {2 P
0 P2 p! P P4 O% e- char *dmabufsrc1 = NULL;: x! L- s& F/ D4 G- R
- char *dmabufsrc2 = NULL;8 h- O0 g; d8 Q% b" S# z% j& N
- char *dmabufdest1 = NULL;
; D! J7 Y+ n: G6 _ - char *dmabufdest2 = NULL;
$ ?% E; h0 n8 U1 @( m! [0 t( h
/ E0 {0 u3 I, c: I- static int acnt = 512;
0 b% e$ |! p1 n8 |, d6 X x - static int bcnt = 8;
+ T/ M- L& Z. ^& V7 H - static int ccnt = 8;0 Y" i) r6 x4 J& D8 ?: a
0 d2 A9 \6 U* C* c- module_param(acnt, int, S_IRUGO);
! ?, H+ {9 C0 @/ d- S& N6 W - module_param(bcnt, int, S_IRUGO);
9 B. b6 H& |! i7 C ]+ O; t/ A - module_param(ccnt, int, S_IRUGO);
复制代码 6 Y; l5 B: u. A3 z5 H- [
# ^4 S5 u; P5 i- ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 G! L# K5 I$ a0 s8 U7 e+ W6 t/ A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 S: X/ e: n: @. n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: \. L p& A1 ~/ t# v$ w* n4 d+ _7 i! Y
* {& L4 b& ~; U( a& r- y7 ] |
|