|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & X& {8 W6 Z( y2 }
- [code]EDMA sample test application* M- R' x% f1 @. Q
- /*$ P3 K4 R! _ M* W
- * edma_test.c" |# ]/ k- G' ?4 M! M" F$ B3 Y7 I
- *
" G+ J2 O9 c+ n8 w$ w - * brief EDMA3 Test Application% _$ o @5 B6 ]( r
- *
) s5 X7 t. l U% a2 n - * This file contains EDMA3 Test code.1 U: U: \, U3 }
- *
) O6 x; m- g w3 l5 v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! z: H* K1 \- A( o {1 n6 @. h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& j9 }; ?0 h( n9 ]: d
- * TO CHANGE.
0 h* O. z3 U/ A$ |5 L" g; j x - *
" C# M C9 g. s' u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. \2 V7 y8 R/ T) }" }, A' x' O - *) \" g1 u) P$ [% u
- * This program is free software; you can redistribute it and/or
. \& L0 j7 T4 D+ T - * modify it under the terms of the GNU General Public License as5 X- A/ H; Q3 s# d
- * published by the Free Software Foundation version 2.
* f* {9 K$ t1 R0 K - ** W7 S; P5 n2 E( w3 A0 {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* ?% A8 u. b* B
- * kind, whether express or implied; without even the implied warranty
- s5 ~* A' h7 \* i- g; [: h( e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 V. N" S" J" j2 u* F
- * GNU General Public License for more details.. E2 z& H& y% `1 K2 ]/ m
- */
; I( G, n. j- D) r4 X. B6 d5 \ - / O" l; v+ u0 k% N) p; B; B
- #include <linux/module.h>7 W9 S9 K4 r3 n) }9 V! d
- #include <linux/init.h>
2 I$ @' a& E" t9 Y/ x: \& j, G - #include <linux/errno.h>
, \* o3 ]/ v' I3 Y1 |0 P/ m0 Q& e3 [" N - #include <linux/types.h>
6 M4 s0 A* D' Z p2 G - #include <linux/interrupt.h>
) {' B# l" t& k - #include <asm/io.h>
% Q `/ X% T; ]+ B: M5 H$ ` - #include <linux/moduleparam.h>
' D! w; k+ k8 D% R: J - #include <linux/sysctl.h>
' j% d' T$ y& o" g - #include <linux/mm.h>2 m, v7 ~8 T7 S: \8 x, P
- #include <linux/dma-mapping.h>
" r/ O2 Y0 g6 a% f( L$ i
u5 P5 q# q7 r8 ?. A- #include <mach/memory.h>
, z9 J5 y! Y5 o9 J) }0 ~ - #include <mach/hardware.h># ?# i0 a i1 \- Y' a0 s. M
- #include <mach/irqs.h>; R! C6 ~: ~& ]% @! ~; @& G5 M
- #include <asm/hardware/edma.h>: p0 Z8 ?1 g- Y% }6 Q" e0 @+ S; T
' f8 B4 `: g# @4 B! C! y D- #undef EDMA3_DEBUG2 t: U( `! t! O+ ?
- /*#define EDMA3_DEBUG*// W2 f' k) b9 X$ [9 y9 ^
2 m' E6 s6 `6 h7 j& s& M# L! @- #ifdef EDMA3_DEBUG5 P0 U; \& w0 K( X# R9 Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' x! s% S( k4 S! c# f) ~, [$ m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 `, v; K! \0 o! s f; I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' J# o1 ]( ]3 K: M) D
- #else
; A) J) r+ `. T' S# \ - #define DMA_PRINTK( x... )* c- U* A, [6 f2 V
- #define DMA_FN_IN
. K8 y1 y# |9 ]. { - #define DMA_FN_OUT
6 w3 O* m1 y+ c4 z - #endif
7 O( F& P ^% w: @
' a4 [$ n) w( U6 Y; l7 k+ v4 H* t. ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; X) l6 V6 J+ s3 p% {& X0 h: C( R - #define STATIC_SHIFT 3
% V* J2 \8 Y% @- P: ?& Y( ] - #define TCINTEN_SHIFT 20 F6 Z/ c/ U9 X, G8 ?" W
- #define ITCINTEN_SHIFT 21
1 k" K3 M$ |3 [7 }, t - #define TCCHEN_SHIFT 22
: L5 o4 l1 @2 m$ C5 i" N+ b M - #define ITCCHEN_SHIFT 23; i( F# B K$ v0 T
1 T/ `# H8 ^& ~4 V* G; `- static volatile int irqraised1 = 0;
' n3 f5 M% w. y5 d% `3 F3 D- T - static volatile int irqraised2 = 0;3 v& Q2 N0 \; q: t, P* V
' o6 \$ o+ T' a& T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 g3 x. u; j5 B# p! `' D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 I- w0 x( ]6 f" ^% w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 }4 j, q1 S' F# K! t1 v% e: u
* ?; p5 B, Z' u6 x# F: ~4 H$ Q- dma_addr_t dmaphyssrc1 = 0;
! q* [1 V5 B4 z% u* t. U - dma_addr_t dmaphyssrc2 = 0;0 T9 s# L& R$ S
- dma_addr_t dmaphysdest1 = 0;( D* |# ?8 E5 ]/ J v
- dma_addr_t dmaphysdest2 = 0;
) o% U; H' c3 ~# m' @" r) t
9 J, v/ _3 R! e* C* f: Z- char *dmabufsrc1 = NULL;
5 P4 ^. @& f1 e' [$ ? ] - char *dmabufsrc2 = NULL;
( i: d1 y Y" Z0 Z - char *dmabufdest1 = NULL;" e* w- A0 Y& g
- char *dmabufdest2 = NULL;+ `' F, [7 G. R4 Q
- , F6 I; B) u/ v4 K' M+ N2 T* E
- static int acnt = 512;4 _) {: A( Y9 p0 C6 n
- static int bcnt = 8;+ B- s+ ]0 y8 W) Z9 D- z( \1 T7 U' ~
- static int ccnt = 8;) e- k! F# b4 Y
1 w3 ]: S( \, }# J- module_param(acnt, int, S_IRUGO);
T: B3 X9 \, B& W: J. `& C# p - module_param(bcnt, int, S_IRUGO);) {( b7 ?7 f2 X+ s& ?, ~, ^) i
- module_param(ccnt, int, S_IRUGO);
复制代码
" @: I+ [2 u) }2 Z3 K0 g
9 }; S/ M! j) J( n6 o7 s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ b; ] w' x* H( \: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 Q8 |. y- M) i' g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' G! X. I8 o: g4 Z
! \' O7 S: j& Z+ W) A- v& p8 G; L! v% H) }8 A1 A, S0 k1 y. G8 `
|
|