|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, \& v0 C. j- K+ G/ p3 ~3 j- [code]EDMA sample test application9 J8 t$ V4 x# z% g
- /*# X7 x' W/ G5 U- B* [
- * edma_test.c
6 w; @3 h) P8 o& n" ? - *
5 M& a( u& x" t5 I0 r( Y - * brief EDMA3 Test Application
3 s2 k# v5 s1 i - *; @+ g# j i) Q. L
- * This file contains EDMA3 Test code.5 U% j' A( d1 z* k/ T7 w2 W5 k
- *3 _* _3 R2 k8 z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" K3 w. Y3 N; M' J! Z9 W. L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 F! W+ Z6 g8 Q+ A6 |) ^/ Y& j: v
- * TO CHANGE.
0 b5 Y- j5 D! a% a- M - *( x9 k. [' s5 p# J6 n, v4 c; M9 \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! B0 N: \1 Y. j/ M1 n: G: \
- * d$ Q- r* d/ F2 h+ c$ H( ^
- * This program is free software; you can redistribute it and/or- z5 H4 |. Z7 e9 O, j; H1 p& j! {
- * modify it under the terms of the GNU General Public License as Z& V6 w4 ~; }9 b
- * published by the Free Software Foundation version 2.
. g' {) I* H. V/ R - *
7 A3 _; T6 \; s) i2 z7 I2 Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 a- B! m/ X- I3 `) v
- * kind, whether express or implied; without even the implied warranty1 t, |- J, K' A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; O/ n% j. Y" S) X - * GNU General Public License for more details., {* c& N+ ~4 c0 d5 I# r1 U
- */
! H' l/ v$ J# Y" `% j1 `2 y
7 g7 Y. C; l, B8 d4 Q% F- a/ H0 f- #include <linux/module.h>
) I$ ^ e) G$ U9 G$ w. l0 K - #include <linux/init.h>
# P8 {. l6 S' T" T9 ] - #include <linux/errno.h>- p3 B* z; _) h% w2 @+ B
- #include <linux/types.h>. v& `6 D. f* l' ]: K- H0 p" m9 Z
- #include <linux/interrupt.h>) [4 g/ v$ @) k& l1 g( f
- #include <asm/io.h>' h7 ~) v( ~4 \
- #include <linux/moduleparam.h>
: ?: L2 Y! L3 ^5 @1 |( P3 ?# P - #include <linux/sysctl.h>
, x; g+ G& E- D - #include <linux/mm.h>1 U/ `4 {) K0 i: s6 L! f$ C* {+ f
- #include <linux/dma-mapping.h>1 W) k8 t% {) Y6 i
- 8 _# @$ |7 {+ J% A0 S! N
- #include <mach/memory.h>6 ~7 d8 R4 E# t
- #include <mach/hardware.h>5 T! I8 f g) e) _' X2 q
- #include <mach/irqs.h>5 f' d6 H B' _) H2 F3 ~
- #include <asm/hardware/edma.h>
\9 \0 L4 G d Q- p2 b - - g, n+ y: ^8 b4 C/ S7 e8 O6 S
- #undef EDMA3_DEBUG6 m0 B' s2 a9 ~: I
- /*#define EDMA3_DEBUG*/
; j: |- t x) w& F3 l
! w: `5 K1 x$ ^) `+ X2 J- #ifdef EDMA3_DEBUG4 a2 i3 I+ G9 y L: V& H% d( a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ T% u$ _& e5 y' r' B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, r _4 U* ?8 R+ V, V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 ^" U+ p, \' |: y: B
- #else
/ \% a+ s3 ]" P7 ^# g - #define DMA_PRINTK( x... )% s D( F5 d3 }( O- X
- #define DMA_FN_IN
3 \5 j9 r ]- m8 I8 Q - #define DMA_FN_OUT$ {4 R! {0 r0 l B( y
- #endif
2 C q2 E. p3 U5 O - # D6 [9 u# `& L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" o+ A3 K0 z, t0 i7 l- r - #define STATIC_SHIFT 3
/ t# {$ @* I. C - #define TCINTEN_SHIFT 20
: T5 A+ W( T* g, J0 t9 l - #define ITCINTEN_SHIFT 21- V1 n& t3 N6 G% D. N, s
- #define TCCHEN_SHIFT 22- u8 n }0 b" L
- #define ITCCHEN_SHIFT 23
: z3 o1 [* f- r' g* X u
0 j: {4 n$ I+ u, ?% d t- static volatile int irqraised1 = 0;
/ z- ^$ ^8 O3 A. X' m5 `% v2 y - static volatile int irqraised2 = 0;- H! H! @ V. p) }9 y
$ ]9 e9 v& A. b. B5 Q0 d3 g1 T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 p* c) D% c N% g4 n/ H! C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ ?4 k, M2 z( U- H" T* t! U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) p* p/ [8 g a& R1 |- A# {
- - m4 |% f. r& C( |" \
- dma_addr_t dmaphyssrc1 = 0;" V c% D; s& z q! s5 d
- dma_addr_t dmaphyssrc2 = 0;' _" L. C% U6 E, J( p* O1 x
- dma_addr_t dmaphysdest1 = 0;3 I7 `1 J% W8 ~' g
- dma_addr_t dmaphysdest2 = 0;# J# z( [1 L. k7 m
- % F) h* o# O$ R: @' g
- char *dmabufsrc1 = NULL;
$ F, Y7 b6 I9 \9 u+ c - char *dmabufsrc2 = NULL;' `) ^3 m7 ?: r) ~
- char *dmabufdest1 = NULL;
' H" o/ h( }% D8 @/ Q/ E - char *dmabufdest2 = NULL;# N5 X8 z4 `6 R! O8 U2 N; `
- 6 g. w9 e4 Y+ J2 y$ X t: R
- static int acnt = 512;
7 L" }% L% r; p - static int bcnt = 8;
* V/ x2 j1 A8 ]2 u - static int ccnt = 8;, U. ?. Z$ T" w! t9 Y8 M+ O1 E
- 6 j( D/ ~' }: h. {% P
- module_param(acnt, int, S_IRUGO);6 ^3 D5 Z) I- T$ ?
- module_param(bcnt, int, S_IRUGO);
- M! p' L/ t/ V+ E& v; ?! t - module_param(ccnt, int, S_IRUGO);
复制代码
* D$ x" H* z& z1 |) k u/ H L2 C
; e1 q- W3 R, i/ g3 b8 _/ r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. @7 {5 T" U2 @1 a, rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 R: a& U# A, ^% h) ~* f: s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) p5 X3 V& U$ L9 X* ?
6 R$ E- @+ f; D @7 i
# U9 C6 q# s) m5 O |
|