|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. ]) L# L$ C8 P; Q. M* G- [code]EDMA sample test application6 }9 D ?( f4 q; j1 N
- /*+ s8 n5 m$ j( p1 A2 j5 ^% l% w
- * edma_test.c4 z) T6 u4 P; B3 \- k! j
- *4 J& h# U% f( ^7 @
- * brief EDMA3 Test Application
0 H2 v2 F4 h! u3 ? - *
) ~* a5 ^6 L2 F - * This file contains EDMA3 Test code.
* ~ ^& l4 I7 _ - *
5 N! l7 ]. Q, w/ ?* @5 d$ o# u# I/ s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, b% J& b* _& T7 \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! @! s: ]$ V; a
- * TO CHANGE.. Z4 {/ u- e% R" t2 M, w; T
- *2 m; M" C( o. B6 S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 g7 @ N8 y4 U/ p# v. e) \. A
- ** w. {. z- m$ I" u: [" T' {; c
- * This program is free software; you can redistribute it and/or6 j* T& O2 {4 j# k# F9 e
- * modify it under the terms of the GNU General Public License as) p! S, P' O3 ~( {" J
- * published by the Free Software Foundation version 2." g/ ]! @- f7 s3 t E% z& h+ {
- *5 r; h7 X- B2 B. v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 d7 a# V4 t8 `; S4 g - * kind, whether express or implied; without even the implied warranty/ P5 ]/ ^! g5 ~, q* K: A n# X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& @7 U& Z6 i6 J, y, ^% e5 v
- * GNU General Public License for more details.
/ D$ [ @( O- L& J# k - */
8 P) l, h4 |3 I$ e
8 q. l) k/ J: W6 {' p- #include <linux/module.h>3 P4 O" P& J& g5 e J: t
- #include <linux/init.h>9 \; y' t) I: I3 f/ Y# a* x: C+ A. y6 v
- #include <linux/errno.h>
- U) a7 }$ d3 j$ K& R! x3 ~8 ] - #include <linux/types.h>: T4 b) `* A/ b" v* q
- #include <linux/interrupt.h>: c1 h& \0 {6 S4 f6 {
- #include <asm/io.h> O4 {/ r6 u4 E) [
- #include <linux/moduleparam.h>
( Q8 [: n: h( x5 Y5 i% `% L - #include <linux/sysctl.h>
- h% [; P2 u* b" s4 E+ U - #include <linux/mm.h>% V: ?* x6 l( F# D( A/ X6 }- W
- #include <linux/dma-mapping.h>
8 G( v! y: q/ s - * N5 P8 d/ B6 f! a$ ]6 P8 t& J
- #include <mach/memory.h>2 }1 T8 P* X. i) u5 u
- #include <mach/hardware.h>
{+ {1 v, A$ y/ r) D0 k - #include <mach/irqs.h>! |8 K h) T, j/ a \
- #include <asm/hardware/edma.h>4 y% Q2 Y1 {8 J5 u# M/ {* A
V) z* N" w, n7 p- #undef EDMA3_DEBUG3 _& |' U9 r. ?- v
- /*#define EDMA3_DEBUG*/5 f( R! g# t" E6 ~
$ u! |3 v; r8 B. C" d7 u- #ifdef EDMA3_DEBUG5 q1 j' h T* [5 K/ {1 E0 W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). ~! t3 u- h* ]7 a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 e$ \0 l$ u6 O9 g& v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ ~" G1 C, Q; H; Q/ D9 u
- #else
; F) I+ m8 Q( h. s; u9 f - #define DMA_PRINTK( x... )
/ t, X Q5 f$ D3 l6 } - #define DMA_FN_IN4 }$ Q& O# e Q8 j5 |! p1 T" f- U
- #define DMA_FN_OUT
5 F/ H* p9 F( o' I - #endif
5 b, }1 s+ ?( a! s( d/ D - , U" k( Z3 S- \2 j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 O, G" q( O& C! P+ _$ R& M" t2 U4 d
- #define STATIC_SHIFT 3
4 `5 ~+ L( S4 s - #define TCINTEN_SHIFT 20. f' y: X- C" k. A, s
- #define ITCINTEN_SHIFT 21
% `2 U1 C3 T3 O- Q: h5 d1 w - #define TCCHEN_SHIFT 22# c @0 c, Q6 f3 u/ c
- #define ITCCHEN_SHIFT 23% G' s% u6 {& \8 b8 e z7 @
7 e" d; {5 X" ^9 B7 t$ A& N2 i8 A- static volatile int irqraised1 = 0;
& v6 _$ ?( N% v3 V7 i - static volatile int irqraised2 = 0;
4 j4 B3 _1 l+ F1 r. U1 k5 l3 b% G - . z$ U; O1 j1 t) \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. O' A% A8 q7 G( @" F C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! d) u% z0 t$ L$ _1 E) V1 A2 j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 ^: |0 \ x: V3 L- J+ D0 Q - 2 r+ b# M6 T3 o5 r0 i" J
- dma_addr_t dmaphyssrc1 = 0;
2 q W0 x- \5 `5 _" v' r% Q/ b - dma_addr_t dmaphyssrc2 = 0;- Y( o" z9 k/ Q' A8 b n* Q
- dma_addr_t dmaphysdest1 = 0;7 o2 X" V2 K+ U+ F; Z0 _
- dma_addr_t dmaphysdest2 = 0;6 A2 K' h/ @$ j7 Y
- 7 S% t/ o5 {9 x8 E1 v8 M. ?
- char *dmabufsrc1 = NULL;! c2 b. K: T4 ~+ p, \2 {0 T
- char *dmabufsrc2 = NULL;
9 U! ~$ h$ T% \3 I0 @ - char *dmabufdest1 = NULL;7 v; M- v/ A( H- i: m: \0 Q
- char *dmabufdest2 = NULL;
. |, C+ W! @% l1 C3 h! ]: w
) [; ]' O6 e5 F) S: d% L. N/ c- static int acnt = 512;* x0 J: w9 B- ?8 z( q0 b/ J
- static int bcnt = 8;
5 y' j( [0 s4 b8 d7 B - static int ccnt = 8;2 Z3 |- a2 C7 P3 r2 r
- & A6 \( r9 K+ O) P
- module_param(acnt, int, S_IRUGO);/ {- y! f1 t }$ C) x4 {' R2 o
- module_param(bcnt, int, S_IRUGO);9 W/ i) V1 W0 `6 G v
- module_param(ccnt, int, S_IRUGO);
复制代码
! M- G# Z& v \7 D9 o. u, n; ]. O3 Y& z9 F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( U7 G/ D* z l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 y/ h5 W. j6 s. G* F! U) A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- i' _' I. h) B0 ^" m
$ X8 C8 q& C. l/ ~1 H. l# Q! M3 v4 |3 Z5 f, J- w+ j
|
|