|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 O! P; |7 i# O; U
- [code]EDMA sample test application
0 u. I' I8 n2 s" M& e - /*
0 m6 \% t) K% ~. D4 [$ a - * edma_test.c
& ]/ K( W: q" G" ]" G - *+ ^( N' |1 o/ F: b" ?% R# ^9 a
- * brief EDMA3 Test Application+ P( I( z# P* s4 Y) J3 ?8 z4 Q6 M. S
- *. x; b2 K3 F; g6 D0 {/ A
- * This file contains EDMA3 Test code.
5 B8 ^! R! Z& Y+ t6 P# x) z' c' _: z - *1 z# P2 C& c& E# f- B3 T4 w1 _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% }4 e/ {( p4 } l) n# i: l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ D/ y1 N- N& p- I2 R& i - * TO CHANGE.
4 Z& q0 q9 i6 j) h, c - *7 C/ k6 } k- H. s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ x) B0 Q/ u i' r5 }$ y1 ?' E- U - *
- s, k9 }; H5 B - * This program is free software; you can redistribute it and/or0 ~* j/ j/ J6 S1 n; b) J- X
- * modify it under the terms of the GNU General Public License as
4 O) K5 P# `: y/ b& [ - * published by the Free Software Foundation version 2.# _8 t \2 r! a4 s% |8 ?1 n
- *
% n! l5 X/ q1 e* x h# j' A4 g% M! R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 [' s0 g2 r1 Y: t2 }
- * kind, whether express or implied; without even the implied warranty: P4 e$ }/ k! c$ B. T. b% i% z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. ^$ O; x4 D! j* o H; R& B
- * GNU General Public License for more details.
. i6 k& P! d1 m% a - */
( p8 r2 r' M, K8 B - / D; }7 y: g. P' o; s
- #include <linux/module.h>
! s# ^- G3 P# |% O# y$ I! o; b - #include <linux/init.h>
7 _$ _5 i! P! c- a$ C - #include <linux/errno.h>
2 ]0 y/ a- ~7 Y& Q4 V - #include <linux/types.h>1 J7 X8 F; k+ S
- #include <linux/interrupt.h>+ }+ o. {6 M& ?5 S- x, y
- #include <asm/io.h>
! E/ q: T1 `- n# a1 F - #include <linux/moduleparam.h># R- ?' b, U" w3 d6 l: N
- #include <linux/sysctl.h>- i, ]4 a( l1 D4 J) v1 z# M# @
- #include <linux/mm.h>! R# _& N4 ~+ v4 r# S5 \! {; f
- #include <linux/dma-mapping.h>1 a# Y4 D) c! \# ^
4 f/ n, U1 y5 O I; N" e! [- #include <mach/memory.h>
! `2 [8 L' |) V/ t3 ] - #include <mach/hardware.h>
7 G7 H1 C: u* {# H - #include <mach/irqs.h>; e3 Z! W5 n" T3 c
- #include <asm/hardware/edma.h>
$ X- s; b, B- c1 u# ]: j - 4 f* z; v# e8 \2 \
- #undef EDMA3_DEBUG
' b- X7 i2 D' c# j - /*#define EDMA3_DEBUG*/ z. l" `* I& b! S
- ( J( r& O8 h. j; C
- #ifdef EDMA3_DEBUG
" \7 l5 @3 J5 \8 E8 d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 b8 s4 v! n: |4 H% G6 R1 | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ c# i& H. S, L, l! d5 [( {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% A! C' m1 J% O& O& \: w: W5 y9 W7 Q( t
- #else% X* A/ S- ~# d" t
- #define DMA_PRINTK( x... )
4 ~: P5 _( P: f8 E' d - #define DMA_FN_IN' L1 P2 _( i4 F- P# g. S
- #define DMA_FN_OUT1 h: {3 J% P# j/ P- w5 ~! X2 u
- #endif
2 t7 g4 r/ G1 t4 a) H! n - ) {3 F6 P. L7 Q# \; M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 O* I1 W' M. M/ P; H
- #define STATIC_SHIFT 3) z2 y3 `; ?) n3 Q% \+ g
- #define TCINTEN_SHIFT 207 W4 m7 O1 @% ?) W
- #define ITCINTEN_SHIFT 21
0 d" K, R0 `" e: z - #define TCCHEN_SHIFT 22# o. \4 x- M# {" \
- #define ITCCHEN_SHIFT 23
) U8 D, Q# W3 \! r. N - ! k! i$ ^% N3 |' ^3 a5 e
- static volatile int irqraised1 = 0;
9 a2 |6 R! D2 z; s( R6 [/ i - static volatile int irqraised2 = 0;
! p$ W" F2 Y) g' S) I3 |9 O - - p! K! ?1 X$ Z# D: O9 T5 W' u5 U1 x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) O2 ?& m6 R. |! ^7 H( A6 W3 l* _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ E( R# S* U$ M9 i# Y8 D+ O, @8 Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% i% E C( q6 l A% P5 T' j
- " w8 U( {5 D! l& I) t
- dma_addr_t dmaphyssrc1 = 0;( L. t% a! t; P
- dma_addr_t dmaphyssrc2 = 0;
& l- [& Z. d! {/ k: c: L- ` - dma_addr_t dmaphysdest1 = 0;
' P& u' Z4 ^$ l8 k+ k) I - dma_addr_t dmaphysdest2 = 0;" J( }2 o R7 B
- , j& \. }$ ?/ d" C3 M& M& ?3 q1 Q
- char *dmabufsrc1 = NULL;( d" _ h/ y" n# K
- char *dmabufsrc2 = NULL;6 {8 @/ [' i H; u2 m& j4 f2 i W
- char *dmabufdest1 = NULL;
0 ^3 o8 V6 c. e - char *dmabufdest2 = NULL;
1 J$ p( J2 A9 g# V5 L
; G/ Y1 E+ D- Z4 H. `% I$ o- static int acnt = 512;; r& ?( a4 E5 u8 }
- static int bcnt = 8;
0 |# i" U) l0 L5 y6 h$ c - static int ccnt = 8;/ x8 z% _9 Z) z( Z; d2 ~; p
8 n0 x2 ^) ?9 [- module_param(acnt, int, S_IRUGO);
* u, s; |3 b! w9 v5 @/ M* W! |' C - module_param(bcnt, int, S_IRUGO);
+ g# ~0 v$ J$ g+ z C. B - module_param(ccnt, int, S_IRUGO);
复制代码 & Y7 W3 o! v' L
, o. X* I8 m9 W* M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( t, [- k% e9 Q% V' r1 x; B3 earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 S& d0 d4 N/ M* D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 w- ^" g: I) _$ k1 b! Y
k/ \+ v1 i ?0 D! S) X1 l. g
) K) a+ `! t8 P# n |
|