|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * h" v0 J2 G3 F( F, F% U- C
- [code]EDMA sample test application# ]9 ], i9 o, A2 U, e
- /*
; r6 h, T5 h" F - * edma_test.c
. K: t& W5 V3 H0 u6 B9 A - *: Z9 w& P8 Z8 }" b) ^; h, [
- * brief EDMA3 Test Application$ l1 {& u# \; n) E1 t8 w; @; N
- *3 t+ M# m/ h6 U* S5 R
- * This file contains EDMA3 Test code.0 l8 [; P1 D+ ]: x0 j+ Q( K% [, S* G/ c
- ** T0 _2 p6 Y5 r2 \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 d9 C! R- y" X* K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 _$ z3 X; b5 h+ W* M1 u: v+ z% k
- * TO CHANGE.7 \$ \9 u8 U" L6 Z4 q! ?7 x i
- *
' I$ v7 W& J% \+ F, v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 ^1 x8 k0 d. o* t% S - *
|0 d# z) n7 u, ~' s. p! x; a; j/ K/ `0 F - * This program is free software; you can redistribute it and/or
^7 E5 q ?- z9 C' \ - * modify it under the terms of the GNU General Public License as
6 k- A% l$ M8 Z - * published by the Free Software Foundation version 2.& x7 Y9 X9 H# ]* G0 J/ l. q
- *
' @: f6 R0 K5 l0 m$ m' K: m" c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ e8 K- Y8 O" } z( R- [+ |/ t - * kind, whether express or implied; without even the implied warranty
' J8 l6 A& K( V+ o" d9 T$ J! I& w& X - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" { y/ ~3 {( _; U' ? - * GNU General Public License for more details.
8 i8 u$ z& L8 ] - */: G! h* |2 X* D: O. R
' u8 I, s2 [9 ` F; H# z- #include <linux/module.h>6 n+ D( l; P, e s+ D
- #include <linux/init.h>8 R/ B! r! @8 m. I- o. I
- #include <linux/errno.h>
: |& {! Q: t& Q+ z1 g: q0 @ - #include <linux/types.h>+ p9 A! {( \* C2 K) w
- #include <linux/interrupt.h>3 S& u9 t/ V/ I! X' N7 s. o- m
- #include <asm/io.h>
. k1 D4 o9 M5 X1 T3 [/ G: K& x$ m - #include <linux/moduleparam.h>7 [/ H4 Y' c( C C
- #include <linux/sysctl.h>
8 i* m7 l% [: F! C6 D% k0 M$ t - #include <linux/mm.h>
! G) V! Y: [- S- I - #include <linux/dma-mapping.h>/ Z. `; e/ \9 j
) i: T. D+ w: S% V5 @- #include <mach/memory.h>% X0 J% W* D+ O; w0 Y% @ K
- #include <mach/hardware.h>
" R q* u1 s F. G8 ? - #include <mach/irqs.h>8 a% {3 s& W" Y! @! {7 W! f
- #include <asm/hardware/edma.h>
( d3 A! Z( [! F2 w$ x) M0 ^ - 7 \- N" Y$ w1 p- l$ p
- #undef EDMA3_DEBUG& c1 j8 ^1 U3 ~
- /*#define EDMA3_DEBUG*/1 z$ g$ u9 z* B, B( F ]
" y% l g" {& n- i% V7 N) @- #ifdef EDMA3_DEBUG* N0 b5 l- [0 T$ l; i1 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 ?' d8 B+ ]. G: ]+ q E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 H8 }2 K! V/ g- ]( i4 X3 I3 ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 n! H! g: T! z n% X - #else
- G/ P& g6 j) Y; t1 W8 m - #define DMA_PRINTK( x... )
% v6 L2 @0 `8 F* K7 l+ P5 q* P - #define DMA_FN_IN
" m7 z& n# t; N& g) {) I - #define DMA_FN_OUT# a8 n7 P( Q/ T1 g5 H
- #endif" V/ j; r6 _. v+ g6 h* ^" A
- 1 J6 F b" b. }* L/ {/ V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 \- I6 J0 a1 Z a: Q, @' ] H - #define STATIC_SHIFT 3 D( v+ D# t$ i5 d
- #define TCINTEN_SHIFT 20
, x M/ w6 v9 [ - #define ITCINTEN_SHIFT 21
# f) g& j5 A2 Q0 b; ` - #define TCCHEN_SHIFT 22
1 m( | d6 X0 Q7 Y - #define ITCCHEN_SHIFT 234 f0 e' j9 L2 B1 w
- 5 X0 Z- H" b$ N$ |2 B+ R4 E
- static volatile int irqraised1 = 0;$ |9 f% ?/ q. k1 B" u9 A
- static volatile int irqraised2 = 0;
9 f( Y2 [) M# [ - 3 y/ p2 ~) w1 p$ R$ X& S- |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; z9 W! m2 J) K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. i# R. {& ]% A, ^% T$ c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* ~2 k) X3 N& `) N# G - 0 J( Z4 f% k+ Q# S9 g; s) d
- dma_addr_t dmaphyssrc1 = 0;
\! \/ a2 B: W6 W4 a - dma_addr_t dmaphyssrc2 = 0;8 y. o q" q& b2 x5 E
- dma_addr_t dmaphysdest1 = 0;
- G' }+ _5 u6 F( C8 x. S - dma_addr_t dmaphysdest2 = 0;
* t/ p) M- k8 |/ u: z8 G$ M/ r
" q+ U! ?( U; q7 d- M) \- char *dmabufsrc1 = NULL;
% Z2 U$ D: S. g: } Q2 b% S# W - char *dmabufsrc2 = NULL;
; l$ b& ` M% b - char *dmabufdest1 = NULL;) U" v% F& p7 ^: I
- char *dmabufdest2 = NULL;
. m+ z/ [/ I& f& {) I8 \! a3 w - 3 t. n4 L0 Y/ E" u5 @& t$ x
- static int acnt = 512;
- D& L5 c- x. b+ H8 v ?& r2 Q! S" } - static int bcnt = 8;
1 V" X9 M3 ~4 g7 w; K - static int ccnt = 8;
' N' k' v$ [3 ?" Y - 9 ?6 C' ^+ F2 ~1 r( G
- module_param(acnt, int, S_IRUGO);
$ h; k v/ A( h6 q6 N9 Z - module_param(bcnt, int, S_IRUGO);
5 G! h0 x3 O2 T8 j1 n [1 b. m - module_param(ccnt, int, S_IRUGO);
复制代码
' ]. e n6 n0 u8 S; X& s5 s
" D" g( }0 a# Q: s1 ~5 h9 ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 c5 k' _9 x1 ?: P' v, _; L$ Y8 @4 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# e4 C5 L' ~. l7 Y( p1 j4 V0 p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 n8 ^0 m8 }" u, R5 m
" x- |1 v) b }
2 i/ C* V! i( |6 _" K8 o |
|