|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 ` b/ R" u) ]% g, j5 P
- [code]EDMA sample test application1 N, m2 U3 u- L2 g$ W+ R. _2 \
- /*
7 F/ Y6 p3 B# p# { - * edma_test.c$ X5 X- P, C5 Q- [ Q. b/ W# }
- *
5 F6 m7 k; T% p [& ~ M - * brief EDMA3 Test Application
. n. `0 c C: @+ W. P3 p0 N* r& G3 e - *( H6 f( H) B4 z! ^& {7 V$ J; j5 k
- * This file contains EDMA3 Test code." c0 |( z H9 n, ]2 m1 e: J# j
- *
: E: F' i/ ]" t& J0 n9 d1 Y. ^' s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# W7 q0 q5 l8 g) M1 S) Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 A# i; g' L9 ~4 e7 k9 V
- * TO CHANGE.
' b' }% ]; ^; }- k - *
3 C' \3 J5 R( I7 t2 W0 x, ~* P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: h. J/ u+ K2 L6 p p, |) P( W
- *
3 P7 d6 J& T! ^8 K# f) H# ` C - * This program is free software; you can redistribute it and/or9 c( {* f9 S8 n" y! D( Q% M
- * modify it under the terms of the GNU General Public License as
* I! n8 L- Q& N* L4 b5 C( Y% G; z, _ - * published by the Free Software Foundation version 2.
* b+ F# J$ _$ c - *
- j& d4 q# ~7 n6 V- Q/ S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 _; ]6 q; G; M7 T. o) O/ m0 Y5 V$ V
- * kind, whether express or implied; without even the implied warranty9 |$ a: x$ X. y5 w' j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 a8 A8 O6 v' ^. J) {2 F+ F
- * GNU General Public License for more details.
% ~! ^6 b0 D6 X' J3 x - */
/ M9 {8 e; s& f9 w+ g2 q - * J- Y9 ~; U# M5 D E- b7 @
- #include <linux/module.h>
3 x' x/ Z2 [' i# B - #include <linux/init.h>: O6 k: x: j: } H* r/ X0 V4 U
- #include <linux/errno.h>7 u3 Y) r H! F8 s6 N! R
- #include <linux/types.h>
v: E' m& D! i: i# T" M& B } - #include <linux/interrupt.h>
3 P: X0 k s0 O! T - #include <asm/io.h>
7 M6 R: h! o+ ^1 o6 T: B - #include <linux/moduleparam.h>* i+ {# g; B$ ?& t$ f6 g6 N" G
- #include <linux/sysctl.h> T8 K2 D& P5 f& h( x
- #include <linux/mm.h>7 s* O6 p- V+ h A+ w
- #include <linux/dma-mapping.h>
; R- b# _/ U9 p3 m. ^: R% u0 j
! s0 `( F9 |$ c; e0 E) F4 V- #include <mach/memory.h>
" Q+ k$ b3 g; h- f) E H, d5 s( Y - #include <mach/hardware.h>
3 H, k! S& {% T4 Q, m - #include <mach/irqs.h>$ F. C3 B7 ~8 c
- #include <asm/hardware/edma.h>* j8 `% q9 n" Y% T9 o6 C, [
- 8 M* y8 Y, F$ U* _8 G
- #undef EDMA3_DEBUG
5 G+ j4 S. e. U/ k3 ]0 A: K: b - /*#define EDMA3_DEBUG*/
5 d s# q6 Q- Y2 h9 I2 E8 p* S
8 n( M- t) s5 g: E P- #ifdef EDMA3_DEBUG
0 U3 L+ V4 M/ ?$ q( s# t' G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), N! R U4 P; @5 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). J2 w- u; X5 v/ ~( z3 X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ L. e7 } Q, ^9 w0 o2 \" o
- #else9 O M6 u1 P* B: Y! g& V+ O* _6 j
- #define DMA_PRINTK( x... )
% {* X( w, r0 v, G/ k7 y2 D - #define DMA_FN_IN
$ o( X1 Q' H. G; s* F! h - #define DMA_FN_OUT
9 J, P+ S; h0 @/ y. w - #endif
% |4 `0 @0 I( E k9 y
9 U ~2 w5 m4 w0 [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) f. |/ O4 t5 M, n - #define STATIC_SHIFT 3
; f4 k( z/ t: u& C+ C/ o: P6 U - #define TCINTEN_SHIFT 20
' r* W+ \1 p- }1 `. T" V9 @% U - #define ITCINTEN_SHIFT 21
6 c0 O+ Z# L6 a$ }& f2 j- m - #define TCCHEN_SHIFT 22; p$ T5 F# e7 _! N& w2 M
- #define ITCCHEN_SHIFT 234 [) l6 z }) [5 S
# |! O9 H+ n! Z& C( A! p( s; S- static volatile int irqraised1 = 0;1 d" M& k- n/ v" s7 c9 H/ F
- static volatile int irqraised2 = 0;/ v0 E1 L* f) ]$ j9 C. x9 ~
- ' p% w7 @# z- J& y8 Z/ x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' G [. F* z' H% v0 q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! s4 x* y0 M7 d- Q$ D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" ]$ v3 Q! L8 P - $ Z! z" P1 A: c9 [' q% l
- dma_addr_t dmaphyssrc1 = 0;8 u& U3 ]9 S$ U
- dma_addr_t dmaphyssrc2 = 0;. ^; y9 i: ^7 r# Y. N' j4 y
- dma_addr_t dmaphysdest1 = 0;( N$ ` u1 b2 O2 K
- dma_addr_t dmaphysdest2 = 0;& y* g' G" P0 a2 e2 I8 R# l
- 1 C5 N; K6 x) g1 z
- char *dmabufsrc1 = NULL;
& d: e9 f1 |, b' K - char *dmabufsrc2 = NULL;
7 N* z! J! B1 s- R* u - char *dmabufdest1 = NULL;5 G9 {* I" S* c X
- char *dmabufdest2 = NULL;8 S' x7 W6 i$ L0 o' H+ X
/ i( s1 x0 ?; f2 q3 H' `- static int acnt = 512;
: f! x- d1 |" o0 _0 a2 W$ r% J - static int bcnt = 8;
# E5 R0 F1 l2 W0 _ - static int ccnt = 8;
! X3 \9 z8 w& }" z, z/ A - ' e6 Y0 @" W {# M% U+ |
- module_param(acnt, int, S_IRUGO);
7 d9 \* l7 V: _ - module_param(bcnt, int, S_IRUGO);
, b/ z% J. J, T1 Y - module_param(ccnt, int, S_IRUGO);
复制代码 7 i& p ^) u7 v- y6 c: N3 b
9 ^! `+ W+ k, l; g8 |3 ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, F' n; x! ^8 W, m `# O+ e" Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* c1 T( e5 r- @; ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 `( \# C$ Q7 n; X* Y+ |4 f* H
. {* ^; h+ l3 W& D5 x5 C% G' a# o
|
|