|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 J' E F& n4 e- Y/ F
- [code]EDMA sample test application
' g0 Y% `' c! Q; o, K - /*2 [4 p, F' t) X' V
- * edma_test.c
: }/ w- A/ z: }+ V* \( A8 o+ Y- w* v - *0 m `1 \, u3 E0 H) j
- * brief EDMA3 Test Application1 M4 H1 n. L% p; n
- *
- p$ g$ ~: G* ? - * This file contains EDMA3 Test code.
- o5 M9 R" {* a8 c+ A - *
a% g0 q/ ^6 [. Q* O* W+ r" v9 O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( {: g, W% |9 I' O, K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# I N5 c* D2 |0 [) L Y5 _6 q, T3 x - * TO CHANGE.
( E, f# }7 _' O) s7 L - *
' M7 q/ o$ ]6 E0 i/ I! ?% h- h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 V4 S) |/ U9 o5 L* K; s" w
- *
Q( ~$ `6 s2 d0 D1 O - * This program is free software; you can redistribute it and/or
% x& M) x/ V u# k' G5 F - * modify it under the terms of the GNU General Public License as0 F+ L, C# X$ H4 `; m0 V
- * published by the Free Software Foundation version 2.4 B: R$ b) W% B! K1 ?5 ?: {
- *; _8 K7 s& y- r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. W7 u# O5 ]6 ^# X0 ~# A - * kind, whether express or implied; without even the implied warranty3 E+ K$ q& ^+ X( ?% Q6 I( Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& [$ n! J- |0 ^" |* G! z8 B6 q
- * GNU General Public License for more details.- f% I! k6 M3 Y t( d" {
- */! H8 N1 S' o# j8 @* Q
- 3 r, ~( S5 o* E+ |
- #include <linux/module.h>
* M+ ?7 r5 v) y& T' p | - #include <linux/init.h>$ b9 i7 I% n4 ~8 T h/ [% ?3 w) [4 l7 Z, R
- #include <linux/errno.h>
# ~7 p+ n/ }* d0 y& \5 ^& m - #include <linux/types.h>
5 |6 J& u6 K- l4 G/ { - #include <linux/interrupt.h>
1 }4 @) ?/ D7 P8 z, ^: Q5 r - #include <asm/io.h>
; _3 b T, M3 {6 s+ D! p2 G8 @ - #include <linux/moduleparam.h>
" s- i- w9 p4 A3 [4 W - #include <linux/sysctl.h>
: h0 _5 s' O$ D. i$ \( v/ q6 r - #include <linux/mm.h>- G/ q' n$ S1 {) v: Q
- #include <linux/dma-mapping.h>3 u1 ~; y1 A. l# U
- % U; u8 U" g; J0 b" J+ R) _
- #include <mach/memory.h>4 E1 l, u% e4 O* z( m& b4 z2 e
- #include <mach/hardware.h>
: e9 ]* K. q. i T8 Z9 T - #include <mach/irqs.h>
- K- ]% b5 D( `& ] - #include <asm/hardware/edma.h>2 T# F H3 {1 Z# c" o, i; ?% u. `5 W
; N: h& f7 J4 r* g# V" N- n( e- #undef EDMA3_DEBUG0 q- s' u5 ^/ |$ E
- /*#define EDMA3_DEBUG*/
- p( ^9 C; Y" j) l+ d
7 [# c# W4 e4 U9 b- #ifdef EDMA3_DEBUG
% O1 |# \' j% _2 s3 L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 ~$ _. n0 c! x# w M+ S% a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 T9 w6 O: H5 ~3 s& m" \3 o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% U+ J# B/ D+ y - #else
x& z+ P8 W( X( x - #define DMA_PRINTK( x... )
" K) c/ l6 b3 F8 x4 h - #define DMA_FN_IN
2 T% S: {- U% \: F( T& j: x - #define DMA_FN_OUT
5 i; m& R# @# s( {4 ]5 s( ] - #endif
l6 V( H8 V$ ~) n( U: }
) }9 h8 m" G* w; A" q" H# H% r- #define MAX_DMA_TRANSFER_IN_BYTES (32768), r$ ^6 _* b" \" m) Z
- #define STATIC_SHIFT 3' V! Y) E# _7 e8 [
- #define TCINTEN_SHIFT 20
, o9 `$ Q0 I( B" D" }9 h! ` - #define ITCINTEN_SHIFT 21
4 D8 [$ I! ^9 I( x - #define TCCHEN_SHIFT 22
7 q6 M2 s- B7 l5 ]4 r - #define ITCCHEN_SHIFT 23$ j5 B: x6 M/ G; l: b1 p
- * H/ M; Y4 H. h2 r: B( H( q
- static volatile int irqraised1 = 0;
' d3 \) B2 Q# p7 \0 W - static volatile int irqraised2 = 0;0 ~! Q9 O( Y( `' i7 i' v5 w# `
* S+ f6 Z' g7 G+ o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 V# E/ d) {' z9 i' h2 ^4 B/ [3 q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! F0 y7 g4 P( I- c! y1 u4 \2 N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ p5 G5 X% F% i" R
& k5 _" M6 d+ ]! \, @' Z- o$ f: Q- dma_addr_t dmaphyssrc1 = 0;: A2 m) U1 x* K/ A% }3 s' T7 ~
- dma_addr_t dmaphyssrc2 = 0;& \/ n7 _8 [+ N$ O9 n* f* X4 r* z
- dma_addr_t dmaphysdest1 = 0;
* P6 o/ A9 b. H. E2 F5 C: B - dma_addr_t dmaphysdest2 = 0;1 j. s7 u" u0 R! t9 |2 H) n
% l c$ S# p- R6 W9 b) s' R% b( o- char *dmabufsrc1 = NULL;( U. ]. N0 l, V8 N) z
- char *dmabufsrc2 = NULL;7 @8 v% |- T8 k3 Z
- char *dmabufdest1 = NULL;" O: v) M: G9 M! e+ ]
- char *dmabufdest2 = NULL;
. B/ B; K9 ~$ L% B
7 ?3 o+ {4 m# B+ C" r- static int acnt = 512;
: a+ B4 D& r; v0 M- v. D S# H! p - static int bcnt = 8;
; }6 [" u2 a! D, Y3 K- ^0 p - static int ccnt = 8;
: J% Y$ H9 a) C& U, [
) M4 g8 _( D1 h& h$ Q; q5 F' i- module_param(acnt, int, S_IRUGO);
7 b- P, ~( e A1 S( G& K9 x, B - module_param(bcnt, int, S_IRUGO);
% N+ v. K- N: J8 U; J8 c$ U# O - module_param(ccnt, int, S_IRUGO);
复制代码
$ H3 Q" u5 L f2 c8 ?; r9 D
/ v! d3 I& S( d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! @3 i% K% c0 R' d% k; \9 n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 w. g. C* I, W/ i+ Q' P, N6 A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- u* P& P x( e/ P5 @
9 u& E/ W& t" h6 t( o) q
0 Y$ I) c0 z. {; M! N$ p |
|