|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 `. E! }& J7 `' ?
- [code]EDMA sample test application
; J/ \: a! g, v5 c' t8 S1 g - /*
( w2 s1 ^: c L/ ^ - * edma_test.c, D/ v! b$ E2 a/ L
- *- L. _$ p! C0 C s4 o
- * brief EDMA3 Test Application4 C2 R& U8 x7 r
- *
, s+ C8 \! ~# s - * This file contains EDMA3 Test code.
$ s& X7 Y. D, g8 W - *
) T9 m1 X/ f0 b, \' ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 C! ]( ^( o" f, E2 ^$ l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 Q( c5 j7 e/ p& [ - * TO CHANGE.& F2 M, S: N( \
- ** s9 a7 Z6 n; _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) Q7 o0 A1 i2 N4 z
- *8 O1 S' j+ K/ }4 Y+ @7 ]: J
- * This program is free software; you can redistribute it and/or. e3 \# L8 f. G0 l0 s; N
- * modify it under the terms of the GNU General Public License as
4 A: ` o5 t9 E7 H - * published by the Free Software Foundation version 2.5 v' a7 A+ m4 D3 }
- *
8 D! i* J7 }" [! Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ L2 I& ~+ p6 P: r- w8 I
- * kind, whether express or implied; without even the implied warranty
- D, u* n! E4 p3 Z6 f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' O( V( h6 W& U5 }6 h - * GNU General Public License for more details.0 k5 n/ G/ m$ X y* t/ ]. {# b+ m
- */
3 X. R+ F% \# F& K- y4 B1 ` - $ n) n, _6 g6 G
- #include <linux/module.h>; N- R1 m! k$ [6 Y$ ^* Z) I0 @
- #include <linux/init.h>& h1 F' j& Z2 i4 ?4 B- ~. P7 ~
- #include <linux/errno.h>6 E$ l/ F# d3 R
- #include <linux/types.h>
8 W/ H) l: L% {8 @) @, m* F: V - #include <linux/interrupt.h>
# ?8 Z8 O! _7 ? - #include <asm/io.h>9 T; h! q; |: ^! S' k) t u
- #include <linux/moduleparam.h>
8 s- q, s: ~" @5 j2 e8 O9 T - #include <linux/sysctl.h>" Q: N, Q* p' y; l
- #include <linux/mm.h>. B4 G+ W& @% k1 t1 h ?0 [6 X- S4 P l
- #include <linux/dma-mapping.h>$ @" \( k$ O7 h
, C) ~) ~3 e/ h' U7 @. I- #include <mach/memory.h>
( l; r6 K# Z8 s - #include <mach/hardware.h>
: O' P8 [& a5 _6 d6 a9 j - #include <mach/irqs.h>
9 W. o3 X1 L" Q% A - #include <asm/hardware/edma.h>
% E1 I2 ^' v. ?( ^- T& G - 1 h) \/ f6 A4 s, i- h5 s
- #undef EDMA3_DEBUG
4 o- \* ^; C* W3 w( Y! b - /*#define EDMA3_DEBUG*/6 S3 F+ f. q; j. }* {
- ! b5 ]% i7 e) s3 R+ U, |
- #ifdef EDMA3_DEBUG" n2 x* B. Q' K5 ^+ s, K/ G/ I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 @, C$ P6 ^& J( P5 d. [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( D5 Y/ l* e2 j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 r L7 t4 g& F4 [* q+ a7 j% b - #else6 n; k) m; i1 s) p0 B" y& \
- #define DMA_PRINTK( x... )5 m7 @& s+ R) r5 B4 _
- #define DMA_FN_IN
% ~% c5 W( k% \4 O/ x2 q0 w+ k! L - #define DMA_FN_OUT
W, K' H4 w% Q0 a2 X! B - #endif) Y0 w# c: x3 c+ C! q0 K
- 3 L; g, C6 W$ x; ^! s% Q3 T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 Y$ F% t* ]! Y4 N - #define STATIC_SHIFT 3
2 Y7 i1 u( ]7 h - #define TCINTEN_SHIFT 20
2 M3 ?1 J( \. K1 Z8 M, \' i) k9 v, T - #define ITCINTEN_SHIFT 21* q( t7 R1 Y9 F0 M- w* f3 K
- #define TCCHEN_SHIFT 22
) B1 B! g f, u - #define ITCCHEN_SHIFT 23
Y, {# M/ T: Z, J1 i - # ^/ c# w! M# C7 |
- static volatile int irqraised1 = 0;
; f# Y3 B2 K8 L6 o3 Z - static volatile int irqraised2 = 0;
! i8 A+ |! t" `" a: |8 K6 m, o
* Q% u8 `$ l: O6 u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. {/ G6 j, v! C0 X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# H' u0 a' f+ N& u. v& p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' G& a" d+ E% O4 X; ], _1 G
[& M$ R T0 s& {- dma_addr_t dmaphyssrc1 = 0;1 e7 W% c6 a5 R1 `9 p+ w
- dma_addr_t dmaphyssrc2 = 0;! c9 M1 j1 S9 E6 A, ]3 ~
- dma_addr_t dmaphysdest1 = 0;; ~) |) v7 \$ x* o( Q
- dma_addr_t dmaphysdest2 = 0;. h" S0 q" I# r8 F
- % G6 H3 d$ v# c. y4 R }0 V
- char *dmabufsrc1 = NULL;; H2 B. i7 r' F( q: x* I
- char *dmabufsrc2 = NULL;
2 p" n! N+ |- o; z6 d9 I - char *dmabufdest1 = NULL;/ i& ~3 r1 w2 }) @) C7 b9 b, Y
- char *dmabufdest2 = NULL;; u$ R4 K6 D4 V7 O2 H
b1 i% F' C F& |1 Q5 `- static int acnt = 512;
$ B) _& V! y. r3 r - static int bcnt = 8;) c: M0 z4 p/ g) O8 i7 m0 V* q3 p
- static int ccnt = 8;
3 f! e8 k# h* J+ o
' e( {) o/ ?& Q* ?+ L& z- module_param(acnt, int, S_IRUGO);
. T6 ^# }" N9 K& T- Z! | - module_param(bcnt, int, S_IRUGO);
0 A7 S7 r# Y4 l, f1 }! L - module_param(ccnt, int, S_IRUGO);
复制代码 , A2 q+ e0 A1 b& }5 q
9 W" b5 ?$ j/ t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: ]! q$ a4 m) ~5 E: \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( o, }: E0 X. c8 D. [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 P, ^7 q, S% g
6 \% ~1 V8 Q h% I: L
7 H8 t* d% L7 T5 `$ P: _* | |
|