|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) l# E5 b9 y( b' x
- [code]EDMA sample test application
0 h" ^& }# Y, \( _ - /*9 F& E9 `# }& f5 ^4 z2 m* E
- * edma_test.c2 f; t) L& f! N) P
- *
* ]; {* s% {% ~" E. ?1 @% m - * brief EDMA3 Test Application) f& p' B7 Y" }8 Z$ V4 @
- *+ @9 i( U9 S# X) \7 x: K2 {9 g
- * This file contains EDMA3 Test code.( r" ]. i+ i" H a, G9 m
- *9 K6 q) z, J6 ^; y" k f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. u$ J: }. X. W. p% w% |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% H/ R) n/ a3 g! v( | - * TO CHANGE.0 p+ @! h) |) `
- *
" q( T, x6 }8 J w2 F @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 w* X9 l6 Y* q6 y; S0 r - *+ W/ h& w5 f" r. M Z1 S# v
- * This program is free software; you can redistribute it and/or. P0 o5 x0 G' V& `# X3 \: g8 Q l3 }
- * modify it under the terms of the GNU General Public License as
P' y. c# F4 f$ j) G- x9 ^ - * published by the Free Software Foundation version 2.
5 m! X' _, |+ t5 ~7 S) L- v: U+ C. h - *
" M3 N1 e' r0 A# v$ _- j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 K( d3 {. e' L+ @4 v - * kind, whether express or implied; without even the implied warranty) u H2 v' F5 U4 l/ ?9 \) W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 o" H; u9 @' }: W3 X - * GNU General Public License for more details.
6 ]7 X, `+ `/ p k0 Y* {7 { - */
# g6 ~1 o8 u p Q5 f. F
0 L m$ S$ A o, y: Q) X# m- #include <linux/module.h>) i" c- d7 W8 v% N' U
- #include <linux/init.h>
9 f. J) K# s# \" M3 f, t. X; h - #include <linux/errno.h># T- R2 q1 x8 C6 h1 n
- #include <linux/types.h>6 v b" C3 L9 A
- #include <linux/interrupt.h>
5 s* ~" e- ^) p7 \4 P - #include <asm/io.h>5 H- n H" d% I$ W% R( f3 x
- #include <linux/moduleparam.h>
$ E' R6 u8 m4 I' p - #include <linux/sysctl.h>8 e; c7 r5 n) [2 ~. h
- #include <linux/mm.h>
- `9 C; u8 a' A - #include <linux/dma-mapping.h>, p* W6 Q! i4 }
( }. y8 B% W( O/ t- #include <mach/memory.h>
: S8 Z) H1 c/ a - #include <mach/hardware.h>
8 d5 J0 t( A/ R9 t8 m% ~ - #include <mach/irqs.h>; [7 E' L( `7 @" W' ]& |
- #include <asm/hardware/edma.h>- _. n/ K) |: a3 ^% H
3 B+ H3 y' V% K4 _) g- #undef EDMA3_DEBUG
' k7 e. R* `$ J B/ |! M - /*#define EDMA3_DEBUG*/
% U4 f* U; X" @, J7 t
- i( l$ o, L# u, P5 N3 r! q- |) m* c- #ifdef EDMA3_DEBUG
( K% [: ^% D1 N2 o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), Q T7 x- Q9 Q1 N! [) p) z8 ~$ k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 K; E9 d8 z& ^# Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; J0 y* e+ P& T) Z2 I - #else$ o3 e; U7 [5 |! O7 x% b; e
- #define DMA_PRINTK( x... ) n5 |6 n# y4 F0 P5 G9 P$ B
- #define DMA_FN_IN
0 E5 L, i9 f; O- W( L' ~. X - #define DMA_FN_OUT
5 z* |3 B$ M) t3 G4 |' D - #endif+ L5 \3 F3 }2 s% m J
- ) L/ |/ i4 n3 ^* p- u' m% }% J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 `( [. Y6 X' ?9 Y2 c& }
- #define STATIC_SHIFT 3
! e4 ?6 H. |2 f/ {% [' V2 y - #define TCINTEN_SHIFT 204 D% Z) ~1 F+ E/ ~# F; }$ V( ^2 @# c7 Q
- #define ITCINTEN_SHIFT 21* d# d1 H2 S4 \ w, w; U
- #define TCCHEN_SHIFT 224 j/ _8 k& q. F
- #define ITCCHEN_SHIFT 23
# n/ e* ], r! q. R' p( i - " W K) C6 W5 Y3 ~& V
- static volatile int irqraised1 = 0;
2 A% K' w' Y# } - static volatile int irqraised2 = 0;1 J! j1 A5 z& P" f1 Z# G- ~, g W. O
8 I& X: _$ L) j# c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' C& {6 Z. e7 ^9 I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) T/ p s5 m0 u/ U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& q5 E- K" i3 o2 M - 0 q$ V* e6 y- p" a% h- e( K4 B
- dma_addr_t dmaphyssrc1 = 0;0 [& P5 ^7 }. }% r1 \- i% d
- dma_addr_t dmaphyssrc2 = 0;% ]2 V% @ G7 T% k) j7 L( B
- dma_addr_t dmaphysdest1 = 0;
2 p8 Q- [" _# }4 H8 ^" R, X - dma_addr_t dmaphysdest2 = 0;
]7 `; Y* n( X% O
4 e$ G1 w N$ `) p8 Q% i/ \2 ]0 X2 Z- char *dmabufsrc1 = NULL;3 |7 |6 [5 E2 b1 Y3 h) ~7 N4 f
- char *dmabufsrc2 = NULL;) }: K1 h- w: h* R
- char *dmabufdest1 = NULL;
* P0 J6 U4 f/ n# ^3 ] - char *dmabufdest2 = NULL;
7 F! k9 L ~6 ^/ n( p
; @& M) G2 A |" d6 w, D e7 S- i- static int acnt = 512;. H3 t1 {, e1 I. |( {. u, Y
- static int bcnt = 8;: w5 ~0 d) }3 A' R' J1 Q- g; w8 l- I
- static int ccnt = 8;
@3 P- G5 n9 g+ N% a
s9 p) J* W& ^% I- module_param(acnt, int, S_IRUGO);
' G; s/ |' z9 n" |4 p+ \; c% X - module_param(bcnt, int, S_IRUGO);* r7 N0 I8 E1 k. ^
- module_param(ccnt, int, S_IRUGO);
复制代码 " e8 D5 V# ?& [/ G9 y
8 E& d2 W" r: I: E/ u/ s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: N/ i2 W$ W) b" U0 ]" J/ a* W+ e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 X& y! s- J& y7 B$ J C5 p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" l& U& K6 z& O5 f7 |) A+ j
+ v- X, L% Z- V# H( T3 Y- @
$ @# a7 C/ w a8 Y1 r% {/ q |
|