|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. r+ S' r3 U A$ ~' n3 m5 E0 D1 f# w5 Q- [code]EDMA sample test application @' E* {; x( n
- /*6 P F) X/ O4 o( m$ B
- * edma_test.c) X" Z* W& {6 F6 O% u
- *
# `& Z6 k/ y" G, V; j - * brief EDMA3 Test Application
2 t5 ?6 p" ]$ ~* z- Q - *
. b4 e) d, X( B) j - * This file contains EDMA3 Test code.* J: u( \6 @+ l1 {% Z* T
- *
( \/ g9 ?3 V- l0 g/ E. p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ `+ `& Z4 Y# c$ `) W9 w- Z: ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 Q4 ^) x- c3 y( |, Q2 M
- * TO CHANGE.3 ], I8 v; K1 w5 W \7 Y& K" ?
- *+ h# u2 _7 ~* u5 y* }: B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! Q1 n0 O& ~6 ?( T1 n - *
) o. |$ b+ k( }) i) [ - * This program is free software; you can redistribute it and/or
1 W z# C4 }2 s& u. x/ U) q - * modify it under the terms of the GNU General Public License as
7 c. \# n& t2 X, P Z' r' }0 } - * published by the Free Software Foundation version 2.
& H% }3 d, a) { - *: n/ p7 \4 z, y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 S' [' s* y- V& [- j3 X - * kind, whether express or implied; without even the implied warranty& U% ^6 n7 y& J$ Y# {( e" }1 a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 U- N0 M# h: N+ X$ b1 V) I# o - * GNU General Public License for more details.7 Q. l1 {4 w: X+ o3 Q
- */
1 {1 C3 c0 C/ P5 j5 A# {
. Y+ N2 n0 R$ G- #include <linux/module.h>( ^' {6 Q7 K0 C1 q( l7 `' s( q
- #include <linux/init.h>
( _- c$ v1 f8 \1 Y, u2 a - #include <linux/errno.h>
* \8 c/ r1 w$ O' R - #include <linux/types.h>
) {. y# O1 D( H9 k3 n/ B; Q+ d - #include <linux/interrupt.h>3 y8 V# I0 I( A8 n( \
- #include <asm/io.h>
, u. g b7 ]3 P z! J - #include <linux/moduleparam.h>% w B4 Y- H5 ^) M" {" K( ?
- #include <linux/sysctl.h>
) A# H6 f+ c: |) o& P- x - #include <linux/mm.h>: \7 w# i# W- f5 p" J
- #include <linux/dma-mapping.h>+ K# s0 a5 p" {3 E0 [
5 I7 T- x" a. y: X1 u- #include <mach/memory.h>; d1 b, x6 H4 ]5 O4 O/ b
- #include <mach/hardware.h>( b/ h8 p' U" t) j6 s5 M
- #include <mach/irqs.h>
0 s9 o0 h1 {, L9 z( t7 h( ^ - #include <asm/hardware/edma.h>
7 S+ U6 ^( Y9 X7 h2 \9 C - # d* i, M+ h$ |$ g# P
- #undef EDMA3_DEBUG
' M' }, P, t/ X9 ~6 ? u - /*#define EDMA3_DEBUG*/
- p" R; X/ k( _7 b! q! ^ - / S5 i: ^3 N# `. S
- #ifdef EDMA3_DEBUG
- Q* N4 Z7 S# Q+ y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! B/ Q' G7 ~ X7 ` } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- ]/ p4 Z+ R- h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- g: {+ P2 e- i; F. G. g7 f$ n1 t - #else% n8 j- q; e# T6 W
- #define DMA_PRINTK( x... )
$ |: I9 v( o: f - #define DMA_FN_IN
0 D( v. b. r6 F# ~% P( @0 p - #define DMA_FN_OUT( j% [- Z' \: i& }+ W
- #endif& s1 S. Y* P* j/ p# J
- 9 h! {0 W4 t( \: D) d n8 B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 C" I3 G8 @- s* f, G9 ` - #define STATIC_SHIFT 3
1 {9 S" }4 u( V' T, T9 D - #define TCINTEN_SHIFT 20
# \$ F$ C+ m9 n) k" o - #define ITCINTEN_SHIFT 21) M* c3 n0 z$ [# h9 b5 r
- #define TCCHEN_SHIFT 22
1 a) V$ F8 o' Q4 E2 `3 z( [0 f - #define ITCCHEN_SHIFT 23
0 O; x! g4 l* x s
W+ h5 j3 |/ W8 ?) V- static volatile int irqraised1 = 0;
, r! B- @7 ]5 N0 K. z - static volatile int irqraised2 = 0;
4 l! ~7 o7 f$ y4 z1 D. z - 7 Q' j- h5 `8 D5 i3 \% s. M4 x$ M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 E/ o- I9 W0 _& z5 L& B( N% p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! l# M1 c' ^2 G2 ]; V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) j% y; `( j4 R# D' I l
% P) T" m/ S: ?$ Z+ G2 j8 [- dma_addr_t dmaphyssrc1 = 0;9 N' L8 d/ m4 Z- k3 ^& L9 F3 A
- dma_addr_t dmaphyssrc2 = 0;0 C, t& U# G' m
- dma_addr_t dmaphysdest1 = 0;+ [$ |+ }$ s7 W) `# t4 P
- dma_addr_t dmaphysdest2 = 0;
4 Y) q: F- E, Q9 |7 \% S& h' |& a3 w" r
; ^1 y3 M* O/ l7 n- char *dmabufsrc1 = NULL;
% h$ @- S$ M4 ?1 S6 y" @) h1 B/ ] - char *dmabufsrc2 = NULL;
. _1 f) c! z5 U9 P9 F# M* {6 l - char *dmabufdest1 = NULL;
& x9 g- F& h/ l1 p - char *dmabufdest2 = NULL;9 L' y( Y$ I: b) ^5 B& o% C0 \
: E" t0 W8 ?/ r1 k) z- static int acnt = 512;
0 v8 |4 {, k* k' P3 O ?. d- Z l) R - static int bcnt = 8;. C0 L0 ~& a3 ?0 k0 X- |
- static int ccnt = 8;
- y5 T; N o! Y- x! Q" O - / @& Y$ Z" \8 G, H( L/ \
- module_param(acnt, int, S_IRUGO);
3 E. O) Z* ] n# V& H - module_param(bcnt, int, S_IRUGO);
1 _- ]0 W& s3 b+ i& T+ b' P: y - module_param(ccnt, int, S_IRUGO);
复制代码
s2 N' Z0 n: A% U5 W: M6 ~, ?
" A3 i" C/ V+ ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& b* i) I5 o- }% b, M; ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ ~/ B# k5 P, F+ r, ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& T' b1 b* J* A+ e. e) g9 {# b0 a9 u2 i. U
* d! r) o) K Q- g, t! B: _+ u" l
|
|