|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* Q1 W# z* p: L! Y" b- [code]EDMA sample test application/ S0 m; O. k f' C4 h) h
- /*
( Z ^, K" g+ @ - * edma_test.c' R$ w: ]6 v) e. U' v5 \
- *
8 g9 p9 U; s1 |- g2 p4 d+ ^ - * brief EDMA3 Test Application& b7 y0 f. |6 Y. d! ?5 e! I
- *
3 G: V& \8 N) Z; G% h9 V$ z$ L, K - * This file contains EDMA3 Test code.% \& [% G9 O* H% ~6 O0 y" a
- *
6 D5 a* D: ^; f& b9 {/ K1 S" J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
\6 _ j8 B/ t( b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- N- E1 b% o, W0 b+ R+ @. G
- * TO CHANGE.( k1 l8 e0 K$ A! G+ M) A
- *
$ j U. ?0 ~3 n" U" ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: X& [" ?! [) u0 p% g - *% a& M( h8 r% s# F8 A2 n4 `
- * This program is free software; you can redistribute it and/or1 d. M0 j1 |9 }9 l) a( s5 ]
- * modify it under the terms of the GNU General Public License as
: A7 `1 ^* `3 {3 w( S - * published by the Free Software Foundation version 2.8 q5 B, E; Q. ?8 ^
- *
6 H2 Z, @: v% z( u+ @ v: O+ a( n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ ~% B$ ?, i; p
- * kind, whether express or implied; without even the implied warranty$ g0 }9 `9 Y, F$ X/ q n7 l( L N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 z2 y% T* _, w/ D+ E+ Z
- * GNU General Public License for more details.
0 i# ^. a m* ~8 {4 {0 h2 H - */+ {8 `/ V* F z/ \# T6 N* R
/ R' d0 @% N0 d3 z5 w% ]- #include <linux/module.h>& y" K' ~+ S" Y- O
- #include <linux/init.h>! q7 x0 ]* B6 F) P
- #include <linux/errno.h>+ ^5 p$ d! e* c+ @* y& ]5 F! w8 m" {
- #include <linux/types.h>
5 F2 F8 u' |( k - #include <linux/interrupt.h>
4 ^2 U) V+ p4 i( k! @ Y. H - #include <asm/io.h>
: ?; ~+ U0 v- b) Q w* B - #include <linux/moduleparam.h>
- W2 H$ _7 v# J7 y+ } - #include <linux/sysctl.h># d7 s. i' `7 A8 I( M; s1 ~" u
- #include <linux/mm.h>
; A& o; h3 h( g - #include <linux/dma-mapping.h># w1 L# h" @* _4 K# s- ~# T
" ~/ P5 M+ v0 v8 t; {- #include <mach/memory.h>
0 b; N& Y/ Q' r" m* `+ V - #include <mach/hardware.h>
- t( C6 q, q+ G! I) ]* X5 m% J - #include <mach/irqs.h>
! N5 Q }- W. a3 ]$ ^ - #include <asm/hardware/edma.h>, j# W2 r E4 b: }. q
, S6 M! L( @) ` ^- #undef EDMA3_DEBUG
3 _/ d3 k: m! F8 C/ U: n7 u# A - /*#define EDMA3_DEBUG*/: @* b1 h. c0 V, ]& L/ N% f$ S
- $ M3 u8 _+ O0 l( t; ]
- #ifdef EDMA3_DEBUG7 N/ D' X6 Y- y _: D- l- u: q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 ]) C' M9 C7 l4 D0 L2 [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 g+ e1 E" r3 v- x( N9 k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# e" M- `1 ^1 y. P) c - #else* H c) j* r5 @$ q4 U) P
- #define DMA_PRINTK( x... )
5 }8 o; i r; ]( l( u - #define DMA_FN_IN
5 b) K4 K' K# j$ |- A3 o - #define DMA_FN_OUT/ e8 X% ]: _: _, ?4 ^( X0 P* \
- #endif5 U2 h0 y Y1 ~0 Y. t
* `: [, Y7 i+ D0 l2 j/ d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, d2 p. z T' Y0 l0 u0 S" y - #define STATIC_SHIFT 36 a0 z; a; N9 f! S
- #define TCINTEN_SHIFT 20
8 x8 J! G# P1 x/ }4 U: I4 L - #define ITCINTEN_SHIFT 21
! R6 {% H0 j/ b. j4 c - #define TCCHEN_SHIFT 22
" {0 z" G) S7 a5 ?- E6 o4 G - #define ITCCHEN_SHIFT 23
2 z! I" {/ i+ q7 L1 `. v$ S- `+ p - # Q2 v3 {7 d4 b7 M
- static volatile int irqraised1 = 0;: _1 w) b+ d: n
- static volatile int irqraised2 = 0;% V4 A9 C0 [4 y- g, F
- 8 x1 z$ U2 U5 U: v3 F! |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 C6 {/ J1 S9 E/ j A Z4 e5 l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! {8 h) I6 n9 \' l4 y! J" P* ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); H9 m( t" |; H1 q( [; e2 E+ U
+ ?3 E* V5 A8 R* ~- dma_addr_t dmaphyssrc1 = 0;5 ~! h$ n- y/ }( q. v
- dma_addr_t dmaphyssrc2 = 0;
$ D9 L, z6 W) b& b$ K" A5 E1 u - dma_addr_t dmaphysdest1 = 0;- Y V: k: j% u- W/ ^, r C% j
- dma_addr_t dmaphysdest2 = 0;7 B) a2 Z0 g5 C$ S! ?* ~2 f i3 O
7 i U: _6 _( }4 n' g @. {- char *dmabufsrc1 = NULL;
; f- w0 z# [) v# M' Q2 P1 ^* P* } - char *dmabufsrc2 = NULL;
& ^. q; m% P! C! [. e3 U - char *dmabufdest1 = NULL;
- s$ {# a. v( A. w; S- Y - char *dmabufdest2 = NULL;
% Y$ |' E% [ R; S8 O; q4 ^; L
, t# ~1 N6 S' l, x- static int acnt = 512;8 } s" J. B& H
- static int bcnt = 8;4 j( A; B7 ?6 R9 q/ z4 H- _
- static int ccnt = 8;
1 g/ h1 Q8 c) K) E+ Y8 L. ^0 I
; l- X5 t( q `: t3 f- module_param(acnt, int, S_IRUGO);/ t" I: G, x$ U" _- t
- module_param(bcnt, int, S_IRUGO);, g( J" |! u) ?5 J
- module_param(ccnt, int, S_IRUGO);
复制代码
U' s% N. m: }. l8 _, S7 v5 J
+ I4 A3 [7 N" @- C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( f5 D2 s% X3 Y2 {; d Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% i1 O `6 x! i, F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 a) s" K! e/ g; P& U
5 Q0 s& M& _# S9 `) {( b
7 X8 n1 K, ?; ^+ U9 L9 x( i |
|