|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 x8 y4 h! l9 X' v0 w+ S4 }. ^) ]- [code]EDMA sample test application2 U& B) K L+ Q5 y! m# [
- /* A* w3 C Y; [, W3 a
- * edma_test.c
0 s+ ~9 \/ A% Z - *
* T, w# D8 w% _, d! }6 D - * brief EDMA3 Test Application
1 Z% P3 V/ j; t. K9 l5 Z+ L - *
4 X Y1 c; l8 V+ P s - * This file contains EDMA3 Test code.: C' a' J, ^3 I9 o4 f* x
- *) @; k! u: s# U9 _7 r8 D. `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 ~% v" c2 a j1 V6 I: n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 s; i8 f# @6 r/ X: m& u - * TO CHANGE.
7 C6 X M8 I! x3 j" I1 N# t8 o - *
9 J: G. H# z7 y9 l j8 ?4 a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" b# ]* m, ]* ?& ^ - *
2 ~2 n! [, s' Q# @" j - * This program is free software; you can redistribute it and/or4 {0 N; o- o f" E
- * modify it under the terms of the GNU General Public License as8 x$ h& N' E# k% x5 V
- * published by the Free Software Foundation version 2.6 U6 \! Z: x! @8 B: O
- *" [: z# Q0 y7 m: ? K& m) s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any E. A- c) h% ~' F! }" v
- * kind, whether express or implied; without even the implied warranty
9 u* w, Z, \" p, R; m2 E! a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. V: E/ |) D1 i5 s) \8 ^: Q1 x! X - * GNU General Public License for more details.; L. u9 F) ?; W- h' h; [' o* R) H4 s
- */8 t; w$ M: _1 B" T& X* }
+ ^" U7 |, a4 h4 [/ F- #include <linux/module.h>% q6 w- w0 a% m* F. s1 C
- #include <linux/init.h>" }# l/ m, m. O$ B' x) s6 \9 z
- #include <linux/errno.h>4 l& p1 R8 `* B+ C6 l6 E
- #include <linux/types.h>
" E. k5 s4 l* H6 t" {- p# | - #include <linux/interrupt.h>
6 d, W; r6 I4 v: H5 a2 M, E - #include <asm/io.h>
1 O2 |3 _3 T- j# I) ~0 Z( \* ?+ W9 ]: H - #include <linux/moduleparam.h>: T+ }3 B) ^3 J
- #include <linux/sysctl.h>3 x3 r9 T9 k1 O/ s' p- [- L0 }
- #include <linux/mm.h>% Y/ W+ \* D( @4 A* ]; C, r @
- #include <linux/dma-mapping.h>1 W% l! a! m5 B. b8 F
- - {0 `7 U- U4 m4 @% @! y
- #include <mach/memory.h>
. I9 h& X2 v' U - #include <mach/hardware.h>
w0 S j! @& m5 K- Y3 \( F - #include <mach/irqs.h>
( Z1 T! v, D, p* g( _; ?& b/ q. C - #include <asm/hardware/edma.h>
|+ a9 ^5 Y4 Q# p- ^ - 5 V( [ Q$ }* N* m3 i& ]& w( z9 L0 j
- #undef EDMA3_DEBUG
' x& q# n: v- }" P2 E! s, ~ - /*#define EDMA3_DEBUG*/3 y+ l: z7 R+ \& t
- 1 i9 Q! h' ~- n( r
- #ifdef EDMA3_DEBUG
* V+ M% g8 l# ?/ d1 U' { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 r! E" S* R9 V! o V+ I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 `. |; O, [- A# r2 i7 Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 H- F: |# A3 y) H* z9 e
- #else
( \: U) q7 f0 j! m/ E0 w# ` - #define DMA_PRINTK( x... )
' v7 y: ]5 u4 Q0 B - #define DMA_FN_IN
2 i+ B% G2 R- C+ @1 o - #define DMA_FN_OUT
; f' E$ X6 N2 G+ \" w. c - #endif
( K: I9 c* x1 r' `, f/ L - , b% I* }8 {& P# D2 _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: n/ o# P3 N) L - #define STATIC_SHIFT 3+ H7 R" ^( G. M+ \* n j$ g
- #define TCINTEN_SHIFT 20
: E) m5 W) c7 Z6 Q8 T - #define ITCINTEN_SHIFT 21
b- @' E" v% l* d! Q, Y2 a0 b - #define TCCHEN_SHIFT 22
' u# o) J3 d+ m( g - #define ITCCHEN_SHIFT 23
; |' i; Y4 b/ k/ S6 l - & R! n; m/ J# X9 i* ], ^9 Y
- static volatile int irqraised1 = 0;
( X4 o5 S8 O; |+ Z5 D" M/ F# G, D - static volatile int irqraised2 = 0;# j/ h5 Y$ T& S$ h
, h0 P- t* e* _% e/ j( \/ d) C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 J$ E( u% Z, i2 @( [! m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" ~" h/ X6 q* L0 o$ u8 Z# C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; i/ b, n( b, U/ Y; r6 c9 [
& Z/ G1 j/ [2 w# A+ C3 C- dma_addr_t dmaphyssrc1 = 0;6 O' \8 n8 b4 [7 \# S
- dma_addr_t dmaphyssrc2 = 0;
. M7 D8 q6 H; l4 M( b8 T2 {# S - dma_addr_t dmaphysdest1 = 0;
/ f7 D# N9 }' r; X' U, [ - dma_addr_t dmaphysdest2 = 0;
2 e: P: z4 H1 O& V( ?0 i4 U; E
5 a% `6 V# M. a- char *dmabufsrc1 = NULL; }' [( R9 }: v7 H
- char *dmabufsrc2 = NULL;) U+ ?7 K. O- D' H' B
- char *dmabufdest1 = NULL;8 L: }1 h" y& v. b0 N
- char *dmabufdest2 = NULL;
2 S( Y( l! l5 U9 }: z9 N+ E/ U' \
* o% Y2 r# P3 F! z- static int acnt = 512;
8 f5 A3 m5 V" i, x& z( A - static int bcnt = 8;8 R1 y+ q6 h* J- o3 T% V, w: r
- static int ccnt = 8;8 i& @7 U! B ]" E- D. {
4 {7 L9 H5 @: p6 r q- module_param(acnt, int, S_IRUGO);
. }' ~) x% e" z) `7 ^ - module_param(bcnt, int, S_IRUGO);/ d4 `, m @4 w1 ? R' L
- module_param(ccnt, int, S_IRUGO);
复制代码 . H' C8 h5 D0 L1 W9 R. @9 i9 w( p
! H! a2 Q8 }3 T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ E& m. ~! W+ b) A- ~1 I4 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 o1 B; Z* R# k0 s3 A% g, `5 V y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 d" | P6 D) M6 D6 i1 x
, h$ v/ N! A+ P5 ]2 e' x3 H8 V- k8 T9 J4 ?
|
|