|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 L3 ^, F# R6 z) I- [code]EDMA sample test application
/ p* n; s c) x3 B- I; D - /*
( W$ p% f2 R: U" | - * edma_test.c+ s8 F0 j. i0 g% V9 E1 g* h
- *: w6 `! ~" I' w. S: S* |+ O- ` N$ Q
- * brief EDMA3 Test Application( J& d' y: l/ }9 \3 M; `5 |% h
- *
* ^9 B7 G2 Z' H4 m9 k' n. ? - * This file contains EDMA3 Test code. l+ a8 X) n5 ]. `
- * Y8 U, G4 F7 Y- f7 D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) p+ C! M% g3 l7 G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, Z/ v3 _" }+ s) ?# p3 a6 T8 i - * TO CHANGE.
1 o, H6 Q: q+ d% x% o* k - *5 d# _$ S+ y0 P8 R
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
H! b0 I, e6 { - *
3 \' w5 A- Q8 y8 g: ` d! R - * This program is free software; you can redistribute it and/or9 q! s' c7 q% z9 C" }* N( s6 _ a
- * modify it under the terms of the GNU General Public License as/ }+ u t* {, D5 m* _
- * published by the Free Software Foundation version 2.2 ~ s2 Q% H! l9 r! r
- *
. V1 @8 }( i0 H- }& j1 d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# O, g( ^% T4 d; g! I3 f
- * kind, whether express or implied; without even the implied warranty) n8 D- s8 ]' k% u* w7 y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& N! Y- R1 y( e8 V% ]. ~+ D3 P
- * GNU General Public License for more details.
/ Q8 V8 s, L" a8 j7 k& t; ]) } - */
8 i$ L7 A! ~ z) [) f+ f% u; P - . I. @, s. Q( ^# y9 W5 j6 G
- #include <linux/module.h>
0 k2 e- \9 H! s, X/ H2 l+ O" L - #include <linux/init.h>, {& o9 W; v* R( V9 k
- #include <linux/errno.h>
5 d; q* K1 W* \/ q - #include <linux/types.h>7 Y" `, \( M( ?* {
- #include <linux/interrupt.h>
1 i; Y% ~. L6 x7 k; | - #include <asm/io.h>$ J2 d( I+ o" V9 [1 c: T
- #include <linux/moduleparam.h>
) ^+ | i3 M B# r# t C: k1 F - #include <linux/sysctl.h>
2 @* N- ^' ?; S# H, h - #include <linux/mm.h>
; N) ^2 c3 a0 B- } @* U - #include <linux/dma-mapping.h>- k, J% i- g8 D" u
- ) v# v3 n, q/ T' m# T2 _8 E
- #include <mach/memory.h>6 V1 y+ F5 K6 W# G$ L' V- d
- #include <mach/hardware.h>
" F0 m" I C( \5 V# \ - #include <mach/irqs.h> q. c- V, f# B. J3 E7 R; F
- #include <asm/hardware/edma.h>3 ^* K( `5 U8 H1 l
! p+ n7 p3 c# w( o6 h, J% k: s- #undef EDMA3_DEBUG, ?% O7 _/ _5 q" d
- /*#define EDMA3_DEBUG*/; U$ p8 _; ?+ e, S4 A
- 9 H0 w) t) c3 O8 ?1 u4 x' P
- #ifdef EDMA3_DEBUG9 o: Y' Z: ?; U- o, d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 ^% ?4 W# R! ?) A7 l! f4 V. v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) p7 ]! B6 ]- i" Q4 [* c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); {- u, d4 g: \# a- e) `- J
- #else
. x1 f# F6 X3 ?1 ~ - #define DMA_PRINTK( x... )
- L8 x& }1 L9 s m1 M - #define DMA_FN_IN
5 q( w0 ], E7 k - #define DMA_FN_OUT
, u3 q% h J9 S! r4 }2 [8 C - #endif4 O' o$ a# w7 B8 `8 ^" Z! v
, ~1 l; l; i6 M$ u! e8 a- #define MAX_DMA_TRANSFER_IN_BYTES (32768); `# _ ?* R& m" u* C X
- #define STATIC_SHIFT 3
, R$ T: R9 {0 A) h; g7 o, s, H; u. y - #define TCINTEN_SHIFT 20
; ^! _3 V/ @. c" @, ]! p - #define ITCINTEN_SHIFT 21
# j5 J2 q y& | - #define TCCHEN_SHIFT 22" { c, S$ ^! _+ S5 {$ T3 y
- #define ITCCHEN_SHIFT 238 c% Y; f$ D: S' E, d
0 R m" [+ V7 U6 n/ n- static volatile int irqraised1 = 0;0 P8 o4 x8 B# ~
- static volatile int irqraised2 = 0; U+ q2 O4 w2 j( I5 K$ w* J
- & m1 w! i- s$ H' p: c" d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" s+ W( O7 B5 K+ d5 `, P( K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 q- O' E5 v/ l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 `! n% U. |. [+ V% e% B6 P
: {! d2 i S/ o, I* G8 p) t- dma_addr_t dmaphyssrc1 = 0;; p& X) l8 i& I1 @0 c3 V
- dma_addr_t dmaphyssrc2 = 0;4 @, Q" Z8 }( l' F t! q2 R! n; }
- dma_addr_t dmaphysdest1 = 0;
0 s' n$ B# @& R$ T) O) W. h0 \ - dma_addr_t dmaphysdest2 = 0;
4 D* ]3 f# u9 ?0 C
7 g$ K0 B5 _2 K9 e7 C! h- char *dmabufsrc1 = NULL;
$ I+ a6 I& V! [4 G( b+ H# ~ - char *dmabufsrc2 = NULL;
9 |$ ^$ I) C; P& N) m - char *dmabufdest1 = NULL;# n0 w/ |% i( m# a+ A# M6 z
- char *dmabufdest2 = NULL;
: K: q' C# h. j4 U$ I - 9 L+ z* ^7 g, Z+ _5 E) a4 q
- static int acnt = 512;1 Y( [% w" a- A; s- R- C
- static int bcnt = 8;: J1 ]# I" g) p8 k" T9 W: P/ u2 r
- static int ccnt = 8;
7 m# a# k& `- p
' l* @3 L" P- S' g9 C8 S8 ]' h4 A/ y- module_param(acnt, int, S_IRUGO);
( Z. U* W: u I - module_param(bcnt, int, S_IRUGO);3 n+ J' x# W0 [7 O
- module_param(ccnt, int, S_IRUGO);
复制代码 7 @( R! t: S# F x8 M# P& c0 r p
! k/ t0 Q1 m6 Q- Y \/ ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 q/ K- D: Y5 r) V2 g* g, tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ T; a0 Q! U8 G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 {4 ^; R4 E) n- R& x
' I/ L5 q; G7 H+ ^
5 Q2 Q# e: `! h
|
|