|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 y$ L, E9 k5 s) e3 B1 W' @- [code]EDMA sample test application$ I- g9 i: I3 K) w: _/ G' K0 u8 \
- /*" S' T) ]/ r6 Q$ I8 c) `' O2 a
- * edma_test.c
0 P; }9 I( y( q1 P3 ~ - *8 o0 x4 y/ i7 ?! v& F( G& z% @7 \
- * brief EDMA3 Test Application* |$ ?& u' {7 C( U
- *
2 j( z1 u. H ~, v - * This file contains EDMA3 Test code.
+ Y; [; C$ t2 `2 V - *! i L4 [* i/ y/ a2 I9 ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 Y, ~, \2 c( P7 K" D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 o; U' }$ h# \3 c5 p3 ^, E - * TO CHANGE.. e9 u. G) c Z) @2 _2 z
- *
2 w( J0 x( j( r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- ~+ x0 I* y7 K8 M. P; o- {" o) n: x - *
" k! n% P9 P* g z) X6 d" s' Y - * This program is free software; you can redistribute it and/or
* g8 ~1 L9 s6 ]1 M3 j$ c7 _! B - * modify it under the terms of the GNU General Public License as
6 i6 a1 `" Q% f6 ^; f# i- @ - * published by the Free Software Foundation version 2.8 @) a% O# Y. v* i
- *- G7 L: |/ a+ e5 v2 ?/ b( ], h: E6 p9 B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! _! G, |9 {5 G5 ?" G4 i
- * kind, whether express or implied; without even the implied warranty0 n; X% q7 A6 M; M4 a) A9 ]9 r3 z8 a( s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" b9 F7 Z9 ^8 B8 k( G' T, f& o
- * GNU General Public License for more details.
; c1 u9 l$ w( h - */
* g: E$ l7 q2 C! l( c
# ?. W5 M b v5 m! }2 y- #include <linux/module.h>
: ^; n" C- X+ t7 s8 m7 T - #include <linux/init.h>& c/ N: Z8 T+ _) ^* h
- #include <linux/errno.h>: ^3 h! ?2 M5 o* W
- #include <linux/types.h>
1 ~4 C0 Y: c4 | - #include <linux/interrupt.h> u( ?) \. v9 K0 M$ s1 P. d
- #include <asm/io.h>2 N* j& U9 G- A: }' v! i' y
- #include <linux/moduleparam.h>
5 P6 c1 F$ Z/ N: v% i - #include <linux/sysctl.h>
6 V! U7 P2 |8 ~, f" `& Z" ^$ k- b - #include <linux/mm.h>
: L/ [- ~$ B0 _& S$ }+ G( c2 S - #include <linux/dma-mapping.h>4 ]4 W% B; l$ Y
- * L6 u' U% i( p6 F6 @8 T
- #include <mach/memory.h>) a r4 {; o( b! d' ]& D$ m
- #include <mach/hardware.h>7 w0 p0 @) q* [" R! F& t& ], C3 z5 t4 v
- #include <mach/irqs.h>) z/ W3 i4 k/ R9 _
- #include <asm/hardware/edma.h>
7 [8 b9 j6 c6 e6 g ?
/ r, m+ D$ g0 {) d, f3 U6 k- #undef EDMA3_DEBUG
1 D( y; @" g+ ]7 X; ]; B4 w v - /*#define EDMA3_DEBUG*/% s2 H5 y) {) J0 a& @
; o, M5 A) h4 t1 k3 J) X7 f7 m- #ifdef EDMA3_DEBUG
/ V: d, x7 D5 S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& o, {. i: }0 v/ g& N3 \+ x3 ~# K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( x4 E0 p3 j5 ~- i0 K) j# |$ A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! S& }6 E7 q9 A - #else
' u, A3 n f, m, z& I. \) d9 ~ - #define DMA_PRINTK( x... )
3 e6 k* M% i8 i( e2 c - #define DMA_FN_IN- G/ ?( H& J3 y2 I `, ?
- #define DMA_FN_OUT
A3 Z7 |) I* [( o* \, y1 w/ ] - #endif1 s4 H4 d1 D7 U
- ! @) Q6 q% p3 e, I0 q- b" g5 C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* _( U1 y# y# c$ c- H/ z8 P m
- #define STATIC_SHIFT 3% F# U9 m+ }9 j7 P' m
- #define TCINTEN_SHIFT 205 B, ^6 r- t/ b8 J$ v7 p3 k# F
- #define ITCINTEN_SHIFT 21, M" E1 \8 H1 i4 g' a9 ]! c
- #define TCCHEN_SHIFT 228 C5 u, H( y2 q8 X ~" A' N
- #define ITCCHEN_SHIFT 23' w3 _/ \& K8 R& V1 N7 z) U/ B; s
- j- {, z" N( \% J1 k |5 O! D3 A- static volatile int irqraised1 = 0;& o) v9 d+ n' a9 N3 b2 r
- static volatile int irqraised2 = 0; I; b" j" k3 h5 b
- 9 h. T% a+ T, z' r: e( W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& n4 `% L9 X# |& j! e$ u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& Q; r$ Y6 E; ^) `5 v$ h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 T$ @3 k( j$ Z( i& z% ?
- 8 m3 ~4 P9 |8 e3 e2 j+ d5 L; o. V- Q
- dma_addr_t dmaphyssrc1 = 0;
- v* E' }1 E' a3 { J! [5 H3 ` - dma_addr_t dmaphyssrc2 = 0;' o5 u8 y) n' |
- dma_addr_t dmaphysdest1 = 0;8 M' @5 {; a$ s* a% R4 G
- dma_addr_t dmaphysdest2 = 0;( m( s# V( k6 a/ ~3 S1 ]# S
1 P! W6 f* z9 `- char *dmabufsrc1 = NULL;
8 c- ?7 A/ k- ~& m9 H+ | - char *dmabufsrc2 = NULL;; }! }8 S2 n; ~
- char *dmabufdest1 = NULL;
! H! N5 a, e+ a. R, h. G - char *dmabufdest2 = NULL;; K9 M. l m: \
0 N+ j$ ?: Y% D+ ?" V- static int acnt = 512;
2 n" @. P/ v9 g1 d - static int bcnt = 8;9 r8 ?6 ?3 @1 Y' X3 s( V" |0 Z
- static int ccnt = 8;
9 D+ Z& o5 k0 | N4 F- K0 M9 Y
1 V: F! K- ~1 R6 x) j- module_param(acnt, int, S_IRUGO);
6 w. @7 m7 s, L5 C' n( P+ H - module_param(bcnt, int, S_IRUGO);( L2 _8 l% l. B4 z
- module_param(ccnt, int, S_IRUGO);
复制代码 / s% k: b: @- k& y( V7 V2 N
% y. r/ u" u Q K) P% l' @. O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- F7 z4 @* ^2 x% k% n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' z+ n8 }& e2 f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( A4 x6 X5 Z3 a5 C$ P# k, x
( |9 ~$ N3 i9 C4 y) c4 w4 o' ^8 _, `3 M; k4 I' k. n. W( b
|
|