|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 ]" J) ~7 E$ h' t7 h$ ?- [code]EDMA sample test application9 C% `6 `0 O! \
- /*% R7 k7 b9 K7 v
- * edma_test.c: p5 R$ R0 M' q; W) }$ T/ z
- *8 }) N. H+ T3 I* [. O! x3 T
- * brief EDMA3 Test Application
L3 T3 g5 y( ^ - *8 R) B9 }6 X. C( y# v5 r! f
- * This file contains EDMA3 Test code.
3 d" J: F( P& U& m - *
0 j2 V7 |3 c" z5 K3 B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* \2 J1 f# ^2 z+ b, T0 g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
r5 f2 b. C2 T4 }6 M: b2 M# ` - * TO CHANGE.
: L) f2 {; `2 \6 ?0 v - *2 v, K" Y* {2 k9 w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. H1 `3 i; ?( B - *
_" t$ W, m; ? - * This program is free software; you can redistribute it and/or
4 A, u2 @6 q" g# X9 q - * modify it under the terms of the GNU General Public License as
" S2 H- w( H$ A0 P# Z - * published by the Free Software Foundation version 2.# X2 s/ R. i: p! H3 |
- *6 ?( s( t3 R2 i# W( ~- A; d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# E/ v* g4 L9 X! \/ a/ M2 n
- * kind, whether express or implied; without even the implied warranty% }- G" I# G% x) c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* S+ r* U3 ?, u' h+ K( |. F - * GNU General Public License for more details.! z! Y& U, k0 n/ }8 k; ^. X
- */+ V* ~ ~; V, S; Y& y: B9 G U, L
# D4 j+ r5 X% `2 P& y/ D1 A! Q7 P8 I- #include <linux/module.h>
. ?3 a; h; N' G - #include <linux/init.h>
8 B/ t& l4 N3 G8 _" h* k% V - #include <linux/errno.h>) S4 |9 g2 r: c6 R4 ]' O1 w
- #include <linux/types.h> b3 ^# t* k7 v9 \7 |, r% H! }3 `
- #include <linux/interrupt.h>0 S& N4 ]6 u8 ^: G
- #include <asm/io.h>( W$ `" ]- N' j3 @
- #include <linux/moduleparam.h>$ `5 s/ L$ B& Q( o3 r% h4 B6 Q
- #include <linux/sysctl.h>
' j9 {% M2 M: D4 o - #include <linux/mm.h>
- V; ?6 p+ w' Q( w - #include <linux/dma-mapping.h>$ ?4 O' A2 m6 d( p5 T! h
- 0 b/ _1 h: X, J+ H" |
- #include <mach/memory.h>
0 f+ l' d+ }6 @$ E* X - #include <mach/hardware.h>
+ S( k7 R6 h- U4 F6 G) N @ - #include <mach/irqs.h>
7 W* e& E# q7 k0 B - #include <asm/hardware/edma.h>
# U/ J4 B: i& I( v
; R3 w: ~1 U$ ^: Y- #undef EDMA3_DEBUG
" f* G- P9 p3 F: j+ {; @4 ~ - /*#define EDMA3_DEBUG*/( A. Z7 g3 z4 _+ g( p" [# \) Y* m
- " ^, p A. m( Q* R6 A' D* k: p. e
- #ifdef EDMA3_DEBUG( T9 ~0 F# P9 V4 U: ^4 F k, G+ m6 ?# O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 K5 |! ], K c9 g# e/ I1 I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ z# w* e& P2 G- w7 z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: W3 n6 k! @* ^ l3 Q, D - #else
" _* l }; |8 F9 @6 W: \: k - #define DMA_PRINTK( x... )
& M( H. [" [9 G n' H' [* f - #define DMA_FN_IN$ M9 o* _2 \! D* \; T% v5 K9 B2 T4 J$ Q2 V
- #define DMA_FN_OUT7 R- q3 P- D; i: m. m9 {
- #endif
* w; T- a! J" a2 A7 M
9 u; L5 k- Y+ ?6 `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( v: v- F- W/ Y% m6 H7 f - #define STATIC_SHIFT 3# o/ f$ Y% O' h8 I
- #define TCINTEN_SHIFT 20
( T6 ~" J5 p9 G" l- x: O% Z1 i - #define ITCINTEN_SHIFT 21, W ^/ { D7 V- T7 a+ h+ n
- #define TCCHEN_SHIFT 22
8 X/ Z' }9 }! K# i$ t - #define ITCCHEN_SHIFT 23
2 D( I* I: Q _
* {& r" f# y% O4 k8 f- M+ }- static volatile int irqraised1 = 0;1 }2 l6 v" b3 S7 j, p% R& Z
- static volatile int irqraised2 = 0;! o5 G3 w8 r8 f* V. z, I
- # K" {7 @3 D# x( M# A3 g2 ?* l* Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ Y4 N4 D5 Q( u4 A7 H% X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, A$ S2 `! n* A0 _' n7 k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 S+ }3 T. f6 q( Y* J u8 b - 6 h/ D; L5 s/ n1 W
- dma_addr_t dmaphyssrc1 = 0;& |( C( l2 y% P- j( ]/ y' z, H
- dma_addr_t dmaphyssrc2 = 0;
+ W8 z% j, \3 l; N/ y9 E - dma_addr_t dmaphysdest1 = 0;5 @/ M* u- L" ^+ D ~$ o5 p) {
- dma_addr_t dmaphysdest2 = 0;
! h% W/ O9 O: O8 D% \$ ^
" K( J" R4 R' ]8 g' D# {: m- char *dmabufsrc1 = NULL;# l5 c7 G/ ~+ F5 \) J1 I
- char *dmabufsrc2 = NULL;
2 K4 U2 R, G4 m B4 c' v& W6 @2 k - char *dmabufdest1 = NULL;1 o" y7 m& \9 W* y2 L
- char *dmabufdest2 = NULL;
+ F2 s% q- b3 l M7 v6 r; B( X5 }- q$ u
% C5 X2 j+ X+ p% L: `- K# D- static int acnt = 512;( ~9 W6 X9 h& e. U
- static int bcnt = 8;5 }7 K9 c2 U% N6 m5 v$ {
- static int ccnt = 8;
# p, ^. r: @! s; r6 I
( q. P9 n% D5 w- module_param(acnt, int, S_IRUGO);, r. c, x+ Q; k5 g! a: Z: u$ j
- module_param(bcnt, int, S_IRUGO);
% U1 D- x- p$ {6 B1 _$ L8 C6 g - module_param(ccnt, int, S_IRUGO);
复制代码 # y- R6 i4 a* J/ Z$ Z; C$ ]
- b4 k; N, ?; E. t- {! J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 G( |# B ]# B* T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) v' J1 L% q( q4 S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 P7 _3 E) ^% s* H2 n5 n6 e4 h
& L7 V# y- n6 U- f+ l" m
1 _. R2 I# g. | |
|