|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 {& _8 i: m1 A1 ?: u. T" G- [code]EDMA sample test application& Q% i- x& ?, h8 S! K, _
- /*
% c- X& [" l3 o* C6 q% s) E - * edma_test.c
! l4 v- F, L! W* I% T0 m" b$ A - *
& X( Y5 t2 |, r - * brief EDMA3 Test Application7 G9 A2 t4 f# e* }+ b3 m
- *
- J, ^* Z0 K, L3 {$ k7 d2 s8 f) J! ^ - * This file contains EDMA3 Test code.
1 ~" S" ^! c% M5 T - *
3 }2 ?4 O' Y5 d7 m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% U0 V+ V( n* j, [8 y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* [7 K2 S4 ?7 O* h( j
- * TO CHANGE./ v* P" z4 M& t9 X0 u r
- *1 w0 m; {$ x* C: F& k; Y! J. e
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* _0 S7 s# J9 b! ~2 [' \/ K6 {0 {
- *' \: L- a% C9 r/ G/ l
- * This program is free software; you can redistribute it and/or% [' K; w" G1 K) ^
- * modify it under the terms of the GNU General Public License as
; r7 N5 B6 a1 [# k Q9 B - * published by the Free Software Foundation version 2.
2 i. D# v S5 g - *
8 p7 i4 J* q: t, O! z) r% ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 Q* T' c0 ~, j# f* E4 r+ z$ i - * kind, whether express or implied; without even the implied warranty
- A: H; [3 C& `/ N* f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 _+ B. D! a( ~" B - * GNU General Public License for more details.( u8 {) `$ w$ X% o% o, ]
- */3 q1 H7 y" G! ^4 Y0 k$ r
, R4 _$ z+ E& M8 X7 F$ H7 A- #include <linux/module.h>
3 D: E/ i f1 t% K4 k4 j9 i - #include <linux/init.h>
, R2 e( d' |8 U; C - #include <linux/errno.h>
9 b8 c6 t; v# J/ N! K - #include <linux/types.h>1 K5 o- @8 G1 n7 \" L7 |8 G& n
- #include <linux/interrupt.h>1 m1 w7 U* X( }) Q, K# X
- #include <asm/io.h>( O7 T1 d; g% i# K
- #include <linux/moduleparam.h>
9 s# |. { |* X! o - #include <linux/sysctl.h>
) q4 g: m& Q/ D4 ] - #include <linux/mm.h>; v- V1 }3 y, J. d. K
- #include <linux/dma-mapping.h>6 ~/ O( d0 j/ d0 q5 ?
+ L7 n1 q0 a4 y: l- E" u- #include <mach/memory.h>
7 J; Q! p( x3 `1 {3 }: ` - #include <mach/hardware.h>$ d w( K1 ]) C7 Y* _& ?2 J
- #include <mach/irqs.h>
/ x; W. L, E' f9 q8 r - #include <asm/hardware/edma.h>
& b2 Z! n6 ~ c V
0 P! c1 N3 T9 o# d; q- #undef EDMA3_DEBUG- g6 l& u% _1 v1 Q% H( d. z/ ~4 H
- /*#define EDMA3_DEBUG*/
+ ]9 R1 q; G6 _' J9 K - ! J4 b' _" s/ V, C1 b) k% ?
- #ifdef EDMA3_DEBUG
$ r9 z( F) j/ f- W/ h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" G3 N! E) `% x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' h, u( i, {; p& U6 r t( R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ p8 a' g# A# d% F+ a/ k$ K
- #else& F' S! b3 s" H- {1 a+ M4 R
- #define DMA_PRINTK( x... )
9 t" S5 m, h2 {& }$ ^6 p/ O - #define DMA_FN_IN( f, J+ T2 W# `' a- S! H! w
- #define DMA_FN_OUT0 J$ ^4 v( y U' v5 v% t. [
- #endif6 Q' F5 F6 {; I' _4 E0 f( [/ _4 _
6 Y; t% [' t0 c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 ^5 h2 u8 X# a
- #define STATIC_SHIFT 3
! ?8 z" a3 ~9 {# F- Z2 ^, t - #define TCINTEN_SHIFT 20
+ O$ g6 z5 A. J6 m) }" E; P - #define ITCINTEN_SHIFT 21
4 O- {: |3 O* P - #define TCCHEN_SHIFT 228 q# V& _* e( x# |
- #define ITCCHEN_SHIFT 23; g4 [$ X( r# `6 r& @5 Q5 B
- # J6 k: g# y' l/ Q
- static volatile int irqraised1 = 0;% k9 K7 G, `6 p p! _ r
- static volatile int irqraised2 = 0;
/ ]. P- f: d |/ w - 7 E! X+ } Y4 q7 N; S# E$ O2 R l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 U+ u) E$ T2 t6 q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ q+ D$ x8 a+ e# Z( m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 V* O: S" q- C. h/ C
! r& j7 W# ^" J" o j- dma_addr_t dmaphyssrc1 = 0;
1 A! f1 J9 {% E. v8 m0 z - dma_addr_t dmaphyssrc2 = 0;
$ x4 ~3 ?# O" v3 T* C, K9 ` - dma_addr_t dmaphysdest1 = 0;
9 R+ d7 N) r: @' ?8 D N$ U - dma_addr_t dmaphysdest2 = 0;5 T9 n; y3 [! E% f" c
- : A! {1 E4 y8 l2 E% j( E( k
- char *dmabufsrc1 = NULL;0 m5 e- _2 }" c* a5 B; C4 l
- char *dmabufsrc2 = NULL;) i3 _2 o B3 w/ o* z
- char *dmabufdest1 = NULL;6 m# U" P7 U$ ?" K7 [# B' R5 t( F
- char *dmabufdest2 = NULL;
: D* |8 O( k+ v- P6 c" B$ y6 x$ U, C5 { - " X" D9 v4 [6 [9 o
- static int acnt = 512;. }: N" T+ T/ t
- static int bcnt = 8;+ w/ j8 |& [2 P$ q' D' N6 s8 v
- static int ccnt = 8;
8 {' K2 h6 M" O5 Y1 e
5 o3 |2 W+ H& c8 A# R2 {- module_param(acnt, int, S_IRUGO);
# N& J+ Y& N3 Z' ?( U; g8 P - module_param(bcnt, int, S_IRUGO);8 T. P% q, i! w
- module_param(ccnt, int, S_IRUGO);
复制代码 ! W! W( s3 {( L( n( E1 o& b, C
% |2 M7 U. O& |9 U) K$ ^' J6 o; O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& a2 R% t* `* L6 j, G# farm-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 W. ~4 D+ v* U5 @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 Z% c# ^3 a w$ y% Y
* G. x4 o: @- \( c5 _, [5 ^
; K! s2 L7 `- p6 U* L$ o
|
|