|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# w' N) N5 J; I* I) V; M- [code]EDMA sample test application
$ f1 l! ?- U% [1 n/ g Z. s - /*4 b9 b# K% f# ^- W
- * edma_test.c8 r$ ~) P' r/ a9 y3 B; K) C% q
- *0 P" v& c% v( X7 r
- * brief EDMA3 Test Application0 `- U+ p7 ?: G3 W `
- *
3 k1 u- ^9 h+ Q; K9 e( k - * This file contains EDMA3 Test code.
3 y: z* S3 K k" o - *
) V. H3 O" n( n; M q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( z' l7 F& C0 }0 k. n8 @/ o) F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& F6 h. Q3 g9 \2 \ - * TO CHANGE.
" w5 B- y9 s- M - *8 f; F# U: Q4 A( R& r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% Y) Y: N6 k+ M6 z X
- *7 ~% ?8 r) D$ S( L. c9 z6 K# ?
- * This program is free software; you can redistribute it and/or
# R! S2 H& z4 t, M$ X( ~% f - * modify it under the terms of the GNU General Public License as! a+ X7 m* h, L. Z3 S2 Y5 Q
- * published by the Free Software Foundation version 2.
( a5 }$ n, p, ~3 Y - *& X; M6 t6 a: O/ E) d% Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% Q# [* _4 L8 M6 g7 q
- * kind, whether express or implied; without even the implied warranty: @" f: K" g1 Q- f3 `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' y6 o, T w! y
- * GNU General Public License for more details.
8 a, v! \/ @- p3 @! j - */
7 u$ B* B; f% H! i - . v1 H( o$ w; w5 A8 h' A* L$ K
- #include <linux/module.h>
3 W1 p9 N) u: A+ w z - #include <linux/init.h>
% s' s8 B! j) V$ T - #include <linux/errno.h>
! F0 R3 g* p* m6 N1 v) e - #include <linux/types.h>
& k* J+ |8 @3 m0 T$ m4 |! } - #include <linux/interrupt.h>
9 c# S% L6 }, q% f. z: s8 S - #include <asm/io.h>/ R# Q% I' g% |: d, K
- #include <linux/moduleparam.h>( `. D5 _( l/ t! [! ]3 I
- #include <linux/sysctl.h> E _3 m, E; c# O
- #include <linux/mm.h>" l% K: x8 c$ \3 U
- #include <linux/dma-mapping.h>* L# K; N2 t+ _# k0 `+ O
- * _+ @3 i8 }9 Z: {6 K: ?* ^+ N h1 b7 T
- #include <mach/memory.h>7 c6 v8 @0 W5 R
- #include <mach/hardware.h>
4 {3 H2 _( M6 A" w' y - #include <mach/irqs.h>
# E. Z3 }# U0 ^3 d% U - #include <asm/hardware/edma.h>' F" T0 X% t: d9 v1 h% @$ X% ?
7 `) f# k; o& I; t9 y- #undef EDMA3_DEBUG
4 g5 p, ], p- i8 a$ w1 ?. P - /*#define EDMA3_DEBUG*/3 x1 { X/ o. T7 k
) g/ q0 A- u- B- #ifdef EDMA3_DEBUG
. ^ z) R5 ^' e3 r2 z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: s! ~& z' R& ?0 l% [4 n7 r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) V+ U. [- R- [) f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 T. T1 g2 ?/ S4 Z2 t+ F - #else
1 c3 z$ P& ^0 ?8 W/ M s) z, h - #define DMA_PRINTK( x... ): z" t, W) a/ w9 D
- #define DMA_FN_IN
) r. v- d/ L9 r' v - #define DMA_FN_OUT
3 r9 j; j% X) W! @ D) l - #endif
4 M, T% h) s! ~, R3 D; L7 [. B - ) {" ~& C$ c. z3 v2 F; Y1 K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 l$ S9 j) x! J) c: Q - #define STATIC_SHIFT 3
9 r2 g. h3 k ]! g3 z4 ~3 a z - #define TCINTEN_SHIFT 20
d3 b# U! [7 y- D( O d% \- Q - #define ITCINTEN_SHIFT 21" G2 A) V$ J9 `
- #define TCCHEN_SHIFT 22; j8 b8 x$ W7 h5 E& ?) _
- #define ITCCHEN_SHIFT 23
, p- |8 G% N! i( Q( T" u8 }% x
9 y* L0 \, Y+ e& |- O- static volatile int irqraised1 = 0;
+ O" P1 T x( h - static volatile int irqraised2 = 0;
8 m* _3 {5 C: y1 k v - ) W& N4 \( r2 u, _7 ]8 I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' d( s+ [, O z7 n2 H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# H0 N7 \% p8 `4 ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ^7 f# |* v+ |5 x
( X% p5 _% {/ r: O' d- dma_addr_t dmaphyssrc1 = 0;
0 G2 J% b# o4 d - dma_addr_t dmaphyssrc2 = 0;* E! R+ j' Y7 g$ i5 E
- dma_addr_t dmaphysdest1 = 0;
& S. u+ g2 x) U3 {% y - dma_addr_t dmaphysdest2 = 0;
0 t+ s/ f6 v6 b8 l3 R" G/ w U2 h
2 m/ Q) r% }6 m( V9 E! l- char *dmabufsrc1 = NULL;* O1 h. K3 }: D4 j- B
- char *dmabufsrc2 = NULL;4 [1 }2 N) z h" h) ^
- char *dmabufdest1 = NULL;
6 f6 {) C" [4 O7 n - char *dmabufdest2 = NULL;% R! ~7 W( ]7 m, D0 D
/ h# G/ |/ [/ i& p5 f- static int acnt = 512;2 Q+ }6 b2 P9 G/ J+ G
- static int bcnt = 8;* b$ {6 a4 B$ ]" l: P9 W
- static int ccnt = 8;& C" [" x9 F9 ]% P! G+ }4 s# R
- 8 N! @/ M* O% j0 m
- module_param(acnt, int, S_IRUGO);- L# R: u; o& m1 ~; W
- module_param(bcnt, int, S_IRUGO);' d1 X1 n/ C* j5 f- i
- module_param(ccnt, int, S_IRUGO);
复制代码 ) v& m4 Z7 J( N% K/ L7 p) D. Y
1 w& j3 y- B- f! z0 C) }; B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& a1 e+ ]- L8 O: G% {( M9 s) f6 Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 X" T9 V, L$ W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; \4 ?, M \4 z8 R" p+ K4 W3 F O1 l/ c$ B
0 g! L$ Y) x# K0 e$ O
|
|