|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' W! _2 f$ `- e3 B- [code]EDMA sample test application
5 N% q6 K* i# @ - /*1 _5 N8 X, |3 ?, o; _' [8 p
- * edma_test.c4 \: V8 }7 |* j& k0 V/ ]$ g
- *
& I, `# s- ^! v. h7 x - * brief EDMA3 Test Application
4 c0 Q( F1 ]( q+ G: Y8 Y! z - *
) d& d6 G0 G5 X' ~' q - * This file contains EDMA3 Test code.2 F. r, u# ^+ G5 M
- *
+ T$ @% {" t: S+ ]: p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 h" K* w) D* a- F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 l( b# [9 ], ?- ?( W; u, ?2 C - * TO CHANGE.8 s# ~6 u9 h3 V' P1 V8 V/ p2 V
- *) K* g# e* g+ g/ P# L& s( n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 [% r# U7 ?2 N0 j - *
$ o4 P* V+ M6 e% q1 g: e8 N/ A - * This program is free software; you can redistribute it and/or8 a- T% e0 t) \' I( \
- * modify it under the terms of the GNU General Public License as
* W x% u9 K5 c9 c9 e - * published by the Free Software Foundation version 2.
- b# t/ T) `/ m- c$ o7 { - *
^+ \$ u7 g6 q: n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; k9 z- Q8 A6 z8 w - * kind, whether express or implied; without even the implied warranty, _ \; _- E% ^6 _0 m3 w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 F3 L# k. p, Z5 p, r* S0 J
- * GNU General Public License for more details.! A1 J6 @/ T3 E y* N+ ]" f
- */& L& ]4 ?3 D9 |4 f
- ; W. e4 H- J/ X: i% A3 m$ ` q
- #include <linux/module.h># E* b3 u( i* Z1 p& B! o% h
- #include <linux/init.h>
4 C. i4 I1 J! d1 Q# f - #include <linux/errno.h>
. e6 |( _$ V7 h+ W" D8 o1 \ - #include <linux/types.h>
4 i1 w; p; [' M* k! l- _ - #include <linux/interrupt.h>
; k- g8 o( k* B. z# A6 c; j! G - #include <asm/io.h>/ i6 t" v- y, d5 T# O/ k8 q
- #include <linux/moduleparam.h> @; V- Z/ _" b: b" R* P3 s+ i! B
- #include <linux/sysctl.h>
/ i3 J% L7 @# u5 m; e5 u) `3 E - #include <linux/mm.h>
. v4 l6 u5 I! b4 L( B - #include <linux/dma-mapping.h>
4 n7 ^: B8 {5 \& g x |+ F - 8 y; w: P0 J8 e d! z
- #include <mach/memory.h> x# h8 \6 M0 O l9 w
- #include <mach/hardware.h>
- a. a* `! E% u! Y# W - #include <mach/irqs.h>2 q. Y$ s5 I! a3 v/ r
- #include <asm/hardware/edma.h>
0 n$ U9 l1 C- ]3 A3 C+ s5 w - 2 z2 i& e; R" C8 @& }' R5 i5 ~3 l
- #undef EDMA3_DEBUG
! ^6 e3 T- z5 D0 _1 Q/ S" ` - /*#define EDMA3_DEBUG*/* x. X1 n( y6 V0 S
- * _, I+ s2 ]' d- j. e
- #ifdef EDMA3_DEBUG9 ?, c8 H* N3 v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 C( e% \) u3 u9 d, H' Y- n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, R' w" k' K. k1 @' R: V9 v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) }' y M: q& V9 C/ Q2 E( y8 M0 g
- #else) V1 b( h2 i2 M& K3 r, F2 J h
- #define DMA_PRINTK( x... )3 v0 ?& d3 }1 ]* G9 E" l
- #define DMA_FN_IN4 n c4 W4 I: N! r+ E
- #define DMA_FN_OUT2 M# K- J9 G* O! u6 i: p
- #endif
. Q7 e1 t3 d. _
5 c0 }9 p" B- f% ]9 | j- #define MAX_DMA_TRANSFER_IN_BYTES (32768). O* t7 Z6 b0 G/ \2 u8 I% @
- #define STATIC_SHIFT 34 D+ v- V" a1 C6 l, X9 W7 z! L
- #define TCINTEN_SHIFT 20
" Z* W6 v3 E9 `8 _ - #define ITCINTEN_SHIFT 21
7 ^# ^) q& \* | - #define TCCHEN_SHIFT 22+ W' o5 j& F, S* C% L
- #define ITCCHEN_SHIFT 238 d2 h; G7 c! }& {
- & T' {% u* T2 T0 z6 K; M/ \, q
- static volatile int irqraised1 = 0;1 I" k' V. X8 `+ C' c; t) u# j: T
- static volatile int irqraised2 = 0;
0 p& H* d% y$ w7 h/ [$ v" \4 Y. {5 ` - 6 G" Y. P8 O9 q2 F1 w; R$ o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ o# p3 r7 T& B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Q, {6 n, @- t: ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
i0 U3 a3 J B9 C3 ? j - 0 Z; N( Q' y2 O( c& ]4 n
- dma_addr_t dmaphyssrc1 = 0;# N9 A0 L* k1 E. u5 I( ^1 M* ^, r
- dma_addr_t dmaphyssrc2 = 0;
2 e) S& _ a: J - dma_addr_t dmaphysdest1 = 0;
) V) \$ P9 j, p6 q/ ` - dma_addr_t dmaphysdest2 = 0;2 v- o: O; [2 G& s' b. H
5 ^: Q# d3 u& j+ G5 e. k' X- char *dmabufsrc1 = NULL;# T1 g& z, X* U1 f% M
- char *dmabufsrc2 = NULL;
( w R4 p9 {9 B! k; A) R5 W* J - char *dmabufdest1 = NULL;' y" [) ?+ y* N
- char *dmabufdest2 = NULL;
; t: l3 K- x9 @) P7 E. c+ n
2 r; J; p7 `# E g& L1 H9 T' m# v- static int acnt = 512;9 L0 K- U U4 G
- static int bcnt = 8;& n; q/ r' T* @' \" ]
- static int ccnt = 8;
' m* B, ~: | N - / M. x! }- _" I5 F. g) ?
- module_param(acnt, int, S_IRUGO);; m; s' E/ U' n3 Y: b8 u
- module_param(bcnt, int, S_IRUGO);& a7 x" m* v& h! ~5 u4 u6 ^( f
- module_param(ccnt, int, S_IRUGO);
复制代码
; o+ e4 Q1 I* d4 |, \ S' u# k- U9 K4 C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ P! e% I) ?, R; b4 Y- i( X$ {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% ~7 I. q! [. L- w& R% e% a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ r6 e8 a: q3 C6 I$ ?! K" S9 [, p( n8 r& I
9 U$ i" M0 O# P* ~
|
|