|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ G7 P% m# A1 a5 @( s& t3 F4 P. Q' h
- [code]EDMA sample test application
$ d( H# ~. H" U% F - /*
" | ?; k# } N+ r0 A7 S - * edma_test.c& X( E. e/ Z% R! t4 M
- *- Q/ b7 N1 t7 n# G+ v
- * brief EDMA3 Test Application
( ?" y2 S( H* L3 f1 Z, q - *
" i. H$ q; E5 h8 ` - * This file contains EDMA3 Test code.
' b; |: ` u% w5 A6 M - *' ]/ D+ j# E- _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. c; ?5 w$ X3 R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- _ N$ F I1 j9 \2 M, x# D - * TO CHANGE.
. Q/ t O1 u `8 p8 [: P) |; ^$ o - *1 C) h2 c. v8 _% m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 x- A1 p. f( j3 d8 y
- *" W$ f5 V. c- V3 B
- * This program is free software; you can redistribute it and/or$ G8 [! \& N+ ^7 I( ^
- * modify it under the terms of the GNU General Public License as2 O6 B& u2 X4 j8 Z* Y
- * published by the Free Software Foundation version 2.7 b. Z% [6 ~' X' S8 \
- *
: J/ d' F M; M% ` t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) U) K& e% Q0 c0 w0 B& U2 Z- B - * kind, whether express or implied; without even the implied warranty0 H; b! N9 r1 @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 j, r1 B8 m0 ]: a, M" ^! R A
- * GNU General Public License for more details.
) L! U; G! n7 c6 S$ R - */
: A& i7 n/ J8 x6 W Y - * s0 Y9 G8 A2 O5 e" a$ }
- #include <linux/module.h>+ v1 o: u' B1 U5 }5 [$ t5 W
- #include <linux/init.h>
! L- H) s6 m1 V$ G# c8 ? - #include <linux/errno.h>
, K: F/ v- @; s9 c* C - #include <linux/types.h>3 t6 I+ b4 _$ y1 _# n/ `
- #include <linux/interrupt.h>
* r4 C8 ]9 s9 L' _6 A1 ]9 e' o8 x - #include <asm/io.h>& T- Q c% ?/ l; g
- #include <linux/moduleparam.h>$ Z) X3 r# g) o6 F2 g `2 e
- #include <linux/sysctl.h>
6 {# S6 y/ ~4 T1 I! ] - #include <linux/mm.h>- a" {5 i6 `4 O" m
- #include <linux/dma-mapping.h>6 o# Q8 m( R5 p: {
% r m5 n, @' I( M- #include <mach/memory.h>
. J( l9 t/ U0 y& `7 ` - #include <mach/hardware.h>
8 C! P1 K3 j; y; h5 ~% M" e" K; r - #include <mach/irqs.h>* a9 ~% {& C6 s- j
- #include <asm/hardware/edma.h>8 }3 q9 b2 d6 K. j+ {
* l. O/ d* v* n- #undef EDMA3_DEBUG
6 o0 X f" `5 v8 P0 P6 s0 r - /*#define EDMA3_DEBUG*/
7 N' V$ T) X+ i4 ~& ~
, i5 u, S% h+ ~8 M+ o6 S |- #ifdef EDMA3_DEBUG- \$ A7 C0 ^1 F, y2 D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 Z6 A0 p7 t5 N$ K$ Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 [. z/ x" o) g# @3 @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ t6 y' q& d d' @- V* E
- #else5 S2 i4 i+ x% R4 a5 F& K
- #define DMA_PRINTK( x... ) L0 y/ u8 m5 C! v: k! d5 R
- #define DMA_FN_IN
* B7 o0 f' R K1 s* m+ A* R - #define DMA_FN_OUT0 w% D% M: l- W" \: q
- #endif3 Y. g: F" q) I) h; W& \
- \( |7 A# N* P1 S* g. J( v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& a; T' Y( e* |+ f" J: n: r
- #define STATIC_SHIFT 3
: |" f4 E8 g+ R! G7 _) w - #define TCINTEN_SHIFT 20
1 w7 y, h0 |: Z, P# d - #define ITCINTEN_SHIFT 21
' B# D' B7 c* F" u - #define TCCHEN_SHIFT 22' w4 R8 _! G2 C5 K$ t7 x
- #define ITCCHEN_SHIFT 23
) V6 K) Q1 W4 g
: ^ t5 j( [* v7 o8 u/ D- static volatile int irqraised1 = 0;* n: k& l( H% F" n7 e% h' ?
- static volatile int irqraised2 = 0;
( W" B6 @) i$ F+ T
/ }# s/ I% V9 k4 y" [6 \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ O, }5 d) Y, m9 I9 s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! j: k# E- O6 v9 r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" S8 R9 E/ n" N$ y) c
0 G2 ?( g' f( J- dma_addr_t dmaphyssrc1 = 0;4 K: ^) j3 Y# p/ ~
- dma_addr_t dmaphyssrc2 = 0;( `; {: [5 Y8 [3 M; ]
- dma_addr_t dmaphysdest1 = 0;
: { x2 B& Y$ z! d - dma_addr_t dmaphysdest2 = 0;
# N7 W1 L. i* h8 a0 k
5 X! Y; G% W' R0 Q. V+ B! Y" `( O- char *dmabufsrc1 = NULL;
8 D+ T- w* |+ L" j- l+ O A - char *dmabufsrc2 = NULL;
% j" D# A+ e- N% q0 W6 [ - char *dmabufdest1 = NULL;. C( T4 V+ O7 g1 d
- char *dmabufdest2 = NULL;
8 V9 A* P3 M5 ~$ b3 c# z - 7 Y) V/ p2 F; k
- static int acnt = 512;6 b" |& O, p$ h* r' |4 V' |
- static int bcnt = 8;
2 {* q) q& T" D - static int ccnt = 8;$ s, W- ^+ {) `' k; d/ g ?) s0 s
) B7 u0 B7 W9 k4 _) T+ q- module_param(acnt, int, S_IRUGO);
. J2 K5 D2 [! Q - module_param(bcnt, int, S_IRUGO);
( r J3 A) ^$ [- o: g- q( k1 \ - module_param(ccnt, int, S_IRUGO);
复制代码
8 @3 M, [: [& K% u0 U) @; ^( j: ^+ Z! I. h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
D# v# G7 K8 \" E4 r; h1 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 J+ c( }2 u' q9 u) ?0 C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& r6 Y1 f9 w" ^8 D* B
+ \3 a- i* X+ j* q( M
7 |) L4 M% l4 }! W |
|