|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 j: c$ H3 {7 b$ m: W- ^* \1 t
- [code]EDMA sample test application
( ~7 J" M; W- U( y7 t5 ~- [$ S - /*/ L& ~1 L* u" r- u6 `- _
- * edma_test.c8 C) `) z; E8 a
- *. p8 k6 ^& u( N4 d4 X
- * brief EDMA3 Test Application
4 j8 p. y3 p9 Q$ G9 O- ?* c( E - *! y G7 R: l% ~# {# C
- * This file contains EDMA3 Test code.5 A5 B6 z2 D, I) O$ q
- *
& |+ G3 S3 K2 [" `3 } w4 S7 l+ Z# W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 ~# ]5 v4 r( x+ U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 t$ ~5 T% E x! V4 ^+ @+ [ - * TO CHANGE.
8 k# g5 i4 J7 j" j; E - *
3 m5 {$ O8 C3 E/ k" b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( ]+ D# Q; j, e ~( M5 z, |. ^ - *! n3 e+ A) e9 j7 O1 v
- * This program is free software; you can redistribute it and/or
, i0 B5 o" |1 X6 c- Y6 \- L - * modify it under the terms of the GNU General Public License as
; l6 Q$ i {/ R' O! x3 d - * published by the Free Software Foundation version 2.# k4 l1 _! \! v3 [* A
- *
" E( |0 d9 v# H; { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ M& T) |7 Y9 @8 ?; W/ Q! ^; H
- * kind, whether express or implied; without even the implied warranty( B8 ]5 t x) e# s6 }3 L/ @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ T( @/ X; K, Y( X - * GNU General Public License for more details." d, g& ?/ e$ ] t7 e2 k/ ~
- */9 M# }7 @+ k- t- F
1 [& {" y% c5 A8 R5 N" p& [- #include <linux/module.h>1 y% I6 _9 M" z7 L+ J. y+ S5 n
- #include <linux/init.h>7 ]/ B" b W% Z% u& V1 z
- #include <linux/errno.h>* `6 ~9 ^2 Y/ e4 K5 P
- #include <linux/types.h>& g! R+ h) k2 Q6 m8 R0 M. t
- #include <linux/interrupt.h>
# @/ _8 o7 G* |1 P! Y0 B - #include <asm/io.h>
i5 n r7 c2 H( r8 v - #include <linux/moduleparam.h>
. q$ Z$ ~) s* e9 ?# ?! b& a7 ] - #include <linux/sysctl.h>
4 g! G8 Z' _! J' p! c1 |3 B" R, Q4 v1 h - #include <linux/mm.h>2 H) ?" `' B6 V# Q
- #include <linux/dma-mapping.h>
& z% ~- F7 M, {' f/ B - $ j l% b8 O0 m) _. j, U( v
- #include <mach/memory.h>
' k& M, @$ c* |) o# N - #include <mach/hardware.h>8 ~; b/ V& N* ~% t& v
- #include <mach/irqs.h>
2 ]- A3 P& s5 d! ~/ R% K ] - #include <asm/hardware/edma.h>3 R- i8 g- K+ J) E$ k* d
- 8 k( _. g' ?0 _; p
- #undef EDMA3_DEBUG
$ c" b j- B1 i7 {% S5 t9 p - /*#define EDMA3_DEBUG*/- G U# ?* D% Z6 `* ^
- + \8 H/ k0 L2 Y; w' y9 P+ j
- #ifdef EDMA3_DEBUG
; ?; U# x, K9 V1 ^* D1 g1 _8 w/ |3 ~+ k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 m+ [0 }! z: ]9 j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). ~8 A* J5 w. ]) l, ^. B1 V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 Y" `: r+ ]( v. ]. ~ - #else. U& }! p4 c" q5 C& p r( E
- #define DMA_PRINTK( x... )
- u3 e' @# F9 G - #define DMA_FN_IN
# \% [' c* g; K) e, U% M - #define DMA_FN_OUT
3 F$ _3 T/ w3 u) p9 D9 } - #endif
4 q0 o/ d$ s" |# D5 F7 R7 \
0 o3 _: f$ X. G) [( F: B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! y2 Z4 s# Y# S x- B- j [
- #define STATIC_SHIFT 3
- w% p$ z3 F6 A) g2 ? - #define TCINTEN_SHIFT 20# _" u7 a! G V
- #define ITCINTEN_SHIFT 214 q, S( y% { d R
- #define TCCHEN_SHIFT 22$ e) U; Q- f8 P9 ]- g
- #define ITCCHEN_SHIFT 23( y, `1 @0 O7 ? W& S- e
- $ w% Q6 Z2 @5 B# Z5 ^. C
- static volatile int irqraised1 = 0;
! o2 U: [" M, T9 R! i" |2 y - static volatile int irqraised2 = 0;6 _. U+ u( q. N' n
- R3 `, O" M7 p; u6 b$ Y6 [/ L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* q' y3 N, v, Q6 w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 r# F2 r( {5 C* [+ ?6 h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" u8 E& F* k. Y& z7 T, O
- ; j# m5 w+ U2 J- ~! Y- Y
- dma_addr_t dmaphyssrc1 = 0;: x- W/ ?" ~* }* j, r
- dma_addr_t dmaphyssrc2 = 0;( u/ i( N7 Q% \* Z& `0 Y
- dma_addr_t dmaphysdest1 = 0;
* L! Q$ D* a# t9 I* ]; M* I - dma_addr_t dmaphysdest2 = 0;/ S& ^& Y+ Z d) f) l" s
- 9 a) h3 [% ~0 N* V; i) Z6 R" e+ b
- char *dmabufsrc1 = NULL;5 ?& y. V' D4 c; ]7 m0 f% ^
- char *dmabufsrc2 = NULL;
, |) \0 }7 o% I. E' v; ^( t - char *dmabufdest1 = NULL;
) y" A# }3 I4 c0 y! n8 ] - char *dmabufdest2 = NULL;7 E' O: {8 q: x
) y8 o% j6 L0 r% z2 l: O* F. T3 z- static int acnt = 512;
3 [0 K$ _9 G0 f. F - static int bcnt = 8;
9 s3 s: g5 L* d* H6 T) I; X* f( v+ } - static int ccnt = 8;7 [; N' d; N8 y0 S! q
5 w* H2 [8 ~2 b& \- module_param(acnt, int, S_IRUGO);
5 A6 M: l. G. q$ r. ]# a5 m, E+ b - module_param(bcnt, int, S_IRUGO);
6 Q# P: _) {! _' C8 X - module_param(ccnt, int, S_IRUGO);
复制代码
% d1 a- [1 O# W2 P$ `
: ]( u1 T6 |2 o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& A+ d4 M4 c- E- h" S* xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% i# y' M8 }2 d5 a: R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 z- m& \4 B" [! b
5 J8 N" K$ j) E; S* n7 }7 y1 f5 w5 H2 G
|
|