|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' T1 p( ~& V0 k
- [code]EDMA sample test application1 A! ~* g/ ~7 U' e; y7 m. s" R
- /*
- U8 x: q% F, S - * edma_test.c
2 G( I7 S7 L' O/ l ` - *
, X) ]" ~5 f2 m - * brief EDMA3 Test Application0 i$ t$ f6 A+ V: T
- *
7 ]1 E$ f9 K y - * This file contains EDMA3 Test code.
! L! h; Z# H% {: C6 \* Z+ W6 @ - *
3 y& k2 B- b7 ^) a" N# } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% I( t* B% P- z4 _1 q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, v5 ~7 @* o9 X, T! Q - * TO CHANGE.9 S2 ~3 K' G( z2 I5 K
- ** p. L2 J4 x1 ~/ [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ g% K2 ^% N5 A$ s$ v6 _4 z, n& A
- *
, W) T- c7 Z% _ X+ G- V - * This program is free software; you can redistribute it and/or
+ n4 q" H* L4 H/ U9 n! V+ y3 M - * modify it under the terms of the GNU General Public License as0 b* U: H# Y2 Y/ i/ [$ n
- * published by the Free Software Foundation version 2.' g# Z% j2 N) A4 w9 q
- *8 s& `9 b* n# ?: U0 g/ b* G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& }9 B' o( V+ m M( O$ X- C - * kind, whether express or implied; without even the implied warranty! u/ ^) \' ]" M+ u/ d7 m. l% I' w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) Q @8 G. X3 W: _: N/ T W2 ~$ ~2 C
- * GNU General Public License for more details.0 E# R8 w% [; I0 |4 m$ G3 Y) _+ k
- */
! G$ m1 N$ P' J1 ]9 G0 }# l - 6 u7 I8 N) F9 h! Q! N2 b/ w B
- #include <linux/module.h>
! T9 ?; h5 K2 @1 j9 W7 o6 c6 Z: } - #include <linux/init.h>
4 ]. N, ]" a3 `0 ~0 y% F - #include <linux/errno.h>9 F/ i" g j) l! U- N& {) M
- #include <linux/types.h>5 S& J& W& I! A! g' M3 w# v
- #include <linux/interrupt.h>
% ?; V8 q9 D4 p8 {9 ^6 V6 K6 l - #include <asm/io.h>
1 T8 q8 R9 M; N( U* u" _" V4 N" | - #include <linux/moduleparam.h>0 Y# |. F/ O& ~; D2 Q" s
- #include <linux/sysctl.h>
; L' T, B; I) c6 Y0 |* ` - #include <linux/mm.h>6 G" @1 d4 _, a* q8 ~: T
- #include <linux/dma-mapping.h>
) O: T( {% E. c' F1 C
* a5 u9 n! e: D4 u. m7 i- #include <mach/memory.h>
% D# |2 w# y3 c8 U1 p% l - #include <mach/hardware.h>2 w& e V4 N: f$ Q
- #include <mach/irqs.h>
% g0 s8 U$ b u4 A* p, u - #include <asm/hardware/edma.h>
" F. q1 H5 c! N4 d" {
% \0 X$ g7 w2 W( O, N a! ^- #undef EDMA3_DEBUG
7 a# f1 A, W8 r2 \- v1 V9 L7 H* I8 `9 c - /*#define EDMA3_DEBUG*/
9 W- \6 p, i. E2 N
9 n' S! R0 f% X T( I- #ifdef EDMA3_DEBUG0 F. i# r$ a4 ]. j ]2 J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 b* ]1 P3 T8 m p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ S B; l2 F$ H" O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! o( R: E+ @5 c' ], b1 R* Z - #else2 j8 H }( N7 x9 o" \
- #define DMA_PRINTK( x... )
. J/ i+ k0 K i) B7 K/ K, \ - #define DMA_FN_IN, R7 z0 ^, P" Q
- #define DMA_FN_OUT
@" B6 L3 {, @8 x* P# s" b% M5 G - #endif: v4 [* U2 e0 X& ?8 b% C
- ! D" x( U4 k2 I* z2 R$ j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* L7 W' s: Z1 N' L2 u% d
- #define STATIC_SHIFT 3
5 \ @$ D* ~5 ?; d) |/ H - #define TCINTEN_SHIFT 20' s0 V8 C5 T& z& ^
- #define ITCINTEN_SHIFT 21. Y/ Q- S8 H- ?5 R
- #define TCCHEN_SHIFT 221 q! d% O1 y U1 K
- #define ITCCHEN_SHIFT 238 U N* i8 `1 O9 O( i; J- i- R
8 F. i1 h( }, P, r- v- static volatile int irqraised1 = 0;
: J1 Z" \- Z' q; h, o, o4 L) E- z - static volatile int irqraised2 = 0;
# {! i C/ X. C5 ?( G% R7 t
6 C/ [+ \; _. v* B- H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
v8 x' K! ]* U$ ~- ` N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); Z4 h# d& w2 d w; ?; n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, V& J+ R3 z |
- - Y$ D: K' T8 B0 Z
- dma_addr_t dmaphyssrc1 = 0;
; Q5 o+ ? Y, e+ N& S - dma_addr_t dmaphyssrc2 = 0;3 } o6 Z% y2 q& V' V6 J
- dma_addr_t dmaphysdest1 = 0;
- i% Y+ u+ u' H, K) A - dma_addr_t dmaphysdest2 = 0;3 f( h6 J! E5 ~- T8 }. ?
5 [/ N* _, L( T; d- char *dmabufsrc1 = NULL;
2 G; G% W* q! ^! O- J - char *dmabufsrc2 = NULL;
c1 h* w: R; g. u& u- ]: K( @7 ]7 Q - char *dmabufdest1 = NULL;4 f+ o. K$ z0 f- N0 @) e
- char *dmabufdest2 = NULL;
" x1 N' d& [7 u W6 o B# O: m5 h
5 q9 x5 u( o+ d! z& g# t; G6 \. ?- v- static int acnt = 512;
* B) ?. d) w" E. i7 I - static int bcnt = 8;
) t5 r& Y4 S; h0 \; v8 L - static int ccnt = 8;7 ^5 Y# S. t0 e- R
- , W! b. d1 [! z W
- module_param(acnt, int, S_IRUGO);
- ?& R) l3 S$ S: R+ M# d - module_param(bcnt, int, S_IRUGO);
/ ]8 E# \( ~8 m$ l/ F5 H - module_param(ccnt, int, S_IRUGO);
复制代码
( f0 C' t7 d4 \7 B( X$ H5 y$ H0 q- D3 F# [; L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 y* ]- v6 @: _% \# c$ G5 X" u" Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ z/ r5 H+ T2 l+ T; `/ N) @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; `& B4 ?& q1 K9 L& W/ B* Y. H3 b7 [/ r8 d, F% q
* _% U6 L |- \: d
|
|