|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 @: `! X {! u- [code]EDMA sample test application
" |) `! m r' S- ]0 w) s2 B - /*, f3 f, c' W3 i; }3 y& F
- * edma_test.c
% z5 l9 J+ x5 L: m5 Y$ `0 F - */ M, X1 N5 M1 e
- * brief EDMA3 Test Application
8 P" n4 w; y) x, z - *
# a& ?1 ^- Q8 J% |# }6 X - * This file contains EDMA3 Test code.4 X! d5 `' \# _3 `# H
- *8 w) p9 }. N% ^0 G, R$ |3 m2 |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" L. b/ [7 f5 Z: H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* }; s$ g3 G g$ N2 E7 }
- * TO CHANGE.
0 b) k4 N7 t) d9 L9 Z R - * j, ]7 h0 K! O% G7 [- K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" w0 ^" P* ?$ G& Q1 F. w - *, L& a5 I2 @6 J. M
- * This program is free software; you can redistribute it and/or2 u& w( T: Q3 j7 I8 ^; l1 M* p
- * modify it under the terms of the GNU General Public License as
2 x" a: G2 c( @+ L, v - * published by the Free Software Foundation version 2.
! Z0 k8 z/ v; O/ r - *
: R1 g' C+ H! g3 h* y# P, x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ b5 R2 s U# N
- * kind, whether express or implied; without even the implied warranty" X" G$ `# }$ @, \6 K( x: a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( g7 Z% I5 N3 ~0 c' l
- * GNU General Public License for more details.$ r- }; G' A8 P- K7 A0 B8 q
- */* Z6 `7 x' Q+ Z1 U( p$ H" Q, j, H
- % | j( b# [4 g4 ^9 {/ r: N4 A% ]
- #include <linux/module.h>( o: Q1 k1 r1 Q) p. h }" i! I3 R
- #include <linux/init.h>4 s. t% T! b6 I% w/ _% D' z
- #include <linux/errno.h>7 w6 \2 e8 O, h5 j: C
- #include <linux/types.h>1 D7 N6 V! S& V/ `
- #include <linux/interrupt.h>
# K/ a) p/ o/ E3 b6 V7 Z - #include <asm/io.h>; P9 M7 I; t* v
- #include <linux/moduleparam.h>- m+ ~2 j s- `" H) U; x* d
- #include <linux/sysctl.h>
5 c5 {; T* y$ k0 [0 s5 A- ^1 U - #include <linux/mm.h>
x8 T: l: t( H; y- @1 O/ G& S" ` - #include <linux/dma-mapping.h>3 s! r% y& D! X) n; A9 C$ o
- * o/ L4 e! }0 x2 C+ g
- #include <mach/memory.h>
, o' ?7 a1 c! B) j: D/ b - #include <mach/hardware.h>! v6 t; f! ?% M2 b# {2 w3 ~; o6 `
- #include <mach/irqs.h>% _2 U$ a5 z4 S9 m
- #include <asm/hardware/edma.h># s a3 @& N A% L( C" n2 R
- $ j: ]) ^5 U( B' r! R. J( r8 e
- #undef EDMA3_DEBUG- D5 C. P7 o3 k& Q# t' U* J- X
- /*#define EDMA3_DEBUG*/' H2 x2 H$ E2 D# Q4 w
- 3 j& ^8 V+ d& ]: _
- #ifdef EDMA3_DEBUG
+ l/ c, D; ^+ w; Q- h7 R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 T- R$ K5 d: k# y- q4 [) ~% ]9 l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 k1 f8 s% {* k! j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 X7 l( R1 Q4 P$ W: c/ N - #else
0 t$ W: |6 v6 I* q, d - #define DMA_PRINTK( x... )
7 e: w& E" F) C) r! h - #define DMA_FN_IN$ L( R" R, A7 r* F4 {2 G: K
- #define DMA_FN_OUT
! @ d3 M1 ]% X& N - #endif
& d( p+ a# S' h0 m% W7 g# ~/ z
6 _: Z3 ?* R" w- #define MAX_DMA_TRANSFER_IN_BYTES (32768); O3 `* h3 G7 K
- #define STATIC_SHIFT 3) i5 ]" @0 x* S! y5 R
- #define TCINTEN_SHIFT 20
8 p- P( }1 o2 B4 F - #define ITCINTEN_SHIFT 215 ]% c( ~: o s6 w. n
- #define TCCHEN_SHIFT 22( I2 J. ?( e2 `$ D, J
- #define ITCCHEN_SHIFT 232 l- m2 Y, m$ d# T) U+ q
; T0 i/ q' T8 h5 V4 x3 m- static volatile int irqraised1 = 0;! w4 Z% X, {1 v6 R& `
- static volatile int irqraised2 = 0;
4 l7 J9 T* ]2 [& r- S# q - 6 e! y: |, i% d5 `3 C e# i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& m2 K. N' b# C X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ a( }% V: u/ h" Y1 s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- S4 G. t6 a! Y; [. P' M8 { - " A( P4 H9 [- C
- dma_addr_t dmaphyssrc1 = 0;
& g, N# P! |' i! R& y! P - dma_addr_t dmaphyssrc2 = 0;
) |2 H( E, m( N9 d- e8 D - dma_addr_t dmaphysdest1 = 0;
! ]: Q$ T* q4 a* l - dma_addr_t dmaphysdest2 = 0;; h* u+ L, N- Y3 e9 w6 K8 }! d$ I
& n0 x! B" \3 y0 G- char *dmabufsrc1 = NULL;
% o% }6 r7 x: L$ h) r- M% o - char *dmabufsrc2 = NULL;
& ?$ \ e% V6 i& R7 L: | - char *dmabufdest1 = NULL;/ _8 Y5 {6 m3 m4 |" r( O8 z
- char *dmabufdest2 = NULL;6 W% ~8 D% j& L: j [! w2 s
- ; b% u7 L+ D8 N1 k8 l
- static int acnt = 512;* _# y& A+ c" j/ P# g
- static int bcnt = 8;+ u4 ^% r7 `! d& e# Y
- static int ccnt = 8;+ \3 W u2 S5 k! `; d
+ o! ?- ` P, j) e: w% I( _- module_param(acnt, int, S_IRUGO);; _* S' a. q4 ?
- module_param(bcnt, int, S_IRUGO);
& O$ K3 B. ^) x6 ] - module_param(ccnt, int, S_IRUGO);
复制代码 5 P2 d3 j V" T- ~
9 Q" p4 e" ?- [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
b2 p3 a1 D6 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( G5 l7 t9 A. B l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 Z+ a! g* J4 a# r
# R! F( G: Y( B) W' m# x5 `; H/ Y/ _' i/ Q
|
|