|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( L& k! w9 ?6 b9 r. A
- [code]EDMA sample test application
9 t4 s w" h9 J" d, h - /*
8 {* n/ z& \& t: a' L0 q; s3 @ - * edma_test.c
9 x: s4 Z- W4 s( Y- G" @ - *. p; s6 f' z# [8 Q/ t
- * brief EDMA3 Test Application5 i, @- |+ x1 C" W# ^& M% _) D' }
- *6 ]5 E& `0 Q6 G" @5 v# n
- * This file contains EDMA3 Test code.
' [* z. `7 \) M; T7 C - *
/ B7 J; D J8 A; w" c1 W J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 Z1 }2 o( R9 F- }8 K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ ^1 A3 v% c# T) T& G* M7 ]
- * TO CHANGE.( Y5 L5 g& n' J* j
- *
5 }+ ~1 y8 X# c6 n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; Y9 }6 D- |' S$ x" ~) _
- *
4 [6 G. \% [# M+ M G4 |6 S4 X - * This program is free software; you can redistribute it and/or+ b' @- A) I U( j& u' T2 M
- * modify it under the terms of the GNU General Public License as; e3 }4 v& c9 G k$ `
- * published by the Free Software Foundation version 2.
) j: D( ^( s6 v4 ]! U9 Y8 Y - *+ l& ~9 j, M6 z: Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# X, L6 c& _& Y7 `
- * kind, whether express or implied; without even the implied warranty9 Q( b# i' W8 g! ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; R1 | A* L- d; t U
- * GNU General Public License for more details.
9 P" ^" i" f# ^& t1 y& v - */: ^* r* W& V$ W8 w; _6 n& v7 X1 c
) x2 u% X+ a% P' L, F4 X- #include <linux/module.h>
4 b% h. q# F) A" W5 \) M - #include <linux/init.h>
$ a: ], }6 K( \; Y% k" ?! g - #include <linux/errno.h>! q( h# r9 d( Y8 p* M
- #include <linux/types.h>
. V: _! R: \' Z( C: ?& a - #include <linux/interrupt.h>1 B$ ~% f& R; x( j8 R F, n9 a
- #include <asm/io.h>
3 ^+ Y! J( H+ b% A - #include <linux/moduleparam.h>8 h" e+ U+ a2 V% O% d4 H8 R1 U
- #include <linux/sysctl.h>
2 g" i+ |! _. M9 X - #include <linux/mm.h>! v5 L2 L* v4 N5 o" b- F/ Y
- #include <linux/dma-mapping.h>
) s# X- P$ t5 P* O! c
) V$ B+ ~/ Y) {" a6 _( Z- #include <mach/memory.h>
! ^3 n' Z% ? F2 A - #include <mach/hardware.h>
- `% D, l4 [# d - #include <mach/irqs.h>/ m" d% ]3 X3 [
- #include <asm/hardware/edma.h>
3 S6 M/ ]/ \0 E6 y6 W$ k/ h - 8 w6 K6 J5 Z6 d* x4 ?' F- }; a8 S
- #undef EDMA3_DEBUG5 L8 i# S4 e; r* W' x
- /*#define EDMA3_DEBUG*/0 L$ m' \5 F! ]5 O v0 _5 J
- 7 X- n" L' N& y, v! \
- #ifdef EDMA3_DEBUG
) w, J/ t9 o$ K/ R; q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 S' p7 m z$ y7 ^# k/ j8 B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 p2 [8 A# v( u5 r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 K% e4 m8 Q8 m
- #else
7 H* s6 i1 _: z$ J2 i9 v - #define DMA_PRINTK( x... )" ~1 t5 H# n |0 [3 N; X
- #define DMA_FN_IN$ }( a- q( T7 D2 U2 j- a7 H
- #define DMA_FN_OUT! O3 V9 T- r/ O
- #endif
" ^- t4 B2 v/ [0 x7 _: ~, u4 d - ' o, [: |+ u ^1 H! u$ n" D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( E7 O) P- v% y) p, E - #define STATIC_SHIFT 3
! I# d9 |: T8 e0 b- s. _( q5 R2 a - #define TCINTEN_SHIFT 20
" M; T, l% N* ]8 p1 P" X4 t" J3 M - #define ITCINTEN_SHIFT 21* _( L7 ?/ G% @' W* u& l
- #define TCCHEN_SHIFT 229 G; O4 i) H& A' x
- #define ITCCHEN_SHIFT 23
! y% f* K1 R2 m, p. e( ] - - }6 H6 K. D" N; Y
- static volatile int irqraised1 = 0;
, a, A* K f- Z - static volatile int irqraised2 = 0;6 u; P( V3 E1 z
$ i* a- r4 q6 Q$ U8 O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 C+ N, M N3 U3 _* D( A# u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) Y+ t, p Y/ b8 C2 D+ k N; O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* f+ J3 r$ x5 J! A# S. i
! e; ^! \3 w- K+ p: S- dma_addr_t dmaphyssrc1 = 0;5 f0 }+ K4 O. P% E
- dma_addr_t dmaphyssrc2 = 0;
7 G1 \! Q. z- A+ n% B - dma_addr_t dmaphysdest1 = 0;6 a, \; e6 E l5 t/ ~9 o: R
- dma_addr_t dmaphysdest2 = 0;3 K `* I1 ^3 h
- % b ?+ W+ u! m: ]3 C+ V7 \# F( ?' K
- char *dmabufsrc1 = NULL;& p- {9 [5 m& F6 _7 V/ L
- char *dmabufsrc2 = NULL;
! V4 A1 n; B/ g0 Z - char *dmabufdest1 = NULL;
6 f, [5 {/ U; m; x2 s: d' A0 n3 j* v+ } - char *dmabufdest2 = NULL;0 r# N# A, z1 I( U- t0 w0 t
- 7 w7 Y0 |; Z- k
- static int acnt = 512;, G- ~3 _$ g8 q6 f
- static int bcnt = 8;
3 h; D" D5 b) ~ P; f; p K1 N9 r \+ Z8 C - static int ccnt = 8;
' x, z3 w8 C) T+ v3 _
, M) m U1 _$ q$ f. L- module_param(acnt, int, S_IRUGO);7 z9 v4 ]1 c3 Y- X3 e
- module_param(bcnt, int, S_IRUGO);- [4 w* K; z$ p& v: H
- module_param(ccnt, int, S_IRUGO);
复制代码 & r! h+ N; M+ U0 W! Q, I; f' ^
1 N2 O+ [! N! f+ v' B. E% a* L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! W0 @: X- I* O1 v E; W0 \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 b% \ K! s3 y9 G' \5 V6 | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) y. c8 z0 \1 r# N
" O; a( m9 n, W4 V- I/ r' D
8 K+ u h4 E( J9 O( c6 C$ H |
|