|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) j) T; p4 N9 [$ k1 ~8 h- [code]EDMA sample test application
& u' J' |# ~5 R+ H0 d1 x) g9 K4 ] - /*3 M; Z$ ^8 Y+ M1 M( `; Y
- * edma_test.c
% {0 A8 r0 x: K* i1 [, M3 P2 M - *
& W6 T% y: L; \( b - * brief EDMA3 Test Application
3 H) t8 ?8 H% o9 f' e# q - *
$ \- Y& B% z, B7 B# N" p/ w - * This file contains EDMA3 Test code.9 _) J& m4 U$ o4 \& O5 ]$ K9 t' e
- *
* U! M" ^& g% V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 M8 R! H2 j7 F0 R, L* c% q/ b0 H. w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! B, H& I/ ?6 c - * TO CHANGE.% `$ ^6 C0 s/ _: }9 Z
- *
) ]! y) ` b) L! A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 X! K# n% @& P" ~: C( n - *
" I- B6 c6 ^; _- m9 z% V$ ?2 Y - * This program is free software; you can redistribute it and/or$ {- \3 n) d- [( P
- * modify it under the terms of the GNU General Public License as
4 E/ G' V* l5 f! ~0 s/ n - * published by the Free Software Foundation version 2.
" @' g8 q p, N7 H9 y8 I - *
8 \6 w& [7 b' }3 D/ q( a5 K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; y% P/ K% R2 l' A7 x8 J - * kind, whether express or implied; without even the implied warranty% E; @4 N3 \" z6 R5 l# E$ L9 m4 j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, _( \" R, Z9 [. G6 ~9 Y
- * GNU General Public License for more details.
6 u7 R0 }+ A6 ~" `8 N. P) c& @ - */4 Z: f* Y- R( ~# i; O" @# ?
- $ O/ h4 v- y E3 h: ~: K! S# M
- #include <linux/module.h>
$ Z7 S. y: N4 }) T# n, c& v - #include <linux/init.h>: _) k1 m( A4 ^. M- B- s9 z8 a
- #include <linux/errno.h>+ ~+ |/ y: f& z8 A2 V# A9 Q
- #include <linux/types.h>
! Q8 |9 T9 \) R* {; @8 z+ d - #include <linux/interrupt.h>% ]. t6 L5 Y9 }- }
- #include <asm/io.h>' A0 D4 D, F0 z+ N$ V
- #include <linux/moduleparam.h>4 N9 X4 \+ p5 c# P* `* S
- #include <linux/sysctl.h>
" M! r, Q8 V0 o - #include <linux/mm.h>
- N' }8 S# J4 m& |) w! n* E/ h - #include <linux/dma-mapping.h>
, X/ `! L" z% [$ ]' D0 x* ]3 x7 ^" n
2 \+ [. \4 {2 e" s7 F! G- #include <mach/memory.h>9 l; Y* E* c8 W0 m9 N- O
- #include <mach/hardware.h>& s! K; d- }' | Y! K
- #include <mach/irqs.h>; r9 [+ y4 C: g, P
- #include <asm/hardware/edma.h>9 b/ g3 m# m4 l- p2 P
' V- A$ s7 R0 p6 n3 i- #undef EDMA3_DEBUG1 {' ]' x7 g, y" J; v) o+ Y
- /*#define EDMA3_DEBUG*/
; T1 U& _+ f7 C. n2 w4 n
1 `! ~: _+ ^- T9 c1 G |9 p- #ifdef EDMA3_DEBUG
* i& h9 g) _( V0 n- ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 u- Z+ `/ x2 ], L- X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 w, D. g" ]* w# I2 M+ c2 m0 U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( `+ w% W; H* j7 g
- #else
2 L6 ^& K5 E0 ~3 `6 c# ^5 @( { - #define DMA_PRINTK( x... )9 I6 e- a; i( A6 T7 D& v% r$ |9 V
- #define DMA_FN_IN9 {# l4 \" T. ]2 n$ e2 e, B ]+ E
- #define DMA_FN_OUT
' M( L& }; u6 e - #endif
% T: ^: k# I. e3 q1 { - # ?2 l( w: ^( v: z2 P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- Y" _4 Z& i4 F! b! `* I# A
- #define STATIC_SHIFT 30 v: e& Q# O. A; d
- #define TCINTEN_SHIFT 20
* A7 x. B! d }5 J6 p - #define ITCINTEN_SHIFT 21 ^7 m: N) q$ l9 P8 a% K, u
- #define TCCHEN_SHIFT 22
0 s! m( f* Q. U/ Z3 B - #define ITCCHEN_SHIFT 23
0 c1 l+ S" R- q) p - 6 R* _ V" R4 K5 n
- static volatile int irqraised1 = 0;
4 `- b: t' w4 Z j5 G - static volatile int irqraised2 = 0;
6 Q$ @8 e3 e: {- S. Z - # e/ a! t, P( P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ S8 p% C* n" f& r- C' m6 s b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( \8 p& c& j9 w0 T3 x0 o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, N! E% c0 i6 {/ x' w0 N6 I4 E
- y# s+ r4 `; i9 i5 {( i: T) f% s- dma_addr_t dmaphyssrc1 = 0;
% V/ K7 G. l ]0 k5 T6 e) \ - dma_addr_t dmaphyssrc2 = 0;2 ~5 L, D9 V( l! V
- dma_addr_t dmaphysdest1 = 0;
7 ?2 j& t3 o1 d" L - dma_addr_t dmaphysdest2 = 0;
$ {) k/ u6 h* I7 C2 E6 I - / @3 S" V( j- c' C( A
- char *dmabufsrc1 = NULL;
! I/ t! [. D% Q6 k A7 ^ - char *dmabufsrc2 = NULL;5 V7 x- g" {7 F- k+ Z
- char *dmabufdest1 = NULL;
6 \+ \9 g: Y( X4 i+ D, i' r - char *dmabufdest2 = NULL;) _, q# x: H( ]4 V
- 3 B; |! M& o. K
- static int acnt = 512;
# q0 y- B7 v, F: a+ D- R/ k - static int bcnt = 8;
( O' a7 Y$ Q% m - static int ccnt = 8;
& @: ?) o! m8 y& P: P/ y9 ?1 X
/ {) {2 I W: j- module_param(acnt, int, S_IRUGO);
5 z/ M" o% r1 c - module_param(bcnt, int, S_IRUGO);
) m4 N, q- f7 ?! M! D - module_param(ccnt, int, S_IRUGO);
复制代码
' \8 F' |% J: y# S
1 |+ v6 d- ^1 J# y( e- K& l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! c8 X$ L: n, P3 U6 o; ^& D9 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; X+ ?5 {; R& d; E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- V2 x4 U1 `; X+ x4 i$ N0 M% }
: e# W* e7 J/ k. x: z X; B0 u6 x; O; \+ {4 b
|
|