|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " ?9 a0 t" R+ g
- [code]EDMA sample test application
' H/ f% z) e; i* m% S! C - /*" N- x2 r) U$ \5 N# Z
- * edma_test.c+ Y. L3 b$ D. g; E+ j8 c
- *
4 E. [1 j9 _+ b - * brief EDMA3 Test Application9 s8 u5 D6 e. M6 H+ M9 C
- *
7 `& N8 {/ b" c' X q4 B6 R K - * This file contains EDMA3 Test code.
8 G2 F) h! P1 y - *
2 l# f5 b6 B" E5 z/ S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 R4 A% |8 J( O" t# Q/ i5 ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% A4 P2 q$ e2 e; [* X, V5 k
- * TO CHANGE.
" F3 ]" f. Z3 [5 j' { J( |5 G5 R - *' @% T X; M$ ^ j% @% l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, p c$ K3 r& B: f, P3 }2 {7 v; @$ @ - *7 O* H4 t9 s. N. @( H9 S4 L" ~6 W3 ~
- * This program is free software; you can redistribute it and/or" u4 Z- T; K: a% `4 _
- * modify it under the terms of the GNU General Public License as
% e6 n7 j% n$ U - * published by the Free Software Foundation version 2., I4 V5 a2 j! F3 ?& J9 D( S
- *
, ` `( f, U8 t- V& i, C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 [: X# u+ O% M7 B
- * kind, whether express or implied; without even the implied warranty
) s' z& u: J( T; X6 w# b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the x! }% i6 n; N6 f" `7 f* K
- * GNU General Public License for more details. F {& b3 j& I/ m1 b: A) d
- */
X0 E8 k. `8 C8 i" B: y
- {$ l% A+ Y2 r( @- #include <linux/module.h>
# q' Q) C; M; N( C! | - #include <linux/init.h>8 ~8 K- R8 x1 o2 y1 u2 o
- #include <linux/errno.h>) O; ^1 S3 p% Q4 k% A
- #include <linux/types.h>
! v2 A+ \* `6 c9 t- m7 y7 @8 ^, R - #include <linux/interrupt.h>; d$ Q, v! e" T; |
- #include <asm/io.h>! P7 C6 m2 _7 ]+ n- A: ?
- #include <linux/moduleparam.h>
4 c9 U0 j" \) O3 z" K8 |+ y5 `1 ? - #include <linux/sysctl.h>3 ^% F; y" Q( ^/ f, ?9 K: d0 i8 ?
- #include <linux/mm.h>- y, I0 U: N& j
- #include <linux/dma-mapping.h>
0 q: Q3 Q8 [, R7 \ - . S2 a( {2 a& I! L/ v7 Q* C
- #include <mach/memory.h> ]1 A6 `& ?- g4 i) E! M
- #include <mach/hardware.h>. p T6 i% f& s+ e
- #include <mach/irqs.h>
+ ]$ T% J4 b, R6 T- ~ - #include <asm/hardware/edma.h>
, C) r$ b7 D& D z( f$ @% ]
M+ u5 y) h7 {2 y3 C- #undef EDMA3_DEBUG3 b" i3 i+ J. u7 s1 ]2 M
- /*#define EDMA3_DEBUG*/* l' N0 N, \' I. Y8 C( H
- 8 n) o. {6 X5 \2 v" u) M, i8 ?7 `& l
- #ifdef EDMA3_DEBUG0 W3 }! V: W6 G7 W2 ?6 O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 V" w+ a2 D0 F1 x; `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 \ x& Y+ O3 Y# n* y8 f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& C3 R: }% A; p& J% d
- #else
# Q6 B% l( P1 f - #define DMA_PRINTK( x... )/ }1 P+ O0 b4 a' L
- #define DMA_FN_IN; T- ^/ v/ Q& a4 @ i/ ~% ` r0 f9 O
- #define DMA_FN_OUT2 }% s9 l/ @" y& \) z
- #endif* H. a3 d9 G9 z2 u7 m; i9 Y. r
3 L7 B z/ L/ q6 D( Y% |- p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 t S L5 @6 g - #define STATIC_SHIFT 3
6 g* X7 B3 q: L# a$ Q - #define TCINTEN_SHIFT 20
Q' n% ?) H6 G8 H. M - #define ITCINTEN_SHIFT 21
/ u3 J" _' a- Q3 `1 p - #define TCCHEN_SHIFT 22
! B, j! C. A" `3 t - #define ITCCHEN_SHIFT 235 g+ M/ k3 p# I! E# U* _& g
# C( {! k \ z! e- static volatile int irqraised1 = 0;& z) y& I8 M7 V# F. @; _3 L
- static volatile int irqraised2 = 0;
& C( g3 b ?/ b G7 x
5 j% \, v: A# Q" ^ l% H: E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 ^( y0 ~+ R X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 w) c( n, B7 y/ I. |3 K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 M, b! j0 B+ m5 H+ i
- + X* O6 v8 D2 D' O; ^
- dma_addr_t dmaphyssrc1 = 0;3 n {% U- O+ U$ |8 P( ?
- dma_addr_t dmaphyssrc2 = 0;! \* P2 W- ?* J2 g7 k) N4 M
- dma_addr_t dmaphysdest1 = 0;. B2 z& j* J7 K$ l8 o
- dma_addr_t dmaphysdest2 = 0;2 G& [$ v0 |7 e9 S% I7 P b( m4 o
5 t$ H/ L* l' C8 a# N+ p- char *dmabufsrc1 = NULL; O4 O7 S' W+ ~% f
- char *dmabufsrc2 = NULL;
2 Y n3 Y( c: d4 A* e! k/ Z - char *dmabufdest1 = NULL;
2 w' W% h0 R" T! u2 t - char *dmabufdest2 = NULL;; m5 D2 [- U; p3 `" J$ d+ s$ d/ h3 \
+ N5 t/ w, B( k; y0 D* B- static int acnt = 512;
/ x1 h! X1 ^7 _+ m% t' O& x7 l - static int bcnt = 8;6 D: w: A$ \8 [( E/ k. i+ ^& w
- static int ccnt = 8;
7 N' P6 q" C( L0 A) l
$ {4 g7 m+ B$ o: v) @2 H- module_param(acnt, int, S_IRUGO);
- _+ _! @7 |$ M/ |7 j' W; V! T, B' a - module_param(bcnt, int, S_IRUGO);2 e2 u$ _6 A3 {" M- w b
- module_param(ccnt, int, S_IRUGO);
复制代码
2 G4 i* T6 \8 ^4 k( u3 `% h! j; q6 Q2 n; x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 c6 {1 @! y+ i/ I! M% ]3 uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 \2 Z+ n! a& m9 s6 ?8 Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- v& u$ }- u v. L1 ^6 \* f2 J, ^. u% v2 p" n& d
3 y! H2 w0 U A7 l |
|