|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 P' V1 R: M5 c u9 K. X8 v- [code]EDMA sample test application
9 x( a/ T( M5 L; Z; ~ - /*- ^+ t5 p! i" @
- * edma_test.c n) L9 ~& b7 y4 s) s
- *
; {. M3 X( ]5 e1 D* D* @- u+ g - * brief EDMA3 Test Application" n% a1 I7 s* o! b+ E! Z, o* w
- *' L9 C* Y) A# g3 m
- * This file contains EDMA3 Test code. f1 E6 q6 e- ~/ r* _, o2 T- r
- *; \. |# S1 Q, v2 u1 B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 x# g9 S5 p( Z3 u( x3 v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) Z" H2 `' I. O - * TO CHANGE.
9 o1 M' v, a3 B+ I1 p - *4 P% Q, E, R8 p& Z) S6 P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ z2 ]+ C( X! a% g - *9 \3 u9 {- {; T9 D: D$ r
- * This program is free software; you can redistribute it and/or
- R i/ L& V) l& w; X - * modify it under the terms of the GNU General Public License as- P' I1 n/ q* }# a
- * published by the Free Software Foundation version 2.
* f& F- p* U, ^5 l3 ] - *. l: Y$ ^7 k3 R2 K, x* e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* j$ j* ?" X- D( M; n - * kind, whether express or implied; without even the implied warranty
7 ?) u8 x: B( K( W. Q `+ o0 n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. }1 u' ^1 E3 c/ U, R - * GNU General Public License for more details.' J# b% Z8 Z3 Q s' H
- */
# E1 c* G9 o2 [ - 1 x7 M# J" j6 E2 k
- #include <linux/module.h>
4 B }+ m- @( x" _+ c - #include <linux/init.h>
6 A6 _; P: P* t" r8 l2 W - #include <linux/errno.h>5 }: ~# f h' `
- #include <linux/types.h>& G: k2 B( @/ x% d; z3 \* O
- #include <linux/interrupt.h>/ a4 o/ K1 |6 U0 P3 q' h4 g
- #include <asm/io.h>
U( ]/ b# j: V- p/ i6 f# E - #include <linux/moduleparam.h>
9 ?3 F. h/ N, M% J3 z- ` - #include <linux/sysctl.h>
6 o; X% s+ R4 y3 }& p- Z - #include <linux/mm.h>
/ a& y5 r5 V! W: V+ ^; ? - #include <linux/dma-mapping.h>7 Y* `5 m6 f9 s: r1 d
- : N$ { w9 z( O0 M- [* m
- #include <mach/memory.h>
0 c8 C' y$ G# _% S2 Z/ c# v3 \$ N/ X( o - #include <mach/hardware.h>" b+ ]8 C5 t7 d1 W
- #include <mach/irqs.h>* {6 G2 U9 ^* f7 M8 J9 T2 Y% ]
- #include <asm/hardware/edma.h>! Z- S& o+ q. T; ]- j( ?
. \3 }4 d/ T# C8 w# |) }- #undef EDMA3_DEBUG- W8 ~5 w% r7 [4 q, H( _- I
- /*#define EDMA3_DEBUG*/& n. @/ p4 `6 ~6 m% J6 W- b
- 3 ~: Q" i/ l' V* i& e$ y' `" h
- #ifdef EDMA3_DEBUG
7 e9 y% q0 }' C) h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 o5 H4 O, n7 h9 y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
\/ R8 U9 F, }2 Q8 I$ J I. A. G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' L r! T4 H" R9 t; ] - #else( _* l' P7 f4 R4 |9 X* @4 P' ^4 v
- #define DMA_PRINTK( x... )$ ?6 I' @6 b7 l8 H
- #define DMA_FN_IN
+ s/ k0 E0 J6 T" G9 ]7 l, u4 b - #define DMA_FN_OUT' B4 f! B1 n4 f( O# a
- #endif/ g( w; J) G+ f$ j+ ]
1 `' q7 ?+ u {1 p! z6 @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ C# N# |: n' V1 d9 {! x - #define STATIC_SHIFT 3
' Z6 D: B& q% e' I1 Q3 L; c# L$ Q - #define TCINTEN_SHIFT 205 @! Q3 L7 F# K4 U7 V
- #define ITCINTEN_SHIFT 21
% V3 I0 a$ u! k( A# Q! W% o - #define TCCHEN_SHIFT 22
, ~! P' E7 ]0 X) b' w$ H5 A - #define ITCCHEN_SHIFT 23' l- f9 l4 N- P# A0 B9 a5 H$ @& y
- * o2 R. L" v5 s: e. j) z# Z
- static volatile int irqraised1 = 0;1 J2 `5 a' r+ o9 R3 ~* N9 X
- static volatile int irqraised2 = 0;
0 }3 j% _/ A' W0 |% ^
8 I3 O9 [1 I! s. V, e6 s! L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Y/ ?) @) S: {7 M. f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ Y# z5 ]' C# _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 D. C+ H, y y4 K' N( p
8 C0 @+ C3 O6 Q9 {- dma_addr_t dmaphyssrc1 = 0;) A1 ~* K6 A& X% ]1 T
- dma_addr_t dmaphyssrc2 = 0;
, @% Z; c7 @. ~* c - dma_addr_t dmaphysdest1 = 0;9 ?% d# _$ @' D- I7 W$ c. F
- dma_addr_t dmaphysdest2 = 0;
/ K# _! m! z! a/ Y - . y t0 n# u, d+ ~* e& t, g- Z
- char *dmabufsrc1 = NULL;& A4 U1 ?! u: E( \5 _2 z- O
- char *dmabufsrc2 = NULL;
- F+ n% V- c. b6 ]1 T - char *dmabufdest1 = NULL;
' E& B% R0 ^( i; W - char *dmabufdest2 = NULL;
7 x) I8 z0 _+ E) _1 u! C0 s: R' K& ~
1 j5 w( }" Z4 V% v) w2 k- static int acnt = 512;% {1 K( f% b4 J- J5 j
- static int bcnt = 8;
: b. H+ d2 _0 R5 r% y2 f# y - static int ccnt = 8;
2 t: p: U5 B) } - 3 i2 e$ u4 s, E7 y4 p0 H
- module_param(acnt, int, S_IRUGO);
2 ]! n# f& E' M1 G - module_param(bcnt, int, S_IRUGO);% P) g; e' _/ w' B: i/ \8 V
- module_param(ccnt, int, S_IRUGO);
复制代码
3 ~. T4 A! j6 m0 [* V! L# W
8 d6 g9 v+ A# v, t- ^' H9 j' |1 ~$ _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 U8 ~, Y: W# Varm-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 i: x7 ]; h: j1 G& X' K' C* `- q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 {) y8 A9 }1 d2 k" D
( F( q6 ~6 N+ [( a' B% F
: w- z2 w+ Y2 u2 q. O5 Y# E/ u |
|