|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & @6 P, p) w9 [* S8 w
- [code]EDMA sample test application7 d$ O. }! [5 ?, l, D/ [& R5 T
- /*
2 T. u3 J6 `$ B6 Z* ~ - * edma_test.c$ h' _3 z2 L* u& C1 d$ Y
- *( d, Q8 z& r8 p4 x( k( Q9 n
- * brief EDMA3 Test Application" @' I' z0 c" _
- *
2 a! n6 F; d9 H9 Y& O; s9 x% b5 k - * This file contains EDMA3 Test code.
/ Q) j- F% j2 x1 m/ k9 G! y, L - *" D; d! V( b; N* B0 w$ |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 O- n0 A, |7 c( ]: G8 Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, R7 ~; B. i: v
- * TO CHANGE.- Q# i' v' j( T1 `6 S! X3 H( ]
- *
! j$ S, W! k, f8 @1 A5 F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
@( Q/ r7 g7 d* k6 }! a7 b0 a4 X - *
) n" w2 E( G7 ] - * This program is free software; you can redistribute it and/or
0 j5 L, W2 }, y - * modify it under the terms of the GNU General Public License as
9 P B2 H6 g) k" p# Z5 `+ s - * published by the Free Software Foundation version 2.3 ?( ]# |+ g2 P3 B! |3 r2 H. U
- *: W- A; }! L* A9 L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 P; W: ?1 d& y) ?
- * kind, whether express or implied; without even the implied warranty
! [8 i1 o, \7 g# W% k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- `, ?5 K. D9 N0 B5 w; W- V, N+ m - * GNU General Public License for more details.- U& g+ L/ ?& f
- */8 O2 F% w& @' ^1 i; T/ I0 o |
& t4 n$ g: r0 v+ }3 f4 |! a Q( z- #include <linux/module.h>$ ^+ o* \" Q. B O& z$ J/ ?
- #include <linux/init.h>! ]" {, h0 u. c4 M
- #include <linux/errno.h>. p$ R! \' O/ w$ g
- #include <linux/types.h>
$ h% H7 U4 ?3 I3 k - #include <linux/interrupt.h>
1 r8 g! i9 r. p q% w& M - #include <asm/io.h>
4 u8 ^* C3 y6 S* [& y. `! x5 n - #include <linux/moduleparam.h>
- h2 |" w6 X: u* {, g# v - #include <linux/sysctl.h>
/ b3 F5 Z- i7 p3 n+ i - #include <linux/mm.h>
$ k. B4 F5 ?9 e7 A( I8 n! q - #include <linux/dma-mapping.h>
( e1 d7 S4 N& M P0 H4 ]1 P" W6 x" [ - 9 Y N# Z; i" [$ ]( V: a! q9 k! q J& g
- #include <mach/memory.h>
. H+ u, X( H* w- m- S - #include <mach/hardware.h>( p! e# l% u v1 R
- #include <mach/irqs.h>
4 X# Z0 V1 K+ ` - #include <asm/hardware/edma.h>
1 h- D4 U+ e3 K# A1 L - 7 V3 O) K! p8 B) X; u
- #undef EDMA3_DEBUG
& p& w5 w. n8 I" e/ ? - /*#define EDMA3_DEBUG*/+ a' J: o3 g1 y% L4 C
- 9 J) I; J8 ?. ~) T7 i/ a5 D
- #ifdef EDMA3_DEBUG% w4 h8 o& h$ W6 `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 H3 C: e# i* ^5 `. i* b6 y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 c( V; }( N( b2 U# |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! S, A8 V; T& C- z
- #else
E+ T9 w0 ]1 k - #define DMA_PRINTK( x... )
# `3 l& Q" k/ Z) A+ y5 } c - #define DMA_FN_IN, F8 t6 X- }6 e2 j# c+ c
- #define DMA_FN_OUT9 X$ f! |* g8 X9 n5 C, R7 a" P4 t
- #endif
6 d9 d+ ?- ^, m, T8 l7 ] - + G0 T4 l8 `' D" l' r, b: L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). g1 w* x, ]5 [- P
- #define STATIC_SHIFT 3/ g+ x' W7 D6 o7 d+ _, U% V6 v
- #define TCINTEN_SHIFT 20( f4 I8 D+ X* r$ d
- #define ITCINTEN_SHIFT 21
c2 x9 ~2 s2 C! n - #define TCCHEN_SHIFT 22/ K5 ~3 ~0 U- \2 @; C
- #define ITCCHEN_SHIFT 23
; r) X6 S X3 |9 ~
- l8 L& i, m V+ R- static volatile int irqraised1 = 0;0 ~5 f* Q& n+ r" V# [/ ^. `, X
- static volatile int irqraised2 = 0;9 V& T i4 { g# C
- & ^/ i; b0 t6 U! O( i. l" D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( s: j! h# ^9 Z* H, j! m0 b7 ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- k$ r) K$ P4 v6 r4 H Y7 c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: s3 |* }! A% h
- 7 Q+ X# H3 ], o y1 h4 _
- dma_addr_t dmaphyssrc1 = 0;7 Q# d9 x( `; p
- dma_addr_t dmaphyssrc2 = 0;6 ?2 l+ x6 ]+ Z
- dma_addr_t dmaphysdest1 = 0;$ x. a& S+ c" o. V$ x
- dma_addr_t dmaphysdest2 = 0;" ~7 K" q% g/ D) k
- ' }: a, \- U E6 t" L1 ~ s
- char *dmabufsrc1 = NULL;
, N6 F6 N0 q1 j- e. v/ S6 N! \+ J - char *dmabufsrc2 = NULL;; F) B; F& T+ N) ]( p: M5 h2 c/ q
- char *dmabufdest1 = NULL;
+ `. Z; a( L6 B1 M. R- A6 V4 ?. l - char *dmabufdest2 = NULL;* P3 @ \$ P; n/ Y0 f: V
7 I$ G; w7 b6 { _% t' w- static int acnt = 512;
' A' z0 W. \: u - static int bcnt = 8;
$ v: D& o# [) s4 R - static int ccnt = 8;
/ N) x9 T, G" w( ^- B: ^/ f# ]
3 d$ e$ M* Z& x" M- module_param(acnt, int, S_IRUGO);: | ?/ \* D! {% N R% `( y d1 t
- module_param(bcnt, int, S_IRUGO);
; G/ }. Y* l8 u - module_param(ccnt, int, S_IRUGO);
复制代码
) I* [0 P- K0 t
4 _- Y: m5 r" ~& N4 T9 A Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* j- L1 B* D) ~: Y8 O9 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( P! A, t6 T# D0 ~" m1 T/ ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! {4 \" V6 I- C2 v' @2 `
3 {/ ~- o# `6 C \# w( }6 ?& W% y" S: F! h* k& }
|
|