|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & k* h) p$ r; ?7 l2 G' C
- [code]EDMA sample test application- S/ m' v$ m1 u) a1 S7 _% W4 l
- /*: S6 ~. H a1 ~; ^9 R5 Y0 W8 }
- * edma_test.c
' f- q8 S3 ^' X5 Z$ A - *
3 F+ A! w: w4 H2 I W' O. Q, j - * brief EDMA3 Test Application8 ^0 N+ ?, m6 Q9 Y, u
- *, c/ ~6 @/ _( ~: Q8 |, N
- * This file contains EDMA3 Test code.
* ]6 F2 e g6 }: H$ o8 v$ _ - *
6 d$ K1 j* m2 t0 u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 _2 N' J& w7 N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" f3 L9 w! d7 W - * TO CHANGE.$ t: t% O! U0 o. H, d( h
- *
: _6 F( p9 w9 C" c# } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 Y0 E2 ]9 l% H0 q* b - *- R8 b, y7 I" ~& {, E0 k: F; O
- * This program is free software; you can redistribute it and/or6 M+ o1 I1 Q9 e5 V' e3 L4 {
- * modify it under the terms of the GNU General Public License as0 G3 [/ {6 W }
- * published by the Free Software Foundation version 2.
* u0 i" U& a: _4 Q5 m( k - *# J0 r+ l; ^0 m) @8 T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 W4 M; c$ C9 U/ d7 w
- * kind, whether express or implied; without even the implied warranty
9 ?% i" u2 R A/ r/ i/ H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. H' g* p1 ~5 P" C3 {
- * GNU General Public License for more details.
% w0 d0 C2 [2 F - */4 N F/ D8 o: G6 ?( m5 L
- 3 ?7 I. b$ w/ |+ i9 q q8 y
- #include <linux/module.h>
0 D/ v+ d' i9 U - #include <linux/init.h>
! z- c$ H- A3 M; l! Q4 d: d% I - #include <linux/errno.h>! C9 j0 S; [! n
- #include <linux/types.h>
- I0 G5 T- R/ _" d' ^/ {6 p0 ?& I+ q - #include <linux/interrupt.h>
. p; J1 F, W& \. x# b! L - #include <asm/io.h>
2 R; q( I6 e- ~7 B, B - #include <linux/moduleparam.h>4 e& u- i" Z/ ~1 {2 [! z! @- ^
- #include <linux/sysctl.h>
$ P2 N3 L5 R2 A' [. g3 A! G - #include <linux/mm.h>" p! k r9 p- i7 p% j. l
- #include <linux/dma-mapping.h>
4 B7 g& B. j6 o1 r% z, X8 w/ K# j. H - ( K' G# U! x5 v9 {! {6 ]( A6 Z
- #include <mach/memory.h>
) k: a+ W; f/ i9 s5 P - #include <mach/hardware.h>
- a* d- }. g6 i9 a: }# j8 M/ ` - #include <mach/irqs.h>
; j% i* G# k& {8 [2 d7 N - #include <asm/hardware/edma.h>
& C# Y$ \; r# a" R, ^( P0 X5 K - 5 x+ ~! k% o0 N6 K; e
- #undef EDMA3_DEBUG% c* w/ s/ z( X- A1 n
- /*#define EDMA3_DEBUG*/
n# a! P7 ], k/ c+ x3 l `+ { - % ]5 y$ W2 g: `* K) R* N
- #ifdef EDMA3_DEBUG7 L! `1 N3 v$ }2 y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ [" V. n" @) @/ L* l, A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 m0 g8 G0 R0 g! g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# A! J( I8 V- h* A - #else; F% L# v T. }" q" a2 C
- #define DMA_PRINTK( x... )
, t+ q1 U' X4 E/ i! f - #define DMA_FN_IN
5 F9 [9 z4 e5 a" f% d$ j; N - #define DMA_FN_OUT! i8 @( t( J( B! Y
- #endif
6 N5 L9 Y1 {& i; y
3 E! M9 N$ i" S1 s& l% s, \* h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 z( b7 X$ s3 J; I+ _# {3 x6 p, C - #define STATIC_SHIFT 3# c6 v- i3 T9 {* o1 Y9 i
- #define TCINTEN_SHIFT 20
8 Q$ c6 {2 M w% s - #define ITCINTEN_SHIFT 21. G o3 h* W x$ b1 l! g
- #define TCCHEN_SHIFT 22, t6 L1 L) Y2 X7 t0 ^
- #define ITCCHEN_SHIFT 235 {2 m# O2 G5 O. Q
- ' n5 b9 k! J) ?/ L4 D! U* r9 G6 [
- static volatile int irqraised1 = 0;
6 m& P0 P& L. w l& [9 k/ K; E - static volatile int irqraised2 = 0;
; p" \, I1 C0 V- c3 G5 k) C& \- X - 8 w: ^# O7 v! m- |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
G0 P. Z) a' ?$ B( k5 f9 @ T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ k1 X9 j3 v; E5 z. i% M* c! u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 \5 o; E" y2 B
7 C9 \# H6 p$ j# F4 `5 ?! \- dma_addr_t dmaphyssrc1 = 0;
3 ?0 s# d. S8 l: A - dma_addr_t dmaphyssrc2 = 0;
8 l4 F- x" n# ?8 T - dma_addr_t dmaphysdest1 = 0;
, f0 l, D4 W* s4 W- T* b1 v - dma_addr_t dmaphysdest2 = 0;
; S2 c8 Z0 S8 w - $ Q) c+ E! s B* v0 q# L
- char *dmabufsrc1 = NULL;; [0 `6 V3 x% P: _, P! `
- char *dmabufsrc2 = NULL;
8 G( G/ V( d1 u - char *dmabufdest1 = NULL;9 [6 H0 h% p# v4 t" D" ]8 w
- char *dmabufdest2 = NULL;
& j/ p. _6 T, N; u0 X
2 g$ Q4 D/ Z) R$ a- static int acnt = 512;
: `7 ?/ f5 B& E) b, F - static int bcnt = 8;
! J$ D0 s- P0 z9 Q - static int ccnt = 8; \/ I& C" I/ U7 Q+ N5 w& \
1 d+ \! n9 j% K6 i- module_param(acnt, int, S_IRUGO);" A5 o) O- }! R
- module_param(bcnt, int, S_IRUGO);% ~1 U+ W# o# A
- module_param(ccnt, int, S_IRUGO);
复制代码 ! H! H7 M6 c: |8 ^) D0 G
8 l P+ A8 h: @3 o$ @/ g! Y* J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. f8 U3 m; C* P7 ^) }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 D- X' [6 P0 j. D8 Q& f( F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- k4 I8 w. ?9 ~$ S/ \" E+ f5 l+ `$ V4 x; O
/ D/ q+ Z) a- a! Y( D9 ^ |
|