|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " [1 s7 h' s8 T/ P
- [code]EDMA sample test application+ W( |, C4 x* m2 c( D: r( P8 m8 n
- /*
* o0 V$ h3 I" M9 S) [ - * edma_test.c
6 [3 O/ v' o+ W2 J; C2 \ - *
# A0 r3 ~! p6 K- |* m# @( F - * brief EDMA3 Test Application' E, S- }! D! ^$ F2 I% h
- *3 E. q" t# }/ q+ z
- * This file contains EDMA3 Test code.
" X& z0 u+ V9 I - *
! F4 J( v1 R4 I6 _0 A# B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 v7 _7 @: o+ M4 P ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' ]3 V u" v7 G. i
- * TO CHANGE.+ x, i+ ^& s3 L; q1 |9 j: F+ i
- *
; m4 Q T2 z" a9 b* t8 m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 T. d+ c; Q- k/ v! p! p
- *
4 X, D+ R/ `6 S - * This program is free software; you can redistribute it and/or- P+ {9 K3 P+ A
- * modify it under the terms of the GNU General Public License as
! O+ `1 h; H3 E- d% G8 o2 J - * published by the Free Software Foundation version 2. y% S/ ` f# G$ M7 ]/ _' o
- *
" ~+ q% K* o; Z/ @ z2 |$ s; t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- a8 }! N; ?! w5 c4 d/ k+ g* T) \
- * kind, whether express or implied; without even the implied warranty& ^2 e v+ {% D5 s( }4 g9 c: C, v2 T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* X0 y- _5 C, s; X+ m _
- * GNU General Public License for more details.: O! o- V' H' k: p% U
- */: p" O n0 Q4 S" @# k( x
- 5 W/ g- j0 E6 }+ j9 U: @7 V9 s
- #include <linux/module.h>) ~8 n0 l6 Q0 r0 d
- #include <linux/init.h>8 q T5 ]) j p: d
- #include <linux/errno.h>
3 e9 F( H* K2 h% j/ m: g: w2 x; M* T - #include <linux/types.h>
) m8 f9 h9 Y/ k/ w8 e/ P - #include <linux/interrupt.h>7 \" ~6 N" n6 h& F. q4 W
- #include <asm/io.h>
+ h" z% l+ P w$ X - #include <linux/moduleparam.h>
p) b) R8 D, i2 H - #include <linux/sysctl.h>
$ Y/ T$ O7 S) q4 V& T - #include <linux/mm.h>; T" d* I0 ? {) q: {# x, E) M
- #include <linux/dma-mapping.h>3 V' V0 q, M9 T- t# [4 H
2 u" ~$ C3 N% j0 R) c: G# J- #include <mach/memory.h>% ~ X8 w+ m. g$ F% Z* w$ P
- #include <mach/hardware.h>0 ]! {1 }8 ~& J; s0 Z E8 H
- #include <mach/irqs.h>: N* H6 V; q8 w; C& I" i3 B; ]- v
- #include <asm/hardware/edma.h>
( x' \7 O- T+ |: e/ p I# K; Z
' m- E( A9 z5 h% q! f7 Z: c- #undef EDMA3_DEBUG7 ]5 f/ C# y& s0 f
- /*#define EDMA3_DEBUG*/% X Y6 E) Y4 o% ~: u" o4 T' U7 [
- $ v' U3 B/ g. e R
- #ifdef EDMA3_DEBUG
& f# s! P# s& d* x, g( ]. A7 M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# o# H8 ?) y* Y% {5 t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. a( i: h% g, C4 h' { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' E7 X/ J' q2 @9 S8 \# D
- #else
% C5 d- r& h* g6 |" U1 [ - #define DMA_PRINTK( x... )- Y, i+ m& K: D3 v; ]! C/ l
- #define DMA_FN_IN
' N* i1 m. [; D' D1 y+ I - #define DMA_FN_OUT
( r+ V% A+ K* U* x0 T/ k8 t6 o* z" L' n - #endif
" E$ Q, L& b e+ j$ T" s
( f" l8 T$ V& Z( y) K' A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ C$ K6 Q( G2 {: P8 X* I: y
- #define STATIC_SHIFT 3
9 }' w t! k' e. V3 f - #define TCINTEN_SHIFT 20
0 w0 v$ u+ _) d* @& E, w - #define ITCINTEN_SHIFT 21) h. s* S6 Q" U2 }1 {8 |0 r
- #define TCCHEN_SHIFT 22
* {8 V" B% p5 ]; V - #define ITCCHEN_SHIFT 23
q/ R: B) d1 C( x) m - , E8 Z9 [9 i* }$ S" c, m
- static volatile int irqraised1 = 0;
" o: L& P6 ]0 R8 X, X - static volatile int irqraised2 = 0; u. J' r; ^8 k$ x
- " X W$ H5 d5 J. ~) J6 Z- |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) d5 {7 n4 o" K. r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# W, i" h* m4 g& s) S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 |6 S5 Z' M3 m' _/ t; W' p
- r# j9 c4 S3 T6 v4 d y1 I: z- dma_addr_t dmaphyssrc1 = 0;9 o" f" G5 Q! g9 n- }5 F
- dma_addr_t dmaphyssrc2 = 0;
& N! ~+ _& \) V+ `/ P - dma_addr_t dmaphysdest1 = 0;2 R! F& A. u- L$ P/ n
- dma_addr_t dmaphysdest2 = 0;; b$ `5 @$ O0 @ i
- |. p9 ^& B/ x" O9 r
- char *dmabufsrc1 = NULL;3 j& S6 h; ?0 V+ N) |1 H+ A
- char *dmabufsrc2 = NULL;( y, W; x1 N F, q/ A
- char *dmabufdest1 = NULL;
9 g$ s) V; V. Y$ D; U3 h - char *dmabufdest2 = NULL;3 h* w! e2 X( q- Z
& U7 T( {* g; d c% I- static int acnt = 512;
8 t; N$ Q. Y6 ]' \8 \, J# ^ - static int bcnt = 8;
( p5 ~* B( B* P, r2 Q - static int ccnt = 8;) l: D0 b& \# _; }9 X# l' X
2 t$ q6 P l8 h/ W5 L( w. [" s5 z- module_param(acnt, int, S_IRUGO);: ~ z# Q- ~" z$ y3 `6 x: O! d) p
- module_param(bcnt, int, S_IRUGO);$ {5 ^# Z* l1 f2 O
- module_param(ccnt, int, S_IRUGO);
复制代码 # r3 I) e, [8 Z2 C$ F3 ^
' j! V$ v' i# I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& r/ S; F/ s% E6 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 ^+ ~# c9 o- I! F% _8 w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& |$ Q/ }" j, @9 M M' p# F ]( P
* i) }9 E# { U% d0 E1 \, n
|
|