|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 ~( n2 ~ x+ @0 h2 N, z2 _- [code]EDMA sample test application
* o+ X8 Q, }6 @* ~" }/ h - /*2 T5 ~: i- |$ o5 F
- * edma_test.c9 o& u4 w( ?4 Z9 w" _8 Y- c) y
- *
, J, `* ]* m2 [: J* H - * brief EDMA3 Test Application
0 D6 O& |% d. t6 r4 B0 A - *& }% _. n$ r9 f5 ^- V$ _) p
- * This file contains EDMA3 Test code.
8 g8 O2 ~) S3 K4 W - *
; ^9 B; s' o' Y+ Y, k5 o: F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) w5 z6 {& G. G$ o ]: ^; {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 j8 x3 S; C' h - * TO CHANGE.
8 k f: x. h, v: N: _. Y# w$ E - *
+ @3 N6 W% r7 b7 k8 U$ p, F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! u% y7 @1 ?4 p2 s6 T9 \ - * m9 t: Q d) `9 u
- * This program is free software; you can redistribute it and/or
2 t( ^1 P! ?" H% e" n$ }% C1 W - * modify it under the terms of the GNU General Public License as
8 ?, j8 T+ F: U7 j - * published by the Free Software Foundation version 2.9 v" n& `: r% s6 r
- *9 b$ I! D( C) G$ `" [0 q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: m" L3 K' |8 o. s, K1 g - * kind, whether express or implied; without even the implied warranty
4 t& V" R9 n# q! i( d* Z: b. V% ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 ^# I7 d9 h0 j/ x1 D
- * GNU General Public License for more details.& O' l+ y: ]* K m% Z) w# D- s% w
- */
, T5 x( {# R0 e; @0 j) i& K - & ~; ~0 u( U1 ~+ j* s
- #include <linux/module.h>
8 u8 T/ ^5 U$ J. l- c - #include <linux/init.h># W) e1 }( h$ W; r" B
- #include <linux/errno.h>5 \9 a+ \# f* [ B0 r) \
- #include <linux/types.h>* m3 w7 a1 ?6 y
- #include <linux/interrupt.h>
4 |5 ]+ y8 D( g - #include <asm/io.h>) A6 M* u% O4 j) e/ j
- #include <linux/moduleparam.h>
4 \3 F. g7 E1 d; x9 ^ - #include <linux/sysctl.h>
& X: t/ V+ w( b8 u$ {0 p - #include <linux/mm.h>' \8 W+ @/ a% U( ]% W. a, E; r
- #include <linux/dma-mapping.h>8 N6 w5 X S- @- h1 @$ ?2 {
- : @1 A8 ^: S8 C d. E
- #include <mach/memory.h>
& J5 s! v3 F' v* i* J3 _, q - #include <mach/hardware.h>
" Q- D# d- m3 Z2 A& Y- s8 { - #include <mach/irqs.h>1 z0 r4 c5 J% s, u4 @
- #include <asm/hardware/edma.h> m( B7 ?7 g' ]3 c3 L% M& [ M
; `+ V, b' O- {3 m. O, q% X- #undef EDMA3_DEBUG1 e/ b9 e) D" r; q% G% ^6 L. P
- /*#define EDMA3_DEBUG*/
# }0 n; ]8 p8 i# D, i2 d; Q3 M& M
* N, Y: L$ V$ m: e! s- #ifdef EDMA3_DEBUG5 V) p- _. s& W, Y2 P8 W& K- l9 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), w1 P! O+ Q; q8 M$ Y7 L, j6 @, c% d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& J% p" \5 e! ~ y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 d' ~0 n' B1 s& p5 f1 K - #else
) e; R2 i4 A9 C* K& p6 t5 ~ - #define DMA_PRINTK( x... )
* b9 U: `8 Y/ `4 {& c9 K; L - #define DMA_FN_IN
% b, d2 p3 v- e# x/ J - #define DMA_FN_OUT! M( v; A, W2 i
- #endif5 c" t7 R" X6 U3 L0 X8 f
- - K2 X, F U C7 Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" @% d! Y6 y P" c - #define STATIC_SHIFT 3
5 |, d$ X) w! j i( c' B5 Y - #define TCINTEN_SHIFT 20
9 a1 `9 G' _5 ^0 _; G; e - #define ITCINTEN_SHIFT 21
+ ~9 V: D2 m" m+ h9 }3 F' I - #define TCCHEN_SHIFT 22( W- ?# {- Z+ ^8 i
- #define ITCCHEN_SHIFT 239 M# ?1 ~- X3 p2 T) H" A
- + t/ }* ]: @' i' l: Q4 r
- static volatile int irqraised1 = 0;
# I4 S" ^" c$ ?9 x0 S - static volatile int irqraised2 = 0;
0 l% ^+ j+ O. l' C6 H: i6 l, x
& l4 Y% C/ N- d9 ~2 S1 q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& p4 v, V1 q: S& O4 ~$ N( }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 Q" w Q; e4 W& H* I; S5 Q' }! U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 B3 I. w6 {' V3 S5 Q+ F - ; b: @, w4 u6 _+ r% b
- dma_addr_t dmaphyssrc1 = 0;
% Z% o% t% d2 c0 Q( e- M - dma_addr_t dmaphyssrc2 = 0;
0 p( V W. l: G - dma_addr_t dmaphysdest1 = 0;
3 ?- B2 c8 ]2 Z1 j3 v# b0 e - dma_addr_t dmaphysdest2 = 0;4 l! N: y2 d0 T1 a- D
- / ]: B# q- `% C
- char *dmabufsrc1 = NULL;+ s2 d) R, u3 Z* F
- char *dmabufsrc2 = NULL;
6 F! R8 c d5 F( x7 Q) B; ]. U1 z - char *dmabufdest1 = NULL;6 S/ f5 c7 }' {5 D. z
- char *dmabufdest2 = NULL;
( Z& H7 v& Y1 T2 ]4 G
. n$ x; `" q+ S- static int acnt = 512;/ g4 O& _% S, D! F. u2 \6 r3 q: Y
- static int bcnt = 8;* m! I8 l2 D7 I+ i# {8 o0 R
- static int ccnt = 8;
7 b: M3 c( ?% ^) D1 T- L* N - , J6 h0 ^+ ?% g1 Y' ~: m
- module_param(acnt, int, S_IRUGO);
, M O. J. P4 V5 h1 _9 |+ c' w5 A - module_param(bcnt, int, S_IRUGO);
1 `6 o2 N$ ~7 h `5 X) L/ Z. @+ G - module_param(ccnt, int, S_IRUGO);
复制代码 % p* z+ f/ n& ?. b( q$ p
% ^+ ]! A1 [, X! \- {8 u- ^% V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* A6 P# f7 Z4 y1 q. M, rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 K6 l8 x$ t$ Y1 l% | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 L" [1 C- W" V* D' A- P) B1 I- o* Z$ ? Z- `
) G# w& E6 Y) a/ O1 p5 }9 E |
|