|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 E' q' V; W8 ^. q3 a8 p. |: ]8 z
- [code]EDMA sample test application
9 F) H1 r" U. G" E! z/ b1 H; O - /*
8 n. J4 `/ j" w - * edma_test.c O4 u( N2 E6 `# s/ Z3 ^
- *, J+ D8 A3 Q2 ~* J* @! L. V& b: F
- * brief EDMA3 Test Application
3 ~0 z$ q8 {0 y2 O. N" ^: f - *7 b. [! H4 N& d1 }
- * This file contains EDMA3 Test code.
) R; v. G, Z: Z+ I6 h! n4 y - *
) y2 V: ~$ Y! L2 r: w8 X* S+ E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 b; g" O& E0 { J1 z2 z; P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, n7 n* c4 S" o9 y& S: q
- * TO CHANGE." A9 z W: y0 c& B: @
- *
& Q. L# H+ a8 x! a' r, Q+ |" [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" F8 \% a! |" `. R3 V) D% i5 F
- *
- }% `' G* k. \; g# w8 X - * This program is free software; you can redistribute it and/or
+ T) }! O6 Z% w6 g+ i - * modify it under the terms of the GNU General Public License as& A% c k# f, W) {# `; ^
- * published by the Free Software Foundation version 2.
2 K8 R9 u: V& _# b9 Z, x" Q8 r3 t - *
. \- x" n/ e; d4 v k! q! u6 e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 I0 Z! o/ U Q" @5 x- ]: h
- * kind, whether express or implied; without even the implied warranty
$ S" P9 x+ l& K3 U: F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 r& N& o0 @4 b6 {% |" V# j - * GNU General Public License for more details.( x) y9 J s' i& w6 T p) J
- */2 x7 [/ i' D4 w4 c
- 5 |5 @( _+ W" |$ o: ^
- #include <linux/module.h>0 v. k/ w6 I+ Q' l. J3 f
- #include <linux/init.h>
+ Y! G) }% e! \. i6 L: ~- p - #include <linux/errno.h>3 v6 V8 b r. \" z! ?7 O2 P
- #include <linux/types.h>
' _# S" L# @# d% u& n f( `8 {2 T9 l - #include <linux/interrupt.h>5 w* W3 K: ]% ~4 {' ^6 W
- #include <asm/io.h>4 u6 r+ C) P8 r A& |+ Y }% E. m/ f
- #include <linux/moduleparam.h>
" k( c# x" m* s0 l7 z G) } - #include <linux/sysctl.h>
* g, U4 @" P1 A/ `2 @8 P - #include <linux/mm.h>
9 x+ ~7 T/ D5 `; D' v - #include <linux/dma-mapping.h>
( }: r& ? ]! U& g" x
: A2 L7 K7 N ]- l8 |# J( F- #include <mach/memory.h>
* ~0 u/ M1 x) b8 H - #include <mach/hardware.h>; t, n6 g& E0 C; i, Q
- #include <mach/irqs.h>
/ M# b4 A. `% o" W: v; T* s6 E - #include <asm/hardware/edma.h>$ N( l. k7 H& {4 |3 e
- 9 N* h) P$ f- w$ F
- #undef EDMA3_DEBUG/ i2 q! @5 S4 D% b0 z q
- /*#define EDMA3_DEBUG*/
" P! C" ?) ]5 J7 R6 G - 6 ~" H" D& B& y, ^+ A9 }* z
- #ifdef EDMA3_DEBUG p! J K- m5 Z& }! T' y& s/ c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 v+ F7 x+ ^* l4 D# h: l7 B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! C. _( F$ _- Y8 l# O8 t0 F( L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: q, w7 R# b8 G) N7 O& y( i: U - #else$ ?) x" g0 r4 _4 F9 k2 Y; c
- #define DMA_PRINTK( x... ). s: U' n1 n j" c5 o, f
- #define DMA_FN_IN; n, `8 o! G g% n) u
- #define DMA_FN_OUT
. }% T4 K" m7 h X* m - #endif
% k" N: W* `; Z - ( N2 k" c* Z, p6 k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: B/ D5 C! V- E5 j9 T - #define STATIC_SHIFT 3% Y* f5 ]& `2 x6 V
- #define TCINTEN_SHIFT 20$ I, u# w2 J9 h4 |' w9 c2 o* ^ n; d
- #define ITCINTEN_SHIFT 215 h* F; k$ _+ }8 p" t9 z
- #define TCCHEN_SHIFT 22
! U E0 g- a2 r1 y - #define ITCCHEN_SHIFT 23
8 }7 `9 t" ]6 p% \+ B - 1 e) U) p) b6 p! d) \0 V: J
- static volatile int irqraised1 = 0;
4 k9 {% J) G. x7 u - static volatile int irqraised2 = 0;8 @( N9 q: |+ f m# Z& A
1 M. g* J8 l8 ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% W d9 w' l$ h2 T. F3 u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( O2 E& E# v1 c, f0 j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# o1 k; z+ u f4 B/ Y
- $ b7 j* a. W: p* I/ d5 q
- dma_addr_t dmaphyssrc1 = 0;
( R# t4 d( H3 p' W* |4 a - dma_addr_t dmaphyssrc2 = 0;
5 C9 o$ Z8 U# A7 G3 m - dma_addr_t dmaphysdest1 = 0;$ }2 m& R5 J; q" z
- dma_addr_t dmaphysdest2 = 0;
5 G2 W/ `3 ^" v - 4 [ _. n+ a( y/ P& {1 u( Z
- char *dmabufsrc1 = NULL;& P9 F: z$ a/ r% h. ?& ^
- char *dmabufsrc2 = NULL;
+ a& |- Z& O# y2 Y6 \ - char *dmabufdest1 = NULL;
) v- i) X: a, X* [5 y - char *dmabufdest2 = NULL;, `' Z$ x8 O! W; W$ l5 K
, d- L( f& u3 J7 | p" o- static int acnt = 512;
8 e/ X1 a4 c) I; ] - static int bcnt = 8;& I' \. _* t4 j% \. |$ x! g
- static int ccnt = 8;
. E. }2 n" f0 R8 Y
; V' j6 k X$ R. {' \# O4 |- module_param(acnt, int, S_IRUGO);
4 b [6 f; r# _) Y/ W0 U: a9 { - module_param(bcnt, int, S_IRUGO);7 c2 A% R1 F" j0 _3 a
- module_param(ccnt, int, S_IRUGO);
复制代码 $ ?8 G8 I c: s0 ~, P! C0 u
) P1 Q8 _3 g& d% \1 N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( R3 \7 D# g: marm-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 Y/ i* S) U2 Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* i) ^6 n3 ?7 i. R
# I$ y) z8 P) i0 x( W1 d2 x9 k. {7 g" [; R# G' u
|
|