|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) o: b. X' g; q; s
- [code]EDMA sample test application3 {" z$ r d0 U$ c0 S
- /*
* ?# K2 N6 a3 A. L, F/ g - * edma_test.c6 O. t+ B. X4 l
- *
) n% A0 e) k; w' e9 G- @! U - * brief EDMA3 Test Application$ {8 ^* ]/ ^6 N. |2 m9 T
- *4 R8 g: E# {8 _# m
- * This file contains EDMA3 Test code.
7 H" T7 l! x, X, P `% C - *1 X, c% \0 ]# v* m' R7 O# P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' L- l/ H6 P8 v# M" K" c: v H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 r/ E0 \( N9 U; z) c: R - * TO CHANGE.. Y0 T4 J2 L1 v, D8 }
- * B/ K' j! x9 r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) U3 p9 v4 F- L
- *
" o% T- Q5 Q7 r1 R$ D r# R - * This program is free software; you can redistribute it and/or
" d3 i+ L" C. g* l8 o - * modify it under the terms of the GNU General Public License as
: p. ]) E/ h1 D7 K X( u, R4 L4 Z - * published by the Free Software Foundation version 2.! h# B9 e% z0 b& o: F1 P& E; U
- *
( G- i& y) e2 ~5 x; P/ F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. D7 P Z6 [. x+ S' v( L$ ]# Y
- * kind, whether express or implied; without even the implied warranty' u8 ]% T0 G. `" u- o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* E/ H0 F/ p/ j: G3 x' T - * GNU General Public License for more details.
3 P; K5 `( y# b! S$ v3 N - */% r0 Z! o: g4 t2 F, P/ U: v. D
- 5 o) {: S$ |& z: \7 x5 V
- #include <linux/module.h>
8 }- t. ~, K% Z) a5 M - #include <linux/init.h>9 f. P$ f4 c, V1 E A7 Q9 f5 \
- #include <linux/errno.h>
& g2 \ x4 J$ q7 @' @* T - #include <linux/types.h>
3 u. ]* g7 t4 c- C8 ^. C f D - #include <linux/interrupt.h>' q: t. ^# T8 N2 r6 v8 Z
- #include <asm/io.h>
0 E2 `- \# u2 K- _, f8 @: d( `* B - #include <linux/moduleparam.h>5 A" O/ y1 v* T, e
- #include <linux/sysctl.h>2 B( {' I+ J3 ]+ q3 @# e5 ^
- #include <linux/mm.h>
' r/ Y# u; c( Q7 C0 u - #include <linux/dma-mapping.h>
: Z" r+ {+ S! ]6 {
9 y8 J N& k7 B. L+ S+ _5 M* m5 {6 A2 D- #include <mach/memory.h>" ~. w& x6 n" Z' f9 R
- #include <mach/hardware.h>9 Z, b0 Q% M$ y8 n }4 t$ N E3 |
- #include <mach/irqs.h>
% g" s5 V6 a! K- u* r - #include <asm/hardware/edma.h>
* z4 c0 C5 L; _$ G
7 F8 z) K( F0 h5 T, {0 f- #undef EDMA3_DEBUG
# P* @1 k3 c0 T# B1 ~$ d - /*#define EDMA3_DEBUG*/
- H" ?) l% q9 A1 T2 M - & n. s4 O n! T/ g% S4 X
- #ifdef EDMA3_DEBUG( D# c7 E' O9 k/ E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 ^0 `3 U5 x9 }5 j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). ]; a, k F* @. y: f4 n! A# |1 A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* X- v$ ^: w' A' ]' c9 T4 j
- #else1 k' M3 ^) K5 X
- #define DMA_PRINTK( x... )
/ N9 n' J4 ^) L/ Y/ d V; q - #define DMA_FN_IN5 l/ S. }6 b7 b0 e+ ]% c
- #define DMA_FN_OUT
1 l& R) i. R" a5 |5 [ - #endif
; p6 L- H c5 v3 ~ - ; i! m% X3 c9 B/ q+ y0 G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% T/ I Z9 W; V7 d2 l+ @$ M
- #define STATIC_SHIFT 3* Y5 _0 P6 j& C
- #define TCINTEN_SHIFT 20" ^) d7 G6 u7 P3 Z) Y' a/ ^
- #define ITCINTEN_SHIFT 21
$ B7 B. l! |2 u2 v0 F/ y - #define TCCHEN_SHIFT 220 L. p* D, U' {# _+ ~
- #define ITCCHEN_SHIFT 23* Q, C6 Z% N6 i3 H2 |# M' _
- 0 }: y( ~( A; D( n' T
- static volatile int irqraised1 = 0;
! z9 p3 E' T4 B - static volatile int irqraised2 = 0;4 S' r4 R$ N8 C0 [
- & h7 c3 |# P' r- l1 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ n2 I; n% ~2 ^8 s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ]# Z6 C. d/ q: k5 M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 f4 W B: s/ V
! A% F' G/ P1 ^, G: @5 t" h. ~- dma_addr_t dmaphyssrc1 = 0;4 j+ U6 b2 \& G. ?% k
- dma_addr_t dmaphyssrc2 = 0;
# i8 t" G1 W! S+ x - dma_addr_t dmaphysdest1 = 0;/ u+ R' ?, Z2 o6 t( }1 o3 |
- dma_addr_t dmaphysdest2 = 0;
* b2 b9 k. H5 c- U% F8 G - + ^) v, s! s# w, d8 t
- char *dmabufsrc1 = NULL;
, D8 o" ^2 s5 x2 g5 ` - char *dmabufsrc2 = NULL;
3 Y2 T! U3 k4 s - char *dmabufdest1 = NULL;
+ b4 J4 ^# z7 ^" D9 y - char *dmabufdest2 = NULL;0 b+ a. d6 f0 h; y
- ; ^# u2 h" x6 R0 D' S* x8 k
- static int acnt = 512;, ]* |: c0 a* j# t# F+ g
- static int bcnt = 8;# z1 k6 H0 M9 m: J. x+ d
- static int ccnt = 8; _9 Q o3 ~- B, v3 s9 r2 ~
- 4 T, m2 ^9 v l0 {# W3 K, q. \
- module_param(acnt, int, S_IRUGO);4 D7 R) N% X2 J6 |: j3 N
- module_param(bcnt, int, S_IRUGO);
# D% H! b7 {6 ` - module_param(ccnt, int, S_IRUGO);
复制代码
( p- U+ T5 _ d$ m' a. v e
) H) K* M8 I' q5 v! G X _4 P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ^5 T' \5 X0 Q5 `" H. {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" \6 K8 {5 \3 \4 M, U) K& t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- g6 g+ K/ q7 P) c
+ s- X% [) i+ g* p/ t8 P% x
. N, f$ X0 R! w- k5 |1 `/ j
|
|