|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( k& G1 |' i! c5 a7 I+ y5 `
- [code]EDMA sample test application* A E& C" _5 A
- /*
& W- k6 k$ M4 h$ ^0 S+ w - * edma_test.c
2 _6 V2 x, C9 T5 p, a& g$ d; ~1 H - *
8 ?( |+ N3 G4 F/ A0 l( { - * brief EDMA3 Test Application
) t+ r+ z- D' T. d; Y - *6 b/ _! C6 `( H: u* c
- * This file contains EDMA3 Test code.
+ v( b, K) {. l/ t/ R - *! e4 E1 G" a" b! n4 I$ W1 V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# q5 w3 m8 Z; f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
q8 s, j: p `! t, C+ P - * TO CHANGE.
, L: S5 ^) b1 [. R - *
$ c4 p5 q5 O6 O, a) K/ Y4 Z0 |3 q. m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, `1 R) k/ @% l" d
- *
3 S0 k: M7 f" t. h$ Q) C& [+ U1 ~ F. R - * This program is free software; you can redistribute it and/or( ^: N% ~: C, W( \; a
- * modify it under the terms of the GNU General Public License as# V. U7 r, h/ C7 [, U2 t; q) b
- * published by the Free Software Foundation version 2.
- s+ E* o4 Y5 ^/ l7 z8 x, P4 q7 [# i - *
) D) h( f* K/ F1 c9 N; c3 S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 C. `% v0 N V/ M
- * kind, whether express or implied; without even the implied warranty' l9 X" M7 g8 @2 n4 h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ j+ _$ t- ^. X. Z% R% N4 Z - * GNU General Public License for more details.! I! U1 b& T$ f# _2 }
- */
0 T8 S' ~. P* e- _
9 C: v, z5 Q/ h- #include <linux/module.h># A- `$ E' b/ I# |* T; `* R) ^
- #include <linux/init.h>
, x7 M3 M7 N+ @* k8 F3 j4 g - #include <linux/errno.h>
& ?, `/ r% I. ?1 G$ N - #include <linux/types.h>; k c0 G: |" Q r/ Y
- #include <linux/interrupt.h>
3 n: p1 E* ?( w: G5 V% d" i( p - #include <asm/io.h>$ b; X. g( v% C5 B0 D' P4 u
- #include <linux/moduleparam.h>
, P; d ?, O9 D2 I2 U) U - #include <linux/sysctl.h>
+ \0 M( {/ o) B5 v, D% i$ ` - #include <linux/mm.h># n8 i+ I) x5 g3 l, B
- #include <linux/dma-mapping.h>+ J( z9 ^- a" O% N. C
- 3 w. f& x. C6 M3 ?4 Q5 j
- #include <mach/memory.h>
0 ~( }" n5 B3 k, |5 d! i - #include <mach/hardware.h>
0 Q# }- Q5 P% A1 O2 A: k - #include <mach/irqs.h>8 q2 @3 E# w0 H+ ]
- #include <asm/hardware/edma.h>
9 x; V9 v2 q8 y - 3 D& [# x* }, P( R
- #undef EDMA3_DEBUG8 G1 S! Z9 e0 D2 I5 M# ~. T: O
- /*#define EDMA3_DEBUG*/
3 |7 ]6 Q( K, z9 _& J
6 l6 Q$ z* X, E. a$ a1 L1 d- #ifdef EDMA3_DEBUG# `# Q$ ]3 w! |5 Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
{" _& U# H0 D' F/ o9 E: G# c2 I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
}5 d- h9 T+ q/ p5 p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& r$ n* P; R K
- #else7 R9 b$ g: p7 B% _7 d# j8 P
- #define DMA_PRINTK( x... )
# M% b( k2 [ t3 u$ j4 ? - #define DMA_FN_IN9 J: s: ?3 A$ p
- #define DMA_FN_OUT
1 w2 R) g- S4 g/ r; F( m - #endif
$ E B+ h2 W4 E* A4 s; q; T - " x3 t; a2 I9 L' y7 F4 T8 `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. g1 u4 g) F; T' Y5 w7 g1 g+ T% d; S - #define STATIC_SHIFT 3+ X- N! X3 `6 }9 @3 v" K
- #define TCINTEN_SHIFT 20
6 K/ R w/ v0 {: F - #define ITCINTEN_SHIFT 21
5 B* O# h2 p: s+ } - #define TCCHEN_SHIFT 22
6 E% }! Q; C0 r A: z" w \7 S' }: Q - #define ITCCHEN_SHIFT 235 L6 d& O _8 \& S1 g' [* [
& Q1 T& O, ^! @5 H; g' Q- static volatile int irqraised1 = 0;) ^& a7 o* r' z9 X& \$ l
- static volatile int irqraised2 = 0;" f6 a) y7 U1 K# R% F/ U$ [
6 i0 q( _/ V% T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( ^: N4 o2 G* }! v' S3 k! D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. f" ?" f$ |( M e- O0 r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& H1 E; g$ [/ {$ p; A
- ! t$ h' h M Q, ?, \7 \0 ?
- dma_addr_t dmaphyssrc1 = 0;
7 c0 H* g# T# e4 k+ u1 P - dma_addr_t dmaphyssrc2 = 0; L$ l: `7 g0 T8 U2 W% P8 I. t
- dma_addr_t dmaphysdest1 = 0;" A, h7 U& ~+ W5 Q+ I0 c: e
- dma_addr_t dmaphysdest2 = 0;
+ d! @' R' ^& @3 T5 v+ Q" x
1 r# e- J$ z- f1 f; H- char *dmabufsrc1 = NULL;
( g: s, s/ w S/ v" f& ]1 `& G2 W" X - char *dmabufsrc2 = NULL;
$ {# }& f9 a- l7 w$ e% L* D - char *dmabufdest1 = NULL;/ D# z* y; S& }' K2 v6 s
- char *dmabufdest2 = NULL;
, Q0 T, Y7 @2 `: h' I% {
: q/ E/ m( ]: ?- static int acnt = 512;5 s2 w% o6 D! L$ N
- static int bcnt = 8;/ T8 o" ^ y2 D% k1 X; d0 Z0 r
- static int ccnt = 8;
' ?+ y/ n4 [+ | H
2 ~ N- | r# m0 V- module_param(acnt, int, S_IRUGO);
4 T# C$ \' r" V9 t3 G - module_param(bcnt, int, S_IRUGO); n0 p' z" z# g4 m: V) \, `
- module_param(ccnt, int, S_IRUGO);
复制代码 % c' }( f$ ^4 _
2 w& t# Q( m& C. `0 s, x4 c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) B1 B; k1 f& e: ]0 `3 Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% M& I2 H. Z: \$ ?% @% S6 S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ e. ?+ h4 [! Z0 g0 B1 s/ b6 q6 M5 l/ s7 D# U# u0 r
0 q6 H1 R8 w1 r6 w |
|