|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " u& Z2 ^, Y9 i9 {
- [code]EDMA sample test application1 m# \1 [. g, d, |0 ~' o6 ?
- /*/ a. l: q- ~2 q# G, S0 N
- * edma_test.c
# [' D% W$ [0 u, X, l - *
! b1 G, I" l& `7 O - * brief EDMA3 Test Application" _8 j2 G0 u- m1 L/ ~/ S
- *
) a9 U! U1 s5 O, f8 C - * This file contains EDMA3 Test code.
7 h) u/ Q _, G: S - *
8 Z5 {$ ^; n1 s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 H5 ^: W7 R: V ~1 ]/ ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& v* f; u, ]! s5 x7 k* ]1 I1 Z
- * TO CHANGE.% C0 b& j# Q+ o) C4 ?
- *
( o3 K9 z D& C+ d1 o1 ^) m2 `0 Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: @. {; F) T# z0 ] - *
* N F& `3 C* m. B& k - * This program is free software; you can redistribute it and/or' M0 q& a ]$ r3 w# G/ x
- * modify it under the terms of the GNU General Public License as9 m5 p* W; ~+ \! e3 n( x
- * published by the Free Software Foundation version 2.- |6 Z7 _) W; }/ n
- *. P4 Y: r( W6 c2 ?) ^% S% `# E5 ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; C( {' U/ v. R& W
- * kind, whether express or implied; without even the implied warranty& m- q! i; r& f8 I! @ U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. s6 o0 V) _- b) b! o - * GNU General Public License for more details.3 ]5 Y# o( }* Z. Z
- */# \" C' j( x: U( p+ q1 m
- & F% w1 R) a) T8 s s
- #include <linux/module.h>' b6 [+ N2 f( M1 r, Z, m1 `$ @
- #include <linux/init.h>
. g9 h. K. a! `3 x9 e - #include <linux/errno.h>
G9 U# b2 p+ {- O/ P/ a. E - #include <linux/types.h>0 a7 ^/ C! M$ w* ~
- #include <linux/interrupt.h>0 T( p2 z9 c& T
- #include <asm/io.h>5 y2 r) r1 L5 ]) R- [, E8 [& R* O0 a
- #include <linux/moduleparam.h>
) O/ }. d, p- C$ B7 F) f% D - #include <linux/sysctl.h>3 C# `1 W7 ^6 a% |; z
- #include <linux/mm.h>; o h3 T q( W: ^$ P
- #include <linux/dma-mapping.h>4 B, e8 }) p: k! H
& t4 N, h$ O$ \( c+ Y, d9 }( \% |- #include <mach/memory.h>
& p& I* \8 M% t+ U+ Y& f - #include <mach/hardware.h>1 h: U# w4 Z- y& J" V( c8 U
- #include <mach/irqs.h>
- U0 Q) \+ Y* n+ E1 K0 Q - #include <asm/hardware/edma.h>
/ a1 y* s( d. C2 P - - U1 R1 y$ N/ A1 l" B1 _) n! J
- #undef EDMA3_DEBUG3 T' A( P6 R( b2 v6 B+ F
- /*#define EDMA3_DEBUG*/
" ]$ Z6 R( ^9 Q- X, i! `( y - 7 S. V( X B+ b K
- #ifdef EDMA3_DEBUG
! w4 Z0 `3 E1 g& T4 }# s8 [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 H2 u+ `4 m. M" l- u$ M+ f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 u0 D; T% H) S, c3 A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
r3 H$ ^" J$ g @# k6 W - #else$ \& [" {& c5 `4 F
- #define DMA_PRINTK( x... )( E* ~* G, U O/ g# O4 P
- #define DMA_FN_IN
5 @ r6 ?+ ^# w+ z3 B) j" _* y - #define DMA_FN_OUT( B# s. D. o- M$ p* D
- #endif
0 }- |+ l! \* {7 `9 c- a, c7 a
: d% ^$ J$ d. A" y5 ^) x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' H' r G& \8 ~. ]% M/ a - #define STATIC_SHIFT 3" q. }# B8 B( D5 x7 ?
- #define TCINTEN_SHIFT 20; R: U' |3 i; R8 { I
- #define ITCINTEN_SHIFT 21
# P5 C" M! U+ ~" t( a - #define TCCHEN_SHIFT 224 |' i' E, e: M" Z" X: \% X
- #define ITCCHEN_SHIFT 23: H$ w T9 y/ V0 U
- 3 ~5 W. _* V/ _' [& `7 `# t: t8 z/ @
- static volatile int irqraised1 = 0;
7 o* M4 f, K* q - static volatile int irqraised2 = 0;" {! h3 T' w/ o
- 7 `& d/ s. r/ y0 b7 M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Z+ o; p2 \+ `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; X( }1 H6 ^5 g# J$ @" u1 t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); x% A/ ?, K: x- R9 S
5 x _4 x3 v9 \( r4 o5 q- dma_addr_t dmaphyssrc1 = 0;
; b( {2 J; g' x. a1 `8 x' k" S - dma_addr_t dmaphyssrc2 = 0;
9 v7 w: U# D1 M, T0 z - dma_addr_t dmaphysdest1 = 0;
N$ b$ H/ L/ E C, Z& F - dma_addr_t dmaphysdest2 = 0;1 j, t! z. F8 l( @ b. {) X
- / L9 |& u9 s4 b4 P
- char *dmabufsrc1 = NULL;
, D2 q! V& [+ d6 v, Q) ]! Q2 |: `) z. ` - char *dmabufsrc2 = NULL;
" A8 [; g, Z9 {- _8 } - char *dmabufdest1 = NULL;
" Z U% r0 h: G' N$ C - char *dmabufdest2 = NULL;! H/ m f6 | z# f
+ r: q- w8 {8 Q8 E6 ?- static int acnt = 512;$ @/ m+ f( ]- i7 m' x
- static int bcnt = 8;: n/ m3 ?8 M! d3 [8 m4 v
- static int ccnt = 8;+ ]* e) t9 @2 L1 [8 ^/ Q
- & h+ d7 H5 g* S0 R
- module_param(acnt, int, S_IRUGO);
9 l2 |8 [2 Q5 `! H5 g4 f1 t - module_param(bcnt, int, S_IRUGO);" W7 w' b8 I" C; z' k3 c
- module_param(ccnt, int, S_IRUGO);
复制代码
0 g( n Z" h, {8 d* y6 H
: X; T# |* {: g0 q- w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
I' O9 k3 r9 d/ Sarm-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 E0 r: L/ r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 n; ]. p- l4 V' Q6 n% M% c& e6 D8 c9 B/ C
+ l4 } Y; n2 b/ m8 t |
|