|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 M7 I% S7 P8 g( j$ \- [code]EDMA sample test application1 F4 A" A* R& \3 H, W
- /*4 o; F! F& J9 }! A. r k' t z
- * edma_test.c" t: H" o9 J* `: S- f2 z! a' y& q( ?
- *
# N$ V7 y& m' ^. ]0 @ - * brief EDMA3 Test Application
) ]: ?5 O9 Z+ ?, L' u4 E - *
7 K: \9 ] C1 J$ A, A& P3 \! b - * This file contains EDMA3 Test code.2 L n9 i" u1 s
- *
- v; [ y( e$ Y3 G) R: \, s5 k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& N/ h: i0 m# h1 s+ o* S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 b! P9 I/ \+ v+ ~6 M2 M; p
- * TO CHANGE.( \; T5 A! Q. Q: t) |- H7 k
- *7 p4 p1 ]$ P& Z! E% J V1 G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. P. j' `0 w, ~. f9 U4 v& i; O - *
* W6 Z: {3 Y% J) O - * This program is free software; you can redistribute it and/or B# g O6 ^! _; p% z
- * modify it under the terms of the GNU General Public License as2 |& M$ L& W1 Q! h- T
- * published by the Free Software Foundation version 2.
! H4 w7 U" G G3 C - *
3 E" A! @3 w; U {: n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& k& I. H+ o: |0 h; o: Y- G: Y - * kind, whether express or implied; without even the implied warranty
" c9 p1 ]8 M' `$ ~; f( R$ {* S/ X1 Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& s5 f. c+ q0 i - * GNU General Public License for more details.+ @; p+ [$ t. l; Y) ^* y- A/ B8 C
- */# W! q- k2 T5 q; d
4 \% A- l. s5 U7 B! ]% l3 y2 R+ a- #include <linux/module.h>
O% n) ?+ I4 ~7 r - #include <linux/init.h>& h( u$ N: g. _5 a) P& b, }
- #include <linux/errno.h>
+ t1 V2 ~0 J( U# U6 `6 { - #include <linux/types.h>% Z/ I" P0 \0 U4 \
- #include <linux/interrupt.h>
( C# B4 H- v$ [4 t/ V# o* P - #include <asm/io.h>
" `, ~4 a* d# H - #include <linux/moduleparam.h>3 t3 z9 e" m& `7 U' b) x# H0 S
- #include <linux/sysctl.h>+ T" B0 l' {7 u6 K% Q
- #include <linux/mm.h>. D9 ^- W' U0 @" I6 P7 {
- #include <linux/dma-mapping.h>
; H3 P* X) f6 b/ l' i
% { t/ ~- R* w8 z& o, p- #include <mach/memory.h>- j7 s' ~& Y& n- U1 L: N# p- a$ @
- #include <mach/hardware.h>
: W/ t2 q5 T: s- {9 v V# a - #include <mach/irqs.h>% O/ G8 Q) e4 T% F' G1 H- O8 M2 I
- #include <asm/hardware/edma.h>* X7 C! s* D( s/ [+ G
- 4 r! ^. ~) l+ @3 X' q V/ |* t
- #undef EDMA3_DEBUG
W5 g9 a3 h0 [( X( |% |' I2 a - /*#define EDMA3_DEBUG*/
* A, ~5 V" ^* B' ^1 `5 R" ~' l
, D6 G, p! a O, S( T1 d- #ifdef EDMA3_DEBUG
! Z% D( `8 j7 F- c1 D) L+ Q3 H. l: V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 n2 v( G3 P! c" Q( Q" A7 J3 o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 r* R; O& y- H' A$ ^" {: I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( ?- x5 ]2 T4 R0 ^ x' P
- #else0 p! p9 }0 ?% g6 m1 u) q
- #define DMA_PRINTK( x... )3 D0 y" U4 O2 _0 a2 [) M
- #define DMA_FN_IN
$ t5 ~; B8 B( Q5 p2 H3 R9 B - #define DMA_FN_OUT! T0 h2 Z8 ?5 W }- H! r8 k
- #endif
8 ^5 G+ O8 N6 G( Y( d; ~7 J
6 j8 G' `$ F7 v( d! M8 C# H) t a) C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" a1 @3 m5 a' t | r' h1 B
- #define STATIC_SHIFT 3
# j& ^' S: D7 s, o' B - #define TCINTEN_SHIFT 208 Q; H- P" c# }. S4 x0 S6 @; h
- #define ITCINTEN_SHIFT 21- i+ [' J5 I( ^% |% c/ _
- #define TCCHEN_SHIFT 22
6 t0 t' x6 t$ A+ e, s5 G - #define ITCCHEN_SHIFT 23
0 D: {6 B8 p3 s - & }. b& x9 c" E; [" Y! W8 ]
- static volatile int irqraised1 = 0;8 U4 U* Y! t( @( \4 w% ?: y
- static volatile int irqraised2 = 0;. L0 A( Z. o- b- [% o
- : q8 ?& S0 c! X) Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 W3 A$ K: a& y) c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. |4 F3 B: g+ ]0 k* E( G0 [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% o4 Z, V+ R6 J$ I4 w H
- % n! n3 g+ i+ G8 Z/ `6 Z+ n
- dma_addr_t dmaphyssrc1 = 0;
- A4 n; L9 q- p. J# C% w$ t - dma_addr_t dmaphyssrc2 = 0;
6 Z7 |# F2 D' r: k/ H, ~& p - dma_addr_t dmaphysdest1 = 0;
8 c6 Z4 E; n) w" V7 @4 H - dma_addr_t dmaphysdest2 = 0;
1 I7 d( x4 }& }
& A( `0 \6 c4 r* O0 I8 c5 p& t- char *dmabufsrc1 = NULL;0 O- }8 \2 e! m W) t3 x
- char *dmabufsrc2 = NULL;5 d" U& x) Y* C
- char *dmabufdest1 = NULL;: h) D+ J& m5 Y$ l/ M/ T
- char *dmabufdest2 = NULL;
! m+ {" }/ C7 J* f: g2 y
; w& W# h: Z9 \8 ^- static int acnt = 512;
1 ^: W+ ?( J% u( @# _! U* V - static int bcnt = 8;
. P$ R. o V+ V( h9 Q/ K - static int ccnt = 8;8 g, A9 b, h* ^1 y
- D# N+ e5 d8 u
- module_param(acnt, int, S_IRUGO);/ y( g: Z' P4 y2 l
- module_param(bcnt, int, S_IRUGO);
) L( Z0 g- n, g! o- x7 h5 F - module_param(ccnt, int, S_IRUGO);
复制代码 ! I6 m9 J; A5 Q# j0 K3 J
0 ]+ q6 r" Y( d0 l5 Q- z3 l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* ], C, B6 f" @7 u2 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: \9 Y# c N; `1 v; D. h: A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# D0 k% i0 r5 i" i) P
. A; p8 d/ a# ^5 b+ Z
6 A' _3 U6 s+ T- L% K7 F |
|