|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - A0 X3 ?0 q2 S1 Y" U
- [code]EDMA sample test application
: J) {: ~8 C* p! A - /*
8 C) Y7 O+ K6 I& a7 _1 N' m - * edma_test.c
. ?+ W4 {7 r/ v6 {- K5 k- W: r - * N4 Z* V/ b6 Q: J9 k' }
- * brief EDMA3 Test Application/ r, d6 j/ H' T2 A
- *
9 \* V8 S- G9 {& Q' g - * This file contains EDMA3 Test code." _4 H1 d) i) R
- *
, N7 { U' j9 \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 a1 t0 V3 t( m# r/ y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# z9 Z2 k1 D2 X" Q( \. y
- * TO CHANGE.
8 d4 P& u$ i% x: l/ _3 |0 l" _ - *
8 L9 `' V: @6 ]/ _3 @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 z1 r) W( g* @+ K - *3 @" ] }7 X' g' a3 `7 g
- * This program is free software; you can redistribute it and/or
+ a" ?5 @3 y" x& F4 {* ]1 d8 V1 i - * modify it under the terms of the GNU General Public License as
1 N2 ]1 P3 s% F3 |- f" F - * published by the Free Software Foundation version 2.
( s3 z1 ]% g- s9 i - *$ C9 f( q+ {3 H* v+ r8 C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) ` h/ Z) I/ x' ^ k2 S2 O - * kind, whether express or implied; without even the implied warranty, f, W: ?5 ~9 `2 D& c5 l; i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* b+ w1 G9 i# V' o5 i - * GNU General Public License for more details.# z+ N" W( O# w( P5 f
- */9 E% v* y/ J* \: F
- - e, c% m0 b' D. ?
- #include <linux/module.h>
5 s3 T$ ?1 y% ?' o4 D! h9 [ - #include <linux/init.h>
4 v" t& p3 z* m1 q - #include <linux/errno.h>! {1 @3 H# u1 X* F1 d' P% S
- #include <linux/types.h>6 n1 o" ]! s1 N O, s% _6 o
- #include <linux/interrupt.h>6 e2 {' j! E3 M% X) Z7 I. E# W+ n( Y
- #include <asm/io.h>( |0 O$ y3 L- D7 k/ k
- #include <linux/moduleparam.h>
c& r$ l4 C5 i ]; X - #include <linux/sysctl.h>
+ F1 R, v% j2 C5 j - #include <linux/mm.h>
$ j9 z/ i# b# J* e; q- i, D( B* F - #include <linux/dma-mapping.h>4 n8 c) J3 b( C4 A7 E, ]: \4 b8 Q
- 6 O3 n5 `- B& X+ C8 w
- #include <mach/memory.h>" S; D) ]2 O$ X2 h Q
- #include <mach/hardware.h>( F$ ~2 u @- J* q3 @9 h: p
- #include <mach/irqs.h>
* u3 g4 Y- Q5 f1 `6 |* b! d& R3 K - #include <asm/hardware/edma.h>( F6 }; j( k$ e9 j8 y; u6 U
+ W% I: d0 g! O- #undef EDMA3_DEBUG
1 _6 M2 M, L( U9 _+ Q; [ - /*#define EDMA3_DEBUG*/) ~+ ^7 u2 o) b% C
- 0 I% I+ ~1 c4 c( a2 T7 O
- #ifdef EDMA3_DEBUG' Q; Q) p: G+ `6 S+ K6 P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ z" X$ T; d1 {2 D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); _# `; C, c: r- x$ v- n* @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ @3 j0 q2 [$ T1 }2 _: q+ g' g. b
- #else
1 g, p3 G: O9 r* ]! Y7 X - #define DMA_PRINTK( x... )
9 t0 X; K! `. M) n9 ^9 X! y - #define DMA_FN_IN6 L0 ^5 x9 r: G* s: J8 }
- #define DMA_FN_OUT
, e4 E' S& j, m/ G/ [4 ? - #endif7 b, c1 R; O/ w3 ?" g8 t/ t
- 7 X2 b8 e7 Z# U& t: ^& d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ T' A% e6 t0 [ - #define STATIC_SHIFT 3
2 t% ~ F" ?) z$ @: T" [$ x4 y - #define TCINTEN_SHIFT 20
' h1 `5 K1 T% O1 u- B* m - #define ITCINTEN_SHIFT 21
8 D! y4 W- ~3 r) @ - #define TCCHEN_SHIFT 22- i1 o" I0 ?0 N$ t( \$ c0 k+ `
- #define ITCCHEN_SHIFT 23
' i t; t3 k5 M8 H3 x' a y - : \ H8 e* h8 y; j1 R
- static volatile int irqraised1 = 0;' ` `- I6 @* G$ a. ^" k6 Z
- static volatile int irqraised2 = 0;1 A! N; p0 X8 L6 [4 t
- & Q' o& u4 Q) L9 w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* O1 l, e) M+ R- _0 t* N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) S. v6 J* \+ G3 ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' w# y2 T% E K$ O
- ; H% A: u% p9 |: ^4 R
- dma_addr_t dmaphyssrc1 = 0;+ ^5 R* l+ k1 B w
- dma_addr_t dmaphyssrc2 = 0;
7 n4 r" V$ w9 Q4 g5 }/ k - dma_addr_t dmaphysdest1 = 0;( l) d, `1 l2 V. b- Q/ Y- ?
- dma_addr_t dmaphysdest2 = 0;
) J$ l$ O1 K7 A9 ~- Y - % X3 [6 w; {3 I |8 {
- char *dmabufsrc1 = NULL;0 u$ F0 U& |: ~: W
- char *dmabufsrc2 = NULL;
. X0 _( k @0 o# ~ - char *dmabufdest1 = NULL;( v7 n* E, k$ A m7 L/ L
- char *dmabufdest2 = NULL;
) K4 @/ p2 i% ?. R0 `( `
7 t0 C3 l8 d6 s+ M4 b$ ~' l6 g% `- static int acnt = 512;' a' D! E( U# g7 N" Y2 Z2 f
- static int bcnt = 8;
) a! L' H$ v/ S7 Z6 W" h - static int ccnt = 8;
0 \2 Y$ K# A( s7 o4 g - 4 s- I# P4 d% E: O2 I$ W
- module_param(acnt, int, S_IRUGO);
: W4 d5 |" L7 L' o! F6 J. m - module_param(bcnt, int, S_IRUGO);
# g! K5 H; R# `) p - module_param(ccnt, int, S_IRUGO);
复制代码
: G" E9 }3 J8 e z- K' z# M
( k" O/ Q7 v: n1 D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. W( X4 |; P, {1 F9 K$ T3 d% m; z$ @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 [% P [( z2 O' A4 G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' U# A8 j+ U# ^/ P* l6 l2 W# r5 Q
# _' b5 x6 i/ p7 p- \. ^' b$ Q6 n7 n' M! X- Z6 H
|
|