|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ h. O3 s7 G, v, Z* S n6 n$ w2 t0 N2 o- [code]EDMA sample test application3 P/ r) P, h- {2 p' q7 @
- /*
) d0 a: F- h8 {5 j& E( r - * edma_test.c. K( s. \) ~# v$ a1 h
- *( g+ d+ j1 I. K* A* ]
- * brief EDMA3 Test Application
# o* C, [. g/ e6 h3 T2 a/ W8 J - *
0 e/ o" O! T/ [; a+ P% @" B. L - * This file contains EDMA3 Test code.5 L6 n$ _8 g6 I* p8 }3 N- N" u
- *
9 d9 M. i; I# f% i2 P8 t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. F- v1 V7 L$ x9 }4 z2 z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( H+ K0 U, a G) ~% n' Z5 M - * TO CHANGE.: b5 D) r! o/ a& H( }; g7 e
- *
; h1 V+ l5 ] Z* ~. z) {6 F2 t/ q, y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" f* }* G+ o, u% B" z' V - *
: b' w( u* d4 V, @, Y! N0 j j8 K+ [ - * This program is free software; you can redistribute it and/or
) \4 |) Z5 J1 a- }( d- o) ~ - * modify it under the terms of the GNU General Public License as
' p7 W9 S- s. ^% n: Y; Q - * published by the Free Software Foundation version 2.
/ w, c3 }( k0 S! U9 p" U- h9 { - *
/ Q4 C/ R8 b3 G7 {( [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 N% N$ R' X# Z3 N' Q8 c# h0 I - * kind, whether express or implied; without even the implied warranty
) J) A4 J& J& \5 H3 F: Q& V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 o" d6 F' S# F/ R: T+ L' D ^ - * GNU General Public License for more details.
( h. D0 \, ?/ {4 A. j P( V" ?5 I0 U - */7 y$ b5 @, o! u: r/ F' ^6 N
- * ]& Z! u, e, n
- #include <linux/module.h>4 ^( [& S5 d4 A
- #include <linux/init.h>' V5 ]8 M: r% b, j( o
- #include <linux/errno.h> f) b1 I% r8 h; k2 f0 X
- #include <linux/types.h>
6 Y+ _2 w! v8 X; A( o - #include <linux/interrupt.h>
6 _3 O p3 L6 y7 s* n }6 c. ^7 C) W - #include <asm/io.h>$ N5 q* X5 h, i
- #include <linux/moduleparam.h>
! e' b3 p0 r: ^, k1 r7 a - #include <linux/sysctl.h>
' j; s# s& j, \* a% i1 Y$ f - #include <linux/mm.h>8 D' _, N' R+ R* ^1 i& x) B$ `
- #include <linux/dma-mapping.h>8 b, n# W1 g1 v8 S2 K7 |
! N6 p, F" i( E' `* t" L- #include <mach/memory.h>
: W/ W8 _' |2 a - #include <mach/hardware.h>. j2 F; A: f7 L7 M6 s) Y5 y! A
- #include <mach/irqs.h>
! y" b0 _0 H0 ~$ p - #include <asm/hardware/edma.h>
! w+ K1 ~8 ]: d! A! I6 l$ Z) a
5 P+ Z# ?& |6 I" b Z- #undef EDMA3_DEBUG2 o' l: U* d1 H7 _ V( t
- /*#define EDMA3_DEBUG*/) @, C% [( S4 n0 G( L
- ! l/ J. Z3 q. @) K3 S- N9 B# p
- #ifdef EDMA3_DEBUG
4 u& I- g6 Y% E4 }* n# i! \ w. s3 h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), W0 _% o/ D e' x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 |( P8 Q# e: c8 l0 G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 v# O5 p" r8 D* i - #else6 f; I1 ]( W* u2 o. @* {+ D
- #define DMA_PRINTK( x... )
1 ^& {) ~9 K8 ~2 o" Z+ D - #define DMA_FN_IN, W, H7 w4 X( `' ]. f1 w: H; [
- #define DMA_FN_OUT. r# J! x/ ^- b5 M* X
- #endif: q1 x0 s7 [! ^. h/ \' s0 @% }. ?
7 b. G% Z/ ?+ v, I3 Z. W' l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 o6 R; @% z$ u; N' v - #define STATIC_SHIFT 3$ C" r t0 S* l8 Z
- #define TCINTEN_SHIFT 20
4 V( E* W. k1 \7 W0 A! [ - #define ITCINTEN_SHIFT 21
" E& B( }( M$ J1 t& a! B5 c2 i! o - #define TCCHEN_SHIFT 22+ g2 W8 b: D5 ] O( M
- #define ITCCHEN_SHIFT 23
0 x) E+ s+ k2 p. W) O6 N. K - }, v* i+ b' k8 F8 B5 U/ S4 Y
- static volatile int irqraised1 = 0;8 ~3 m- ?: Q2 I) g! ^
- static volatile int irqraised2 = 0;' \4 r4 [6 ?6 d& x( H
( p$ ]: `( E* @& d& p$ Y w+ F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 K5 ~' P' [ F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" N( x1 V8 U$ T- Y' @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 q/ `! f6 {# s1 m; u( Y
5 F% D, o" R9 k* ]* D# P- T- dma_addr_t dmaphyssrc1 = 0;; i$ ^& ~% I b x
- dma_addr_t dmaphyssrc2 = 0;' u( p+ s* S8 k8 O0 k7 I8 `
- dma_addr_t dmaphysdest1 = 0;
2 L5 g; Q. t; v" }% u4 x {; o - dma_addr_t dmaphysdest2 = 0;
) t+ a% {+ \8 G- e. w% ?+ Q - , g: |% @5 L7 R7 ~% x: R/ C
- char *dmabufsrc1 = NULL;9 i6 D. l4 @, h$ J. M4 o
- char *dmabufsrc2 = NULL;
% f4 [! T3 f2 K) y" w/ k6 W2 O: J - char *dmabufdest1 = NULL;" O1 z [) E; r% `/ b4 F, r
- char *dmabufdest2 = NULL;
% S9 u" F0 n( p1 D2 l* K* P
) W, A! J/ D/ S) P2 b# h( p- static int acnt = 512;8 T$ S; k( d6 T% V
- static int bcnt = 8;
; h' p* k1 e1 M8 j6 v - static int ccnt = 8;/ ~- v% F* b/ w- U9 s0 v
- * R! {% f$ y* m
- module_param(acnt, int, S_IRUGO);0 [- G# G g! ]% v
- module_param(bcnt, int, S_IRUGO); u* O. Y- X- n
- module_param(ccnt, int, S_IRUGO);
复制代码
& X1 c" w9 S% _' P% i7 V$ ~/ S6 k' G& D+ w9 m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 Y, p# j9 p" ]8 ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 I6 M: V/ g: J' m& S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 x/ X( s2 J7 F3 @
5 `& W: }9 w6 H/ v% P' K* V" p& s
|
|