|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 a9 z& H5 C* F E' K1 C! k. G- [code]EDMA sample test application
. A- \! q/ C) r$ N - /*
9 {' L8 W) T P$ ?* X - * edma_test.c- t- i% J8 [; n% A' }# D# v( u
- *
3 J6 y5 u. p Q- @- m- B) ^* L7 w - * brief EDMA3 Test Application% t; l1 C1 ]+ ^: v5 W& w- K
- *
* \2 V5 t3 H0 o- ~ - * This file contains EDMA3 Test code.5 Q8 ~5 T+ d; v. k3 E' O% R( z
- *
8 X) j/ Y- X% ?; N8 K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! Y6 M! g5 \$ L+ f; L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 Q( D5 O$ k8 Y6 [
- * TO CHANGE.+ O) q! u+ s9 I9 g+ F- @ ^
- *
8 y, b# ]' j9 g3 _! F* ?% n+ A2 r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 L) g9 \8 `( i, @. x$ j
- *, B* ]6 T9 Q9 Q
- * This program is free software; you can redistribute it and/or% w9 ]1 c0 b; Z% M; ], B
- * modify it under the terms of the GNU General Public License as4 ?6 G! Z# @+ x6 [# L+ o
- * published by the Free Software Foundation version 2., O. H* b- L6 J3 I3 o% R3 s
- *
+ U: k4 t5 f6 x4 d. Q, U' Y6 f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, c6 x, G- N/ U) q - * kind, whether express or implied; without even the implied warranty
5 r" k% j: z0 C$ j9 Z' M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# f$ Y, [* W3 o N" b' _2 K
- * GNU General Public License for more details.
" C, t$ S2 H; s( b4 N - */
- Z9 d# j/ j7 y9 T# c9 S( s6 e - * s" `1 A1 w! m; n( `0 ~
- #include <linux/module.h>
( X1 D. h8 M- O# H/ Q/ q _ - #include <linux/init.h>
6 ^0 O5 }9 O7 t, [$ U' [& i g4 K* I - #include <linux/errno.h>" [9 [2 V! I9 `9 s
- #include <linux/types.h>
' \* w7 U6 B% D- s( ?" X - #include <linux/interrupt.h>
9 ~; s/ x: ?2 {& `( K - #include <asm/io.h># B% @, w2 h9 x8 T& P1 `# ]! q) K1 f
- #include <linux/moduleparam.h>- F4 J- A4 ]3 p) b% K4 w; d3 ]& i
- #include <linux/sysctl.h>
( I4 l& f0 ? |$ E8 v7 Y$ A* u& R \ - #include <linux/mm.h>
! t7 n U$ e3 ?: A. B! T- w - #include <linux/dma-mapping.h>
3 ]" F; H z1 O) [+ Q
$ m l/ a1 B9 P: p4 S E& {- #include <mach/memory.h>
) @# I2 \4 f# I+ T, N- Y/ h: u - #include <mach/hardware.h>
- W. [7 @; r. B9 y) k2 O& W5 q - #include <mach/irqs.h>3 W# s4 F0 o1 O& k3 P2 O: I" }* Y
- #include <asm/hardware/edma.h>- B$ v! b8 J; K5 J- ]9 t6 m4 x9 P, F
- 6 e) K: p* Z ^5 T9 Y
- #undef EDMA3_DEBUG
; V5 V3 l" A! e( Z- R' h4 C - /*#define EDMA3_DEBUG*/6 ^: h6 `4 m( U& ~7 }8 A4 |$ S
, ]7 g1 a- H! n$ R; p( g- D! U- #ifdef EDMA3_DEBUG
" v9 ?/ A; R" T6 _/ ?5 S. s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% P( |; i$ u1 b. Q* `8 s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' A5 {, {' b/ A6 i% E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 G% P. n) T! z% b% f - #else: _2 [( p+ V; C1 \$ b9 `: ~
- #define DMA_PRINTK( x... )
. d5 I6 D* ~ ~" }& T; |8 B - #define DMA_FN_IN
9 ^3 \/ k0 G6 X9 i& e. T - #define DMA_FN_OUT6 a J" T2 h7 M) i* l9 H3 w( P
- #endif" g2 V* e) [! a
- B+ h- N% k7 z2 a( @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# |: y: r L/ f, |! y% f5 x& |5 T - #define STATIC_SHIFT 3
: p5 N; R2 ]5 J+ J3 a! I - #define TCINTEN_SHIFT 20" _; W* Y c6 V1 K/ U
- #define ITCINTEN_SHIFT 21* Y6 Q5 E, B3 x1 Y
- #define TCCHEN_SHIFT 22
" g) j9 [( V* N8 u, ?5 `' } - #define ITCCHEN_SHIFT 235 ~: i8 G) y8 o4 t# U- q
- + x7 B3 ?9 p% g! J
- static volatile int irqraised1 = 0;
. `; \% I6 L+ h( _ - static volatile int irqraised2 = 0;
( r5 N+ A! @; T0 L$ }5 c: R7 {: g - ) `6 k$ B8 h# q) Z9 l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ h" R8 U' d7 e; x( G8 O ]& k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& v; @& s- n" ~- D! o, l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 @7 d2 t5 E/ E, z
- 9 t- L. p& g2 N" Y/ W+ J1 G+ c
- dma_addr_t dmaphyssrc1 = 0;
- {2 C5 N! b, ] - dma_addr_t dmaphyssrc2 = 0;
9 F# n( L1 d' S9 V& t5 J+ P9 l8 @9 Y I5 L - dma_addr_t dmaphysdest1 = 0;
8 ~: v4 X ~0 l6 D# f$ ? - dma_addr_t dmaphysdest2 = 0;
6 K! p+ c n# d0 h - 6 J* y5 p8 @$ `
- char *dmabufsrc1 = NULL;
; _! |& w, T! c+ A' G4 [! V$ s - char *dmabufsrc2 = NULL;
8 N3 W. K/ n9 A9 {: A - char *dmabufdest1 = NULL;0 l3 i8 R# G' x {6 g5 F7 q s
- char *dmabufdest2 = NULL;
4 Y- U5 E# g/ A6 o: l
0 b6 o5 J" B u0 f' L( _, X- static int acnt = 512;
0 P' Z; p& A r) u2 @1 i - static int bcnt = 8;
( u4 e9 {+ S) R/ t - static int ccnt = 8;
3 c* _9 P1 X( i2 h8 ~% d0 b6 T - 0 R" r% t$ }% ]4 \" \/ r- k- r2 w
- module_param(acnt, int, S_IRUGO);
) L& M- E1 m1 A' m3 b$ s# s" O4 l - module_param(bcnt, int, S_IRUGO);
# [: c1 X& D' T$ i9 `% m - module_param(ccnt, int, S_IRUGO);
复制代码 9 y- ~5 _0 I9 C {' j- [- [% o
4 q7 x0 }3 ]1 P" \5 B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ B# F5 N7 V! {( [" |- qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ X( o* c7 I. o; G' F: y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: S9 }; B2 e& h/ o/ W$ ~- A. a5 ]) C
( t9 H/ v+ |% Y' \# @) q |
|