|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% _8 u, [" B) E7 q! a& i- [code]EDMA sample test application; T: e( m0 _0 b1 ]% l: B% G# ?, `# l
- /*! A, c( e* x" I9 l: A
- * edma_test.c# O7 Z; {5 j( f, {
- *
/ W8 M4 o% \* r/ E$ _( W6 J8 p - * brief EDMA3 Test Application! P7 Y3 s: |+ E- K( B
- *
: K y! ?" c/ c ^9 `- [ - * This file contains EDMA3 Test code.
* |$ C0 M1 i1 A% ?# @ - *0 }! T: Z3 l/ r' G
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* p2 P8 l! \6 B' Z7 Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ z- C1 w5 k5 D
- * TO CHANGE.
) c* n4 e5 [& P# ]# c - *
8 J5 J! N0 Z s" @) i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 D7 ] i+ _( X, u- B) L% c
- *
0 a9 |4 j. d" }6 d/ ~* K - * This program is free software; you can redistribute it and/or
7 ?( y& P6 }1 T V" T2 {) h8 v - * modify it under the terms of the GNU General Public License as
! x) N: E. {( N - * published by the Free Software Foundation version 2.
' S* U, l" }8 e9 v* p - *8 W6 i0 ?, x) S) K* t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& x( r; r+ t7 K' p& X: ^* t - * kind, whether express or implied; without even the implied warranty; j. V) e( @* o( o, Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% b. J# g1 k O6 B. Y0 p' k0 ~: U" P
- * GNU General Public License for more details.
+ b) d9 d v* j: { \ - *// O" d/ X4 Y" ?9 S2 @
- ' w4 k, z+ k- ^- o2 @" L
- #include <linux/module.h>3 u8 F- ?' ]! q/ K" J
- #include <linux/init.h>5 g# }9 I2 A9 ]
- #include <linux/errno.h>9 M0 W- ?' t& A, z+ `
- #include <linux/types.h>
# a! d2 E# D7 M; c - #include <linux/interrupt.h>. L/ p r& w6 ^( c( Q- g0 w
- #include <asm/io.h>5 l8 J( _: J5 ~6 u
- #include <linux/moduleparam.h>
! l5 @& B4 f/ t1 q - #include <linux/sysctl.h>( R3 O, O) r' t2 n4 R
- #include <linux/mm.h>- f/ f: h4 U9 _# Z0 ?6 q
- #include <linux/dma-mapping.h>4 r* \# _8 D+ t, T% g# v( v- I9 b$ H
; ^* c' B. t8 ]0 w1 |5 o) i p4 l! v- #include <mach/memory.h>$ Z% Q+ K. X$ D/ m
- #include <mach/hardware.h>8 _( p1 Q- q9 s% V
- #include <mach/irqs.h>
6 n8 ~ _1 u3 J8 S - #include <asm/hardware/edma.h>$ Z* `2 c4 N! w3 c8 W$ Y& h
" [ z0 ]: r: A- #undef EDMA3_DEBUG
: c _, n4 g( I - /*#define EDMA3_DEBUG*/' a2 i) f! ]: S- {0 h
- + H0 F: t. o% l9 x" b* n
- #ifdef EDMA3_DEBUG S5 y1 `& `1 L" W. f& H# f `" Q+ c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ t$ A, Z( H. x& d t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ e5 i! J! p% ?2 p- X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% \$ {$ ]5 I/ T9 V! @' t: n( B - #else
2 t, s" ~) [- e- A- o - #define DMA_PRINTK( x... ); `, h K* U& [6 X c- K! O
- #define DMA_FN_IN
5 V" d* \. o7 K5 `$ [! C; F- Q! X - #define DMA_FN_OUT
7 _2 F, ^1 A* e' F' H7 c2 w' J - #endif
9 o' D* H; j2 S7 J6 f
. V% k# @6 ]( x3 b# T4 d) H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ y) `6 o% |! C4 x) i5 a- h0 F6 ] - #define STATIC_SHIFT 3
* G+ `- C; }7 a6 r7 I - #define TCINTEN_SHIFT 20
2 h8 m$ W5 A. x. _: ~+ I6 k - #define ITCINTEN_SHIFT 21& e" ~% _; [: b" T
- #define TCCHEN_SHIFT 22
" c, H' d: @% S# y6 G, I1 o - #define ITCCHEN_SHIFT 23* B6 w. X: D. G/ R- a3 \ C! U
- $ x M, A$ T8 L* A
- static volatile int irqraised1 = 0;
) R' }: D9 s3 h$ Y" l& M# o - static volatile int irqraised2 = 0;
) u# J/ g/ R; `* B' l9 _ - 8 ?% {$ d3 a8 m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: V9 { g+ b" r& t; [- A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; P2 c3 @$ v4 _+ S, H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& M! e, T8 x3 F8 z
# p. Y, R- v9 B) {$ H$ T1 p+ Y- dma_addr_t dmaphyssrc1 = 0;0 R- E3 v, F3 m' V0 Z! K W% f8 c. s
- dma_addr_t dmaphyssrc2 = 0;5 V# s- @4 T7 j5 L% F# Q. s
- dma_addr_t dmaphysdest1 = 0;
7 ]& S1 T! o9 _$ u3 ^ - dma_addr_t dmaphysdest2 = 0;# N& x' g/ V& y$ p9 D! g
) W ^9 d0 J7 ^8 ~/ D) P% f& \7 p- char *dmabufsrc1 = NULL;
3 L; R& q& U4 t' |. u! b/ r - char *dmabufsrc2 = NULL;
% H2 t6 y4 D0 p7 _& ~ ^/ f - char *dmabufdest1 = NULL;
7 ~. H9 I! J3 ] - char *dmabufdest2 = NULL;2 [( g1 s9 Q5 I Y
0 \ n* x; b1 J0 Y9 T1 D+ P) L" u1 p- static int acnt = 512;
! V7 |7 U* a3 S6 T7 @* y - static int bcnt = 8;5 u; H: B! W$ J2 @
- static int ccnt = 8;) t% x! p, ?5 R4 D" p1 l
- + s& L6 o% B1 y& O; s$ V) u
- module_param(acnt, int, S_IRUGO);
! j9 G7 e4 ]& x' ` - module_param(bcnt, int, S_IRUGO);4 k& {" h$ f+ e- V- v6 p' l
- module_param(ccnt, int, S_IRUGO);
复制代码 5 m0 b8 E& D- _5 a( Y( c/ c
?. \* B# q1 q: l* w7 K* l$ y" l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' B6 K9 x% u$ r9 T# @6 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- E5 I! _9 H% y- V7 {: n2 Q1 b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( V# Q. c0 p5 E+ k0 z2 L, l
2 c: ?& g# l: g/ c
1 {; a' l6 j+ F6 w- J0 S |
|