|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , V9 q' u* n- M
- [code]EDMA sample test application/ n- }7 I. @. E# |
- /*$ m7 p6 g. X6 ~$ d" S7 D
- * edma_test.c
+ ]( v( C8 q, k' h: ~ - *. C) `6 j0 [# a3 q n
- * brief EDMA3 Test Application
* x- p0 j, G. ^4 \7 U% \6 o7 l - *" t9 i. y0 {( h/ X; k4 e
- * This file contains EDMA3 Test code.
2 t/ c) j* y5 M7 u - *, Z1 q" r( z- ^3 C0 t- P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" B. W9 m7 c: F8 { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ c( d+ g$ g' ^ - * TO CHANGE.- z3 W, S H2 s
- *- C* ~) D9 L' D) q3 f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) {- d% r8 K1 w2 p1 X( o% M - *! S4 \$ H( \% g+ D! A a
- * This program is free software; you can redistribute it and/or
( X* J- N9 D! c# Y - * modify it under the terms of the GNU General Public License as. D/ z9 i6 {+ _) ] M; E( W
- * published by the Free Software Foundation version 2.
4 t, ?/ A% [1 L! g - *9 E! i% A; M& c* R& n# F* X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ Z1 i4 [& ^" i, m& P - * kind, whether express or implied; without even the implied warranty
2 }$ ~ u3 V; \: [7 I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) V9 L3 a7 ~# k9 @) x- W* e- s
- * GNU General Public License for more details.
: F! }9 P/ \2 l( C; h- { - */ ^ R" e- r! A5 l& U
; a* a) b% s4 `- #include <linux/module.h>1 k6 Y. }7 R8 x- ~0 U1 }
- #include <linux/init.h>8 ~. r( m* t: O
- #include <linux/errno.h>( [0 T7 h, z. [- D/ D1 z/ b% H3 L/ @
- #include <linux/types.h>
& O' c7 x( P! U8 L - #include <linux/interrupt.h>9 f4 S: V" s2 R$ ?1 |. l( _
- #include <asm/io.h>: F8 F7 _: z# @
- #include <linux/moduleparam.h>
2 f6 q, J) l% f+ ^8 Y3 y7 n - #include <linux/sysctl.h>
. o9 C, w) X+ i; b! Y - #include <linux/mm.h>
% K) W$ {1 y) x! r: S9 T! { - #include <linux/dma-mapping.h>( ~) h1 Y: ]# q3 v- ^
- " b+ O+ e# {6 J# k- ]
- #include <mach/memory.h>" U4 ?* ^7 Z: A+ C" b
- #include <mach/hardware.h>
) @9 r: C- K" J) l2 [0 E2 x - #include <mach/irqs.h>
4 q4 C9 Z f$ u" R( [/ Y. | - #include <asm/hardware/edma.h>
8 G4 {3 z5 u6 E/ w+ S9 X - 1 L3 Z( ]$ g/ p: x0 T0 [
- #undef EDMA3_DEBUG
3 R" z2 x. R# _! w$ B$ T" R - /*#define EDMA3_DEBUG*/
+ b! e8 \# s0 ~ - / }$ O. n4 x! x2 e7 E
- #ifdef EDMA3_DEBUG, C: R- [6 Q$ t* P/ X) y/ ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 P! u9 a ~9 n: n; T* U$ H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* L5 ?; Y5 T8 h1 E, I1 v, t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' c0 s6 l8 u6 _: L1 d - #else
9 O# S3 |8 `' T8 X8 W0 C4 K - #define DMA_PRINTK( x... )
6 G0 d6 O# U3 h( T - #define DMA_FN_IN, T$ l) w, r* }& A6 d N2 K, i) n4 y" u
- #define DMA_FN_OUT3 n9 i$ v& x: N
- #endif
0 v3 D9 b1 S- \ - 6 `: W1 F2 R* W% e) k1 e8 K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) Y6 s0 w4 Q9 m' Z* D4 Z - #define STATIC_SHIFT 3
. W- p* V8 D3 Z( E - #define TCINTEN_SHIFT 20( h2 \9 E3 E+ U$ N0 ?
- #define ITCINTEN_SHIFT 21
. J! E7 Z/ j' z) o+ X! B+ L - #define TCCHEN_SHIFT 22
|. ?5 ~( F: N! U# i' U% @' t - #define ITCCHEN_SHIFT 236 H5 [# G# |+ b' O5 Y1 v6 ]' O
0 N% T& v/ Q( ]+ b1 K1 m( ?, Z- static volatile int irqraised1 = 0;
( C& ?" D' T" Y6 s - static volatile int irqraised2 = 0;2 p5 i5 L! m: j o( ?* d! L
- 8 X0 z% w: P7 S$ f; c) x" H1 A: I! Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: R9 Q% ?1 Z/ ^! Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 u8 |8 C; N) a; }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 o* ?1 B. P2 |) M - ) S, z+ D+ k6 y$ b$ V
- dma_addr_t dmaphyssrc1 = 0;( G# U+ F! T" U" x: H! Y1 r
- dma_addr_t dmaphyssrc2 = 0;
! |4 ]3 b& n1 t, g( W" H, P8 [ - dma_addr_t dmaphysdest1 = 0;( u' f* _" d( l: U$ E
- dma_addr_t dmaphysdest2 = 0;' b, v4 y+ d1 l0 S3 W. ^
- . `3 b7 K: T1 d0 F' t
- char *dmabufsrc1 = NULL;
9 \0 j8 n( \6 A; G; Y8 _7 @ - char *dmabufsrc2 = NULL;$ q6 f' y; I: C+ o9 U! u7 M
- char *dmabufdest1 = NULL;
( l0 O7 }4 O+ M5 ? - char *dmabufdest2 = NULL;
/ S- U9 e' U$ C9 f8 o
! R" G+ E* n% G- c5 d- static int acnt = 512;( w$ D$ K! m4 x2 g& w2 v& u
- static int bcnt = 8;( `8 N+ H5 y$ A, d' w* `5 |2 u
- static int ccnt = 8;
& Q# r4 L6 r+ x0 z6 h6 r! m - & f; Y% d, T* h% U4 X
- module_param(acnt, int, S_IRUGO);* ?3 Y" S+ O* t
- module_param(bcnt, int, S_IRUGO);3 }( M+ m+ ~8 V8 c6 @
- module_param(ccnt, int, S_IRUGO);
复制代码
2 x1 Z- G, I- j7 j1 L( N3 r/ z' M. l& W- P6 I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ a0 m" A4 @. W0 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ G, g3 h( |& t+ w- J4 C( b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ w8 [6 ~( {% @7 }3 t# z
( O2 Z6 M" ^7 K: @5 N3 i* M8 a* X9 k2 D$ O: d! M
|
|