|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + ?' D, F4 o) R1 I
- [code]EDMA sample test application
% R: M4 s) Q+ D% Q. i$ G3 X0 X2 I - /*& }; N- r5 t0 ]$ v% O( q
- * edma_test.c
# a5 ^0 c( }4 g' f( J* h - *
) `; s& ^* f* O# l2 v - * brief EDMA3 Test Application
; W6 n1 L. \5 H5 @2 n - *# u0 J2 t6 d1 H1 |- F; g) j8 a# c$ k
- * This file contains EDMA3 Test code.
5 }" Y- r8 w# F2 k* R - *6 H1 {) j/ Q0 W! q7 q2 i8 G8 C9 e) W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% P8 f8 b4 S% b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& p5 q( Z% F/ e0 K7 |7 ] - * TO CHANGE.
% H+ @+ d! Y" h - *. a/ D/ N0 a: c$ M& `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 W& v8 s( p& @5 `* |# \$ j0 a* b - *7 Y5 x, {+ p7 k
- * This program is free software; you can redistribute it and/or
2 J* {( U3 C- N6 J6 | - * modify it under the terms of the GNU General Public License as
( y" @. ^/ G r- V! n) _5 R - * published by the Free Software Foundation version 2.4 h+ r7 j4 G$ h
- *+ D& D \- ~$ B+ M1 u8 W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% W9 W& Z3 o! C/ [
- * kind, whether express or implied; without even the implied warranty
3 @8 w0 K5 \5 B' d( Q$ o( w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* g5 i: T6 j7 A0 g) a$ X x% a - * GNU General Public License for more details.
3 H( J, M8 p I$ q" b - */* d& k9 @ D5 k2 C$ J, |
- 4 A8 [9 A' O: @4 n
- #include <linux/module.h>+ x* [3 O9 V* V* }; w$ p
- #include <linux/init.h>
; t$ f+ M$ F( @: ]1 C0 l0 h9 f$ ~ - #include <linux/errno.h>
2 ^7 v" V6 {: @- { - #include <linux/types.h>
0 x0 M9 d* g# L1 V6 ]9 S - #include <linux/interrupt.h>/ G4 K) z9 ~7 D* M1 `& ^
- #include <asm/io.h>
$ F( l1 ~0 o. g1 j; e* U5 {4 ] - #include <linux/moduleparam.h>& X3 h& {6 r* N5 P) K
- #include <linux/sysctl.h>
$ ^ d+ V( ?& b/ I" y, k. P - #include <linux/mm.h>8 m, x8 C$ t5 |- u
- #include <linux/dma-mapping.h>
9 j) \1 C9 \: ^- k - , H6 M2 |2 H( n! e0 y" W
- #include <mach/memory.h>
( w) O# R0 w8 ^4 i/ u1 w2 I8 b* m - #include <mach/hardware.h>
3 S7 j' ]: U0 s; j1 P' \ - #include <mach/irqs.h>2 C: `3 M7 H l' H M' Y4 F% }! h& Z' {
- #include <asm/hardware/edma.h>
7 U8 i0 L! o: G, r! C+ R
: ~* D5 _( f2 c* i# B& R; C/ S% m- #undef EDMA3_DEBUG: a1 @7 p4 S6 T! `
- /*#define EDMA3_DEBUG*/5 A( x' u, a' n# Z3 `, T! d4 m
8 y6 I; q7 c) e1 D- #ifdef EDMA3_DEBUG" }. |7 v0 U; g4 H; E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 l" G) h; m( J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! z! S6 y5 z$ ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 f9 I' }9 @ f' d# ~6 M
- #else. l& @8 h7 Q7 }
- #define DMA_PRINTK( x... )4 _8 c1 D5 w' X) Z5 I% u
- #define DMA_FN_IN
! `7 b/ a4 J/ C2 J8 `- ^1 P5 c4 ^5 C - #define DMA_FN_OUT
9 G' I: i8 [" Z: B# n - #endif% I8 M7 N" G, t n: n4 H$ D
- * X% s/ b' h6 R7 _) w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) _: u! c' K Y& }+ [+ X: O
- #define STATIC_SHIFT 3
1 A! k7 [( [* a& E3 D" M6 g - #define TCINTEN_SHIFT 20* ?- V/ \9 N; ~7 K
- #define ITCINTEN_SHIFT 21
# K% a! a" N+ V - #define TCCHEN_SHIFT 22" G4 E7 h; u6 F5 f" G2 D, G
- #define ITCCHEN_SHIFT 23( ]' E6 T1 y6 U4 |
- 2 Z9 f8 s, t: C% _! C
- static volatile int irqraised1 = 0;
) ~5 w1 ^6 V1 k3 T) J - static volatile int irqraised2 = 0;
7 {" X3 R4 Y, T9 N7 S/ T% x7 ^7 ]% r. n
0 ^! l/ U8 v8 X! ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 U; F7 h' E$ O. X" {" g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 I/ |/ E0 w( _. V3 ~+ Z! J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 D) q) @. j, F$ Q9 o
- & x3 s7 J( o' v* b( ]! y
- dma_addr_t dmaphyssrc1 = 0;
1 f- x$ l# ^+ c) w9 g/ Y - dma_addr_t dmaphyssrc2 = 0;
/ o% H% B8 L% h! A. T! F - dma_addr_t dmaphysdest1 = 0;7 n' O3 t% S7 K: H2 c' l; {
- dma_addr_t dmaphysdest2 = 0;, @. M. B2 Z' M* ]- [
: Q n! b) B( D0 U- char *dmabufsrc1 = NULL;
, ]5 ^- j- g$ ?4 ]4 ` - char *dmabufsrc2 = NULL;( f, ]" J* `) H3 P) c
- char *dmabufdest1 = NULL;" [ H: }; |3 r. u5 K, l1 F: V3 n# k
- char *dmabufdest2 = NULL;' s8 D& v1 \, B3 `
6 r# Y+ e* ] U' g1 S0 I- static int acnt = 512;
* a) X+ R7 u- i& J2 j8 b, U - static int bcnt = 8;* O3 z7 E1 Z; b- M% I5 P9 B
- static int ccnt = 8;
+ }) M A" I( a/ Y' p2 c) W - ' A/ b; a" b3 L8 F' E
- module_param(acnt, int, S_IRUGO);. g- o. r( R: P; y V' ?0 e
- module_param(bcnt, int, S_IRUGO);
% N# T% W8 J! Q- g, e' G& ?' `: D* E - module_param(ccnt, int, S_IRUGO);
复制代码
9 h Y v9 H* f( G) ~- T, G( @! A1 `+ @2 D4 I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 Q" y8 I j: V6 f1 P* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ N3 I- z2 s; J# j; s6 G: P% f# J7 c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# G- m9 A; `0 [1 d V. {" n) r! p" A# F
; h! A; O3 Y/ d0 a9 O+ Q) g: }' u# e# \# K1 s
|
|