|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 d1 N8 O4 H; A2 } ~& a# I% @- [code]EDMA sample test application
3 h2 h/ g$ P/ I8 T3 E* \ - /*! |/ v# P# [7 O! |+ }
- * edma_test.c
# E+ B; f- Q, D; k l0 T: M - *8 B( N+ o) G0 x" U& ?
- * brief EDMA3 Test Application& r1 m/ m! N a( _
- *: N& i6 A- x7 O; ]( M7 m6 W7 L, m, Q
- * This file contains EDMA3 Test code.: @4 V3 t0 s( F, z- a( o1 ?
- *
6 W9 t( z e2 n4 r: C0 z" U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' [ X3 u/ l( |7 U5 @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ F% b# f! W0 L+ J/ D1 Q
- * TO CHANGE.
1 V" t9 a3 [; r8 s! g9 Q - *
4 w5 z. A+ V9 [" y- p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* i! z1 @; f7 }& W' R
- ** _1 [; U7 k. v) f7 t$ o
- * This program is free software; you can redistribute it and/or' A+ c, Q% H5 b9 J$ o, E$ X+ }
- * modify it under the terms of the GNU General Public License as
* w: }* @6 O. o, W# U+ p5 C - * published by the Free Software Foundation version 2.
8 {4 _+ R! G4 h0 u: \& i7 z8 m - *: D; n% I( }- ^9 K4 k0 [- Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 F8 ~! h. z+ d# W( M m - * kind, whether express or implied; without even the implied warranty2 i, J: I/ c! M7 F* J
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; c' X- \: k" d& g7 A$ W/ C5 J* ` l - * GNU General Public License for more details.
' O% @% a; W+ ^! l - */) z, q$ V5 S9 W. ?1 S
& }) z$ X# l- Q$ F- #include <linux/module.h>" d6 {; i* _5 T6 ^& @4 t$ c
- #include <linux/init.h>* F. O6 S' F' \2 D
- #include <linux/errno.h>8 a" |, k# O( Z: |& W
- #include <linux/types.h>
0 @* @" P! U8 h) I: y, ` - #include <linux/interrupt.h>9 @+ [: G) E% u# H$ E g3 C
- #include <asm/io.h>
6 {4 x. z4 ?8 m" R& X - #include <linux/moduleparam.h>8 `& J1 B8 I3 U' V
- #include <linux/sysctl.h>
8 l" [( v3 \* B G- } t - #include <linux/mm.h>
% J" a1 g. v$ `( @ - #include <linux/dma-mapping.h>6 ]+ ~; @+ q8 g! _2 {
- 1 e: M4 h' O& M
- #include <mach/memory.h>6 @+ ~6 ?8 @5 g2 F2 D5 N1 W" i* P
- #include <mach/hardware.h>2 H$ q @4 C& @# n! C
- #include <mach/irqs.h>3 P% w. h5 Q8 h$ q0 h; q
- #include <asm/hardware/edma.h> H4 r. W# c5 q
- ) M( w6 R/ f2 f4 c
- #undef EDMA3_DEBUG
/ _( S6 T* r' X. O: l) b4 c - /*#define EDMA3_DEBUG*/4 O4 ?% `8 X! ]4 Y1 j/ G6 R
- # C' G+ l" ?9 O4 G
- #ifdef EDMA3_DEBUG' W5 i4 [1 o1 O) M* e1 P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 ^- U) k- K. [- D) u+ H9 y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; ^5 n* W d& S. p$ b# x4 T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( r9 f, h; I" @& a# w
- #else
7 k; b' N2 b1 { m7 Z v. Y8 V2 a - #define DMA_PRINTK( x... ) w$ ~) _1 R$ E7 i
- #define DMA_FN_IN
: y% ^ \9 B* \1 Q V+ G - #define DMA_FN_OUT
/ n( S4 L* L0 l9 f - #endif
. P8 O. c6 J+ w8 B, F) { - 2 }$ `% @# l1 ^
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 ?+ U3 R# `4 z' ]
- #define STATIC_SHIFT 3, L4 R3 f$ i( b# [
- #define TCINTEN_SHIFT 20
8 f7 A- [$ V- j- n - #define ITCINTEN_SHIFT 21
9 y* q: U5 l# B8 Y% p) ]/ f b - #define TCCHEN_SHIFT 228 d3 k" U! D5 j& {: o
- #define ITCCHEN_SHIFT 238 x4 |4 ?8 w& Z' V
% h. b& W) l c" O- static volatile int irqraised1 = 0;
) x" S4 O9 t8 D1 E" Y6 a) t, | - static volatile int irqraised2 = 0;
F# l. r$ v& J$ k1 B. H - + W5 Y5 t( w, V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* j- U( i$ d. H" v; ]. D& V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; h0 B! y) B) y1 ~) `5 G" R# P+ t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% p! H8 m$ x% J
3 f1 _; S5 N4 F8 d# x- dma_addr_t dmaphyssrc1 = 0;- P0 l# p' `! }4 n, w5 \" ~0 C& I$ N
- dma_addr_t dmaphyssrc2 = 0;2 X _! h; g5 g, A' _; |& w
- dma_addr_t dmaphysdest1 = 0;
/ [. j5 C# i+ p1 I( W' x - dma_addr_t dmaphysdest2 = 0;
0 K3 [: W. y8 B0 [& r% _& u
5 ?2 P' T% e( O6 Y0 X- char *dmabufsrc1 = NULL;2 j `- A* M3 n* B8 n; x
- char *dmabufsrc2 = NULL;: B0 H, A' A6 `$ s" v c
- char *dmabufdest1 = NULL;( J: j% A! n: m x+ q) N
- char *dmabufdest2 = NULL;6 I' u# Q' R0 C8 K6 y; u1 N$ W
- 9 w( y8 d3 I9 }; e+ R' P/ w, q
- static int acnt = 512;
( T% b+ L# z& e. m - static int bcnt = 8; U4 N' E# B! b! L# j3 J
- static int ccnt = 8;" x3 q) v. J) K
1 O2 h7 V) z+ Z0 l7 b, P- module_param(acnt, int, S_IRUGO);( I' S# J. @) T7 t2 D$ r' t5 H
- module_param(bcnt, int, S_IRUGO);6 s( N. m1 N* J4 ]/ c# M
- module_param(ccnt, int, S_IRUGO);
复制代码 . o+ B; E2 R4 [, t- D9 a+ T
* o6 ?$ |$ g/ |4 N; Z$ ^: i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) Z0 m+ P j2 E: @6 u& i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 S0 T2 G% d+ G* r( I: E5 w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 q0 r: V( a G" \& c
$ `- c* D; T0 ?$ m
' }8 x( [% C0 m |
|