|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* t$ W/ O) g5 T% c1 A- [code]EDMA sample test application
- ^- p/ S$ Q7 j4 q! x7 H' y7 d - /*2 l8 [& O/ c6 E3 ?; N
- * edma_test.c
8 d& e$ W8 L/ h9 D* Z' u- C - *
+ z" Z* h- }# Y - * brief EDMA3 Test Application
4 j+ M; W' ]+ A; ]. F K - *
N6 C- K8 A, ?7 ~, r, U/ H - * This file contains EDMA3 Test code.0 N1 j2 u& ~9 o" b/ [2 j' d; m% V
- *6 Z3 i N7 W; G, H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE C* y% Y# l5 N- A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( v) M6 |+ u! v6 T+ M
- * TO CHANGE.
' V: o1 \0 ^8 O4 P3 A( o - *
e& J! a: r7 h$ `, K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 T5 a0 J. \& F) Q2 [
- *' A3 e2 w; Z1 K! _* e* P, m! u4 o
- * This program is free software; you can redistribute it and/or3 U6 j) g* F+ J% g" o
- * modify it under the terms of the GNU General Public License as
6 w$ m3 ^/ a2 a [+ ^ - * published by the Free Software Foundation version 2.
" d- k9 W3 M4 a" V) W. @, B - *
5 |, r$ Y( y# W k) t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; Q4 W* a9 B5 X; ?
- * kind, whether express or implied; without even the implied warranty$ Y+ ?1 U# Z) @3 ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* N& i- n9 o( U- W" w7 K5 V7 e - * GNU General Public License for more details.( J! m+ L# T4 F3 t C. b$ t
- */, s* [4 A5 z ?, ~! T- c- @# f
, f; K3 m" k; B8 y. u0 u$ `1 v- #include <linux/module.h>) T% J/ S% C. c) z8 M
- #include <linux/init.h>+ ?6 I& e( i2 c; b6 y4 [
- #include <linux/errno.h>% _) ^+ d7 V9 X0 z2 e* j
- #include <linux/types.h>' h) f& J w) {" b2 g3 e2 F
- #include <linux/interrupt.h>
2 E: ~5 [% t3 V# {. V - #include <asm/io.h>
' |; \. I# ~0 A/ J2 e& h& f - #include <linux/moduleparam.h>
% e3 C. k9 T, u( ^- S - #include <linux/sysctl.h> l: P7 i* y, J3 v, n
- #include <linux/mm.h>. P# N ~0 M) r9 Z; W: V0 a
- #include <linux/dma-mapping.h>5 R: B0 i7 ` o$ I" p4 g: x
- ! g0 N( M9 Q$ U
- #include <mach/memory.h>
8 j# l* I* k+ m" c; e9 [ - #include <mach/hardware.h>
, A$ r! f2 n0 A. [: e( n' y - #include <mach/irqs.h>, J D$ R, D% d) w
- #include <asm/hardware/edma.h>5 N, d; H5 X" \; s& n7 i
- " `7 z4 s0 \/ J# t* G8 C' n; `
- #undef EDMA3_DEBUG" M- [; K$ c4 q
- /*#define EDMA3_DEBUG*/3 R. Z1 V8 h4 M# `5 n/ o
- 7 h, Z6 ^3 p. V) @! ~, j9 S9 u& K
- #ifdef EDMA3_DEBUG5 b L4 @8 [. b0 ` w4 X) K1 m* [# s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& ~5 l2 {2 i; a; X- O$ R - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- Q8 |$ g8 [/ p, C- H' A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), r% z5 z7 v7 b, m% E
- #else
5 D3 S$ Z7 A3 c1 S - #define DMA_PRINTK( x... )
# }1 b! o6 C8 b+ N6 V/ d0 _& @ - #define DMA_FN_IN6 N' M! d0 K4 f/ o& E, i3 \
- #define DMA_FN_OUT6 a* o; ?' B n" t, `9 a. A8 G
- #endif
, x4 z. a8 _4 H - & L a& |- m, u7 R- A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' `3 K9 @, F) @+ Q! t% J
- #define STATIC_SHIFT 3- G s5 t2 l) f; P- {2 r5 k
- #define TCINTEN_SHIFT 20, O! v" C) q# ?6 D
- #define ITCINTEN_SHIFT 21
: S8 x: q6 R9 o: x- k) ~# Q - #define TCCHEN_SHIFT 22/ Z! ?, w: ]: y5 p. H
- #define ITCCHEN_SHIFT 23
7 D& a% I( V, o4 I# @
0 o' o! k' b( l/ `3 X* Y2 W2 C- static volatile int irqraised1 = 0;
6 ]4 \/ _7 W4 d& F# G6 H" N - static volatile int irqraised2 = 0;
; ?8 |6 ~% e' P - 9 h# G+ b1 a# o% L* R' M/ P" E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" f+ ~" @. E5 w6 E- T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* F$ w9 y. N* w0 K, K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ J; @' W% i2 |1 a& X
- e/ G2 @ c+ t6 Q% E( l- dma_addr_t dmaphyssrc1 = 0;
( r6 a+ X! p" q( g- L' h7 h/ m1 \3 a - dma_addr_t dmaphyssrc2 = 0;
0 A. s1 F0 L9 L5 Y8 E - dma_addr_t dmaphysdest1 = 0;$ P. B3 L! j& x. M1 n) S |$ Y5 [# D
- dma_addr_t dmaphysdest2 = 0;
. g7 T* B+ u; O( @9 L9 C1 ^ - 0 @' M9 X% l6 N. \
- char *dmabufsrc1 = NULL;
/ n: h m$ M/ D! u - char *dmabufsrc2 = NULL;4 ~# |8 w$ x/ g" o7 H0 E; y7 d$ @/ `$ g
- char *dmabufdest1 = NULL;
: Y: @. Y6 l2 _* I2 o - char *dmabufdest2 = NULL;. ~% |+ Y1 J5 U3 M0 k! l
+ H- G5 s J$ R9 q# t7 C# t- static int acnt = 512;
2 t( c# D) I6 e - static int bcnt = 8;" P! G5 W2 N& q: P+ \5 }$ f
- static int ccnt = 8;8 n/ z7 Q4 g! f5 h9 J
7 {3 C& `0 u- F- module_param(acnt, int, S_IRUGO);
! p- t t3 p1 c3 }6 f1 k0 i - module_param(bcnt, int, S_IRUGO);
. R& s( |, f, Y, B0 K, C% f - module_param(ccnt, int, S_IRUGO);
复制代码
$ [. ^. E- ^( P% b6 j% u) H N% i; w3 r- R: x+ |2 L, s8 I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 m- Y& u7 ~7 }) c
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 C' W6 R( }$ ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, x0 s# f b v _2 A, j" a
4 B9 }' X% d+ h- H$ ^# ]4 e
: [( F5 Z# T6 T: V- T7 F8 v4 C |
|