|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! f0 r6 }5 c6 N2 d- C
- [code]EDMA sample test application$ y, v& b3 w- Y( H% M
- /*
7 S/ p1 [) b/ n* \- O - * edma_test.c9 f4 l0 b- M0 i* W! ?
- *
" K$ S$ `1 q C" Q+ @. ? - * brief EDMA3 Test Application
; g# d! d. w; T H! j& r F - *
+ X" Y( q1 J1 g8 H$ g - * This file contains EDMA3 Test code.0 x7 H* a' i6 I8 h+ j$ v. P
- *
$ N( x: t5 q4 j! y5 S$ s( M# q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" a2 D: m( b; y z0 Z" A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 {6 S3 H5 g9 H# h
- * TO CHANGE.7 D: x: O/ d% M! E' F- A
- *
' K) w5 w' {7 } e5 D* r1 d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; y' C y# m' r* Z2 Q4 j
- *1 M l5 S ?+ f0 T0 p+ Q
- * This program is free software; you can redistribute it and/or
+ n# J9 z S+ N( e. h9 n+ H0 _ - * modify it under the terms of the GNU General Public License as
7 m7 z3 K3 F+ D9 Y2 G. ~ - * published by the Free Software Foundation version 2.
9 C a, E/ ^' S - *
" W0 @. S h9 z3 Z& _8 W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# O6 o9 w1 r! H$ T& G/ i - * kind, whether express or implied; without even the implied warranty& O' Y5 _+ k: l0 r8 N# A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ ?( ^5 D# i9 g& o- `% I2 O - * GNU General Public License for more details.! {) k% |( i) M$ V x
- */* [, p2 V8 k- S
- % a3 ?4 T$ ` e; a& M. D6 _4 o8 r$ d
- #include <linux/module.h>- z/ }6 }. I) w) ~! o
- #include <linux/init.h>
' y0 {2 f" [3 P! P3 U7 M - #include <linux/errno.h>
/ Z6 Z/ p4 w l: k0 e - #include <linux/types.h>
, V& T7 |/ o3 ?5 K( A4 x - #include <linux/interrupt.h>
; m5 [+ q7 x$ j; { - #include <asm/io.h>
3 E4 N' ^: @# `6 m1 L; m - #include <linux/moduleparam.h>
) N9 i( k* l% m7 m - #include <linux/sysctl.h>/ ~/ `2 y; A+ x- h
- #include <linux/mm.h>
( F& A9 T5 A/ j/ l; w4 ?' W - #include <linux/dma-mapping.h>
- U) g+ } t; U- [7 W
3 Z5 i0 j; X- i; u5 M7 T- #include <mach/memory.h>0 r" ^7 n/ J! X1 C3 X2 `' ]# _' K
- #include <mach/hardware.h>) v4 D' O' b- Y, k7 p* I
- #include <mach/irqs.h>
& B S; }9 d: q) e - #include <asm/hardware/edma.h>
' H6 i( L' S5 Q - 9 y& [& ?# S2 h4 r3 d; l6 o8 |+ a
- #undef EDMA3_DEBUG& J7 ^; F2 {+ @+ A4 y8 G
- /*#define EDMA3_DEBUG*/* E9 k O: K: N+ s( e3 q: X
" V1 g7 F) \1 l4 T4 `- #ifdef EDMA3_DEBUG
4 v- |, R" i, R$ [9 g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& ?. k0 v; B8 D1 C- l6 p: k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# @" H3 E& [5 ~. b% w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ h* C/ Q. s/ W$ e- h! |0 ? - #else
( n4 J8 K/ t7 `( e: L8 B - #define DMA_PRINTK( x... )
1 k. `0 `/ S" n$ h& a - #define DMA_FN_IN5 N$ E( k0 I0 x8 p/ {: k" X
- #define DMA_FN_OUT
2 j" r7 w$ O2 T1 B - #endif
. x' Q5 c h4 E# D7 G - 1 [, d+ k& K8 W6 \3 p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). U1 `; O, H- s/ y) J
- #define STATIC_SHIFT 3
- o9 A, @0 ?7 K7 F - #define TCINTEN_SHIFT 203 L0 `) A8 }! f& ~. m- v0 S
- #define ITCINTEN_SHIFT 21. f3 ^# \9 s) _, g! d* o& G
- #define TCCHEN_SHIFT 22
7 H% v/ E2 p& Y, Z. o* L1 d - #define ITCCHEN_SHIFT 23 H% F, U4 E) p
- / T, p1 ^/ g6 X7 M1 l# V
- static volatile int irqraised1 = 0;
; w4 k1 b. s; I8 x - static volatile int irqraised2 = 0;
# g/ x* g0 }4 N. M! J* U! N" m3 y# M
! s; p/ z, x( V& k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 Z; U; x# k8 t+ o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 ~0 [7 _* ^/ d* K5 R8 O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ^4 P' m$ ^' L- t
- N6 P: s- v. ^. M( R8 P j3 S- dma_addr_t dmaphyssrc1 = 0;
' r% n ?# ^( [. C* L" R2 c8 c - dma_addr_t dmaphyssrc2 = 0;
7 |, l, T+ Y, X! I/ q H - dma_addr_t dmaphysdest1 = 0;
" H. s3 m+ A) j6 } - dma_addr_t dmaphysdest2 = 0;" Y9 O+ O7 V. ~' E- X* R
- 4 t, t v" z/ V. N4 N3 B* s
- char *dmabufsrc1 = NULL;. ?/ f4 C1 d8 X, l+ b! ^
- char *dmabufsrc2 = NULL;4 H9 g! S' R9 l& r& u& m* P4 b* ~
- char *dmabufdest1 = NULL;' M% n4 H$ m3 w+ T4 t4 Z( j
- char *dmabufdest2 = NULL; b: v c( M l: S |2 S
- ' O. Z! m6 D1 K3 E
- static int acnt = 512;8 |- u3 L, w8 D
- static int bcnt = 8;
6 G( ?1 r9 i% J$ o+ V) Z - static int ccnt = 8;
7 l" B: q( F+ f4 u' I
) E6 T6 p) ^! s1 s0 z' e5 o% J- module_param(acnt, int, S_IRUGO);
$ ?3 R8 \9 X# ` - module_param(bcnt, int, S_IRUGO);; ~8 g, Z) A2 Y0 O
- module_param(ccnt, int, S_IRUGO);
复制代码 & q7 g6 f! C# u1 m# q, F
; V% w4 V6 M9 f9 C7 e7 X' A: O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 i" J& C% s: _& O* @* {9 Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 X- d3 n1 A; m! j2 {3 X+ z. W8 D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 U2 t% w H T. H( V
& \ q5 H2 T! J+ W9 r; Q' r* V
% q9 ?0 M! o9 I2 y3 N$ w- r/ F |
|