|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" s" M N; j$ @7 M- [code]EDMA sample test application
0 l1 ]5 t. H: i H9 @5 C3 z" O - /*
$ e: ?* Q4 V3 x% D' u" ]4 {1 o - * edma_test.c
7 r8 ~# {: k( i; E - *7 |: f' b5 [/ {( N2 {; [0 J, E
- * brief EDMA3 Test Application7 H$ v$ w: `7 L& c
- *
k; j' Y* i+ i) Y9 w9 U - * This file contains EDMA3 Test code.
& h6 d2 U# Y' l( A8 d! s6 t. j" R" y - ** Q+ x, n: |+ X ?2 w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 g. N8 Z3 |& R3 ~% g8 Q; X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ g- D7 U+ u3 r! } - * TO CHANGE.
# V% |; |- @( c1 V% W( o/ J* |3 w& G - *& ?2 \3 z5 n/ c/ T- k/ O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; W* `1 a+ |" G5 D5 B- L+ S4 T& D
- *3 I: a2 S% { [4 Q6 }% K
- * This program is free software; you can redistribute it and/or
6 e5 z- a& l! J7 @- q3 @0 V - * modify it under the terms of the GNU General Public License as4 v% J3 U, b5 J
- * published by the Free Software Foundation version 2.
0 x% E% u" h, }* | - *
* a" k( n, i3 j* d K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ F! B1 F3 B, v2 C; j - * kind, whether express or implied; without even the implied warranty
& R" i1 h7 U+ s- F; F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 a5 W2 h S( W% T$ P5 w3 w1 E
- * GNU General Public License for more details.
6 @- G) Y: B9 w' L% _( K. e - */
' r s4 T/ z. N) M1 P - 4 }! C' t/ b( v% O1 [/ t
- #include <linux/module.h>9 ] E3 E' n3 U Y- }" U- x
- #include <linux/init.h>
1 e- i% \* B/ N* w! V - #include <linux/errno.h>7 d6 K7 o: q+ A E7 z
- #include <linux/types.h>% y$ A" g6 V& @8 z
- #include <linux/interrupt.h>, D/ E# `& o2 P6 M
- #include <asm/io.h>
$ j$ Z( Z1 F6 g& h) D8 h. T - #include <linux/moduleparam.h>: @9 V: m( F* m/ r0 q% o/ w
- #include <linux/sysctl.h>
$ W: c' L% F9 h+ \8 L# Y, S1 f - #include <linux/mm.h>5 n" U4 `3 g4 h6 U7 W% A. J$ E- q
- #include <linux/dma-mapping.h>
H& s8 `" x$ C+ d - . M8 l' i2 r; q
- #include <mach/memory.h>
% A+ N; X6 B$ T0 L1 Q - #include <mach/hardware.h>
5 s( T# u$ P3 N( }; H% g1 z9 {+ [- T4 E - #include <mach/irqs.h>
3 }2 l' _% Z1 h- `! \. e - #include <asm/hardware/edma.h>- r: N1 ~ K! f& m& x. p4 k
- 2 X% R3 M- A8 ] {2 i6 W
- #undef EDMA3_DEBUG
5 R. A4 P5 w1 @$ W9 u- D - /*#define EDMA3_DEBUG*/) h5 f2 s/ \5 m
6 C A* ]! Z2 h# {( O/ h8 i- #ifdef EDMA3_DEBUG) ?% e. Z: q+ ^; C7 x( S( n& j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 f9 ^& v: ]' f* z" k$ |" S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 v! B3 F6 j/ K; z. }# _& h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% c' M; f' I* O) s# ?
- #else
, a, v( M, J$ w8 t5 v% m9 M$ @ - #define DMA_PRINTK( x... )
# Q( i: y F% I1 U% B" T - #define DMA_FN_IN
$ F. D" s2 p I: W; n: J, j P - #define DMA_FN_OUT. a% e) v8 \. x
- #endif
" K3 S2 g n# x& d$ b0 t/ } - ! _! h: i: W/ M$ `$ _( m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* v+ I9 ?& \, E0 J$ \- \
- #define STATIC_SHIFT 3) }% J4 Z) t' }0 O: \0 ]. g- A
- #define TCINTEN_SHIFT 20% y- t4 ^# E7 X# o, I3 x
- #define ITCINTEN_SHIFT 21- b7 i) u2 A$ p- ^
- #define TCCHEN_SHIFT 22
) H" v7 V: M. c$ z: V; a- M( h - #define ITCCHEN_SHIFT 23
& c1 f/ o+ x- r9 j - # t! G1 f8 Z2 E* Y
- static volatile int irqraised1 = 0;
' ]! R" s1 e1 I - static volatile int irqraised2 = 0;
, G+ P0 @/ q9 R7 Q! V1 D - ' f4 d; ^* V" G. H& A; c! {( k' L) Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ N9 m3 m# @1 H! h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. `" j! v- K9 j5 n) _8 d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ K1 S) A* C7 e+ ?8 J: |
n( G8 v9 C# ^- V1 v I- dma_addr_t dmaphyssrc1 = 0;
C1 U0 E/ I/ Y( x2 r5 g - dma_addr_t dmaphyssrc2 = 0;! Q0 E, N$ m& S- f& G
- dma_addr_t dmaphysdest1 = 0;, X- B5 B" x& q# P! v9 V
- dma_addr_t dmaphysdest2 = 0;
# T* z& }7 T9 b9 j8 N* m, g
6 u" _! f4 v, W" g5 Z, o- char *dmabufsrc1 = NULL;" g" ~) C0 l$ W$ p# B
- char *dmabufsrc2 = NULL;$ p+ ^# y5 Y" z" X Y' p# i
- char *dmabufdest1 = NULL;0 B Y( n) O7 q9 A
- char *dmabufdest2 = NULL;
* W! b2 |7 Y$ p, L - : V. F( m3 e% R8 f$ A
- static int acnt = 512;& Q5 ?% \& z; O
- static int bcnt = 8;
* ^; k) B1 s, W+ c& `% Q - static int ccnt = 8;
! R3 |7 ^! @# G6 E( {7 m/ n9 d
5 u( I& V- l0 P. O T( F3 S% ?/ O- module_param(acnt, int, S_IRUGO);
7 R2 Y* t" E) N* k4 e - module_param(bcnt, int, S_IRUGO);
0 `4 q' O3 T2 Z% @' w9 p" I - module_param(ccnt, int, S_IRUGO);
复制代码
: V1 E0 o" w4 n& m9 T- K) ?( r( `$ D# ?* o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 G2 C/ ~& f1 v3 h+ ]9 T: H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 _7 V+ t; ~) g$ N# H# ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 P6 y; c9 m- x' ^$ y# e A: P- D% `/ [* \3 q0 ?
6 p% u [9 S; w/ R5 Y. f$ d
|
|