|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * O; O* D, i9 x! ~& j
- [code]EDMA sample test application
5 ^! g, J# p' d0 f" G - /*( S4 U' G( N' v. H2 N
- * edma_test.c3 n6 d+ p4 K. j1 c2 N( Y
- *
. ~# Y: l$ N, z- I! \ - * brief EDMA3 Test Application
& F/ r$ A j# \! h5 {; n - *
6 q& N8 j V3 _2 z5 h. ` - * This file contains EDMA3 Test code.
2 J s# W, }: j! u5 L - *- |) N9 d. \0 G5 n. [7 L$ @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# ~# p3 P- s4 p" j, j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 j3 p) O! d9 x7 F - * TO CHANGE., H9 k4 q# ~! n5 g0 V; p
- *- W$ ^' S2 C! T( Y+ O. _: n, T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 J; _/ L+ w! M( Y
- *( J9 g) u7 E+ h' ~0 R- g
- * This program is free software; you can redistribute it and/or+ ^* U/ u# e6 `. K
- * modify it under the terms of the GNU General Public License as+ Z+ I. S7 J$ q
- * published by the Free Software Foundation version 2.
% y- u6 C- p! P$ B - *
4 ]% B9 g! l* Z$ p2 {3 C% E) d4 S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 L! D& }" D) T0 G! p4 S/ ]0 \- g - * kind, whether express or implied; without even the implied warranty
7 _# e$ Y7 r. f. J# N6 Y6 ?" z. b" ~ ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" T5 _! p# A: P/ _; E - * GNU General Public License for more details.# H! T6 Z* e; W2 y
- */
7 s1 Z# h/ s+ P5 r8 S
. }3 ]+ N7 j: P3 G3 t- #include <linux/module.h>% }' `/ H* y$ _* n
- #include <linux/init.h>
, D9 p9 O. o# i1 ^ - #include <linux/errno.h>3 o& N3 b/ v: z- Y k
- #include <linux/types.h>. H2 W$ e3 Z2 p) K; K
- #include <linux/interrupt.h>2 K- `2 A; E- N- U. u) e# G
- #include <asm/io.h>! W) Q" W$ q: H e
- #include <linux/moduleparam.h>8 w2 f0 I5 P, Q& @% S a
- #include <linux/sysctl.h>: B" V) I2 P8 f) ^3 S6 \
- #include <linux/mm.h>$ X. a+ h, N9 q' B4 a
- #include <linux/dma-mapping.h>
/ L' l5 Z! {/ s: M - 6 T6 m! n, G6 y. N( F
- #include <mach/memory.h>
$ S9 v5 G% I8 D0 B! |6 }2 Q1 l - #include <mach/hardware.h>: F0 c$ _7 X7 A; f
- #include <mach/irqs.h>, E1 k/ J! s# U8 [6 n
- #include <asm/hardware/edma.h>& ~! ^# ?+ r1 l+ Z/ I
, Q% ^. R* `8 P- #undef EDMA3_DEBUG
# p0 X3 l" ?: a9 n, M. t& ~, I - /*#define EDMA3_DEBUG*/3 n* F2 q5 |2 s7 y5 R' @
- . i. I5 v8 |$ f; Q- m! x
- #ifdef EDMA3_DEBUG
9 b* K' {6 z Q C8 }. }6 e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ x* r9 T2 ?& W: E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( x7 q3 B- f6 z k4 `! _2 ?- Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 ^* R- C* j7 D/ v6 Y$ N8 M$ ~ - #else; K: Y; v6 z" S. U7 T( v
- #define DMA_PRINTK( x... )
4 O( X U) X; c0 l' A, I0 ~ - #define DMA_FN_IN1 D" s0 w) J' P+ j, n2 d: ^! p2 j
- #define DMA_FN_OUT5 Z# ?4 d2 I3 @/ t5 E/ J
- #endif
* T. G; U3 D& {" D/ R5 D5 b
6 Q0 ~# Z4 _% L7 [2 W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 g4 n6 P x. F5 x$ g% c$ L+ B - #define STATIC_SHIFT 3
0 r. F1 C. l# Z1 Q: u$ y( U* X - #define TCINTEN_SHIFT 20
" N. m' P2 k! Z$ W. Q( Z - #define ITCINTEN_SHIFT 218 N% N" \4 B; N( R/ s+ h+ B5 M, g
- #define TCCHEN_SHIFT 22- L# B& w0 ?& l" }; S2 h. s
- #define ITCCHEN_SHIFT 23
; @6 Z8 u$ J+ ^; E
) O: l8 D& I9 `% R: I8 n3 N- static volatile int irqraised1 = 0;
1 \; ^ ^. E4 q8 ^ - static volatile int irqraised2 = 0;% X$ U3 o3 v1 ?$ D; B
- ! F" D. S$ u2 k" f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 a: p; f" D& ^7 J8 I' X( r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" H1 C G7 h' f, A0 K3 S3 w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Q5 C* D+ k, b. Q* n/ g
- 8 p3 g% a0 s1 d% Z7 v. z2 H& H8 o
- dma_addr_t dmaphyssrc1 = 0;
I: Y$ s6 ?7 O- z, N- m+ |- S. Q; N - dma_addr_t dmaphyssrc2 = 0;
* m, {7 L5 W7 i, @ - dma_addr_t dmaphysdest1 = 0;' I" z1 f+ o9 S( C
- dma_addr_t dmaphysdest2 = 0;
' X; q( @- ^8 T$ K: e/ r' h
2 j! Q% i7 P' O" o7 f$ q- char *dmabufsrc1 = NULL;
* y; E# [' e7 k! s1 J# B3 b - char *dmabufsrc2 = NULL;9 f- f0 ?* D7 Z! n+ l
- char *dmabufdest1 = NULL;3 |% H7 @$ } i0 p+ q A6 j; Z+ ^
- char *dmabufdest2 = NULL;% h2 P3 U5 j7 G/ T5 O- u
- & n9 e- K; Y0 B
- static int acnt = 512;9 I& F* Z0 F3 ]3 c) ]
- static int bcnt = 8;6 p0 }/ N) @7 @1 A4 V# B* u
- static int ccnt = 8;
7 N6 z; l8 Z! n( N0 S+ f2 O
O6 t1 N3 Q7 g) Z- module_param(acnt, int, S_IRUGO);6 h" @0 i$ }" @9 ~3 m8 `- i8 j6 L
- module_param(bcnt, int, S_IRUGO);- [6 y6 z! y: o W4 U, I
- module_param(ccnt, int, S_IRUGO);
复制代码
9 C7 r9 ?2 u/ E; c U
- z w' r* s% D- {" _9 G7 T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 p1 c: V( I' \9 o7 w5 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. c R& Y5 H6 g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" e4 B" S, s7 U7 @
d/ r; j6 {. o' z7 J8 k' I
* B1 Q( N- g+ z; Q
|
|