|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 _4 k" t, f' `' E! ^6 I- [code]EDMA sample test application
, E1 d, V! |6 E. S. O - /*5 @! q- Q, e# p- X/ E
- * edma_test.c9 O1 a( |# _# m4 \4 ^0 X; p
- *
2 S V6 p5 u: @9 x" f - * brief EDMA3 Test Application6 O/ J6 ?9 [1 X. T- A0 |
- *
( v7 W5 H" j* g+ j) t - * This file contains EDMA3 Test code.% g* S) b7 N ]! h4 t, P
- *" n7 m! c; K/ U7 n, j6 P9 Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 l0 F1 [7 ` H8 g, f$ T( D4 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: L& F& j: f; N' U9 R
- * TO CHANGE.
+ S1 k, S4 z$ ^ - *$ E! J1 A' D& ~5 O7 g- H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! F+ Y3 y& k3 I* D9 @
- *$ p" f) x( r% ]& w1 a6 S1 L1 P
- * This program is free software; you can redistribute it and/or
4 I& f6 n2 x5 y) }- S% k$ z - * modify it under the terms of the GNU General Public License as+ ?% ?. g, U, @
- * published by the Free Software Foundation version 2.3 [0 m1 {& y5 a; j) W$ ?
- *" \6 ]7 i& ]1 x6 J2 O, [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 @! R0 ^% N+ v2 N B: v - * kind, whether express or implied; without even the implied warranty
+ t4 {- N2 g3 T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: r# V! _6 C1 C. Y
- * GNU General Public License for more details.
& N* @* ?/ m7 m# x' q8 `( G b' @ - */
, p' G3 X# d6 v7 S% M! o) g
6 k# M5 Z5 v9 f. T/ B- #include <linux/module.h>
, c5 x+ \* z( E, t4 X6 v - #include <linux/init.h>7 W' h% w5 m# D- d2 l! y
- #include <linux/errno.h>' X' L+ S2 X! Y Y1 n# L G
- #include <linux/types.h>
# H6 E% s3 ^( Q3 r. G+ D3 o8 T% @: c - #include <linux/interrupt.h>1 g' D- k# H6 i* x; w ?2 x+ J( _5 X
- #include <asm/io.h>7 J$ }9 q9 j2 ^$ R; m
- #include <linux/moduleparam.h>
% D0 f2 ~: }5 _; B4 ^$ [, B - #include <linux/sysctl.h>
8 g% g6 } v& M$ l - #include <linux/mm.h># k0 h) w3 l9 M1 C; a q
- #include <linux/dma-mapping.h>
# O( I! R# ?) R+ `+ q: w( b- | - 7 y+ O% S; r; u, W
- #include <mach/memory.h>
" c q: H4 @: ]7 T3 Z - #include <mach/hardware.h>
5 X A- p+ E$ F - #include <mach/irqs.h>
5 x9 ^- _2 s$ F+ v- Q7 b - #include <asm/hardware/edma.h>+ d) i7 ?' a/ X' n8 p7 H
- ' C) `: ^( `: A: G+ V* R9 u. }0 W
- #undef EDMA3_DEBUG: x1 Z& c" G0 f( s+ T
- /*#define EDMA3_DEBUG*/: @$ w+ S8 ^! _7 F# O8 G* W ]# R8 c
- , x. k8 y9 @2 b; ~0 `8 N
- #ifdef EDMA3_DEBUG
- V* f& ~' U' T0 L# y7 i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) ?" {: p3 `9 |9 d6 G* S/ [& P; ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* [, I; Z2 N$ D( q) M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); ? I. Q% _* j6 z4 h' W C
- #else% q5 c/ r' F e3 Z9 P/ y) X# T
- #define DMA_PRINTK( x... )
/ }1 Z9 c" Q0 U1 A; ]/ t - #define DMA_FN_IN
5 i! B6 }- f7 }3 J- G+ _& D - #define DMA_FN_OUT) X6 c, B& [# |+ v
- #endif# d+ U5 L1 E4 P
- 4 x% E: \" N4 _( r/ n4 t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 h! F/ U7 X3 V# E - #define STATIC_SHIFT 3& \! _9 g9 x" T
- #define TCINTEN_SHIFT 20
! @5 R0 i6 ]+ D5 c3 X - #define ITCINTEN_SHIFT 21
: R1 H6 z% M( b& I - #define TCCHEN_SHIFT 22
' Z3 z0 a: Y3 \1 O. I7 \' } - #define ITCCHEN_SHIFT 23* ~0 I. h* \, Y$ n& k
- 3 x2 X+ Z: h# O+ z) ~% s# O a: W5 r
- static volatile int irqraised1 = 0;/ b2 O/ {# R( Q( v3 G# l7 H! Z! s
- static volatile int irqraised2 = 0;4 C# |; G- H! z
- , I; ] I, j# m/ L. N. q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 x6 ^/ R8 P* \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ C9 |1 ]1 B# N' x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 U; Z' K- e- a
- ) u8 x# C4 F- y( F" s
- dma_addr_t dmaphyssrc1 = 0;7 G G+ H B/ a1 a
- dma_addr_t dmaphyssrc2 = 0;
% H& g2 h# q' ~ - dma_addr_t dmaphysdest1 = 0;0 ?5 `/ k$ j& L9 ^8 n5 T( J) c
- dma_addr_t dmaphysdest2 = 0;
5 U4 K" p0 v4 G7 m. d2 @+ f* s c - % j0 r+ C9 o7 X7 L9 N, U
- char *dmabufsrc1 = NULL;: H P" R8 h& S% {( C0 _' e
- char *dmabufsrc2 = NULL;
- B5 n1 L5 l, A1 J) @* ~, b5 M - char *dmabufdest1 = NULL;, U8 Y! X; L; I0 [# ~; @
- char *dmabufdest2 = NULL;0 H) W' a/ ?( e- d
- # V2 t! b8 }$ t' p9 \1 Y1 X- ?
- static int acnt = 512;
5 J' F+ J7 \ N - static int bcnt = 8;! Q, W( ~: V/ u9 m" I; p; j
- static int ccnt = 8;
) M7 E+ C6 E2 r+ E
+ e) j% r& G0 g- {& q2 d- module_param(acnt, int, S_IRUGO);
( q8 @5 b$ z% C% O, g: T - module_param(bcnt, int, S_IRUGO);
; P% I. Z% [- y: q. T4 g - module_param(ccnt, int, S_IRUGO);
复制代码
& O7 V( }# P% V. V( S5 D6 u: @7 ?- o, f% y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ ^* N' g. [ c, f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 L# V- A- e! |9 L$ {/ g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 K" z/ ?. t8 H* P7 z6 U% ]4 V. c7 }: R6 I: _* K0 T! E8 ~: N9 O
9 m6 o: l" a U+ Q$ @# s% B |
|