|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 i. W3 T8 _5 b, i* I0 F; V- [code]EDMA sample test application
# {( V- F0 O) y% a v9 ? - /*
& ^3 u. k9 t- d b- u/ t - * edma_test.c
3 ?2 b( a" n p% ]" z - *
0 W" S- n! ~! v6 m) T$ P& {+ _9 P - * brief EDMA3 Test Application
2 I! P. L8 K, W, H - *
4 }8 a. I, B. _( {- H1 Z4 b7 J" b - * This file contains EDMA3 Test code.
! j" o4 T. J( f2 z1 }; y+ R& U% ^ - *
! A$ z1 Q6 G; |1 X6 H1 B$ { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# R9 f9 e u# h Q8 K' w( j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 V+ ^+ j# g8 p4 c - * TO CHANGE.2 s: L5 P7 I, M9 [
- *, X& v: y" t+ u; K5 ]: K+ o7 E4 T: j* H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- h" o9 f2 }: G# g - *
% c7 {' G3 Y; L+ Z8 j" J - * This program is free software; you can redistribute it and/or
5 d2 y! U) w- |8 \ - * modify it under the terms of the GNU General Public License as
! O4 f3 S' m: I5 q4 { - * published by the Free Software Foundation version 2.9 o$ p$ @( ]! M! `" ~4 ^' L+ T
- *6 s# X/ P) _' P/ F9 M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 H. ]: O- d& t+ I6 |3 ]% V2 D - * kind, whether express or implied; without even the implied warranty
, Y5 A' o _. [: X l: ~, Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% d7 P6 R. S' N. P - * GNU General Public License for more details.- e# n& t8 v4 \! G" p
- */& r# b# S3 i3 E9 ^: b
; P$ ?1 q; P. u& G. M- #include <linux/module.h>( q. e5 y3 E3 ^ g; Q3 z% [5 ~
- #include <linux/init.h>. A! n) s4 Y; }/ B% t* ?! k2 A
- #include <linux/errno.h>
- \/ N# }" t7 H" \& f - #include <linux/types.h>, X5 U) [ v+ V& \* [
- #include <linux/interrupt.h>
& v' H# O, G, m9 a8 d( k - #include <asm/io.h>
+ l4 W7 ?! C- d6 n2 V: q7 a - #include <linux/moduleparam.h>
( Y3 z9 E7 x4 @/ \, I! t - #include <linux/sysctl.h># D. C% R# U0 ?1 a. y
- #include <linux/mm.h>
. w6 b' x9 c( l/ \# M - #include <linux/dma-mapping.h>) j; W+ c7 v( B. a' {' G
- $ G8 |4 z6 u1 Q+ U7 u" D
- #include <mach/memory.h>
5 Y( [) t) g8 C* o! m - #include <mach/hardware.h>
* S* {2 J9 L2 }5 o1 L1 B) l7 E - #include <mach/irqs.h>' ]4 }% Q4 p/ D2 W9 L( S( B
- #include <asm/hardware/edma.h> ^, f: \# n: H* F$ u6 q/ Q2 ^
2 l3 `2 y1 _( _7 {, O% C- #undef EDMA3_DEBUG
3 }6 C9 o* A, M& L. p - /*#define EDMA3_DEBUG*/& Q. o. g0 r& e2 v! j) X7 ^% I
, j. T" X) d4 l# @3 t! o- #ifdef EDMA3_DEBUG
$ r# R" M/ X2 v. V/ z8 H- ~" h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 n8 w3 i2 h# P7 O) [' X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. R0 V5 u. C P" j* j& n0 J% ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! ?; \3 | @) a9 u7 ~1 N! n2 `6 r: e - #else; E1 p' U8 z" f S) P, A6 v
- #define DMA_PRINTK( x... )
3 V2 B- `4 W% d4 @+ q. n$ r - #define DMA_FN_IN
( i6 [" T3 e3 b# ]: `( c0 w2 l - #define DMA_FN_OUT
# g) x# Y' R$ y w, w - #endif3 a; s8 X+ i# C3 {9 Y/ Z
- 6 m- P; J4 [3 m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ T/ b& x# `: u1 q# U9 k, { - #define STATIC_SHIFT 3, Y' C. c* \6 s# n$ ~9 j
- #define TCINTEN_SHIFT 20
0 C, X; B8 c6 d7 | - #define ITCINTEN_SHIFT 21
6 A, j$ a7 ]! c+ ?3 [ - #define TCCHEN_SHIFT 223 H. S% x0 i% l; A z* u" @; r4 w
- #define ITCCHEN_SHIFT 23* Z* R/ J, D6 x q
- 5 u$ i; C. ?* a% c) x
- static volatile int irqraised1 = 0;9 m5 G- v. }; A( x/ \! g
- static volatile int irqraised2 = 0;
9 X1 c( H4 X, ~( H7 H
- _7 u. ^5 m- Q& C7 z5 T/ e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( @; { t' P/ t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 n# e% \" [; q2 Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 |2 |( ^. a; n
! l1 S! V3 J3 q: ?$ Q' z- dma_addr_t dmaphyssrc1 = 0;3 o W$ p& M J9 v
- dma_addr_t dmaphyssrc2 = 0;
: ?/ r/ ~8 @2 q - dma_addr_t dmaphysdest1 = 0;
. k I! {# e! ^4 ^& X& J - dma_addr_t dmaphysdest2 = 0;( c% t: J$ O" n6 U! y$ W1 ^
- 5 D' e7 S S+ [8 l% }) `2 F
- char *dmabufsrc1 = NULL;: [1 Z' {- A f" _; {7 W
- char *dmabufsrc2 = NULL;
8 Y3 m( X8 T W! F& a& g - char *dmabufdest1 = NULL;
. C8 }! p" U6 \" e1 Y3 S# @ - char *dmabufdest2 = NULL;
+ i H1 A1 c& z8 D9 e' v - $ c5 L ^! f. J3 z
- static int acnt = 512;
' d: e- j) n% J: p - static int bcnt = 8;5 a) r1 I+ I: |% R: r, D
- static int ccnt = 8;/ L2 b u" @8 P6 q/ Z4 [" S: |
8 D7 y( g: q. ]" n. h% Z- module_param(acnt, int, S_IRUGO); m4 \9 a) Z) p& q( P% X
- module_param(bcnt, int, S_IRUGO);
1 e( ~6 D1 T. D8 _5 b5 [" S6 Z8 ~ - module_param(ccnt, int, S_IRUGO);
复制代码
$ ]7 K$ c* Q" J. s; `$ y0 }
. N1 Z; q I) W/ F( F4 ~ i. `; p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 c( U9 T' G, U( }8 P. I3 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, e- @( n+ z8 l# o, C% {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& P! M2 r+ u' e" I% \# d% l. N
0 l) n U& Z3 V4 ?$ Q0 G3 B7 @: x C6 C4 _
|
|