|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 S: _: p; R* M+ D
- [code]EDMA sample test application) }$ r1 n4 |1 q3 T3 [; ]
- /*! ~. `! V" o; h0 t
- * edma_test.c
+ E6 I; W7 U* |. \7 p2 V - *, @: Y8 R8 N; e5 q, Z
- * brief EDMA3 Test Application) u8 W1 s; y, ?8 m8 @( x+ Z/ J
- *3 r; z! m2 `2 V& q: w( e0 V3 C
- * This file contains EDMA3 Test code.
; O) A) |! n0 T/ p! `5 s4 ?. z2 y - *
, T0 n H8 ^1 d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 z4 I4 M0 {- _. t# {. G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 ^! g! Q6 }5 }9 P& S: F - * TO CHANGE.
' _4 M4 m% e9 f/ b! v( Q) Q+ j3 b - *2 R+ r. W0 u1 ` D' O, s2 U1 g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 f' _& Z: }4 K1 ~, [/ C1 ~
- *
* j4 E6 Y& r! t# [5 w' a - * This program is free software; you can redistribute it and/or2 x% o# B/ V2 V' I. j$ [
- * modify it under the terms of the GNU General Public License as
* H u: W. T! v - * published by the Free Software Foundation version 2.# |7 L4 j& B: ]/ M/ a8 K" H
- *
5 r+ l4 s. u% l7 \5 S, }" t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* g3 P* O" h* d, X% U% J+ H% B) n2 j6 F - * kind, whether express or implied; without even the implied warranty
) K3 n, ^2 @; ?: E4 ^& i% C1 ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 f- k E7 U5 m8 P0 s5 w4 ], y - * GNU General Public License for more details.& _+ H5 k0 A7 [6 O9 {9 e5 R- x- h
- */
2 o5 K' W) k9 L% ]5 f1 b - # l. k: a; b: H+ R
- #include <linux/module.h>
( @5 `6 F2 V3 L" K T* P8 E - #include <linux/init.h>5 g/ |: E+ A- ^* r% m
- #include <linux/errno.h>. q7 }9 o# I2 s) @9 v
- #include <linux/types.h>( G6 }! @) K3 M
- #include <linux/interrupt.h>
% A' G" q* G+ m& F* @ - #include <asm/io.h>+ J/ N* k1 o" O7 j' f: |0 p
- #include <linux/moduleparam.h>: K. a8 ]* p3 E; }- ~
- #include <linux/sysctl.h>
- `" b9 ~/ h f0 f - #include <linux/mm.h>
3 o8 I; T) E, A( \5 J' [ - #include <linux/dma-mapping.h>9 C+ B9 D! l0 Q1 F# F
, M" c+ G9 z2 x; _- #include <mach/memory.h>+ h- D! }0 x/ E7 I$ @
- #include <mach/hardware.h># i) f3 c' t% h* B( e5 l+ e
- #include <mach/irqs.h>
( @! Q5 J& S* N* X. w8 c - #include <asm/hardware/edma.h>3 l) |8 X0 K. Y% Y8 C
- 9 e& w5 z! r# m, Q
- #undef EDMA3_DEBUG% B' @! d# ~2 p3 I6 v" `! a
- /*#define EDMA3_DEBUG*/7 m7 l6 S4 V e; G6 K& W1 H
$ J) I5 M6 f, P- #ifdef EDMA3_DEBUG
7 e, X" t' D3 ^3 M' W; e+ ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ l, i6 i" g, F- ^" W7 H) f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. S& G& C* Q1 m1 v6 K: M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 y+ y: a' ]$ E6 Z
- #else# ~+ C; U% g0 X7 u
- #define DMA_PRINTK( x... )/ H/ C. n3 r9 m7 v+ w
- #define DMA_FN_IN7 N; d9 |) s( Y& \ g
- #define DMA_FN_OUT
6 h! \1 U2 B$ b* B+ A+ k - #endif
7 W4 u8 C% Z8 Y0 @# v. H' b - ' i3 Z$ N, M* ^) ?2 ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ Q+ c! y4 c/ k ~) h4 H, x# R$ w - #define STATIC_SHIFT 3
( ^% b8 `1 H1 x - #define TCINTEN_SHIFT 206 J* x# ]% x! a* g5 F/ R) N& ~7 O
- #define ITCINTEN_SHIFT 21& {7 h0 j% |9 a+ \8 d3 D+ x
- #define TCCHEN_SHIFT 22$ M! W# e v! c( F Q! {
- #define ITCCHEN_SHIFT 23! W5 d9 z5 D2 E# ?8 c, b0 ]
- & \8 g f1 F, @- S5 u
- static volatile int irqraised1 = 0;3 {/ C7 M2 v9 t
- static volatile int irqraised2 = 0;' r9 Q- V/ y8 u% |8 L5 U% |
, F2 c0 P) e: D! F5 r8 M& Y6 G: F1 g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) x$ m' J. u8 U; a' p. N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ [4 L. z( ~+ n. B* I X0 X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 v7 O' n; \ S1 W% \
- ; x& j h) U5 _8 B7 u9 e
- dma_addr_t dmaphyssrc1 = 0;% l% I) U1 A" X* ^3 ?
- dma_addr_t dmaphyssrc2 = 0;& I2 L4 m+ E2 ?- x+ Z% u
- dma_addr_t dmaphysdest1 = 0;0 v6 K0 c8 D$ c5 L: y1 A6 }' H3 R
- dma_addr_t dmaphysdest2 = 0;/ p8 x$ q0 u3 Z, Z3 D' U1 D
- 7 G0 B; D& _5 |" n
- char *dmabufsrc1 = NULL;
* a+ ?8 R" n# O7 E% p, B! L - char *dmabufsrc2 = NULL;
0 |' ^2 W% J0 n - char *dmabufdest1 = NULL;
" l0 g/ z/ [9 m - char *dmabufdest2 = NULL;+ R4 C. V$ D, N' ]! `
, D: X0 K T% B- static int acnt = 512;4 Y( j& w4 `* ~# w! M
- static int bcnt = 8;
5 X' x* H c& D - static int ccnt = 8;
3 B/ f0 _' [; S) D1 I - , V0 S3 Q+ ]' f( L! \4 K
- module_param(acnt, int, S_IRUGO);! r. e! q0 E6 p
- module_param(bcnt, int, S_IRUGO);
$ H" x+ l/ G% O5 Q- [# B - module_param(ccnt, int, S_IRUGO);
复制代码 9 O1 u$ [' ]9 }
3 t* x W( F, c: D8 v4 t2 @4 X( c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- Y8 Q- E- Q2 Y. v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; }3 O4 q$ @0 z% p1 ~2 k$ {1 s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 [: k( I/ {/ E* J
5 `1 R4 f; ^3 U
/ X4 {4 {1 H( R/ y K: G |
|