|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& Q) r* M7 h& w5 f0 R/ q2 T" I- [code]EDMA sample test application* f2 H: |" u6 b
- /*
& y2 A- u$ @. L: R1 |+ R - * edma_test.c" b4 k$ i' E' H$ n( a* q6 ~+ V
- ** W0 l: p% h3 ]- `. C
- * brief EDMA3 Test Application
- w3 b# a0 R( e - *, C7 i! L/ g8 Z9 o
- * This file contains EDMA3 Test code.
% a) E1 b6 s7 H1 c4 l$ m' X0 z- O/ Q - *, Y: |! B# i' {, M: _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# d7 w; e: ~! y$ E9 ?, X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 e% D, q1 T4 F! F, ]8 g
- * TO CHANGE.- \3 p: ?( }% _7 O; q; X' }4 t
- *7 U% Y" h5 N, a3 {) T2 `' g- W3 m3 e6 K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" [9 h0 H1 K& V3 i - *! u; _! Y/ J7 l/ R7 F: C
- * This program is free software; you can redistribute it and/or
& i8 c, f8 j) M" P - * modify it under the terms of the GNU General Public License as8 o' Y L& V& y" _' |' ] F
- * published by the Free Software Foundation version 2.
# F/ s$ D$ i% `# P3 B, v* D - */ h# r- _% r4 l! R* D# p! M6 c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ M7 G) V ~* s/ O: v A - * kind, whether express or implied; without even the implied warranty
; h* r9 `4 U5 S$ o k; V7 Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) [5 A) V" M" ]3 W# G5 W - * GNU General Public License for more details./ Z7 X O$ `# ?: P- P
- */
8 ^' V( k) d. K2 E - 8 E ?, o& f! T g
- #include <linux/module.h>
* I3 t1 ^. ?; H5 W& _ - #include <linux/init.h>
# D5 v) d& H5 r: B+ Q4 x - #include <linux/errno.h>5 ]4 h# C8 L0 v
- #include <linux/types.h>
1 q( Z$ n/ [& ~0 n8 ` - #include <linux/interrupt.h>: _ K7 e7 `0 u! C+ O
- #include <asm/io.h>
& ?* e: {' ~8 s' c* q - #include <linux/moduleparam.h>& {8 w, I" N% S! H5 `1 o# z# @
- #include <linux/sysctl.h>' V" @8 o. U k, S
- #include <linux/mm.h>& n f% G8 m+ i" I6 q: H
- #include <linux/dma-mapping.h># q n7 U& l; E4 L7 K$ @7 I
- 0 A0 ~$ E& e0 L; V$ `3 F
- #include <mach/memory.h>& k. w% Y: ]; q. S, f; r
- #include <mach/hardware.h>
. u6 w2 Y, R, e5 x7 d9 b - #include <mach/irqs.h>
: q+ P/ D/ V, I5 N! m/ Y2 ` - #include <asm/hardware/edma.h>, }/ `9 s3 O2 F# J
4 y5 \1 f1 V+ k; F- #undef EDMA3_DEBUG
: F* ~& q+ y- V/ h0 f - /*#define EDMA3_DEBUG*/1 ^5 d: O( i$ q) A* h6 g- h5 o
( Z, }4 V& q, L9 P- #ifdef EDMA3_DEBUG
8 J, B% N1 ^* X0 T' p0 b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* }1 b2 i& K5 x; k" S. `- U# m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* H: G: D8 I: {/ [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 R7 v- d1 J: h% L$ q - #else) _3 N' ]# A, D+ j4 Z/ g
- #define DMA_PRINTK( x... )
/ ]6 b( _% @/ E$ D, @7 W! K1 J - #define DMA_FN_IN* B e' P* Z& b1 R
- #define DMA_FN_OUT6 H7 t: i/ N M1 n
- #endif) A* c/ L x* I0 z* |2 M o
8 {) ~* [5 a& D- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" `* T0 ]1 z( {1 `9 c& {
- #define STATIC_SHIFT 3- v* u2 E. o$ S
- #define TCINTEN_SHIFT 20+ t/ Z! f+ b0 K' X6 U
- #define ITCINTEN_SHIFT 21/ \6 W; k9 Z9 S; ^1 Y
- #define TCCHEN_SHIFT 220 R0 o# U9 b# R7 V: O
- #define ITCCHEN_SHIFT 23
/ c) Y8 G1 ~+ r7 @" s7 Q5 G
# m3 P! Q& Q- ?- Z3 a- static volatile int irqraised1 = 0;
) C' Q( N L5 W# ?" [ - static volatile int irqraised2 = 0; s6 ]8 O" N3 `" V5 v
- 5 F2 @& x/ p8 y" h! W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 E; T% e- @9 ?1 m- X9 x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 j9 k% |+ D- z0 A8 m0 h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" X# |& r; n9 ^/ V: c
I. M) a& X8 d8 @+ {- dma_addr_t dmaphyssrc1 = 0;, c# p4 m( Q$ C6 q& k+ O
- dma_addr_t dmaphyssrc2 = 0;
8 ~* v& V, o! H$ d/ a8 z! E - dma_addr_t dmaphysdest1 = 0;
. k' `; d- b$ T/ }0 I" W - dma_addr_t dmaphysdest2 = 0;
2 x3 M8 |/ z* \# i6 L
* ?1 H0 E$ \ F; a- char *dmabufsrc1 = NULL; ^' V! _2 c" o& A
- char *dmabufsrc2 = NULL;
$ f+ } j4 G& n3 c - char *dmabufdest1 = NULL;
4 y% }5 u1 o# D" ` - char *dmabufdest2 = NULL;- [, `0 h( K+ z1 ]
$ Q0 Y- @5 e4 E$ H( A- static int acnt = 512;
2 z n5 G% i6 [5 P- B - static int bcnt = 8;" U+ a" ~* }+ Z& B' @
- static int ccnt = 8;
$ u6 M0 M) w0 w4 i, t - 2 v! c( R. k' f3 n; n2 e
- module_param(acnt, int, S_IRUGO);
( V0 B! G; l( Y% y - module_param(bcnt, int, S_IRUGO);
, `( @* }0 z$ T% D+ k: _. @7 r - module_param(ccnt, int, S_IRUGO);
复制代码 * I) N- C' V2 U! U# ]3 I, T
], e$ R7 M8 X' [& g' C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 F# R) @7 x( D/ h2 }2 \& u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- L, y2 |3 @# F. U# t9 _: _* D A& C# W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! L. ^5 D8 ?/ p( M
* w' V5 ~) R, ?8 m
; n) `; G2 X4 L |
|