|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 ~5 w! D) Z5 ] p" r
- [code]EDMA sample test application% ?- N6 O( R6 m& E h
- /*: c& A* g2 ?; P) t' H/ q' Z p' E
- * edma_test.c/ Q' S/ S( [5 L" I1 O
- * k3 h5 a1 t: h
- * brief EDMA3 Test Application# }& Q O0 V* h" K; g1 r" L" L/ T
- *
, f1 n0 L/ o7 W# b, `& D$ r' y - * This file contains EDMA3 Test code.
0 W' Q! l$ K$ t4 B; \ - *9 s$ Q7 l) {! X# g) W2 u5 m4 k" H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; \6 @( C) z. H( R' a8 H/ N3 p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. ?; W' @ F# t0 Q
- * TO CHANGE./ A. I& l0 |, A+ A: x
- *
; n S! c+ x5 C) Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 T% r. a% P& r( G$ V2 V - *
, J( r/ O( S: h% C6 U - * This program is free software; you can redistribute it and/or
" `; C) i, Y d* T - * modify it under the terms of the GNU General Public License as
% f# u% t! O, D% Q) c: k4 | - * published by the Free Software Foundation version 2.% [( a: [% n3 `, e! {' `
- *, k4 [+ o ?2 m' a& B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 M- p1 v7 f# b; ~% ~ - * kind, whether express or implied; without even the implied warranty0 ^: S* m: A* d& h6 Z2 c: y/ y6 z" A4 j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& U) {& J) T/ n8 T# C* i2 J( \; J - * GNU General Public License for more details.
$ H e9 J+ C! p/ t d) [ - */) k- z3 Z8 z- \/ P3 ]/ Q$ g
- ; J# W Y0 @4 z7 T
- #include <linux/module.h>
* f6 _$ d% B) E" g( J9 P1 d - #include <linux/init.h>2 r) x, u' K% Q5 F
- #include <linux/errno.h>
$ I! x* ?- [! D8 D - #include <linux/types.h>0 c7 `2 W& R1 N; y$ o, X. f" w( L
- #include <linux/interrupt.h>& }; w$ a3 p' [+ x2 o' r5 m
- #include <asm/io.h>& R8 k4 o( q% p, X
- #include <linux/moduleparam.h>
6 g" G0 K3 J4 E( O$ {' Y - #include <linux/sysctl.h>
* m, |% m7 N& R6 e, ~+ @/ J k - #include <linux/mm.h>& t. x6 J$ K+ ~# `8 q, K
- #include <linux/dma-mapping.h>
* H8 y# g' h9 D0 U( [8 j8 b - 9 U5 E; @7 U9 s. w1 Z T
- #include <mach/memory.h>3 y& I3 t3 |1 l+ e' _: Q# \9 f
- #include <mach/hardware.h>
4 {3 ~; i2 {% `' w& T - #include <mach/irqs.h>
' k, U/ s1 [9 q. {" Y/ n9 f7 s - #include <asm/hardware/edma.h>! }: b3 C- O7 i# d. x; D
5 m6 n( h) T4 r4 h& [/ N- #undef EDMA3_DEBUG# T! t% P- i( R8 u S$ G$ [
- /*#define EDMA3_DEBUG*/
, w+ ]" z, [+ z, B5 x3 v% X6 s6 x7 } - ' ^1 q+ B0 g+ P
- #ifdef EDMA3_DEBUG0 w* u2 N I C1 J* s7 Q \# x0 b: q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 l1 z4 b ?( `$ [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 O" c0 Q- b# p3 p* n$ K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) m3 k v: I, Q
- #else( E! y! G- u7 _
- #define DMA_PRINTK( x... )- c5 _- I/ @" v+ T( Q
- #define DMA_FN_IN
# ?; b/ x5 |8 L1 N0 l% v1 W - #define DMA_FN_OUT
) r5 L; ^: Q) A- c- U: g/ } - #endif2 e, W' X* b6 H
- / q1 M2 U) Q4 B! J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), [0 J7 D! \9 ^* F
- #define STATIC_SHIFT 3. W- O4 y2 P. x- I( D6 ~
- #define TCINTEN_SHIFT 20
s- A( C7 K* Z( N - #define ITCINTEN_SHIFT 21
& b$ |4 C6 ^1 D! b- ?9 k6 v - #define TCCHEN_SHIFT 227 L0 t) @# t" @, K6 ?
- #define ITCCHEN_SHIFT 23
4 ^8 b5 `4 `9 N# k3 d
( a ^6 t' M( h% U( Q- static volatile int irqraised1 = 0;2 N! _ n& L3 }, E+ d
- static volatile int irqraised2 = 0;
. X; A3 ]( n9 W: Z& A - ; A. ^0 h. f' H+ Q2 @; C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 j, b) k7 B+ k# o- _7 ~$ q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# |* x) Q) ], J! ]4 ~! v" [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 i$ K- o$ Z: H% j6 f
2 ] ]2 H" y8 G$ g- dma_addr_t dmaphyssrc1 = 0;
" U" o L, b( _6 V# t* v4 e: F! x - dma_addr_t dmaphyssrc2 = 0;8 N; D0 k) s5 _' i0 _2 S: `
- dma_addr_t dmaphysdest1 = 0;- d! i. n8 J/ \8 s# X
- dma_addr_t dmaphysdest2 = 0;0 p: z% }6 {& `) m c; N: `, F2 J
- 3 _& c& B5 Q% O9 T8 z0 t% F) U
- char *dmabufsrc1 = NULL;: @# w* J- H) [8 K) }; x/ s
- char *dmabufsrc2 = NULL;
; S1 o2 i2 _+ u7 }) O2 Z) t - char *dmabufdest1 = NULL;' V3 A0 B# E! R- x8 q8 B# T0 s9 z" f
- char *dmabufdest2 = NULL;
2 O+ g; R8 p. i8 G1 f9 {& `
8 ^: | Q/ t- _) v% I; `& c- static int acnt = 512;: A: |2 I9 ^- Y! P. @" C# M
- static int bcnt = 8;
8 g/ P1 C7 w. _4 q! G- ] - static int ccnt = 8;4 h& ~! m3 h. O4 w F9 Z
- & j4 n7 k! ^; s6 \% }$ Z
- module_param(acnt, int, S_IRUGO);, a' O0 }" z$ Y# c; y" M( W
- module_param(bcnt, int, S_IRUGO);9 D5 A0 o, E4 D K# l0 P x
- module_param(ccnt, int, S_IRUGO);
复制代码
5 a5 ~" B; i1 C; ]) Q" U$ M2 K0 s) |. V% {) T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ U! [4 x' [6 ~) I( h9 c; [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' H' {4 Y/ N5 x6 M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 ^9 e6 m& L v' q1 X' @6 m# K1 d& p+ w9 ~ O. X
% k5 F' ?, t- m* c# K |
|