|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& ?4 l/ u+ S6 l, {1 y- Y- [code]EDMA sample test application B8 b8 M9 A4 Y9 X5 ]- [# x# n5 o
- /*! m. {* B# X8 h/ t
- * edma_test.c* u9 l. a6 H1 }
- *) j7 N* R, d$ P% F
- * brief EDMA3 Test Application _9 g) |/ a, b
- *
+ Z" Q( n7 y6 i+ _ - * This file contains EDMA3 Test code.
9 G; I) e# @, k7 ]6 w/ Y - *
; V4 @; j0 w( X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% U2 m9 c0 ?* ^5 m* v5 B/ J$ y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, B/ t6 L' Y5 t3 v9 p
- * TO CHANGE.
: G3 v. [: D! M - ** _7 |/ l' u# c% C* H( V4 A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. {2 ~( B2 }) u7 u - *5 Q0 d% L. I% C' x
- * This program is free software; you can redistribute it and/or& ^* {& [/ h K0 V
- * modify it under the terms of the GNU General Public License as
G1 @" q1 A; U( B - * published by the Free Software Foundation version 2.
( h. O b ~4 E g - *
+ Y. y9 L2 ]" E$ W2 Q4 ~2 Q8 P9 y! Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: W) B( s- H. N+ \. I+ o; J - * kind, whether express or implied; without even the implied warranty% N, k0 F' S; l- o, {4 f! s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ X6 i" X4 H1 N5 d - * GNU General Public License for more details.
& Q1 E6 c5 Y6 V" t - */
+ o) ^! C' K% j& f* L
- U& K5 Y. R& v4 Y- #include <linux/module.h>" t) [" Y: r |: e$ W
- #include <linux/init.h>
* D: n }- H1 x: g4 D' Q7 X# o# N - #include <linux/errno.h>
! S! h7 r7 V: U; ]" ? - #include <linux/types.h>
6 j, W# ^. w2 i8 c - #include <linux/interrupt.h>
8 k* m; ?/ D4 |( q6 U6 W5 l - #include <asm/io.h>
* h6 p, y+ D3 ~; s' a) _ - #include <linux/moduleparam.h>8 y4 p; Q; z' }1 T; L; n4 z
- #include <linux/sysctl.h>
4 q: ?4 O6 q# c2 A; A2 z. {& q1 C - #include <linux/mm.h>
1 ^/ z4 _$ V# P5 C! s - #include <linux/dma-mapping.h>- ?/ X9 B1 s% B4 U. W2 U
6 J4 K; f# g0 P& Y- K1 I: A- #include <mach/memory.h>
# s3 T9 R$ J: v, O1 E( I4 V2 u - #include <mach/hardware.h> v1 ]5 Y! t/ j0 ~
- #include <mach/irqs.h>4 j( G" G6 {+ W
- #include <asm/hardware/edma.h>
5 a) ^ i, G1 m/ J" ^7 A
9 h* m: L8 P. g% H: U( x- #undef EDMA3_DEBUG
2 k% o4 A8 v7 d - /*#define EDMA3_DEBUG*/
! j+ W) r! h# P/ |3 Z' S( X* c6 j - ) f! W( \6 @, [; k$ N: m
- #ifdef EDMA3_DEBUG
: o2 @8 e& d6 v) t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; ^) k/ [# E4 o" K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ `; Y" V1 z& s2 ]3 ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ ^3 E1 J& J+ Q0 z
- #else
0 O" f( c4 D% ]8 ?' e - #define DMA_PRINTK( x... )* g- y9 d) W$ h
- #define DMA_FN_IN4 a& |- \/ n3 k# o c$ y4 B8 U
- #define DMA_FN_OUT
% l' m2 L, E+ N, d4 |+ Y5 y - #endif
4 j h4 {# ^1 n1 W. [" b. Z8 a - - }# |- ^. M1 c$ d A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" Y' Y( ^0 W4 I9 c* }3 f - #define STATIC_SHIFT 3) a8 q8 Q4 B$ x4 k* O
- #define TCINTEN_SHIFT 20
% e1 X* S- [: ^- e$ ^! f: K - #define ITCINTEN_SHIFT 21
; H+ u0 q7 _( ~/ ]' T+ b - #define TCCHEN_SHIFT 22
2 d" N! h% K J. o3 q: s - #define ITCCHEN_SHIFT 23, j! {5 f2 Y# z
- + R7 V( A% T9 i* T+ \( v
- static volatile int irqraised1 = 0; v1 ^0 `( I! y4 h
- static volatile int irqraised2 = 0;3 D k6 n! J: a& C! B6 q' A' r4 @
- 1 E: X! C" p, ^1 F4 r# W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: O4 Z# m; x5 o' ]0 K u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! K0 z4 D: `$ ?% q, Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: A$ h5 c/ j! S
- q: Y8 E% ]0 l q* w$ C# ~8 {- dma_addr_t dmaphyssrc1 = 0;8 a, P! K$ ~+ N6 @, ^
- dma_addr_t dmaphyssrc2 = 0;
2 s# s5 ^" m1 _8 |+ k' Y - dma_addr_t dmaphysdest1 = 0;4 ^& F( N7 F/ s
- dma_addr_t dmaphysdest2 = 0;
# X7 b5 K3 O" a9 u- H. F - 8 [5 j! @4 G5 l- B. P. @
- char *dmabufsrc1 = NULL;( {$ J y$ H: Q' X D( B: [6 e, a6 R
- char *dmabufsrc2 = NULL;
4 ^8 A: ~5 t, z* P/ t - char *dmabufdest1 = NULL;
/ L4 N+ C& ~0 C: i, v$ w& L - char *dmabufdest2 = NULL;
- J9 P; D5 j& m: i
: H1 P# x) k) c$ @- static int acnt = 512;
" ?; Z5 C+ _5 E& U5 ~ - static int bcnt = 8;
1 [6 t3 f3 K& L- K) K - static int ccnt = 8;
* m4 I! J- x" Q& G! [ s
4 W Y" P; F+ \) b4 t `; [, A- module_param(acnt, int, S_IRUGO);
- H9 M1 H+ S. b& l - module_param(bcnt, int, S_IRUGO);; O2 R1 X7 w: C: l8 _
- module_param(ccnt, int, S_IRUGO);
复制代码 5 V$ W/ c' W8 W" ]4 _0 }0 S; @
* d+ [6 |: c: ]! V' T! Q! P% X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) J4 N- Q9 n n2 h4 k* p9 n4 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ l& E. S) t' U% T \- {$ s2 r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 u, c J. c) ^# ~
6 ?* [/ G4 U7 `2 Y
# ^+ q8 U- M2 Y' e }: @, ~ |
|