|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! l" V6 t) j6 r9 F4 ?; D" h
- [code]EDMA sample test application
2 q' e4 h9 w6 K I; a8 Y4 r - /*
/ g# J1 u' f9 b- i( {/ H3 e# | - * edma_test.c' j0 M; [ B) @* ]# G6 H
- *
1 K1 @$ Z$ b# L$ T' m - * brief EDMA3 Test Application
' O% q! S. F2 D8 @- O7 \, J9 K - *
/ e/ r+ Q F6 ? - * This file contains EDMA3 Test code.
- i+ } X; Y- r* g9 y9 n3 F2 L - *7 j: P7 U) B, ?' V$ C$ G, j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% g7 ?: R" C( G9 K' v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 d* _( D6 H6 i ] - * TO CHANGE.8 U) u6 G* q6 D
- *
: @! a, u& r3 X$ S& S8 {( \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% @3 g* }! T4 b% R1 a
- *
- @2 X- O2 b4 M. A' p4 | w& t - * This program is free software; you can redistribute it and/or \, U5 v; Z' f$ G6 i
- * modify it under the terms of the GNU General Public License as
0 c- g7 E$ m( P, Z6 e2 t - * published by the Free Software Foundation version 2.
; K- u, c3 r7 n! X6 |5 X9 E+ a- e - *
: k) R3 q9 w) {. @# Z t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 u9 M, u, X! a1 O0 I; [1 C
- * kind, whether express or implied; without even the implied warranty
8 Z e8 V: y/ v+ a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 h+ s+ L3 \+ b. [$ |
- * GNU General Public License for more details., R0 K6 b# w: E6 e0 {
- */
`! @; B+ \: Q7 Y - ' y& ~1 I- P8 Y" E$ E, g
- #include <linux/module.h>
& s3 m, p, H' ? Y/ c2 e7 h9 M - #include <linux/init.h>
8 ?8 s \) ^' d5 K+ a3 _. z - #include <linux/errno.h>& s$ L9 g1 K# A
- #include <linux/types.h>" g& v# Q+ O' t* D
- #include <linux/interrupt.h>
9 G0 V' Q' e! Y( U* _ - #include <asm/io.h>
5 C Q; o' p, G. h - #include <linux/moduleparam.h>
4 U1 S. E" c- R6 g - #include <linux/sysctl.h>
- a: K# y/ F3 ` - #include <linux/mm.h>
% q0 R1 R% v" w# d4 a& H" A& \ - #include <linux/dma-mapping.h>, A" L' u6 x# r" f1 Z8 k
7 D1 A+ L5 z9 U) [% S3 Q/ \8 o- #include <mach/memory.h>$ b! {# z5 S% p' c) c
- #include <mach/hardware.h>& c! t6 A2 c" h& Z! h* |% V
- #include <mach/irqs.h>) b( ?* o( O! W) n: P: n
- #include <asm/hardware/edma.h>
9 Z. }3 {- h6 u& Z0 l
2 I& I7 j7 \1 {3 e0 \0 N+ N- #undef EDMA3_DEBUG
& r4 n u/ C, b1 ^5 U - /*#define EDMA3_DEBUG*/' Q) W* \, }. a& u% L
$ y" J R6 K2 J/ I- #ifdef EDMA3_DEBUG
7 Q" `/ F A" A6 n% S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* f6 z; x! C4 d) r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# M/ R G! u# d) q: R% f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 Q- Q' T8 h3 Y4 s - #else* m/ v [. p7 y, T' W! {
- #define DMA_PRINTK( x... )
- _4 C3 z+ z9 E( r: Z - #define DMA_FN_IN
; p9 C8 }7 A3 C& _# R/ e: S2 ^7 b - #define DMA_FN_OUT
* Q; O$ I7 p6 R; Q) g/ M+ }, m; R - #endif1 U K8 t$ J: ?2 N3 \
- % j' ?- |8 x: W. z5 |. z1 s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" h. a/ f& w P, r6 b - #define STATIC_SHIFT 3
, V3 e# V1 q* x - #define TCINTEN_SHIFT 20
' _) r" }6 }, h8 |# f4 `7 l" t - #define ITCINTEN_SHIFT 21
; f* ?/ }/ E& x5 s+ X: Q7 | - #define TCCHEN_SHIFT 22
) W0 z6 k+ L( I' O2 H - #define ITCCHEN_SHIFT 23! k O7 Z: I* e. M! v
- 5 c% e# v0 E, ~' S9 a- A# F
- static volatile int irqraised1 = 0;
9 ]4 h. V5 ~9 t/ Q: Z8 H - static volatile int irqraised2 = 0;
A& Y' V5 Q% G" o1 i/ u - / y, s- L5 h9 h& h+ c# [+ m# e5 t0 G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% ~# c. c0 `; D$ U0 s V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 _0 b( y! c1 ^" L" d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ g% s+ D) i0 v8 Z
3 ^9 r2 W' s. @, d8 V. E- dma_addr_t dmaphyssrc1 = 0;3 x# h/ K' c7 k8 P
- dma_addr_t dmaphyssrc2 = 0;
$ p! S0 k& @( q1 L, K% q - dma_addr_t dmaphysdest1 = 0;: \' Y8 b# c% F; ^ n; o; x
- dma_addr_t dmaphysdest2 = 0;
- j$ m- l4 a9 A, P L0 k' S - 4 o% R: l/ ^& v) a# r0 c
- char *dmabufsrc1 = NULL;
. e2 ~% N5 k' u- T. |( {: ]" A, \ - char *dmabufsrc2 = NULL;
# k5 V2 |+ K6 T& a* W1 S" J - char *dmabufdest1 = NULL;# l$ O2 Y0 W5 b) R$ L
- char *dmabufdest2 = NULL;. M' y; V1 l' |: a* e# X
+ _; Z* }; ]; H4 a" D) Z( C3 `1 s1 i5 V- static int acnt = 512;0 w/ n1 p9 v% G- v) I6 b
- static int bcnt = 8;+ t) t4 v/ o; _% @
- static int ccnt = 8;
3 I+ k' v# d$ r F* H$ o8 F - 4 e6 O8 H' r6 \$ d6 { {6 y G
- module_param(acnt, int, S_IRUGO);% @) T8 O+ t J, B I/ w L p
- module_param(bcnt, int, S_IRUGO);
* Q" r8 k3 C9 _( o+ W5 ~ - module_param(ccnt, int, S_IRUGO);
复制代码 ) H( v0 t& M7 T: b
; V0 g' l: a' z+ n$ y( i+ e& c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 t8 D1 T1 c7 l# v% f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 n2 X( T0 M8 B. D+ j' m- x/ _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 C3 x2 {3 J! g) X$ i }% F3 T0 L
) G) J& m; A" ^ ]
: m# o& C, b6 D |
|