|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 `6 s% ?7 q+ Y( k; [! e0 A
- [code]EDMA sample test application" T/ J8 o; N3 O* c2 W
- /*
! W, p4 M. i+ r9 P - * edma_test.c
: K+ {9 v& A0 f7 q8 k) {' I/ P0 J - *" C( n8 G$ z" P) I7 x
- * brief EDMA3 Test Application4 p/ B/ ]( G0 g* w$ S
- *: }% @ U3 f, W$ {- r& D8 b
- * This file contains EDMA3 Test code.
1 r! {/ A0 z6 M9 O9 S# H5 H) ? - *
9 Y% E' \# j/ q: x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 `. Z9 |% @2 p. `# P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ f7 h1 q4 v- {/ T2 T3 A
- * TO CHANGE.
! H7 {- L/ x9 @0 l - *
) r! G5 _8 \9 S0 y& N* {) U' B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) `( V3 z; ? r# o - *- m- R+ }3 T$ H2 t4 K: }/ R+ F
- * This program is free software; you can redistribute it and/or& u$ a9 |% k/ V' X a' h
- * modify it under the terms of the GNU General Public License as
" C# u9 Q: o* Q - * published by the Free Software Foundation version 2.; u; |/ B4 N7 m, ~3 R; L+ g
- *
, A. R; B; C) Z M6 o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% R6 j: T; g! Z/ s5 }# w! Q' h4 l' Y - * kind, whether express or implied; without even the implied warranty
2 C e/ z. ]% \# X. N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 W4 ]/ O6 }- B" I - * GNU General Public License for more details.2 m J9 E' m* L) S
- */
0 m2 l, x3 O1 S% c - 3 n1 \) l3 c/ e8 p" o p1 A' e
- #include <linux/module.h>1 W: ?8 k# l q$ l" }
- #include <linux/init.h>+ q6 w& O4 t9 I; [4 u% s7 W: n) }2 w
- #include <linux/errno.h>
$ J3 o3 P: Q6 c3 X, p - #include <linux/types.h>* c& V6 B! Z) E1 G1 ` [# X9 Q
- #include <linux/interrupt.h>
) J$ @% L6 c* a5 x: V& [ - #include <asm/io.h>" f. `% d# I4 X$ t
- #include <linux/moduleparam.h>
( _; g$ Z/ p# A3 c, f - #include <linux/sysctl.h>4 f' `+ y! @9 o
- #include <linux/mm.h>
% J! U5 ]- b2 ~; n5 @9 W3 p4 @ - #include <linux/dma-mapping.h># V% k9 `$ T+ S5 P5 O0 m- E' }
+ H" N# i( O' j' _% Y' T- #include <mach/memory.h>/ N* a. D2 K" |0 N2 t2 ^
- #include <mach/hardware.h>
) a7 W4 ~$ g/ i% @ - #include <mach/irqs.h>
: E5 z. m/ r. w) U5 \( H+ @ - #include <asm/hardware/edma.h># @1 r, X( u- Q* _9 L6 J' R
+ ^2 v% D4 W5 r- n$ ~- #undef EDMA3_DEBUG9 F' L2 I1 b. \: b6 M0 c& V# j% d
- /*#define EDMA3_DEBUG*/- V9 W+ e1 ~; m3 i- v
- t2 h, ?2 |5 r9 k" c' h4 E! c6 h( H" r
- #ifdef EDMA3_DEBUG
1 J* c- R! P1 f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 ^' ^2 P0 f2 l3 I _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); K% H# u( S- J# |1 h- X3 Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 M1 r! L% B2 w( _* D5 h# D6 O( s - #else+ [) ~, E' b/ k8 P
- #define DMA_PRINTK( x... )
7 n# I1 X/ S! N) J1 R* K - #define DMA_FN_IN5 g8 n* [# I( ^# l6 l" n; i
- #define DMA_FN_OUT
% |0 w! e1 W$ a/ z - #endif
) s: D r9 x6 O. ?9 U2 O - % s/ K* _1 ?0 y& S8 O4 ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 h7 \4 l9 y. U8 C" {/ @" ` O - #define STATIC_SHIFT 30 j& o' V* b3 N# ^1 r, F. r- p
- #define TCINTEN_SHIFT 207 Q: g2 Q, Q. v" L+ G0 [, o+ c
- #define ITCINTEN_SHIFT 21
9 |+ i$ |* o8 M% r3 a+ N - #define TCCHEN_SHIFT 22
* Y( ?! T5 ?- `+ W - #define ITCCHEN_SHIFT 231 L* ~' x3 o- J2 h$ Y3 C5 g
- 2 U8 }, E5 d" h; X- @% B
- static volatile int irqraised1 = 0;
6 W2 {3 \, b# T( O) y - static volatile int irqraised2 = 0;- g) h6 G. d! Q! U9 v) M' s$ J
' h" @- t# c) o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; p; o( W! Y& W. |* u9 d( D1 H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# r( |4 R% {' y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 g5 c5 b& Y- ?* ?- g
( p# Z9 C9 {$ W9 n3 ~- dma_addr_t dmaphyssrc1 = 0;# o, \: f6 P2 q" T+ {% _4 O! `9 b# [
- dma_addr_t dmaphyssrc2 = 0;* V% V* P( [. B& O& }! U# f) T
- dma_addr_t dmaphysdest1 = 0;- d4 |# t4 G2 t% h N6 @3 U. R+ i' N/ `
- dma_addr_t dmaphysdest2 = 0;: K6 T7 k- F5 @1 S8 ?
( S: ~5 y( G! ]+ L, r3 t- char *dmabufsrc1 = NULL;. R; M) |" w9 ?' b7 R% X
- char *dmabufsrc2 = NULL;' ~1 x6 b# j/ T g. B
- char *dmabufdest1 = NULL;" r/ b$ q. W5 l/ }3 p; C- Y+ @0 k
- char *dmabufdest2 = NULL;# Y% i, m+ d" a' w8 y
- , L( o7 U( x+ b
- static int acnt = 512;; S, ^# ~+ ^/ o4 J/ d3 x z
- static int bcnt = 8;1 z, N9 e7 w5 P6 F" c) ^
- static int ccnt = 8;
$ j) k7 s, _9 L& \6 ? - 0 c6 R3 v: x$ ~* U5 u/ |
- module_param(acnt, int, S_IRUGO);7 z1 F6 v7 B5 s' H. k
- module_param(bcnt, int, S_IRUGO);
3 U# s7 v) @! p3 P - module_param(ccnt, int, S_IRUGO);
复制代码 * [+ c- d( r9 B$ t2 m
% x! k; i( M5 z& h* ]+ g9 |# T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 Y! i; i ?7 I: J1 Y/ harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 l7 M- P* O- P, ~0 D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 R2 \7 K( y; N1 C- \9 c5 q' @( Y
1 ~, o8 D# J& v9 h3 G1 s7 q# u' P2 G: r$ Y6 F
|
|