|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 Y+ h7 h# J" `
- [code]EDMA sample test application
) }0 B" w. H G$ \# q6 h - /*- j3 B, w" b; V0 \6 ?
- * edma_test.c
; d9 S( g, }2 Z/ d3 { - *
7 B( I# [1 _: z& |9 q: j5 e/ b - * brief EDMA3 Test Application
* f0 h9 @ G. @5 @2 f - *
& D4 n$ e- ?; v - * This file contains EDMA3 Test code.7 W( ?! L/ r) U$ W |/ G
- *
1 g$ q! C# _3 C5 ? {( A6 T1 _- d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 n1 }. O+ ]1 k/ c) [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ M- J# Z" Z7 N. y* Y; E+ f
- * TO CHANGE.; D) U/ w, s% H% i4 }! v0 _2 x
- *5 J4 H4 O' M. ]. W0 H9 G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 E9 K" K# ?9 R; p1 j6 q9 N - *. z5 c" G0 @1 {; ^2 P4 o, W
- * This program is free software; you can redistribute it and/or
: o. Z' f/ Z2 F2 X* i1 ? - * modify it under the terms of the GNU General Public License as$ v7 W( J2 c# `0 ?4 i
- * published by the Free Software Foundation version 2.
) n# x# A6 D0 O1 H - *
5 k4 b5 k! g& u, P7 R/ d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% c0 Q9 f* k! L, P j - * kind, whether express or implied; without even the implied warranty
2 Y- U. N% U& y& `8 ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, d9 q f5 D1 J/ b& |! v/ X
- * GNU General Public License for more details.
! m; F! w0 }5 i+ u0 _" c - */
+ r" t+ S/ r" L$ R7 E
) c, {: f: p% I7 n+ n- #include <linux/module.h>
# B1 d$ S: @2 Z( l) }4 P - #include <linux/init.h>9 S+ M- n% P- \1 [5 B
- #include <linux/errno.h>
* F$ E: [5 c$ E: W - #include <linux/types.h>
3 f; k8 Z6 G: K9 K - #include <linux/interrupt.h>. m. ~9 B' ]; ]) `9 b, S6 A" W
- #include <asm/io.h>* w! c6 b. k5 E
- #include <linux/moduleparam.h>9 s( B& i7 I8 O8 L( F6 t3 `
- #include <linux/sysctl.h>
; a9 ^6 k9 g4 V3 c8 J - #include <linux/mm.h>0 @5 w. q* [+ A, |6 s* ]1 E
- #include <linux/dma-mapping.h>3 H% L) |+ U0 ]8 r: f, H
0 G& M7 e+ r( Y7 d- #include <mach/memory.h>' A5 a i) o7 q) a# o# U Y
- #include <mach/hardware.h>
5 H4 g" I. y6 q! x% {) K2 d - #include <mach/irqs.h>
8 n2 d; O0 G% v O& R% p, i9 T# \; ] - #include <asm/hardware/edma.h>
: a: @) \. N( R3 w4 l
: c; p+ g. b, c- #undef EDMA3_DEBUG9 i, b3 G, Y1 i! [1 ^) J' u1 {" A
- /*#define EDMA3_DEBUG*/3 I; j3 v5 ]! ^0 x
9 H. L" }; D" I. ]4 r$ L ~- #ifdef EDMA3_DEBUG2 s! h0 [1 V$ W$ j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: m/ v" |! T: {: s; c% D# [: p1 W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' v1 B% T8 [& w. L5 \2 b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). f# {& ~/ i; w
- #else, z# s5 k4 Y: X2 U! Z. ~
- #define DMA_PRINTK( x... )5 U% R0 q( z: J! ?
- #define DMA_FN_IN
; o+ E% e$ l( d' t$ k! ?: ~9 g7 V - #define DMA_FN_OUT+ J4 Z* g$ _# p. Y
- #endif
' ?9 T4 Z4 F9 o7 P3 J& w6 k
* H9 d5 n& B7 H v% U% E; F; O& `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! Y u4 C2 u8 i. q* v: z/ l - #define STATIC_SHIFT 3! {$ i( d5 v& }" J0 M
- #define TCINTEN_SHIFT 20$ W+ r3 R0 f+ N" e, t7 A' p3 w0 D
- #define ITCINTEN_SHIFT 21* q# b% A# x2 a/ s5 G; K- M" N
- #define TCCHEN_SHIFT 222 F) D, e2 i% w8 f0 v9 b
- #define ITCCHEN_SHIFT 23
' q/ l6 t: Y3 ~- R0 h
2 B: z3 | p8 b7 P- static volatile int irqraised1 = 0;, c$ [% v6 {/ r/ M, O* O3 z2 p
- static volatile int irqraised2 = 0;& _$ t- K3 E/ c- k, d E M% s
9 U9 S; f5 U, o L6 W9 d/ p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ?1 v5 q) n% e2 S6 X: s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 E( R. a4 F- l; B. r# w' g1 G+ G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 B0 _) H" F0 S6 E7 u6 F: u - ; _3 @; I7 D3 @. d- t! E
- dma_addr_t dmaphyssrc1 = 0;/ x$ Q* @2 B a: r9 l. E
- dma_addr_t dmaphyssrc2 = 0;
0 F0 F7 u: i: i( i - dma_addr_t dmaphysdest1 = 0;! s4 w$ E |# l" [3 R
- dma_addr_t dmaphysdest2 = 0;
1 s$ ^9 \8 U+ C - 8 Z" X6 H* l* T/ h
- char *dmabufsrc1 = NULL;
3 j9 p# g' g( K! a4 | - char *dmabufsrc2 = NULL;
9 v& t" ]$ A* s0 Q4 c9 P7 D# K - char *dmabufdest1 = NULL;
Y) a1 s8 O( M' [ - char *dmabufdest2 = NULL;
6 \4 \* x! v, k* W
9 `( C+ m. D! b8 A; {* k3 ?- static int acnt = 512;
. V6 U, P2 T4 S- ? ~! c1 o - static int bcnt = 8;
- z+ Y+ j2 S- O" @7 I" s - static int ccnt = 8;6 n0 M5 \& H* O% e, ]8 Z# R# g
- ! c5 e5 \- x2 J( s3 G# d" S' d6 S
- module_param(acnt, int, S_IRUGO);7 o- K3 N" ^. i' _0 N
- module_param(bcnt, int, S_IRUGO);% B$ ]* X4 S3 i1 E
- module_param(ccnt, int, S_IRUGO);
复制代码 0 M6 ]5 K: }) C% Q8 M
6 L" D- t1 b. ?. S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' f# @/ V: O n+ |* n
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 s' t- k- J9 V' D( }2 a( l. ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 X Q8 g% z$ X$ w8 F: z0 L( x7 w' M. v5 S& i
, P! a N, ~, ~$ E5 W; V/ K: a; O
|
|