|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; D! ], j* R) C; P6 q: u1 g
- [code]EDMA sample test application
8 O5 P: A C3 w$ I - /*! [4 e& ?* e& H6 F
- * edma_test.c9 T% ] r& D$ a! a$ n
- *6 f7 X5 v# N2 M& j7 x5 Z6 i5 C9 q
- * brief EDMA3 Test Application
O1 t/ N0 F' L" n( X - *$ V/ |2 _6 J2 C4 A
- * This file contains EDMA3 Test code.. f. U8 z9 w6 g, X6 A, W
- *
- Q( S* l b! d( [6 L# Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! V$ n/ s$ B; U: w# j& s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 D; X# e" c% {3 v- q( {: y
- * TO CHANGE.2 q: b9 H/ S1 N! \6 @/ D' H+ _
- *. {6 |. m/ u: H* M+ `9 c" e
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; r$ H; F; [' z0 O
- *
& u( [. ^2 Z( ]# ] - * This program is free software; you can redistribute it and/or
2 G2 J2 a8 F" t8 k3 W" a - * modify it under the terms of the GNU General Public License as
# w A* J7 I- U* }2 r1 n - * published by the Free Software Foundation version 2.1 K: `" C- t! t
- *# `7 R# P) o. A }3 k4 F$ g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 z9 n" j6 f1 U; E* l
- * kind, whether express or implied; without even the implied warranty6 ]! q" v7 o A: P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 I. f( _# X( x3 }: @
- * GNU General Public License for more details.' e- R1 s- S# T8 z& R2 ^1 ~: P4 D
- */
6 ^) ]5 [: S9 q( W: W, Z/ o0 d: Z2 G
" F p# z3 b- J" U& {9 q- #include <linux/module.h>1 e9 N4 n6 z* A8 j; [5 G T
- #include <linux/init.h>6 F1 u' I4 [8 t
- #include <linux/errno.h>5 V3 k6 W" J ^% \/ A; F
- #include <linux/types.h>/ ]( e( J3 f- |: ?/ g- Q. g- \) u) f
- #include <linux/interrupt.h>* r7 A$ A& ?: F6 h4 M8 Z9 P) W
- #include <asm/io.h>
5 o: L5 p* l8 i; \ - #include <linux/moduleparam.h>
; g. R: }8 c# Z) |0 | - #include <linux/sysctl.h>
h( O- l8 Y% d - #include <linux/mm.h>% L8 G* k- R* u$ l: g2 u2 r
- #include <linux/dma-mapping.h>
; X. D( J% t) x: l! m" b - 5 u/ K! b0 R, L: I8 ~% Q6 H# N
- #include <mach/memory.h>
% B' k1 E) V9 \1 ^( _ - #include <mach/hardware.h>3 X6 _' |; H2 G6 x; L, j
- #include <mach/irqs.h>5 [. u" T7 Z2 R( ?9 |. L4 L) v
- #include <asm/hardware/edma.h>% ?- K% t, [/ z
. L* u; @6 z4 `3 K$ A4 W, I- #undef EDMA3_DEBUG
0 x( I: o5 y% M! U0 N" B) d5 o - /*#define EDMA3_DEBUG*/& B* E; v/ Q; e4 F; g: w% d' ^4 u
- ! {2 q8 @2 e; [/ R! ^; z
- #ifdef EDMA3_DEBUG# Z0 s1 s! V1 `% v9 ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" \. u5 f8 K& i# i- a( @* Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* |" w" j6 e7 ]" ~/ p& {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( {/ h" u/ L) q3 U# q3 J" |# K
- #else) i5 k# i C4 B. g& Q& }, r5 ^7 C' ]
- #define DMA_PRINTK( x... )+ w! z1 H1 H7 G! w6 P* C
- #define DMA_FN_IN
1 _- U; x, i- |; I7 S ^$ Z - #define DMA_FN_OUT
: n3 o( \& X; J! g/ U; I' u - #endif1 u5 D3 |$ T$ h) v. F% k% f
/ e# Z, C9 a# B- #define MAX_DMA_TRANSFER_IN_BYTES (32768): a% J/ g. f3 Z/ u: g9 s9 @6 D* h
- #define STATIC_SHIFT 3
$ r4 Z% M5 x R; @ - #define TCINTEN_SHIFT 20
& H( [: a- c+ J0 R - #define ITCINTEN_SHIFT 21# X4 Z. B% U7 D4 o% J! m
- #define TCCHEN_SHIFT 22
. K( S, \# J. d0 g! U - #define ITCCHEN_SHIFT 23
6 g" n$ {" Z- {3 o
& i- g! d e/ d, X& `0 C- static volatile int irqraised1 = 0;/ P8 v) I' n* _4 G1 N
- static volatile int irqraised2 = 0;
+ U# d- A; u1 o/ [5 F - ; o: ?8 X8 x# H/ X' I* ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" k1 h8 l+ j1 I( n* ^6 l8 c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% A5 a8 W5 X2 T, h! d% w" ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 t1 F* p9 V; M% C+ U - ( |: p N- w3 j. j/ K/ c& h
- dma_addr_t dmaphyssrc1 = 0;
. O/ ^3 ~ s3 P( M. x+ l - dma_addr_t dmaphyssrc2 = 0;
; n9 f$ [% l) M0 I3 W - dma_addr_t dmaphysdest1 = 0;, ?0 f1 N: C7 B- _
- dma_addr_t dmaphysdest2 = 0;. T0 L1 X; h: G/ l0 J
+ K. b9 Z( @+ {) }! l" [. w- char *dmabufsrc1 = NULL;$ r8 e( S% t$ w4 o: _0 y
- char *dmabufsrc2 = NULL;
7 i. ] k8 a2 D! `+ w - char *dmabufdest1 = NULL;
+ f ^) I7 x, f( h5 z7 c6 Y - char *dmabufdest2 = NULL;# W4 x& M7 w7 P* o" }- G9 I
+ ]" `, r3 U, W; G& E' v- static int acnt = 512;
( q* B. ]. l$ e8 Y8 ^ - static int bcnt = 8;
d9 _; g+ e4 K, v9 ` - static int ccnt = 8;' r- P$ o; v8 w
: {3 m, q0 \8 q% b- module_param(acnt, int, S_IRUGO);
6 u% u& d6 |) R9 C9 k - module_param(bcnt, int, S_IRUGO);
% ?1 W8 o- P1 r% }3 ^ - module_param(ccnt, int, S_IRUGO);
复制代码
0 r0 ?$ ]* U$ u$ @8 e
: v( x# ?% ?7 e8 G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% K# u) w$ ^# X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" H2 J: J7 T( k f4 L& ? z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 L: X8 ~, x# T& F" M3 N
& _8 N+ k+ U9 S- j9 C- u C8 F+ E) z5 D1 B9 g' a
|
|