|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 q! u* {- H$ s4 K# T2 _" S+ I
- [code]EDMA sample test application/ f) g4 C3 b' e7 D4 q: f
- /*$ f# ?: k" n; o7 n( B, O
- * edma_test.c4 S: n* u6 S3 O) A, K
- *
+ i8 @9 [5 _! h6 z6 v8 q( B - * brief EDMA3 Test Application
& F6 A0 D4 k( B' o2 X' g1 ] - *
$ n% z6 g7 G1 e& \+ Z4 ?1 u( D U - * This file contains EDMA3 Test code.( P4 [7 I) y B5 V, u9 d
- *, F& [% F4 `8 a. T, y$ y% C9 Q' H, x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ L6 A% L% Y1 ]2 K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: ^; k' C1 r! _' D, b) P3 @% } - * TO CHANGE.
% e4 }% V* w0 f: Z6 K# I2 M - *
4 C8 P D8 Z, Q, j$ {% L0 _: P+ b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ S# i9 X! {1 c$ D" Z) ]7 G5 ? - *
. g" J8 y: x. m) N" X - * This program is free software; you can redistribute it and/or- d/ z9 h* [2 G7 l2 A
- * modify it under the terms of the GNU General Public License as
5 `0 Q; e6 H4 _. w - * published by the Free Software Foundation version 2.
/ \1 C- ~3 Z4 o* G" u W - *
5 ~0 K3 k3 L0 \0 ?: X" c' J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 ^7 _1 X; m9 w0 }( l - * kind, whether express or implied; without even the implied warranty) W+ u3 i v/ ~* A& R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 s" s: ^* t7 `
- * GNU General Public License for more details.' U! C7 h: M) h
- */
3 ]+ f% H, Q+ t6 `3 D2 x4 N9 Z6 | - - p* j% t1 ~1 j2 W! s* x0 j: y
- #include <linux/module.h>+ Z+ P5 ]5 t7 h8 e( H
- #include <linux/init.h>- ~4 [7 P" J" `( g+ D
- #include <linux/errno.h>- J$ A$ J& y7 g* u) P3 y' D
- #include <linux/types.h>8 L3 I" S! E$ N4 X: p* [0 d
- #include <linux/interrupt.h>
- f1 v3 y" w, e$ Y8 P' R1 S. c" x - #include <asm/io.h>9 a3 p9 W; |: i
- #include <linux/moduleparam.h>
/ q' D& x- p2 \2 B$ Q$ t q. { - #include <linux/sysctl.h>
$ w# h0 _% H+ [5 L4 Q: K% i - #include <linux/mm.h>4 w% Y# n0 }/ V/ s Z6 W( j2 t
- #include <linux/dma-mapping.h>6 q4 X8 U6 x5 i( C
& `# p. ^5 X# a# p6 s+ d9 U- #include <mach/memory.h>8 g# f0 I1 g0 U9 [
- #include <mach/hardware.h>. c; t1 A! h+ I+ A9 t
- #include <mach/irqs.h>
8 g% ~: [3 ~3 G! {) n9 _+ o - #include <asm/hardware/edma.h>" B1 Q; b1 y& b/ i) n, ?' f; P
" o1 b. P6 v9 f: V8 {5 m- #undef EDMA3_DEBUG
r6 v7 G; B3 u9 ?# z5 B) j2 l - /*#define EDMA3_DEBUG*/4 T% F o3 [) o
- " O) u9 `' X; i. I1 ^, g ] ? A
- #ifdef EDMA3_DEBUG. T4 R7 ~) ^# i; E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 T2 Y/ ?5 n5 f7 ~. f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! I' x9 X1 Y2 l3 D+ V8 G0 ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* p* I- B! d0 s5 ?' ~0 Y* c* X
- #else
9 e2 q( \* V3 b9 k/ K$ R - #define DMA_PRINTK( x... )1 n% Q9 d& k2 g& C, \
- #define DMA_FN_IN& N# y$ E1 G) s1 j! x: M. Z5 R
- #define DMA_FN_OUT
2 a4 ?; o0 a( G. k - #endif
: P2 S- s4 S, [" V3 j3 Q* m: ^& T - 5 S9 x1 B: `. [ H( B9 |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 o6 d& L: K5 N3 {# ]
- #define STATIC_SHIFT 3
5 D6 {3 U! i& W( a- K# W1 d7 p9 p' l - #define TCINTEN_SHIFT 20) z9 @' x" { ]5 t& L3 G
- #define ITCINTEN_SHIFT 21+ l2 y; b( B2 S% [
- #define TCCHEN_SHIFT 22& ~& r/ ]* Y' Q7 z0 ~, s6 j
- #define ITCCHEN_SHIFT 236 E- N6 x5 A' U6 |
- * f! F2 q' {7 m' N1 j& P
- static volatile int irqraised1 = 0;
! X7 N+ | y( g( y' k7 e% K - static volatile int irqraised2 = 0;
u( e' S% i. @. W) f# ?7 v3 O
6 I% E1 [8 q Q" a8 v6 A) U1 n. d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 i& W/ x" A5 i F: q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Y8 U3 O. {3 q X3 Q6 ~% B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: {% V% f, B( b0 U
) p2 a- Q: N7 n5 m- m2 i2 ^! I+ [# |- dma_addr_t dmaphyssrc1 = 0;
9 R4 @2 F" q! F+ E - dma_addr_t dmaphyssrc2 = 0;
4 Y5 K( ~/ ?7 o( y. ^4 L - dma_addr_t dmaphysdest1 = 0;+ @6 i0 Q* P) @7 U: n/ S& P
- dma_addr_t dmaphysdest2 = 0;# a) b/ B, |; \1 ^7 `
% ^, B8 b. q: T( c- char *dmabufsrc1 = NULL;5 K8 ~5 ]" S% Z
- char *dmabufsrc2 = NULL;
, w- X2 d8 }. H* N. s% k0 }' Y - char *dmabufdest1 = NULL;* x/ ?. c1 }; p* v1 Z6 s0 c* w
- char *dmabufdest2 = NULL;
& m( P; J! [& a0 ^
' K+ @0 W5 ]2 R/ M% B- D- static int acnt = 512;3 K+ \" U3 k }/ Q/ R
- static int bcnt = 8;1 r( v! q; _, z U0 t' \
- static int ccnt = 8;& n* T. u( H5 f/ r/ e
- 9 o* x9 Y. X/ W
- module_param(acnt, int, S_IRUGO);
4 m" T Q5 N5 b2 A - module_param(bcnt, int, S_IRUGO);9 b2 M+ I2 ^& R4 d% C% S: ]
- module_param(ccnt, int, S_IRUGO);
复制代码
, }( a& u* }9 m! A/ j8 `" u, g- w1 a& U- I3 j* l4 z2 [8 H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) i2 ~3 g* j4 y# [9 G6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 k* o9 D3 V+ I, l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) c9 t0 o& S% s9 R
1 L; b' d( z5 i! C2 J# J+ o) J9 s, \6 |( ?; P+ r
|
|