|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ \6 `+ s& J+ ^) I& N- [code]EDMA sample test application4 d& D" U4 G4 G9 a
- /*% j! ^( ]1 G4 k. b
- * edma_test.c
* {8 T0 E- ^6 D5 w# A7 I8 u - *
9 }! U( T" x- E( W9 o - * brief EDMA3 Test Application
6 a" K$ k. l7 e7 t Y- i z+ H" N - *
( Y* C+ X/ {/ {4 k0 x. C - * This file contains EDMA3 Test code.
1 O0 j( R1 ~8 s - *% C0 Z7 J" g. Z1 M, f& v: s, ]# J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 s. `7 x G' X5 k% i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, q0 B7 o3 Y' C# a5 e! x) Y; M
- * TO CHANGE.
( x' i4 l2 a/ l+ n' U1 _ - *- L7 C" V( s+ N% y1 [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 W: D: E8 p1 |
- *
8 C' g: ~ B8 K* E j - * This program is free software; you can redistribute it and/or
; o, i/ w. C* B: L - * modify it under the terms of the GNU General Public License as$ _5 q/ i q- ~/ [- k2 N' q
- * published by the Free Software Foundation version 2.! R+ u7 Y9 }# k; B' H6 Q
- *% L5 J! \# v+ s1 l2 l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' A1 Q `* M- _ - * kind, whether express or implied; without even the implied warranty
Y# S1 a# y, s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% L3 U H/ z5 x$ _" b - * GNU General Public License for more details.& T/ }" q+ b+ W" i% C
- */
+ [: R* b! ]1 K' z - 6 L1 g5 D7 c7 h% l/ c; j* k
- #include <linux/module.h>
r1 g4 _* x: Z/ k C - #include <linux/init.h>
/ |& G7 f1 H/ f; G6 j, N - #include <linux/errno.h>! D A) N: f" x$ R. ?9 L# g; g
- #include <linux/types.h>
7 w" v8 I9 P* o5 E% U3 X9 g% U - #include <linux/interrupt.h>
" @+ c# H! r) e; s+ H# X - #include <asm/io.h>
' _& l$ h$ Z4 { T$ \% e - #include <linux/moduleparam.h>$ C4 x1 c: c3 Y$ @" w5 Y( L
- #include <linux/sysctl.h>
( @7 i7 P4 H2 n9 Y1 I9 |# f - #include <linux/mm.h>
. s" m7 p+ s% g7 |$ t7 b - #include <linux/dma-mapping.h>
0 }+ H2 @. F# Z6 o' r/ [
+ p- r$ }9 V$ {- #include <mach/memory.h>; |% W. _* B$ A# M8 _ _3 d; w* l
- #include <mach/hardware.h>
# z2 _1 V7 B; v' }5 i- Q% H1 U - #include <mach/irqs.h>
) N% T- @; v' I$ L - #include <asm/hardware/edma.h>
: d. P5 b5 T6 f: V0 `" ^
+ `. D8 Y5 ^* ?% }- #undef EDMA3_DEBUG; C8 F& b3 k- M7 R' J1 e) s
- /*#define EDMA3_DEBUG*/
. P" J6 D2 c4 L% G' X# D
7 [) O( C# p$ M+ q- #ifdef EDMA3_DEBUG" j/ K) O6 K/ j/ H0 ?* j; b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) B& I; f7 R1 Z! ^! C6 H8 R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! v, B2 M* C1 h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& S+ q1 r+ H+ p* u6 H
- #else4 N3 N+ K: X5 R: K
- #define DMA_PRINTK( x... )) M; n& n$ A2 u3 Q8 U) b- r
- #define DMA_FN_IN# r/ U( p3 p t& ], ]
- #define DMA_FN_OUT
6 E& f4 @; H$ \8 L/ `- x - #endif; h/ z4 @& ^ l2 G2 P* K% x- ~
- {+ B! @5 d/ T! C6 x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" u o# R% E4 ~ g - #define STATIC_SHIFT 3- V( D3 J/ q- F) }
- #define TCINTEN_SHIFT 20
8 T1 t# i9 L: w9 U$ _( A9 i - #define ITCINTEN_SHIFT 21
# G, _* [6 l* g' m" b. \* h* j - #define TCCHEN_SHIFT 22
& L6 I* H1 V3 C# a' ` - #define ITCCHEN_SHIFT 23
# [7 i+ j7 ]/ ?+ Q. w: `
: \8 e" f( y( F6 V [4 B" k# l& ]6 m- static volatile int irqraised1 = 0;2 ^: X6 v; m8 v8 C- D, X% S& l4 @3 Y
- static volatile int irqraised2 = 0;5 T2 t" Z5 e% X$ L8 u! s
x0 P3 j/ O5 u1 M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 S: ^* E+ C6 \8 {1 N* b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* l% } }" v. {0 c7 r! T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 d) A0 A. J- w. _. ` - . J8 t# U# z" x* D( t
- dma_addr_t dmaphyssrc1 = 0;
2 n V* U* I8 I0 V+ ~& u9 k - dma_addr_t dmaphyssrc2 = 0;
# W l/ J* @& r8 e) D" j( T$ [ - dma_addr_t dmaphysdest1 = 0;) F% K" ~* k- C2 I a" K
- dma_addr_t dmaphysdest2 = 0;
$ R5 a* G1 O n9 L% I; J! h( }
4 X/ V5 E* j( b: b# W8 Q- char *dmabufsrc1 = NULL;2 Y! }: n9 s- u
- char *dmabufsrc2 = NULL;0 [* F$ r) g9 I
- char *dmabufdest1 = NULL;
8 C) Z% E! O8 W4 g9 b2 M - char *dmabufdest2 = NULL;
+ H2 C2 U* {: |2 j6 U2 Z! x$ U - * b" C- k4 S, @6 t T8 K5 W
- static int acnt = 512;
5 y o. x0 G% R - static int bcnt = 8;8 I. I7 M2 B* P+ q' e W
- static int ccnt = 8;6 P2 ?0 W' Z8 x# Z' e8 m r# v
& t d2 P t) _) g- module_param(acnt, int, S_IRUGO);" R3 T8 ^( f; ~, l7 F
- module_param(bcnt, int, S_IRUGO);' H/ ~/ O+ b3 I! o2 M
- module_param(ccnt, int, S_IRUGO);
复制代码
: ^7 v/ Z0 D. u% r& m4 F/ v! x" S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" x! p" q/ `7 T. uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 `9 l3 A6 R% K7 @2 Z' V( n- o% e3 @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 i+ v8 i3 Z9 n; R: Y' y
6 t% ^7 t: ?/ H! J, l5 A6 b! s( \
- h' y, _% j* \& |. B9 G |
|