|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; w0 K* t; t$ E7 T% e
- [code]EDMA sample test application+ ]2 d1 ~( h) Z, u& [+ }
- /*
0 |, u) `0 ^! p7 @ - * edma_test.c: C e) D# d! Q7 b6 V
- *
7 c/ \0 x) T$ v1 b - * brief EDMA3 Test Application$ a2 m1 l5 m) M1 B( n
- *
; X: {8 l0 ^- D! l8 Y6 @* M - * This file contains EDMA3 Test code.
( [ ~+ h# b' ` - *
- I1 U5 \! j$ d+ Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 ~- S( _ o# C9 g' \/ l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 ]9 }5 U) @! B3 e; @- x, \& X - * TO CHANGE.& u0 [2 {6 V# B' L3 \
- *
' u0 ]1 E- a4 X/ K7 M# r2 ^; Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 U; c. E% n) t+ P - *
1 ], }$ g* ~$ H3 T: v - * This program is free software; you can redistribute it and/or( k* b) f' z2 k$ I" ~
- * modify it under the terms of the GNU General Public License as
( s6 d" ?. }! m6 R - * published by the Free Software Foundation version 2.
4 B _# m+ v- E8 p* V7 d, ~* u- L - *
" y' C" \4 A/ B7 T9 E4 g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* p( C2 L5 K; ?$ F - * kind, whether express or implied; without even the implied warranty
9 j1 T: _/ S2 r/ M5 m9 o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. P% ]6 i! q1 P g
- * GNU General Public License for more details.3 e6 r8 t# z9 o& P# L
- */. m; ~4 e% _6 @' H
- 1 t5 y9 {) r0 ?
- #include <linux/module.h>
V0 O% p/ }& Y- T3 { - #include <linux/init.h>
3 j# m5 A+ L) T7 s - #include <linux/errno.h>
6 @7 v* T7 p( y& w" | D% y, B - #include <linux/types.h>. i' n0 C5 _" |
- #include <linux/interrupt.h>
( p# ~+ B* M$ r( U! D - #include <asm/io.h>' p( g" N/ {) ^$ L' b
- #include <linux/moduleparam.h>* i6 w U7 [' }* L( _
- #include <linux/sysctl.h>
I: {3 W+ r5 N - #include <linux/mm.h>2 y% F, u( n3 C
- #include <linux/dma-mapping.h>
, I' A) S- i% V - . Z+ F8 [5 C) z& D; R& r" }" G
- #include <mach/memory.h>
, ]9 R* c6 D2 G; |3 P; m - #include <mach/hardware.h>
% |% W8 S4 x4 l: T2 K - #include <mach/irqs.h>
; G0 x# Z( @* ~/ y9 H: M - #include <asm/hardware/edma.h>) U ]: D$ `/ v
. u) d) y1 U& l) H- #undef EDMA3_DEBUG5 q% C5 v' t' Z9 |
- /*#define EDMA3_DEBUG*/$ b% u- a% C% P3 O7 F( ^/ ^2 B4 m1 N
- ; W5 i& n+ Q7 X5 K
- #ifdef EDMA3_DEBUG
4 r; y" K9 r p& S9 F% r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* F; o* q+ e( i$ ~* J' o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! i, S7 ^* V; b7 E, r. r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! J% `0 Q |5 C) O
- #else3 e/ |1 y( @* m! {2 y; H1 a. N- |
- #define DMA_PRINTK( x... )5 U/ u0 j- M: Y7 D4 C1 d
- #define DMA_FN_IN8 P X. B9 q) O" W; x
- #define DMA_FN_OUT
$ ~, B4 ?( B, `7 h$ G - #endif
~2 D: m; r$ P: d' k% N5 k
- G4 U* r5 n: q& Z7 A, ?* _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ |9 d N7 M, V: e* O! q9 ^
- #define STATIC_SHIFT 32 E0 w0 i* P9 D- n) [/ L; r0 p
- #define TCINTEN_SHIFT 20
: T% w" V/ c2 e" X - #define ITCINTEN_SHIFT 21: A5 |* u A+ m* N0 F
- #define TCCHEN_SHIFT 22, l) j$ b, m# u( Z4 ~
- #define ITCCHEN_SHIFT 23+ A& D% \( V. @' ]8 r/ Z5 [2 W
Q; H8 [: P% M7 ?" r& j* K- static volatile int irqraised1 = 0;4 g. F: F+ P6 X% `% B
- static volatile int irqraised2 = 0;
6 m6 Z* j% h' Q e$ Q8 D
- p+ ]1 R6 L( q" G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- {; |3 H- |. e& V# Q. B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, E" _7 n2 q# N! M# i/ M5 y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 |; N3 g, Z! v1 f6 r8 @6 E - / G/ r+ r9 u& N3 ^3 F
- dma_addr_t dmaphyssrc1 = 0;
; b! n; ?' U: p9 n) O/ i - dma_addr_t dmaphyssrc2 = 0;$ O0 F3 s n7 c0 Y0 Z
- dma_addr_t dmaphysdest1 = 0;. y7 E( T2 q' u. U% c6 b
- dma_addr_t dmaphysdest2 = 0;) k7 W+ K4 \7 }0 J, H) t
- " l M* M$ B+ v; M0 c7 ~9 U2 u
- char *dmabufsrc1 = NULL;# H" g9 M% g5 d& ^1 N
- char *dmabufsrc2 = NULL;
_% R: N, `! g8 f6 H - char *dmabufdest1 = NULL;1 ^( H6 q/ T/ j- H1 p" s1 L
- char *dmabufdest2 = NULL;; h/ q( G, D2 N- j6 f
- ) j8 p/ K. \& p( ? \
- static int acnt = 512;
( U4 ]3 c# x$ D! g5 A7 A& h - static int bcnt = 8;
7 U/ k1 H3 m+ j, j* O - static int ccnt = 8;
% V) s. h6 @: z
m0 g" k/ F& z% W- module_param(acnt, int, S_IRUGO);8 {1 z0 X) O, {
- module_param(bcnt, int, S_IRUGO);+ L: E1 F! V9 |3 }3 O
- module_param(ccnt, int, S_IRUGO);
复制代码
* j+ B, M. X, e' v1 g7 E* X' ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 B$ }8 q9 K, t- J/ v: G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- I+ o% I5 ` i& N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ }! M# o/ o; P0 e) i
; ?* n1 o- p* A
% { o$ o6 K; G8 J9 Q% A |
|