|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: h$ y: g& p% ~ s) k* G5 s- [code]EDMA sample test application( y$ N( o8 E; N ~$ N: B
- /*
( c. `* T8 a; G - * edma_test.c: x; ?9 _0 Q" B
- *% Y" _+ W a5 [+ j$ U; D7 Y
- * brief EDMA3 Test Application( N' o8 b8 {; ^1 h8 G
- *
4 l, U! d- I' @9 Y+ @; @. z - * This file contains EDMA3 Test code.- W1 S: ]3 {: ~+ s1 S/ [
- *$ Z# o: {- O3 g# A7 q, J& s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 U2 y; [) T- M0 O; x5 x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; u3 x) ]% G: H( f% V" f! X
- * TO CHANGE.) X" N# b9 ^+ a' w6 V
- *
3 R; ~+ O' e$ Y: g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: Q P; b7 l* X4 F0 K
- *
" w* v' f# ]$ e - * This program is free software; you can redistribute it and/or, o* a7 D: p1 {9 ^1 F+ V
- * modify it under the terms of the GNU General Public License as. l0 e1 m/ _$ g: Q% W1 S
- * published by the Free Software Foundation version 2.' L2 r9 g3 ]* N1 ^$ V8 l
- *+ e! C3 T4 x7 d& Q U6 ?+ \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 S6 ?- u/ l1 i' Y( O; M
- * kind, whether express or implied; without even the implied warranty
2 H# Z1 j, N; Y5 t6 h( S( u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- U0 ?# ?8 j& L
- * GNU General Public License for more details.
2 w1 l: ]: V6 F& L - */0 ~0 o) Y7 B5 w( u, g; J
- . Y5 ], j" G- P& N$ N
- #include <linux/module.h>4 t! F3 ?$ k6 l8 f2 {
- #include <linux/init.h>
* o* Y& T0 p( i* S4 |! H& s4 l - #include <linux/errno.h>$ c& J# M: W7 J2 W" g
- #include <linux/types.h>7 P. T% _6 N- ~+ P" T9 G9 a
- #include <linux/interrupt.h>1 k, [6 I: O. P* D' Y3 D* ~( [/ `5 X
- #include <asm/io.h>
6 ]" Q( Q4 _0 ? s5 \' J5 J - #include <linux/moduleparam.h>; k) C/ n, {" e; ]/ b( p( ^4 Y
- #include <linux/sysctl.h>
! ]: V K! g& D0 A6 B/ I - #include <linux/mm.h>
! z" u9 e2 v* o8 W( j6 P( Z - #include <linux/dma-mapping.h>
" G# x8 `) j8 ~2 n0 |5 i# n - 4 i8 f) V# Z* n3 n( \
- #include <mach/memory.h>: B% @6 a& g |5 J9 K; ~& J
- #include <mach/hardware.h>
- [2 x, w: y% H' E; g - #include <mach/irqs.h>) x# ` j L7 O# |# V6 H
- #include <asm/hardware/edma.h>
' Z& x( Q7 m$ H, I g$ z
5 \! @# o Y; z2 w# f7 n) Y- #undef EDMA3_DEBUG) F: N+ ~0 x( z4 F/ ?. a
- /*#define EDMA3_DEBUG*/
9 Z f" m$ B+ B - 5 r; j. L" w2 j$ e2 }1 V$ s0 V
- #ifdef EDMA3_DEBUG# p* |! J2 \- f' p8 D9 u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ D( n7 z! P- d5 ^. n" _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' s3 b4 D% B0 w8 v; U6 u* y% s7 r; R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); \; u$ t2 X a9 s9 V
- #else
% i, @7 b, \: Y, z& y - #define DMA_PRINTK( x... ); s2 B; Q& m( V0 d/ j" L
- #define DMA_FN_IN
5 z* p1 u0 i5 w2 y/ Y ~ - #define DMA_FN_OUT
, T! A7 f2 \, s - #endif& G! S' W1 ]- ^9 ^( @3 A
- 4 f/ `) m# i% r3 T8 _2 A0 X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 S; g1 Y2 t0 f' q/ p9 W7 \+ S
- #define STATIC_SHIFT 3
0 M( j5 o) Y2 o% k8 S# U8 } - #define TCINTEN_SHIFT 20/ I9 Y5 F$ [" i9 X7 x0 J
- #define ITCINTEN_SHIFT 21, N' j( n8 [$ ?/ p) s: k# U& m
- #define TCCHEN_SHIFT 22
1 s/ w0 G+ M A! K. ~0 t- E7 @. e - #define ITCCHEN_SHIFT 23
2 w) `7 M {5 R% l U& G
5 h8 {4 _9 ^5 [8 z" a" H6 N- static volatile int irqraised1 = 0;
; c3 g9 n; |) N' j - static volatile int irqraised2 = 0;
3 Q1 T e& j; t- [6 p- X, f, M - 3 K; q: R( x8 A% ?: D( y! I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# P/ j8 @! U$ g/ [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- Y& x; J% u( c. q2 b/ g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 z( V e8 ?7 R, c% o! V - ) t9 {2 W% N, }9 O5 l
- dma_addr_t dmaphyssrc1 = 0;( n: U1 y2 F8 h
- dma_addr_t dmaphyssrc2 = 0;
; N# v8 S+ f# D3 G1 ^; ` - dma_addr_t dmaphysdest1 = 0;
* r7 e2 T9 M8 M9 f3 K - dma_addr_t dmaphysdest2 = 0;
% y$ {# ~1 _9 l$ e0 a& c' @1 s
& V, I+ c, R0 p* n" v8 U: A+ b) |- char *dmabufsrc1 = NULL; J# u1 v6 p+ k' q+ [% P
- char *dmabufsrc2 = NULL;6 V# o H7 E+ |/ _+ e* K
- char *dmabufdest1 = NULL;- i" f+ R( e; A
- char *dmabufdest2 = NULL;( Q+ d& T+ }9 C0 M* f! q" m
- 0 J3 d, j! b' G6 ]; ]: ]* g3 g
- static int acnt = 512;
' E5 G0 |, G7 V% D& a* } - static int bcnt = 8;
' H4 _ z4 A% c. ]6 s - static int ccnt = 8;% L# m& }; P R+ v5 @
( w1 f" c" ^1 Z5 r- module_param(acnt, int, S_IRUGO);
5 U8 F9 }! _; J( |! i - module_param(bcnt, int, S_IRUGO);( M+ ]3 y1 p* r6 G
- module_param(ccnt, int, S_IRUGO);
复制代码 , c( F/ d: }, A3 P' [& a
$ [& y! \) _! b, T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ f3 \6 i! r' G* H9 m6 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ d* y! w' _* O. S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* ^- }( ?+ q3 E' F8 v) A2 \& M: Q! ^( g: [0 z% O& l
3 w6 q4 x' N/ |6 C; J2 H |
|