|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 P$ ^ d8 a$ U
- [code]EDMA sample test application* ~ t8 P, f! s$ \9 R
- /*/ ~( H4 _6 ]- ~
- * edma_test.c
1 B; a; N6 @6 J - *- l: ~% X3 e/ y, Q
- * brief EDMA3 Test Application
. p6 f; ? b) ^8 M - ** m+ d5 I% |( ^+ O! Y$ G
- * This file contains EDMA3 Test code.. {( w8 h2 i0 M. [3 X$ P
- *
6 k" O, _1 s( g/ j1 Y" w% O2 y6 q5 o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ w0 u4 P* V5 z* V2 w: ~* ?9 e$ L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 M, v8 I: a' C1 C" g" w - * TO CHANGE.
- u6 Q0 S! T% ~: y - *) {! `0 i- p# M2 L' G! y& v4 u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* O& g3 v9 H% T5 J& ^6 { - *
" n" \# W& P B6 A% c1 V) {/ W - * This program is free software; you can redistribute it and/or) X% I1 n* C! x5 Q% C9 H
- * modify it under the terms of the GNU General Public License as
/ v7 W, v4 D& c6 | - * published by the Free Software Foundation version 2.
/ T. F( K8 a9 l. ?9 X" {4 N) i - *- `8 b$ X v# D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; n, ?5 s) K: {7 ^4 f( e
- * kind, whether express or implied; without even the implied warranty
0 h" ~9 z4 X+ n, P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 q5 j1 }# \ l( v) J% `/ b, e - * GNU General Public License for more details.6 f( ]) `6 L! H* \
- */
- G0 V2 i$ g4 w6 l. c2 z4 Z
) Y+ H/ N( v' ~5 T& i1 C6 c8 H- #include <linux/module.h>5 r" _$ E! }3 U' \: q0 D( Y& H
- #include <linux/init.h>. i( {. o0 T/ k% Y8 t( U
- #include <linux/errno.h>( d3 ?" J# K5 j
- #include <linux/types.h>
/ W5 S4 c3 g5 g - #include <linux/interrupt.h>3 q6 L$ z) B( K1 D0 B: ]* D- x
- #include <asm/io.h>9 Y0 v& F4 K4 H3 O
- #include <linux/moduleparam.h>+ J6 v7 T. I& c/ [
- #include <linux/sysctl.h>* g3 n2 P9 d' Y$ v; ^
- #include <linux/mm.h>
7 U( z9 w+ R! @, K - #include <linux/dma-mapping.h>) |8 j, B# L; w( k4 w% {
- 8 ?9 l# P: g. \3 }2 M1 i
- #include <mach/memory.h>( f7 A" q! c. ~. J4 r4 W
- #include <mach/hardware.h>9 p3 P; ?* A! o/ v; ]2 B" L3 h+ W
- #include <mach/irqs.h>
+ ]3 i' v( a) w9 {$ ]# j9 { - #include <asm/hardware/edma.h>) L! c7 ~9 D e4 v1 \7 u
- ' Z( i2 l( S1 Q7 E) C
- #undef EDMA3_DEBUG
m& @# H+ r4 s# Q5 n - /*#define EDMA3_DEBUG*/, N3 v+ }4 D7 \" G( Z
8 E. E7 {& v6 m6 n. @( V- #ifdef EDMA3_DEBUG
5 B" I: R) m+ D7 S c$ ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' z$ t6 L* B3 K) E0 ?, K5 `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 W3 I* |7 @4 \% c& P {( {* d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 f- Q: J/ b5 d7 _6 @ - #else
) a- m9 n; q- @- N9 q8 t. u, k2 m - #define DMA_PRINTK( x... )
& _% p# C& r: J X) ] - #define DMA_FN_IN
7 [$ ?5 s/ R0 n) [/ M6 u - #define DMA_FN_OUT
8 M$ W M3 N: S* T( { Y' ^ - #endif
/ m7 R) {% M9 ?2 I. ]7 Z* U - $ d" _( z" x+ p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), Y) u+ u8 y9 M3 }
- #define STATIC_SHIFT 3
' K# C1 V( [6 ]1 s! k# J - #define TCINTEN_SHIFT 20' G+ `% b- S7 j2 P; x% R- u
- #define ITCINTEN_SHIFT 21
; M/ t& c, J& I, N1 k - #define TCCHEN_SHIFT 22
: M! }4 l# C: c9 ^) a6 ] - #define ITCCHEN_SHIFT 233 b6 _+ R* u+ D$ a1 \! F$ \ x! g
* J; d( G$ G0 S6 F( D, Q- static volatile int irqraised1 = 0;
8 @6 B9 T+ w* W- X. ?. b, a - static volatile int irqraised2 = 0;
Q" K Q8 O) l- J9 w. j - # W0 H1 D) u1 I1 G" K1 k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 d. T6 I6 Q5 J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, D$ e# Z+ ?; `' @+ y8 x+ T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& F4 R$ {- P' J- j5 O2 ^ - 3 d: M \4 @4 Y5 @* z
- dma_addr_t dmaphyssrc1 = 0;, C! u" u, t/ F) X+ ?8 W, @
- dma_addr_t dmaphyssrc2 = 0;
! O6 a; e, `" p q, | - dma_addr_t dmaphysdest1 = 0;
/ Y6 U1 \& t5 d/ ?' Q& F9 Y - dma_addr_t dmaphysdest2 = 0;+ j' v2 w' \0 M- S- J8 c" S4 h0 s
# M0 a0 W6 W- G `- char *dmabufsrc1 = NULL;4 m2 e2 L8 ?6 M7 X; L
- char *dmabufsrc2 = NULL;* [# _; W$ C+ Z [- }+ f5 u0 N
- char *dmabufdest1 = NULL;8 R1 F) r: Z1 t& k6 o5 C9 g
- char *dmabufdest2 = NULL;* q3 q7 k- e. }, y! i4 N% O
% Z4 `4 o# b$ V: Z: ]- static int acnt = 512;
4 l9 J) E/ e/ {2 a. y& D5 q - static int bcnt = 8;
' C; z# o0 i$ O1 q1 g9 ]) R - static int ccnt = 8;
+ `6 o4 N, I S& u4 U1 w
6 h2 [' q& H- E- module_param(acnt, int, S_IRUGO);1 a1 Q# _) u; ] {4 e
- module_param(bcnt, int, S_IRUGO);
! y, e. |; {. C; w3 W! Y! a9 g& W - module_param(ccnt, int, S_IRUGO);
复制代码
* c- r6 ~! q9 H( I* R R* [9 g! y9 O _4 v+ h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# @/ v% w) d+ k* i, Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: \: K* V3 s. q- }8 ]- g7 e+ p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- v9 L4 A+ g2 V0 V& [5 m$ s% _$ P
2 K `5 E8 V a4 U9 u/ r) l
+ {7 X" I6 O# w6 u o/ \ |
|