|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 c+ ~ i- ?0 f, v9 P g- [code]EDMA sample test application9 t4 x5 Q; p3 p3 f) N) E
- /* a* o& T( m7 l) k
- * edma_test.c! `% \$ I+ G; W2 M" v! H
- ** A4 N2 B7 l$ P1 B- C K3 F
- * brief EDMA3 Test Application; Z" W( f7 _$ d. Y% Q0 t
- *8 }& S0 b3 U/ ] ]
- * This file contains EDMA3 Test code." z H; r" H: c/ [
- *& O+ ], a% [$ ?: x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) _$ q* Y7 ^0 ^8 _) ]4 e5 `" u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' c' m. T* ?1 m# ~7 v2 L+ u. `
- * TO CHANGE.8 E- s: k* c8 H
- */ w" y0 Y. Z3 k! f) \5 J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' v/ W1 H* t; \2 F: ^3 |8 {. a/ L
- *# l5 B3 k3 F: m3 y
- * This program is free software; you can redistribute it and/or
6 O( D9 N% j/ S3 M3 E - * modify it under the terms of the GNU General Public License as
. z2 e* ]+ h8 g5 s9 t/ t: C: S - * published by the Free Software Foundation version 2.( L1 j, `+ G/ h7 i$ I
- *2 E8 G* r4 s' T' L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, a4 |- ]: }$ r" f$ @7 U
- * kind, whether express or implied; without even the implied warranty
6 I/ b; I' w. P6 U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ J9 S k( H: X6 c, h - * GNU General Public License for more details.* D1 ^5 U# {) X4 l8 ^0 W) }
- */1 N8 H7 u' e5 a( c9 N
- ! u# [0 z/ Y0 |* c& q
- #include <linux/module.h>8 W2 z$ v# u' ]- }* O# Y. z2 d! v
- #include <linux/init.h>
- p; k; y# p$ p6 y+ V+ x; G5 n7 n% } - #include <linux/errno.h>' A) ?1 ^- T- Y+ t, S/ j& \# N
- #include <linux/types.h>
2 o" g8 W# I/ ]; j - #include <linux/interrupt.h>1 k% ?& [' V/ K
- #include <asm/io.h>
2 G1 b3 P" I: y' e - #include <linux/moduleparam.h>2 e& L/ d: g" \, n0 g' A- \: y7 |
- #include <linux/sysctl.h>+ J F. m `# P" H% N) c
- #include <linux/mm.h>; u) U6 @! T0 @) _2 m
- #include <linux/dma-mapping.h>
/ R3 A( }" @* w7 j
- k8 t2 q4 v% d- #include <mach/memory.h>
' F+ i a9 f7 j0 s( R" g: j. b - #include <mach/hardware.h>
! r: o& L; Y* \2 F - #include <mach/irqs.h>- x4 Y) N* \* X% L# w
- #include <asm/hardware/edma.h>5 y- o9 i4 d2 l( Y
" o8 L( n$ z! K: i- #undef EDMA3_DEBUG' J9 q* L; l# m J z
- /*#define EDMA3_DEBUG*/: E! f( i; X! A8 M1 \
+ H7 E# m& ?) M4 A# H0 D- #ifdef EDMA3_DEBUG5 z) `2 `5 _3 {+ K! Q$ A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ t6 M) j6 m+ t5 W' B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- S X- Y) J0 N' k, `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ w0 j1 P; Q2 r* O: m - #else' V/ Q, m4 T2 L
- #define DMA_PRINTK( x... )% s& A) `$ u# N3 v' V
- #define DMA_FN_IN+ w! Q2 N+ y+ _" x+ i& m5 i2 ]& W |
- #define DMA_FN_OUT6 C! ]& n3 M1 v" [+ d; i, n
- #endif
8 A, x% A. X* [# I9 t6 P9 U$ p1 s
. T9 J, h" p2 f/ A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 k# }! a8 f) j m - #define STATIC_SHIFT 3! D- F5 M. ?& q1 [! O
- #define TCINTEN_SHIFT 20, E( g. [8 s. o1 |5 }% i
- #define ITCINTEN_SHIFT 21( I+ g' {: P/ @# p8 y
- #define TCCHEN_SHIFT 223 X# \# i' R( `% l
- #define ITCCHEN_SHIFT 23
2 N) T4 a* ^4 {9 i7 r/ t - " ?4 {% T c/ m
- static volatile int irqraised1 = 0;/ x: ^' |0 V4 X8 }: b2 P7 m' M4 Z
- static volatile int irqraised2 = 0;! Q. }$ {4 ?. i# [0 g3 X* ~
- * e& B. Z5 T* Q3 H2 h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; n' d4 f( Y% a" }% c0 M- t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); z- P8 O, l/ w( p9 r0 I- _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
C8 j- h& @( ?) v1 m: G - # W" R; R2 x) k2 a% o5 K
- dma_addr_t dmaphyssrc1 = 0;
' X) c: Z/ R0 ` - dma_addr_t dmaphyssrc2 = 0;9 O* O8 J9 p C/ L
- dma_addr_t dmaphysdest1 = 0;; E8 j" ^9 [2 N6 l0 i% e, a- ]
- dma_addr_t dmaphysdest2 = 0;
/ Y, ^) r5 o% d8 G3 r6 A - : d4 t7 K# b4 }1 m" W" M' S
- char *dmabufsrc1 = NULL;
8 h6 I0 J& g! E5 I - char *dmabufsrc2 = NULL;
: F+ W4 x4 ^1 ~. ^) \ - char *dmabufdest1 = NULL;. ]/ ~8 _5 s* s( s/ G
- char *dmabufdest2 = NULL;
1 p0 d$ |/ T0 O
0 ]4 ~& Q0 B! \( t$ y9 J/ u! K- static int acnt = 512;
& G" a* ]0 \" O$ Z/ K - static int bcnt = 8;
( d+ O* F: l1 M) Z8 h0 E# K - static int ccnt = 8;
! m2 X. f) a& U) P; n
7 L4 o: W! W8 ?+ C- module_param(acnt, int, S_IRUGO);7 T: r+ z0 H. V/ B; m$ ~
- module_param(bcnt, int, S_IRUGO);
0 R N: D+ F* L# j4 T: a& W/ w - module_param(ccnt, int, S_IRUGO);
复制代码 0 R( U' C4 G- J8 ~2 p3 b. X
% s2 `, ]/ o. A4 s: P. m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 p W, }, n+ v
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 y2 L5 Y$ R% s6 ^# e% \9 S0 I" G' E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( \) S S+ E* @+ ]
5 k( d% I2 _ |" X- i
' t6 `% k( [4 t6 H' @4 G |
|