|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. X1 L4 A5 D1 D# w4 B+ s- [code]EDMA sample test application
5 v9 M4 z; B$ s8 E. D' n - /*6 x4 T; I G9 Z& r; E `4 x; j
- * edma_test.c j( W- m# ^- |4 z: R( v2 I
- *
7 b+ x* Z% Z! u/ b/ w; s' |7 }$ z* W/ z, S - * brief EDMA3 Test Application
5 V$ N3 P9 g9 `% J4 h$ S - *
( s- p: n1 n* A0 l8 a - * This file contains EDMA3 Test code.
" O$ s: H* l" q& X/ |. u) X - *' N: @! {% v, Y# E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" b2 Y5 ^) F+ d8 ^) U6 v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 C! S, b% a5 O& F! i5 D5 X: w+ j - * TO CHANGE.
' ]6 k% w0 l# {7 }1 y4 u4 A - *
' W% s+ j0 ~1 z1 Y u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 p3 |' n7 `' ~8 w9 V0 z
- *
, k$ ^4 `8 |# t2 ?9 D - * This program is free software; you can redistribute it and/or, A3 ^+ j) W9 |+ ^# F3 \0 Q
- * modify it under the terms of the GNU General Public License as
2 m g3 `4 X. z1 Q - * published by the Free Software Foundation version 2.% W I0 n) O8 P; F9 ]! h( ^8 w8 f
- *% M/ c* z, |+ v9 ?0 E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 I3 {0 N& V# [, O' [3 n
- * kind, whether express or implied; without even the implied warranty
8 y- {1 d! [5 k; Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. D a1 x% _. F& @4 v/ x; a - * GNU General Public License for more details.
8 X& j- v2 p; i/ y9 e$ T$ |' L8 D - */
8 m* A( U$ h- p: } - $ T. M: q; j, `# `7 Q
- #include <linux/module.h>8 z# K) K! B& P7 y
- #include <linux/init.h>* @+ B i1 o- E1 M/ T# Q' ^
- #include <linux/errno.h>2 e! [. t5 M% E" M
- #include <linux/types.h>( t3 Q7 {5 P+ F
- #include <linux/interrupt.h>
% w3 }9 B! `/ |: d - #include <asm/io.h>" G- f1 I7 B& Y& U+ r6 ^
- #include <linux/moduleparam.h>" v4 P @4 |+ l, B4 X) {
- #include <linux/sysctl.h>
6 i: X+ i. X. b2 ?2 y: I# H - #include <linux/mm.h>. ?- G; Y) `6 f. P9 I2 m
- #include <linux/dma-mapping.h>
2 w8 Y9 M. w' C k7 m* t3 x - $ \0 G1 |& z- Y% l0 k0 ^
- #include <mach/memory.h>
. x( k1 [5 p8 m7 R8 `3 V' Z3 z - #include <mach/hardware.h>" |. j) b( Z+ g. r
- #include <mach/irqs.h>
1 d' z. ~% P$ | - #include <asm/hardware/edma.h>
/ j) o8 n1 P# b8 L6 Y0 W7 Y8 b - 7 S, o. p: Y& H8 \6 S R1 Z, @& k
- #undef EDMA3_DEBUG# \% e# K' r" w! J6 d. X6 d- o
- /*#define EDMA3_DEBUG*/
$ f0 i1 ~' t/ h) x5 r. `& ?
* B% ~6 p: P: t0 E) G0 {% Q- #ifdef EDMA3_DEBUG
. w6 W9 U6 q, R! W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); c( b p4 C# ]5 @. r% G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! M# s- V$ }) V0 A9 ]1 q& [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ c$ r) ^1 `) c0 G. D - #else2 N L1 i5 ^8 b( A0 @# A
- #define DMA_PRINTK( x... )0 Z# c' k+ x# j- e1 w0 O
- #define DMA_FN_IN# x! \& q5 P7 T# e
- #define DMA_FN_OUT) ^! n8 @% f" k$ |- o8 I9 q6 Z0 e
- #endif5 D' K9 E. r- {" O8 {* q
- 6 A) D# |* P7 V2 a. T9 O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 }. D( h9 l" G) o) S* f
- #define STATIC_SHIFT 3
7 C& m( h0 f+ j7 Q, q - #define TCINTEN_SHIFT 20
0 T9 G5 w- j8 S( e8 D/ W) ^+ ? - #define ITCINTEN_SHIFT 21
% P+ w0 B. M8 K2 m0 O8 y V8 a - #define TCCHEN_SHIFT 22' X& v5 J" A5 z9 c+ ]; C
- #define ITCCHEN_SHIFT 23( F6 C1 ]2 l6 U* R
- 8 J, C( k8 f3 F1 x
- static volatile int irqraised1 = 0;0 v9 v& \! l7 d/ c" M# ]3 Q
- static volatile int irqraised2 = 0;9 @1 U4 E9 m( A' U0 F5 v. c1 l
- & Z7 l% c" _7 t8 S2 D: F( a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: u. Y3 _7 d$ ~ ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. x" e V2 y7 u" B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ^, ]3 J) P2 S; J3 Q
- / J3 H% r! y' o n
- dma_addr_t dmaphyssrc1 = 0;
1 P) k1 H1 w! G0 h6 l9 Y2 P - dma_addr_t dmaphyssrc2 = 0;
# d0 G0 U9 U3 [& P2 i6 y; R - dma_addr_t dmaphysdest1 = 0;$ v. E" {6 s, a9 j" b
- dma_addr_t dmaphysdest2 = 0;7 q. S( G& i' S
- 0 i4 i7 {+ F4 V8 B
- char *dmabufsrc1 = NULL;& }, O7 c7 t, L
- char *dmabufsrc2 = NULL;( _& ?" ~9 i7 w' X/ E6 X
- char *dmabufdest1 = NULL;
4 n& W: E* N( a+ L9 }% z( ?. Z( X - char *dmabufdest2 = NULL;0 @! ]- O2 C- P
- 5 j5 A# F! F/ i' T+ t2 b! X" z
- static int acnt = 512;+ z9 e5 i; G3 g
- static int bcnt = 8;
4 M q# k, A9 A5 s& u: t1 m - static int ccnt = 8;
; q* N2 w$ c; L; t
. M/ i1 |' S, a8 `4 D- module_param(acnt, int, S_IRUGO);& a1 k& Q# x6 D6 Q; ^; Y
- module_param(bcnt, int, S_IRUGO);" g; T& K8 Y% s% g* D+ S. ~- y- _
- module_param(ccnt, int, S_IRUGO);
复制代码
, ]! {7 O7 K ?; o, n& N6 I" [9 h9 u8 Z3 e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: w t7 u4 D& Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 p+ s2 {9 E; x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 Y6 }6 b x' W: _9 e: c- H$ F3 B6 W& t3 _( s2 @; N
0 f4 |3 \2 S% g8 C( h) P. }( n
|
|