|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : z. U, F0 @3 g; e! b% ?
- [code]EDMA sample test application! _( ?8 U8 Q# G* @6 E) ?
- /*% _6 o6 q" N' w+ L; [- Q* U2 m. m8 V- M1 V
- * edma_test.c
* U) n# j) m: D8 c" r - *
% Z* I, L: M% W I - * brief EDMA3 Test Application) |/ Q7 U8 S: I: M
- *. y. k8 g% A3 u# c
- * This file contains EDMA3 Test code.1 M% o; ]' a$ E/ R" M$ d3 i
- *
; u8 N7 r, T' x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! F& `' `5 K1 I4 F+ a u3 T5 M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 d0 h- p3 y: |$ l& J
- * TO CHANGE.3 S: P% P2 G& T- X
- *
4 D* Z) Y8 Q1 v9 s0 h% f7 a1 Q% K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! b$ i" v2 o& T7 I - *
: k7 A1 V9 @ n. R7 M: e1 C - * This program is free software; you can redistribute it and/or
- |4 k# y! \8 `6 ~" O - * modify it under the terms of the GNU General Public License as
; O, R( {+ ~8 V8 v v/ w' b - * published by the Free Software Foundation version 2.
9 C* ]5 e1 b/ k3 V/ @$ F& I7 L+ X - *
- [5 G" }! _% K1 H3 y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ G$ l- T( b }2 u$ V
- * kind, whether express or implied; without even the implied warranty# x) M2 |/ Z% x& Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, {" p4 X+ q* E* p4 ], f
- * GNU General Public License for more details.
+ S* {- p1 ]2 E: R3 G - */. n2 G* @# ]/ j! ]) S6 ]: @, [
- ! ]- u- m4 ?3 e2 S' j
- #include <linux/module.h>
' T$ Y A% `. l$ p1 T2 `- h. R0 p1 K - #include <linux/init.h>
) E) O2 ^/ p' w0 _ - #include <linux/errno.h>, S& n: W" f2 g
- #include <linux/types.h>
, W% W4 @- d" ~3 ~ - #include <linux/interrupt.h>
4 k( f" C5 J: C9 y( S) Y4 I - #include <asm/io.h>
1 S$ K! n" a% @, z% D1 g) G - #include <linux/moduleparam.h>
0 ?1 F/ W3 `6 Q% g6 H; ~ - #include <linux/sysctl.h>1 \( }4 |4 n9 K- y+ S/ g
- #include <linux/mm.h> w' p7 @# m% M1 @. y6 \
- #include <linux/dma-mapping.h>6 B9 g! Y6 m' T. O
/ J9 ^" _ e8 G* H' O- #include <mach/memory.h>
/ u$ g' S: B, ~2 Z, p6 v - #include <mach/hardware.h>) S6 j8 B5 z) e3 M
- #include <mach/irqs.h>
( c0 t( K) ]- ?! i- F* |' y1 ` - #include <asm/hardware/edma.h>9 {! [, h" G! F/ j9 d
2 b8 A3 S' ^+ T2 h4 c- #undef EDMA3_DEBUG
, P8 K& e# v% f& U7 d- @ - /*#define EDMA3_DEBUG*/
' x8 W6 i3 d9 W - % E& e H6 m$ g) D1 }9 o, J
- #ifdef EDMA3_DEBUG
v2 k8 r5 y V9 [8 [7 P: K! x: @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% E! z e% m/ _/ K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), G: T% L* J# z' d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ u$ Y5 u1 J. @& t
- #else
% t3 O u" R* n, p4 C% `# |- B* r - #define DMA_PRINTK( x... ): c. @& H, n M: K5 x
- #define DMA_FN_IN
1 n+ @6 u: ]6 \" `6 r% x - #define DMA_FN_OUT
2 ?" d& u& Y2 M - #endif
1 K2 g' J+ \; K. h5 ? [ - + V1 q2 v8 [' p2 m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; V; q& W3 S/ ]# k1 C Q - #define STATIC_SHIFT 3! f# c6 F" ~6 `, a, ^ x
- #define TCINTEN_SHIFT 20% L- P( J t8 ^
- #define ITCINTEN_SHIFT 21
7 j q9 K' ]" ?- x) z' H) \ - #define TCCHEN_SHIFT 229 @6 e6 o& ?; [" V( @( ~% I
- #define ITCCHEN_SHIFT 23
* d! N9 `# P$ S) Q5 h - 1 ^( C* ]$ m+ p; `" a; o; C+ z
- static volatile int irqraised1 = 0;6 e" W0 M' q/ k: v$ |* _3 P: s
- static volatile int irqraised2 = 0;
: m2 I3 B$ E5 Z( B - 6 Y) q4 Y1 y# d4 z5 Z+ ]8 M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 k! j* j! I. q6 }, R4 j, G; M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& Y0 g& p/ R. n3 z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 V- n2 e3 P- u( c
8 C; Q0 V" Y! z) D7 S- dma_addr_t dmaphyssrc1 = 0; J3 T" p: ?( C" e
- dma_addr_t dmaphyssrc2 = 0;
+ j1 j- K. k! ]0 W - dma_addr_t dmaphysdest1 = 0;
+ }* V# m7 [$ s5 K0 V - dma_addr_t dmaphysdest2 = 0;
- _2 Y8 Z. i" e }6 `( S3 p
' X* X$ ^' S4 Q! L( i5 i. D- char *dmabufsrc1 = NULL;
# _+ X$ a8 t- L' O/ [, v; m - char *dmabufsrc2 = NULL;4 i. Y1 t8 ~2 n
- char *dmabufdest1 = NULL;
; j ?4 O! d* E* t: @ - char *dmabufdest2 = NULL;- N+ I2 [3 E1 {8 {: y1 l- e/ m
5 K8 v2 c$ g; ~# b- static int acnt = 512;! x: }( Z" L* F* ]& J/ k6 @9 Z
- static int bcnt = 8;
; i+ L- }+ E( }6 f. i0 s5 y/ a5 D - static int ccnt = 8;
+ S6 ~0 H7 | v1 l8 C9 x+ v
6 p5 b, \. \* T' q9 d2 q1 l- module_param(acnt, int, S_IRUGO);
( F4 w! _5 J) g* B: Q' I - module_param(bcnt, int, S_IRUGO);8 A# T6 H' R5 N6 M0 h
- module_param(ccnt, int, S_IRUGO);
复制代码
3 z3 m0 l! g3 R5 [9 l7 U) c2 D; D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; N5 P0 F* w# @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* r1 t0 e$ Z5 k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, R' o s# Z, G( g2 q5 h" G8 q9 H8 }
: A) p; ~: I8 T0 ~8 M" ^. V8 r) j6 K3 m7 @3 @' x0 ]( z6 |; M9 [! C
|
|