|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 R3 I" T9 k {. X6 @& a
- [code]EDMA sample test application" P6 b/ _/ _1 B: Z4 S) g
- /*3 [2 `' }+ b& @9 ?
- * edma_test.c, o0 M/ o: J/ W6 L' ?) d
- *
4 ^- K0 ]) J% r* y - * brief EDMA3 Test Application
D& T Y, O3 F- u" p - *
1 f9 q: z# }( P7 o' \ - * This file contains EDMA3 Test code.0 E5 _' j9 g: g- e" K
- *
# j% x9 H$ b/ m9 j# t9 W' [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" W$ c& {5 F" Q# P+ X( W- S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, A9 e. L. z' V0 y$ O& g4 v
- * TO CHANGE.
' Z% d7 L5 [1 _* d8 q$ b - *
8 q# d- I6 k0 N3 {- g P U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" b( L& O; h: H" I
- *" a+ K' [, B3 C) A. H
- * This program is free software; you can redistribute it and/or
5 [) w* R# O/ _* L8 P$ N - * modify it under the terms of the GNU General Public License as- x' c. }- }# c# K2 T) u
- * published by the Free Software Foundation version 2.* l$ k2 H' |3 Z0 _
- *0 c! q1 U) w1 |& B8 H3 \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- X" W1 n# M+ L: a( R; h+ M - * kind, whether express or implied; without even the implied warranty1 I2 c% W8 [2 i5 c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 \# ?9 j9 w0 E# O$ R& N9 E: [' ^% Y - * GNU General Public License for more details.
: b' r ^, h# v! c, t& o - */' d3 ] i8 s" A
- 8 i/ V" y0 p# x- q" J* a: F
- #include <linux/module.h>
: r2 j' j. W" A6 S/ x- ]5 m - #include <linux/init.h>4 M/ r' y) W7 M$ n- A
- #include <linux/errno.h>
. Z3 e( H2 f# g1 ~4 ~ G - #include <linux/types.h>! j: x9 k! B! J) O7 ^
- #include <linux/interrupt.h>& }* a8 k" l" K
- #include <asm/io.h>" D4 ]% O0 Q/ [* T: c
- #include <linux/moduleparam.h>
4 E) v: Q8 G5 x3 ]: T6 a - #include <linux/sysctl.h>
' l0 V6 z! ^. T, C, V - #include <linux/mm.h>
L8 E z' x' H; E - #include <linux/dma-mapping.h>1 o& G/ b& w' _* l/ r2 j# G
7 ~9 g0 R5 E( c8 u- E4 i- M- #include <mach/memory.h>9 w6 R' q4 T% v3 X, N/ d" n( \
- #include <mach/hardware.h>
& ^5 v# ?* |% R! A - #include <mach/irqs.h>) `, H! y+ |/ x. G& W: ~
- #include <asm/hardware/edma.h>7 V! e# S6 r' f! y. l1 Z
. U; e3 S8 D w4 j0 M- #undef EDMA3_DEBUG
1 u8 @- k: p+ ]/ b, m, V, X - /*#define EDMA3_DEBUG*/
; I, u! @# @0 _5 D1 w0 i2 _ - . Z" a8 s! ~( s
- #ifdef EDMA3_DEBUG
6 `5 u" }; q% W6 g& a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 d! w, h! C' f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& {: }: J' ]2 K% d! X0 m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ e' P" |* [1 ^0 R3 e - #else! U- b4 J! ]- e5 D. U) T
- #define DMA_PRINTK( x... )
" S) `: i4 E! J4 }5 q* F% O - #define DMA_FN_IN; k* x F$ h2 T, Z) w( Z
- #define DMA_FN_OUT* F! _4 h( u# G5 C
- #endif0 H k8 Y0 k4 r7 l, D2 A; W0 X; M$ _
& n& w- ?; s- m4 F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; d; Z7 x2 s$ g, m5 j6 L8 F6 S - #define STATIC_SHIFT 3& g( g1 r2 l% a! O( Y3 N, D
- #define TCINTEN_SHIFT 20
7 D* H: U* F8 x3 D - #define ITCINTEN_SHIFT 213 J3 w. M5 y: e3 \; F
- #define TCCHEN_SHIFT 22
/ S; ^7 Q' s+ J. }- f - #define ITCCHEN_SHIFT 23
9 X5 ]) n- y/ F# U# O
/ W2 C/ E4 v4 D) M# [, o" G# f- static volatile int irqraised1 = 0;
9 z: ?$ f* ]7 s/ {4 i. }" }2 m# V3 i - static volatile int irqraised2 = 0;+ }! y0 L4 n Y5 _, L
- # O2 W) f+ }* Y" x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% E: G1 R( @0 L3 ]% t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 J4 U/ V, P/ E' u7 X" s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* m& Z# S _, J% C
" J5 q- m. m, \- dma_addr_t dmaphyssrc1 = 0;
7 m( ~0 @( k4 r# u6 n: K- J( f - dma_addr_t dmaphyssrc2 = 0;% X) a0 ?) S, `2 p C! B/ W: D f
- dma_addr_t dmaphysdest1 = 0;
( b3 ]3 l' n$ q, h6 b - dma_addr_t dmaphysdest2 = 0;
# M! P) X( N% @3 E" e - / R$ i3 f* e1 u
- char *dmabufsrc1 = NULL;
( W: }+ i6 [+ C7 z - char *dmabufsrc2 = NULL;
, t w6 D% f. w7 V# o - char *dmabufdest1 = NULL;5 a2 {& m y7 q
- char *dmabufdest2 = NULL;
- i3 @: K+ F8 M0 e [
) a6 ~& K7 n) {6 O: s& P/ e& d- static int acnt = 512;
5 P' \3 A4 ]. ?) @. B - static int bcnt = 8;5 R& {- B; G% ^
- static int ccnt = 8;
4 w/ f' q7 \3 i$ l - . ?* q# ~. A2 Q9 f3 L" l2 j
- module_param(acnt, int, S_IRUGO);. a; Z8 A8 S4 G+ j
- module_param(bcnt, int, S_IRUGO);/ s: ?6 F2 T6 R8 d% i
- module_param(ccnt, int, S_IRUGO);
复制代码 $ i6 E: y: \) k/ h
: E& z R3 L2 X6 K% O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# M" h9 r2 \3 O" larm-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 }2 c$ V" t1 h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* ^% i' m( D2 y, L
' S8 p- X. o4 h0 G& l6 s' ^3 O: Q3 U' O( S, F
|
|