|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 N& H7 K4 D3 q% ]
- [code]EDMA sample test application7 _3 \4 V3 n; B: M) N8 l8 n% Q
- /*
) n/ C1 \' \3 c - * edma_test.c) ?/ g4 V6 f! o* u7 F) G3 Q
- *
- G) \$ G' I' @8 o- v: ?" @- l% | - * brief EDMA3 Test Application) t9 n' q: q' {& h: ?4 ], A
- *9 ^4 _/ W: J( ]
- * This file contains EDMA3 Test code.8 |5 U4 x+ {: d5 x4 p; |
- *: j6 \( O. m5 r0 t3 w" i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 N7 V% B7 | x$ ~/ Z8 m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* b# g0 ?. J0 S c4 m' P
- * TO CHANGE.
2 Z1 h0 R d E- I' E6 a - ** |0 `0 j/ g* h' d7 X j$ F+ }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( ~5 {0 J E! [( o5 L7 L7 V( n - *
* I" |4 D% [; P6 s$ d- U' Q2 D1 o - * This program is free software; you can redistribute it and/or
4 U& \' F0 T+ W X2 | - * modify it under the terms of the GNU General Public License as" Y' ?7 B8 ^9 _0 s P' e
- * published by the Free Software Foundation version 2.- @; |4 `( `/ |# R2 p- i
- *- ~+ ]5 A( \9 a1 w! U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any V. s+ k! h" `, F! g1 j/ e
- * kind, whether express or implied; without even the implied warranty
& g" p1 W" v1 B/ b$ m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 s5 c8 |( L4 @1 G% }) E
- * GNU General Public License for more details.. t7 W9 V5 O! k9 E/ W. n
- */( ^1 n& D$ o8 r6 n( L
8 q) j ^- u4 g% G( v, `! P7 n+ b- #include <linux/module.h>
O }5 v* h: q7 R% q - #include <linux/init.h># [/ J1 P8 m# g0 p# j$ P
- #include <linux/errno.h>! |6 ~5 \: k7 t% [3 o0 |
- #include <linux/types.h>
1 E, y4 T& `* w# X9 S, Q3 w - #include <linux/interrupt.h>
2 Q) V' s4 j/ F M) I - #include <asm/io.h>
, d9 ?: Q1 n0 _7 h+ v% A; d5 Z- a - #include <linux/moduleparam.h>; c S {$ T: y0 p
- #include <linux/sysctl.h>
* \' ?- x9 d# Q4 W0 l! O - #include <linux/mm.h>
/ p9 O$ g7 p% @ - #include <linux/dma-mapping.h>
' u% n6 w0 v8 s% p2 v$ f - $ w! L6 z4 ]7 F0 g+ ]
- #include <mach/memory.h>
( ^" b$ v' v6 G% p; O$ @' Y6 j) m - #include <mach/hardware.h>
1 d( u% K9 D4 [7 k7 e( f" m - #include <mach/irqs.h>* b* J' K; E$ Y$ _; W) c
- #include <asm/hardware/edma.h>! U/ ^1 a1 h% f- N' x0 s+ _* X
; k" N1 @( L" n' B- #undef EDMA3_DEBUG
. _. g6 R# ?1 C1 ?+ S" K' _5 ]2 t3 W - /*#define EDMA3_DEBUG*/
. N$ E" s. e, }: A: b u, k ^# N
( e7 ]9 Y/ j4 E1 d- #ifdef EDMA3_DEBUG
& z1 F& |) g8 @* Q Z. V2 L9 l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 i9 L9 h) S3 o/ D5 d2 s5 l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" _+ K( f2 }# ^& s) T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 i x# t) z4 s4 @& ? - #else
) H" j( s$ J O1 b - #define DMA_PRINTK( x... )
/ A7 K# o }: F- B7 j& Y - #define DMA_FN_IN
# \* ^$ d D. Z- A9 M - #define DMA_FN_OUT. e3 Z/ {+ M! v% q# N
- #endif4 b9 }9 |5 ^# }/ ]9 e
- 2 `" |4 ^$ P0 [' o. [) L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 X5 V" M; A( `& r9 @% m A
- #define STATIC_SHIFT 32 N% ^) n5 h3 N1 W( b
- #define TCINTEN_SHIFT 20
: w# R8 d" Q* I- z - #define ITCINTEN_SHIFT 21$ l6 d, \0 V* F& H, n
- #define TCCHEN_SHIFT 22
! Y0 `! P- U( i& c) W! ` - #define ITCCHEN_SHIFT 23
0 f3 T1 E. Z8 L( L& W; ]+ n( z
! o& f1 W1 f6 V) e5 K; Y- static volatile int irqraised1 = 0;/ ~7 ^* j0 r9 V
- static volatile int irqraised2 = 0;
( L, Z( f7 W6 R
- \' u# G# C& s! i: c8 D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" `1 P0 C0 Q; \7 z0 D# [, S9 A0 E& e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 O+ P8 C* m, x& q9 ~# z& E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 l% e4 Y/ P% H$ \; z
! l4 K9 c* x/ D Y; B* o: s8 d- dma_addr_t dmaphyssrc1 = 0;) K C+ U0 y" ?
- dma_addr_t dmaphyssrc2 = 0;/ z1 d" W* }3 y& l' g/ v* w
- dma_addr_t dmaphysdest1 = 0;
8 y% ?- M/ q9 r% R& V, \- e0 E - dma_addr_t dmaphysdest2 = 0;3 B1 e, q" }! x
% [% U8 g( h, x; T9 q* g- char *dmabufsrc1 = NULL;# L7 `) ]/ b$ i7 y5 y
- char *dmabufsrc2 = NULL;! M" y, \' ]2 C/ {/ \0 k
- char *dmabufdest1 = NULL;& ?) B3 {- P) F/ ~: C1 }( ^" l
- char *dmabufdest2 = NULL;$ o# E7 J+ }( W) ~7 g8 I$ T
- 9 E3 e- S# }2 M) ]: _: `8 R4 G
- static int acnt = 512;
9 c- R+ n" _ L) b - static int bcnt = 8;
8 E; ?/ }, q$ x/ M" G" Y) Q/ y" _+ i - static int ccnt = 8;
0 y9 C/ N: ~0 q7 ?) B; F. B: I - 4 h8 Z3 h1 J, _" W
- module_param(acnt, int, S_IRUGO);
0 L( @, e4 @: d _ - module_param(bcnt, int, S_IRUGO);
: |3 S8 U% E6 s: Q/ L9 x - module_param(ccnt, int, S_IRUGO);
复制代码 7 q X/ K$ u6 r, N# W! B+ c
( p! @8 z5 Y, M# e; h& H# L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- _; \' R5 V. J0 H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- I# J2 C9 N# L4 o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' d8 ]" f+ z5 x+ d4 g
5 J9 E1 L. A& u7 G
% \4 U; F+ }; v3 l9 c4 Z& B/ n |
|