|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " Y" }" j3 d. k* a
- [code]EDMA sample test application
3 x; c- ~# p8 S: K/ o - /*
1 D5 Q8 L. q% H! M. O) R6 Y - * edma_test.c5 v" O v& w- J+ ~9 J5 x; s2 B2 Y
- *7 I. H- }" S" Z9 S4 o' N
- * brief EDMA3 Test Application/ \' j( U8 L; I. w' O$ G9 z H# h
- *
; p8 e* ~+ {: G E5 N' W - * This file contains EDMA3 Test code.+ Y5 Z) h) |. }& f
- *; V3 l' E# {, H/ X; p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, |- Q" v/ w6 G" H. @, d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# D' v! M6 G! U+ e7 s - * TO CHANGE.0 m2 n3 @+ c( C
- *: |7 O. S" p) a, u; E L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: z1 E6 H7 D( u% }8 D% \0 }4 X - *
: Q" Q7 g. l& |3 d# G9 _ - * This program is free software; you can redistribute it and/or4 |+ w& `$ W9 G7 d4 l1 K5 {0 d
- * modify it under the terms of the GNU General Public License as
' u* E% a$ J6 J! m8 v' g) s - * published by the Free Software Foundation version 2.& D+ \) U' R; ]3 J8 o
- *- e6 r& G0 C" T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ p1 j+ J* J9 j0 f' e6 c - * kind, whether express or implied; without even the implied warranty: \" s9 f1 |. U5 M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" S& c H% b* M$ j
- * GNU General Public License for more details. k/ I% k$ {+ a
- */
) p- s4 x1 n" m
g6 |$ k$ ^$ t' y; r- #include <linux/module.h> L) T+ A9 x; Q5 a/ V9 |
- #include <linux/init.h>. t" f, C+ O. ]# P1 B* m
- #include <linux/errno.h>5 U: V2 k' P2 i7 ]% ^
- #include <linux/types.h>0 Z+ O5 @8 n# z/ _
- #include <linux/interrupt.h>8 C7 @0 u5 j2 O4 G' o
- #include <asm/io.h>
) t3 _+ u" R$ U& O# G- ]" { - #include <linux/moduleparam.h>& r9 g& H. D. G5 T
- #include <linux/sysctl.h>* @7 ]7 H: `8 T+ d5 O- [! X
- #include <linux/mm.h>
! j! q& p. S, r) S - #include <linux/dma-mapping.h>
2 _2 M0 t& N7 e$ A/ j/ l- ^ - % [' b2 q0 ?8 P* I9 K3 J! _0 ~+ t
- #include <mach/memory.h>
9 v, D: i' ]& A6 `8 L$ M4 l6 T$ t - #include <mach/hardware.h>7 n* I! \3 p% ~$ X# d4 Z) c' |
- #include <mach/irqs.h>/ F9 p' g; @% f9 d+ Q y1 q
- #include <asm/hardware/edma.h>) t, J. K$ e5 d' H+ G2 N
9 y! ^4 |5 W7 t% M: p4 R4 g- #undef EDMA3_DEBUG6 w: R& d4 [* ?7 Y0 ]! W
- /*#define EDMA3_DEBUG*/
' w7 L( `, M7 |9 P. R
9 Q$ o' }& ?" F5 H2 A- I- #ifdef EDMA3_DEBUG# E, d- V4 \" y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" g( |; `8 Y3 r; W+ m" B3 p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ @6 w7 f$ ]- x1 q" u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, `3 b1 l. s. F! ?2 P3 J( N) s( F - #else4 h n4 q/ ^5 C( R. A
- #define DMA_PRINTK( x... )( K' x% a( F! d& D& i, ~/ T7 R# ?
- #define DMA_FN_IN
" e$ R. n8 }% A1 x( W - #define DMA_FN_OUT3 P$ G0 n) K8 k% d+ `
- #endif. L8 B0 \. Y6 }# V' w+ p" e
G6 o7 f* k# Y9 Q; Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: E* G3 J# }9 ~4 s2 x; U - #define STATIC_SHIFT 3
6 ~. {6 z7 \% F. u5 Q: Y - #define TCINTEN_SHIFT 20
" w. @% {; A2 j' }0 }; N1 C& A - #define ITCINTEN_SHIFT 21
& ]% k. X7 f' X' t$ ? - #define TCCHEN_SHIFT 22 a8 V1 @3 N8 H
- #define ITCCHEN_SHIFT 23
# W" f( z6 l' _7 X! q7 q - ) `, r1 l$ M; E6 H7 A1 d
- static volatile int irqraised1 = 0;
/ c( f( t* X' x - static volatile int irqraised2 = 0;
! w7 w, O0 i' j7 B9 U% U! }
% x4 G$ m* ], x4 _0 z3 ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 W" [6 e& k* E7 r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! f, Z- F$ [/ n$ H3 P4 Y: D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% Y* Q3 M9 y/ D4 M0 G
9 d9 {3 E$ ~" I- dma_addr_t dmaphyssrc1 = 0;! b2 k4 \* S4 a7 E5 `! p( Z
- dma_addr_t dmaphyssrc2 = 0;
+ y( T& Y* e2 J7 P0 g8 g - dma_addr_t dmaphysdest1 = 0;) \7 g+ D- |: |+ I8 w" @
- dma_addr_t dmaphysdest2 = 0;1 Q4 A. M7 ^( t$ _- p. X
- ) ]( Z. G) b! v% ?. T7 p3 T
- char *dmabufsrc1 = NULL;
3 ~# d+ N+ k1 a! h& @3 A+ b - char *dmabufsrc2 = NULL;2 V1 [8 l1 Q( R: l( Q: Q
- char *dmabufdest1 = NULL;
: ?+ j0 M9 A2 \- S3 d - char *dmabufdest2 = NULL;
- k, e6 h! n6 e# v: {! g5 a
1 q! s' u8 ^3 _& G& `% V3 X0 v, N" z4 ]- static int acnt = 512;" c9 [' ], A) d, d, R6 Q( ~8 W; {
- static int bcnt = 8;4 C I: l0 G+ y! u# H+ |' E
- static int ccnt = 8;
9 t" Q& i! _2 Z
1 O8 s; G2 v) [- module_param(acnt, int, S_IRUGO);( e4 m1 M2 X9 Q* @4 C& j- G
- module_param(bcnt, int, S_IRUGO);
) \0 L0 M, y7 E - module_param(ccnt, int, S_IRUGO);
复制代码
. b/ g2 _! l9 _+ d$ h
. X: \ H7 D% I6 X: A# _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 v- F# u+ X C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 r6 j/ b2 N2 t$ S0 X% b+ V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
X& ]% W" S t
+ Z- U% I8 Q: x) p" {% ?1 Z6 I$ Q; i- h. g" Y: t2 E
|
|