|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 }" s+ Y' w! R- [code]EDMA sample test application
* Z" @' G/ u* Q - /*
! X8 O* I7 A: x( q& N) o( n. v - * edma_test.c( M; Q `1 a3 m/ ?2 n. _
- *
0 \) K! T1 l0 v6 M" J - * brief EDMA3 Test Application
9 n3 k# j( ^1 k" }& y0 P - *
9 Q7 o! N& M9 p; ~# z- r2 G" } - * This file contains EDMA3 Test code.
% v& T9 J% W7 {$ ?9 f, t- ^9 G3 M - *
8 }2 k- w, {1 ~6 }' h9 } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 F) z0 N3 o0 I1 O3 G" w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 L- @& D+ M2 k. H3 O, S9 ?6 U7 x
- * TO CHANGE.. m3 R& z* m2 |/ ~
- *6 b6 ~; z/ L* H @! N# R$ V4 O9 t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" @* C7 F6 k& r y' ?5 F( A. J+ C - *3 \% c2 t/ e, d+ B! o. A& o! i0 d
- * This program is free software; you can redistribute it and/or
( H9 ^& ^% g8 u9 s - * modify it under the terms of the GNU General Public License as
. d* i, Z. v$ x7 N( h& L - * published by the Free Software Foundation version 2.
) U- i1 r b7 Y0 g9 k' [2 N - * S5 s- h' Q. j3 ~. ~# H, n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- n: F, t: }2 _5 g! g - * kind, whether express or implied; without even the implied warranty& V2 K$ P& O4 J2 X8 I& p6 g4 O4 F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, X# p, l- Z' G9 y. C+ t( o - * GNU General Public License for more details.
. | \5 ?/ D7 G/ P; n6 s' w- u - */
: w f2 P: _/ N3 h6 k% [" a5 C - * }; K6 R# r$ u+ D
- #include <linux/module.h>+ d6 w5 x* q6 B' F
- #include <linux/init.h>: A" Q& Y& O, }; i6 z& F4 {
- #include <linux/errno.h>
0 N3 |3 u* Y$ b- ]2 q5 ~: k - #include <linux/types.h>+ z* w) p8 @+ A* t4 v
- #include <linux/interrupt.h>
2 k0 C/ |: e# k8 S) L0 f& `* }5 D - #include <asm/io.h>" _7 y5 Y8 k2 @8 z7 M% x' E* J
- #include <linux/moduleparam.h>
i( E: g& p! R* r, j( A - #include <linux/sysctl.h>
& F; z+ z) c3 P, z1 i9 c( ] - #include <linux/mm.h>7 ?- X) l. S4 N) i1 q1 V5 x
- #include <linux/dma-mapping.h>
3 C/ @3 B- y; V% e f k
, p$ j* M* l% G0 Z( l- #include <mach/memory.h>
9 w: V Z1 K" F$ Y3 O - #include <mach/hardware.h>4 E) D! E8 ^2 O9 s+ j. a
- #include <mach/irqs.h>
) I m% x" @. K6 n2 B' K$ h+ ] - #include <asm/hardware/edma.h>
! p6 S! x3 Z& B* ^, ?" @# p: ?6 I - I2 D4 u. R8 u+ g4 f* y% U. g9 K
- #undef EDMA3_DEBUG
. N' [1 U" Z# ? - /*#define EDMA3_DEBUG*/: X% e5 O4 B% k" Y" N+ {
4 q& c( l: w4 ]4 t4 J1 x- #ifdef EDMA3_DEBUG
1 A7 a) O8 r; D: ` D - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 L5 l ]6 J" N, N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 y& Z$ S. Q5 Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* m3 Q; Q2 k# q/ U# u6 l- L
- #else
& u( W! W- D9 r( N: s4 n4 D2 K0 [7 R3 r: r - #define DMA_PRINTK( x... )
9 k: S6 |9 k' J _2 u - #define DMA_FN_IN4 x1 s" O. ?' k( h2 k _" f
- #define DMA_FN_OUT
2 w- y8 V' K4 S0 a4 H% G - #endif
* P$ F' ]: \4 J; j - # J; l' y7 [3 Y- a' b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. G' W0 n0 ], Q4 I - #define STATIC_SHIFT 3
( L7 E% N) b/ X" O) q8 u - #define TCINTEN_SHIFT 20
" g0 e, q, P, r8 k1 [; i - #define ITCINTEN_SHIFT 214 l: ?% r* C: K3 v. e
- #define TCCHEN_SHIFT 22, V' m9 D) K6 |& J: P4 c
- #define ITCCHEN_SHIFT 23, r, z+ n7 z ?$ U( b
- 3 z& H, \ f2 e) i+ ]& Q' G, t0 J
- static volatile int irqraised1 = 0;& M0 ?4 V, n( T7 f
- static volatile int irqraised2 = 0;. B% c" V( h0 T% d& V: k& ]
4 M8 t# v% U. o h# R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 G+ z# | D3 e) v0 C0 `1 | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) a2 W% A' H: O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 i1 L" N& U% X0 {- C7 t7 | - , S$ I% Q! f7 G* ~& |
- dma_addr_t dmaphyssrc1 = 0;9 ` E7 k4 ^ w7 w, q L) G+ H" a
- dma_addr_t dmaphyssrc2 = 0;
! a, z: X8 m) v5 I- i k* F4 C8 i - dma_addr_t dmaphysdest1 = 0;4 k; e9 @! R" s% z& f
- dma_addr_t dmaphysdest2 = 0;
8 I j# Y7 d5 K+ }2 S/ ^: X4 q - ; K8 |, n$ m8 c5 n, @* A( [5 ~
- char *dmabufsrc1 = NULL;+ C9 E# K2 {. N" Z
- char *dmabufsrc2 = NULL;( _/ ^4 j. p0 ^7 x4 I
- char *dmabufdest1 = NULL;' P4 o3 I7 ^' | v' L: L$ f8 ]9 y( l
- char *dmabufdest2 = NULL;- B" L* o; w) C& n3 P3 L
1 t/ G$ Z1 A8 c! ~* c& N- static int acnt = 512;6 V, [* J7 S% ^! M4 S" A8 P
- static int bcnt = 8;
4 c: j. e7 @9 d4 |# o - static int ccnt = 8;
6 I5 W; g2 O. n! a& ]2 [1 w8 P - " E; b' B+ ?2 V6 u+ q. t0 X
- module_param(acnt, int, S_IRUGO);
8 H/ @; q- B. [& d. T6 \ - module_param(bcnt, int, S_IRUGO);1 h& Z# M0 r' D! l# J; s7 q
- module_param(ccnt, int, S_IRUGO);
复制代码
1 R) ?5 t( e; Z( |" } m' {, I8 Z+ k& |* K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 U J2 @/ I& L) H" [ W. parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 T0 W2 L" H' F3 @) G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
\3 n0 {# K7 H- C8 O# e: @9 P& t2 M* M( p
. G- H) @2 y* c u; ?
|
|