|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 s9 C" P g% ^4 S# Z
- [code]EDMA sample test application4 M* T* E$ Q0 o; Q0 ~* M$ o. E" H
- /*
( _/ K7 u4 H, T - * edma_test.c
& D' d/ ]7 g2 ~ - *
; S$ Y9 E9 Y, h* a - * brief EDMA3 Test Application* d$ ?. y# R' U# @
- *# I% _: C2 e N6 Q) C$ K
- * This file contains EDMA3 Test code.5 C1 S0 t8 C, z% _) V! r9 Z0 c5 |
- *
# T1 d- b& P/ |! l" w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, l H5 a) S. G7 `* `& n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 L6 {% Q6 ~4 O - * TO CHANGE./ B# G! J+ R) k. J& C1 j8 M9 {
- *# i4 z* Y( ]7 q7 b$ M6 A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 O0 {3 q9 l, k0 F% r9 @" c+ V - *& l" | N6 u) r, p$ I% t4 ^- C
- * This program is free software; you can redistribute it and/or
" b. Q" W/ l$ [, G, Z1 D, t - * modify it under the terms of the GNU General Public License as
~5 T5 P: |- O' Z9 d, X+ U - * published by the Free Software Foundation version 2.
7 K3 Y3 z% L) c6 G' R - *. b! g1 f4 f$ v8 I4 h1 w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& t% q5 ?7 Y: }& A" v, j
- * kind, whether express or implied; without even the implied warranty3 `- w, r0 Z" W4 J+ B! G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: y/ X6 {' V3 k, K- ?
- * GNU General Public License for more details.0 B# e* o" a( R8 l! p
- *// T+ y; P" E) E4 o4 C, z. X9 H
. s. j2 \, C$ m- X' j" g- #include <linux/module.h>
/ H: g9 p# Q! E& s - #include <linux/init.h>
: g; b1 U/ M8 p& Y5 n0 U - #include <linux/errno.h>, J6 C0 O9 F- `. \
- #include <linux/types.h>) b. }$ I9 b6 K, P4 O0 H# n! H$ H+ S
- #include <linux/interrupt.h>
0 w9 P0 I5 A: H W) E - #include <asm/io.h>* l+ ^9 |; I9 Z" w* i
- #include <linux/moduleparam.h>: j2 R- f) b$ R( B3 M
- #include <linux/sysctl.h>
$ [: ^. r8 m% A7 s* y4 q8 d - #include <linux/mm.h>
4 E- }1 u7 d F& _0 H) T( E - #include <linux/dma-mapping.h>
# y! Z2 z! c8 [/ S - & P, ]" M7 x; S, G# X& K
- #include <mach/memory.h>
: Z! g+ @; i# Y: F - #include <mach/hardware.h>: [" P& c: e( r
- #include <mach/irqs.h>
' d2 ^: V# g3 p7 d4 c1 |# X - #include <asm/hardware/edma.h>4 S, |9 u# r: Z. l U
- # m* C4 q0 r) M+ P% l
- #undef EDMA3_DEBUG/ h$ Y( }: @! s; f h2 }3 |
- /*#define EDMA3_DEBUG*/
9 g" y2 k% ^( [; T/ A - ' N/ C/ Y6 F @. h( C& p
- #ifdef EDMA3_DEBUG' i% ~! L4 x# |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) ? M2 C7 _) t+ w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: [) w+ |! L7 S2 @( u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 h6 Y8 ~6 _5 B/ K: A! ?
- #else) Q! `5 m/ M0 j% z2 q7 u6 `
- #define DMA_PRINTK( x... )
2 h R+ G' S3 s r - #define DMA_FN_IN
$ z! O8 B" b* \$ S( v - #define DMA_FN_OUT
( R/ p- x* `5 h+ s- X$ d - #endif
; E, [$ A3 `5 I9 \/ L( A
9 ?6 y8 B4 w& I, L1 v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! Y: i0 z, K( {9 B - #define STATIC_SHIFT 3
$ d- S; u2 p4 }5 D - #define TCINTEN_SHIFT 201 `* t8 q M4 P' o
- #define ITCINTEN_SHIFT 218 b$ P8 w) z& p: ]$ _( t+ _1 g! v
- #define TCCHEN_SHIFT 22% M0 @ p) M% d$ A
- #define ITCCHEN_SHIFT 23
& p; J }# F0 {: V" P: O9 k$ B5 S* e' L - # S- u- X2 Y/ N! O: v; u+ X
- static volatile int irqraised1 = 0;
4 |# R9 ]8 G7 ~1 H) T - static volatile int irqraised2 = 0;
! N1 J0 r' H/ P) r& K( V4 ^
+ j4 O( x& {9 B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 m, e) }) V2 h5 o; m# O+ l9 Y7 j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; X( z7 S/ K5 J d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( @8 W y Z1 N* i3 u1 c$ K
$ t0 c/ q4 ]1 Z1 q6 p- dma_addr_t dmaphyssrc1 = 0;% p1 u( U& b5 ?8 G! |
- dma_addr_t dmaphyssrc2 = 0;3 P4 Z# f; L E
- dma_addr_t dmaphysdest1 = 0;
) s: T$ b0 P- h) e - dma_addr_t dmaphysdest2 = 0;
! Z, Q! h4 q. E! I1 y$ ~ - : e' D+ T4 d3 s% v! v2 J
- char *dmabufsrc1 = NULL;2 _( ?6 g2 f/ {# F+ u
- char *dmabufsrc2 = NULL;: _1 c4 q" E# K
- char *dmabufdest1 = NULL;
1 _. o K% Y: F( _$ J - char *dmabufdest2 = NULL;
+ E% R1 z# b% p - 5 E" G6 y# ~/ |6 c) {" H$ F# n" w
- static int acnt = 512;2 R- W7 A) x& R; h1 p% |
- static int bcnt = 8;) K5 L1 V0 h. i. `4 o0 m" S3 |0 u& ^
- static int ccnt = 8;
6 S; R) Y o& k b9 m - - L( P( x5 h. W+ r
- module_param(acnt, int, S_IRUGO);
M! R6 Q, o% j1 W6 ^ - module_param(bcnt, int, S_IRUGO);
1 j% J- J# z) m* M4 B - module_param(ccnt, int, S_IRUGO);
复制代码 ! D1 z. ~, S3 V' A! T. z9 S8 H
% q% n8 f7 G) A' l" w' h b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 w9 p; b* O& p5 Q+ k4 t; h- j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
y0 z3 h1 D" O$ R; P0 v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 u; O' m$ M9 u) o- {4 g
7 N2 v: K8 r4 F) K
" C) _: n! Y" f0 l: _% ?4 ` |
|