|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ ` t+ a8 @* x% |- [code]EDMA sample test application1 U' D' y3 r, j
- /*8 T) w! B4 Z3 h5 B0 \0 \- }5 S. {
- * edma_test.c
7 [0 [% H) [. T' `* r0 ~ - *
$ m; t* ^3 s4 c - * brief EDMA3 Test Application
& K% M, O) O5 w2 ^( P - *% T* k! d: o% s ^( R; v
- * This file contains EDMA3 Test code.
( c) l- M3 G7 W* T& k& T- N - *% l# |/ M. l' `, t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 i. }% y$ v) V; v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- ?$ O2 F) `8 a. I( y } - * TO CHANGE.2 o6 ~1 e6 R8 ?3 g# P
- */ B' F9 x* _! C: V8 Q& j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) u# X, p7 O2 S( Y$ V3 _ - *
9 g, S/ m- A1 Y& U$ t+ P" t/ g - * This program is free software; you can redistribute it and/or
* {/ |* p& B% ~ - * modify it under the terms of the GNU General Public License as
; ?* L1 q# p& P1 N: u. ]* W# R3 U - * published by the Free Software Foundation version 2.
. R% B* M; D" e3 w Q5 O - *
) S5 k4 e' s8 a, Q+ k/ f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& V1 N" D3 J5 ~4 q% Q: J
- * kind, whether express or implied; without even the implied warranty
, _6 r/ n' ]/ t0 z) p$ `6 C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the N; J7 e8 E* N* N- I* X! @5 d
- * GNU General Public License for more details./ p3 x' F* n- ]. J# Y
- */0 K1 z- U# r# V+ R Y. }( F
. t( j8 s1 v$ F( n+ C L+ V- #include <linux/module.h>
+ W) y) e4 X+ w. R% m; Z - #include <linux/init.h>
7 _6 U( @/ T6 V2 @/ u5 o - #include <linux/errno.h>
( D/ k" g- l! i) p- S - #include <linux/types.h>
3 B* Q( r* Y, l+ f; n - #include <linux/interrupt.h>
. \% G5 F& U1 L2 x k6 K7 N - #include <asm/io.h>2 _4 t# `7 Z9 ^/ e7 Z
- #include <linux/moduleparam.h>
. ]7 U0 C9 G; T - #include <linux/sysctl.h>% e% h; D3 t7 }8 c) ]0 r9 F8 |
- #include <linux/mm.h>
$ z }* Y" T: j/ F6 s1 T - #include <linux/dma-mapping.h>
4 f4 U7 w$ R# m# k1 `6 j: M - 1 ?0 C" \ z R* b8 B
- #include <mach/memory.h>
5 ?' c6 V& w8 {! W - #include <mach/hardware.h>2 J8 L, s2 P9 {6 V6 |
- #include <mach/irqs.h>
) Y% w. a+ u" o; A( E$ m - #include <asm/hardware/edma.h>
7 f8 `0 _7 X' a& _" C - , w, ^, n9 W, m/ d( n1 f
- #undef EDMA3_DEBUG& t8 K' h# B/ ?) g: V
- /*#define EDMA3_DEBUG*/2 @2 s$ \) Y4 `& l; l
6 H2 C+ W0 \4 A q2 i- #ifdef EDMA3_DEBUG& Z: n' Y8 K: l& t5 U8 T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 J: E( f: A+ u4 x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). Z0 x. s" F e; B; Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 o, f g/ \7 P) u# {
- #else
2 C; R6 \ A4 `" ` - #define DMA_PRINTK( x... )
" [& J1 D, W$ v3 @ - #define DMA_FN_IN
! Z) b$ }6 u5 T# m t/ } - #define DMA_FN_OUT$ L3 C/ D: P6 K
- #endif& j6 E$ k5 I/ [; z6 w" o( [( h# N
2 n0 U n: A! y- #define MAX_DMA_TRANSFER_IN_BYTES (32768) S0 C$ s# y3 i1 `: s5 {- J3 R
- #define STATIC_SHIFT 3# x' ]' f$ @% { }6 A
- #define TCINTEN_SHIFT 20
/ |2 h* R( _' ]! Q* C' _ - #define ITCINTEN_SHIFT 21
6 K" B$ y7 f' E f - #define TCCHEN_SHIFT 22
. f( N" ~; N% J) V: V7 a5 a - #define ITCCHEN_SHIFT 23
7 N9 p0 a% v1 i, Z7 i
8 ~: e0 `8 L! K, m- static volatile int irqraised1 = 0;$ v" a7 @ K* G# D u
- static volatile int irqraised2 = 0;
3 X _4 F4 t% Y0 W1 a - ! h% b: l+ {; i Y5 F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 V l7 L3 K! D' ^! K; E9 e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 x7 [- E. Q; a N$ m1 T& N2 B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! i @+ M0 g6 p+ C
- / v7 d% w+ `# s/ t- q) j
- dma_addr_t dmaphyssrc1 = 0;
3 P$ j- t9 v& r$ a - dma_addr_t dmaphyssrc2 = 0;
$ Y9 x: [; X2 e8 H( d! m- V - dma_addr_t dmaphysdest1 = 0;* G! t5 L0 t& F7 H
- dma_addr_t dmaphysdest2 = 0; _" p2 _# A. x7 K; M* W4 L6 c7 p
- / v; {$ P' X- N- ~$ L
- char *dmabufsrc1 = NULL;
" j- k# {+ ^- d; W7 n( `" p, L - char *dmabufsrc2 = NULL;
& P% S/ h2 H1 ^- L7 y* C - char *dmabufdest1 = NULL;: {3 E C% R. Q. _; l
- char *dmabufdest2 = NULL;
) e( J* D7 x- k - ! F$ `% @. o& M; X/ S) R
- static int acnt = 512;
& x3 a7 o! z# w8 l - static int bcnt = 8;0 D$ V p3 c& ?
- static int ccnt = 8;, f) y" E, @8 T; [2 t, N; q
E+ |2 i5 Q1 a. u- module_param(acnt, int, S_IRUGO);
- V3 Y8 G$ B E - module_param(bcnt, int, S_IRUGO);
0 @! G' N! i0 @ M: i9 z5 l, p - module_param(ccnt, int, S_IRUGO);
复制代码 + q3 m4 K' m+ Z" D
4 }" g, k6 W' S5 C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 I. L! B; ^0 X8 M; {# i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( ]- D. s# f2 P! G1 Y, z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! Y* ]2 h/ V6 q1 I E: D
' Q" d5 Q4 Y) Z0 |9 T0 a& S
! \2 g: K/ g) Y6 l: G' b- o |
|