|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 Y+ f# t4 _% V& D& {- [code]EDMA sample test application
/ Q( N1 [, _( m$ t3 n6 S" A - /*
3 H$ w! g& A7 i - * edma_test.c
+ \; H$ X% K2 A! ^& H/ ^ - *- c6 q, h+ w. R/ R/ Q
- * brief EDMA3 Test Application! C; @. g4 p( B8 `5 O) [
- *( L& v5 o8 a5 D# g- o. x" z
- * This file contains EDMA3 Test code. y5 \7 i1 Y7 l- d5 A9 z5 \4 N
- *
p, C! X; d6 H4 L8 r8 k, M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ @) m( X& C F* U, M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 `( l. z9 n: K- A( N6 C
- * TO CHANGE.
5 H+ `7 B( }# N3 L - *
0 W- Q! [2 _5 O- v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) U! u2 ]5 @/ \- K# y7 y/ a$ x
- *' c% _+ `; D2 }9 D. {& V2 ^( x- x
- * This program is free software; you can redistribute it and/or) d" Y2 b: w; Y0 m/ o' [
- * modify it under the terms of the GNU General Public License as0 w4 [! u: E! E4 @. \1 C! e0 h" t
- * published by the Free Software Foundation version 2.
& W7 b; ]6 B1 f$ \ - *
6 ^9 i2 P% O0 d$ p! B- S/ M; e5 X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ n7 I+ G2 v7 {3 J/ b - * kind, whether express or implied; without even the implied warranty
9 n6 h4 q% G R- {0 Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 p+ a1 A& l6 Q
- * GNU General Public License for more details.& _8 _% x& D. i* a
- */! Y% D% u+ g6 j
- + f+ Q& ~* w! }6 ?
- #include <linux/module.h>
. ]. I3 A- E) {0 H - #include <linux/init.h>
( C- x$ W3 x) k9 x4 l( j' u - #include <linux/errno.h>
1 o1 b2 k! j# b! c0 X4 A - #include <linux/types.h>
n7 A! m+ x; B' t - #include <linux/interrupt.h>
- N6 h: z0 x: W. s2 m. l) p; x- G1 j - #include <asm/io.h>) v: |$ l9 a/ }' \/ Q: W9 H
- #include <linux/moduleparam.h>( l k l x3 z( Z
- #include <linux/sysctl.h># j$ [8 J) w4 |' g; L& l
- #include <linux/mm.h>
+ u" u8 i6 a& A$ n - #include <linux/dma-mapping.h>, a5 L* r5 y* u i1 d7 F
# K* s* K; ?% T4 n3 j/ ?' o, i- z- #include <mach/memory.h>
% X! m, K" c" d) k# E3 Z' ]6 q - #include <mach/hardware.h>$ G* Q' k4 @: @" ^; f
- #include <mach/irqs.h>6 H5 p) M' I) [" b/ {
- #include <asm/hardware/edma.h>: \5 ^! D3 y0 ~
" \+ p1 Y2 v) L$ B- #undef EDMA3_DEBUG$ O; [; W' \3 [9 }8 N& g7 ?
- /*#define EDMA3_DEBUG*/+ K c% e# O# w( s7 S T* }! O
. s" i3 }* Z. h- #ifdef EDMA3_DEBUG( C2 D, r! I1 T" k* X/ I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 N* {& [ I* b: ^( K) k: `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( u: J: ~% o- h& S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 M: \, d% P# c+ h# G3 S" N9 Y
- #else, M: T3 @" a/ ]& ^- l# r# \
- #define DMA_PRINTK( x... )
+ R8 {' ~" f- A1 [0 z. g4 ? - #define DMA_FN_IN
( A# g8 E* ~5 d6 T6 I: Y* X# { - #define DMA_FN_OUT
) n5 p. {: M; W y5 p; B - #endif% W% [. O9 p) B. l
8 t0 Y8 L# k N( T' k+ Q# z! f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ ?7 Y; _8 h: ]; i% j' U J - #define STATIC_SHIFT 3
" i- ]7 m/ P8 \ - #define TCINTEN_SHIFT 20, R- e' e( Y& z, d9 A
- #define ITCINTEN_SHIFT 21
" T9 N- K2 ]1 ` - #define TCCHEN_SHIFT 22
8 ?' J1 m5 A$ U* z [7 z - #define ITCCHEN_SHIFT 23& N( R( ^; O9 {4 d
- , y7 V( f- l( Q' Y( S- m' a1 r
- static volatile int irqraised1 = 0; y/ D+ S* Y7 P
- static volatile int irqraised2 = 0;
/ [; j) ~; V- V% K - 5 S: R, y' D- h$ ^# ]4 \9 E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ~; \5 }8 U3 T) F" p! S5 y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( a) p( X5 [9 j% G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- X3 C0 G1 A( P( ~5 k g
- Q. K. \: J9 H% @: B. u4 ~3 X7 ]- dma_addr_t dmaphyssrc1 = 0;# [9 Y, \+ ?! D' Q% O' ~
- dma_addr_t dmaphyssrc2 = 0;; |) w) m/ _6 N# h2 k4 f
- dma_addr_t dmaphysdest1 = 0;
; k1 e- E; i2 m- C! T* X - dma_addr_t dmaphysdest2 = 0;4 }+ O- }% t' {1 t; K, E3 V
- / w. } A# N" e1 Y$ _ P
- char *dmabufsrc1 = NULL;. { Z' v6 l) `. m% B: K/ P
- char *dmabufsrc2 = NULL;
3 \; h/ w9 o+ ~ - char *dmabufdest1 = NULL;
: o0 \. A' s/ j5 }2 ?4 u- p - char *dmabufdest2 = NULL;! p0 ]9 I0 A! E2 |: Q4 ^
- ) I; M9 [9 r# u. f8 Y
- static int acnt = 512;
/ P# D/ G2 N. Y d - static int bcnt = 8;* {, j, U' v, z [) U" Z0 M9 j
- static int ccnt = 8;
& @9 U" u" x q$ K - , O/ A) y4 [' ?2 T4 M5 e( i
- module_param(acnt, int, S_IRUGO);
# [( `0 R. [5 K$ y - module_param(bcnt, int, S_IRUGO);4 ^& w6 J+ n6 v. @) X# Y! r
- module_param(ccnt, int, S_IRUGO);
复制代码
: e4 o/ w" j' V, L4 L3 U# n- B- M2 r2 a# @( A Y; A/ T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 F. g6 D# L5 [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 x! R3 u3 G. W+ h h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; u& R$ F1 C/ Z) B$ k: N' k8 p
, V0 D& D% p3 t8 A" f% ?
/ x; O7 r6 f' U4 u' l. X4 y
|
|