|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # B3 K8 A. T+ K+ C% D! w& ~ o
- [code]EDMA sample test application
" y) a ?& k8 o- L% `- ~- r - /*
8 i7 Q& F$ e' _& S - * edma_test.c
! g8 L- }4 Q/ I: Q1 ~- G3 V3 g G - *% R0 G9 w* v5 M9 n- f
- * brief EDMA3 Test Application
$ h1 T9 @& \- @3 Y5 m+ X% y$ {" l - *
{8 [4 I; T( l% T) E, _ - * This file contains EDMA3 Test code.
$ u5 Y9 ~* y* s& I7 [$ a - *' X6 {. S" B7 r& D9 G" D8 V' d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 g+ X& h8 c: c. H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, D$ B6 M' s ^2 n - * TO CHANGE." h" D& w% T* w8 b. a4 Q
- *
' f+ M- q* `% @+ G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 F" ~) |8 V( F% n3 I
- *4 }. R% o5 t- q( }2 W p
- * This program is free software; you can redistribute it and/or
2 h$ b- x) v1 v/ c- v# X - * modify it under the terms of the GNU General Public License as
! {8 H# p( n& k - * published by the Free Software Foundation version 2.
_% o$ j- K4 P! e - *' p! s% W" {& s& L/ z' P7 w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 d- v, y" z& p+ m4 U - * kind, whether express or implied; without even the implied warranty' s0 q' k8 K/ V C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# F1 n2 P( h$ Z7 B' y - * GNU General Public License for more details.
' k: y* i+ W& A) [ - *// V9 A5 \1 P+ l- M+ m
/ m+ L% Z: U6 {- #include <linux/module.h>/ I$ y% w$ A* U. l) J% j4 c: a
- #include <linux/init.h>; H4 A2 n" ]% c3 k
- #include <linux/errno.h>) d5 I, _$ d' ^1 y% a
- #include <linux/types.h>
4 V3 h6 ~. ]; \# N1 T) U2 \( U - #include <linux/interrupt.h>
/ U2 D8 E' ^8 G1 h( f7 x - #include <asm/io.h>) q! u% K+ G. m/ A- s$ O# i
- #include <linux/moduleparam.h>+ X' L& }4 M& v, Z/ u
- #include <linux/sysctl.h>
' y- `. u- T, w/ W3 h9 ? - #include <linux/mm.h>
8 k$ m `! C6 G% ^# ~6 o3 J* m - #include <linux/dma-mapping.h>/ i) i- c+ U2 z0 G+ X4 n
- * D) Y1 Y8 T: l1 C6 }) e. v
- #include <mach/memory.h>" c8 b0 V- D6 J% a+ a
- #include <mach/hardware.h>
1 b: f/ u# p# I1 O5 r; P - #include <mach/irqs.h>; x( i2 D% Z! g. @
- #include <asm/hardware/edma.h>7 z0 o1 n$ w( b# C) r3 H( l
- l) }2 T1 A% j9 p- T: m( c
- #undef EDMA3_DEBUG" G6 d& Q; Z! d' z1 Y- v$ k
- /*#define EDMA3_DEBUG*/- l0 W/ I# I/ l+ i3 t! w
- / M4 C+ i1 [4 y; ^* t
- #ifdef EDMA3_DEBUG8 j: F4 b& [# g# N8 a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 p, u$ _/ ]; O5 x& P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& h" | i1 ]: _1 L; D; S( s- d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' |+ x; p/ S: x" s8 T6 U1 o - #else
1 Z9 X! f: N# Y - #define DMA_PRINTK( x... )+ ^ X* }: W3 j. {! x% @/ g3 ~
- #define DMA_FN_IN3 B. k/ `3 `8 U
- #define DMA_FN_OUT- q* h$ }6 D4 @' @1 x
- #endif' }9 e- v1 q1 z* Z1 x" |
- 9 i; j* J% @3 C5 T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& l( b- U! j) N$ f
- #define STATIC_SHIFT 3- [1 t, O9 Z! T
- #define TCINTEN_SHIFT 20
/ [' p" g# W/ X5 L4 t( o$ f - #define ITCINTEN_SHIFT 21
! l. o& i! V- u9 T - #define TCCHEN_SHIFT 22/ u: t, K/ c4 b, h L9 y0 |9 `
- #define ITCCHEN_SHIFT 23
, Z5 Y( d% V {4 ^ - 3 n* w; Y2 d& Y9 ^, X" a2 c6 v
- static volatile int irqraised1 = 0;
4 M) n' Z; m5 @* z - static volatile int irqraised2 = 0;$ [8 \* ?5 J! S5 c% w1 O
: Y3 N. @3 F; J- m. i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! |% O1 N) y" s* V: H. C0 a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ^. e5 M" T' {' d5 _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 I8 g; q3 _/ D5 e E - ! `* Q! R) A) t+ R) v, z' i0 s
- dma_addr_t dmaphyssrc1 = 0;3 s1 D- d" s) h# B6 t2 L4 p% n
- dma_addr_t dmaphyssrc2 = 0;4 U& w1 X! ?9 W9 n
- dma_addr_t dmaphysdest1 = 0;, p4 R# M( B6 f' E+ _
- dma_addr_t dmaphysdest2 = 0;5 s- F! C% @+ g) @
- 4 y! @& a' a2 y3 D
- char *dmabufsrc1 = NULL;
- s6 c; e$ o% w: S; i8 _- q0 L, c - char *dmabufsrc2 = NULL;9 S; P ^8 H' Q) S' `9 x+ x- T
- char *dmabufdest1 = NULL;
, |# H! }2 y0 @- h& f/ T - char *dmabufdest2 = NULL;, P0 k- Y% ]% J3 C+ l, V6 V
2 l5 Y2 u: J3 F- static int acnt = 512;! g; s: ^& g2 ]) C: w
- static int bcnt = 8;6 u( [) S# v% d, o% V4 R5 j
- static int ccnt = 8;
" G/ j' f( x7 i, d
# J9 E8 \1 s6 X) l. @" f- module_param(acnt, int, S_IRUGO);7 r& x5 ^7 J2 t5 ^; E8 q* T% o" k( Q0 }
- module_param(bcnt, int, S_IRUGO);8 |; ^5 b7 |0 H& J. w: m
- module_param(ccnt, int, S_IRUGO);
复制代码 ; s) \; I1 f+ u4 U, J3 @$ a
. l9 w# G5 [ `( r; N. q- @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) ^8 R9 j0 }) F$ B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 N6 E+ B8 Q8 W/ d. d) j: }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 Q6 a" b; X. A( p" ]* L3 e
, Y- s* \& c! o8 d; \8 Y6 ]$ q/ F0 I: L; ^* C" o$ w2 |1 R
|
|