|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : o# E, t- V) ]4 U
- [code]EDMA sample test application+ K: O: Z2 d% b
- /*/ i3 w+ d) d a, s) z d
- * edma_test.c
1 R5 m9 j0 _7 @2 V7 w - *
) N, Q# x G! k, u - * brief EDMA3 Test Application5 f( Y* t- Q" `1 M
- *) k2 b) X0 B# z0 ?% w: X
- * This file contains EDMA3 Test code.
2 {/ J4 z9 r6 H6 i2 U7 L - *5 a: J5 q( A8 J4 I" ]3 R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- c5 u% g: B/ {' S2 J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# R9 O l8 [! ~, J9 G. Z% j
- * TO CHANGE.1 d8 E' I/ Y5 W8 i Y2 I/ x. q4 N, \
- *
# k- P' n& O, Z3 V; Y8 S$ E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; Q: r7 i- E, Q8 t4 M$ {$ X - *" ^9 W+ x& N4 } T
- * This program is free software; you can redistribute it and/or2 X6 t( | T! r9 Z
- * modify it under the terms of the GNU General Public License as7 s7 z7 Z' e( O% n4 w% Z: f
- * published by the Free Software Foundation version 2.; ]# Z" c4 S- }8 \
- *6 ~" x4 q9 @* e3 w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ Q1 ~ ]+ S: Y/ w" r# a- }" V - * kind, whether express or implied; without even the implied warranty- x! q, d" t/ h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 J$ i+ j- q2 `( ?/ k% j) S3 u - * GNU General Public License for more details.2 H( {/ k9 o2 r
- */1 u6 P' R- v# j% ?6 e6 ~2 ?% D
- . e# b/ p/ d% a
- #include <linux/module.h>
- f" _4 Q Z Z. [( g) w - #include <linux/init.h>7 v2 r, d0 F ]' F& V& O" O: i( B
- #include <linux/errno.h>& v0 Q) ?+ j& Z S6 p+ B6 f
- #include <linux/types.h>' e4 e6 R+ r* G+ [
- #include <linux/interrupt.h>
' E2 N/ R2 X1 E - #include <asm/io.h>
8 m& D7 A8 C/ _! Z% `' M, p - #include <linux/moduleparam.h>
( h* _$ [& N, h% H' p* @+ m - #include <linux/sysctl.h>
% L# h8 T U6 F1 e. M4 B - #include <linux/mm.h>
* e4 ]( [2 f1 O( ^ M- L; \+ B; F0 g - #include <linux/dma-mapping.h>
" H+ M0 D l1 v# {" s4 h# I- \" z - 3 z9 P j( X( {4 D. x( o/ w% g! g
- #include <mach/memory.h># j; T$ R" G+ H. q) ~* V
- #include <mach/hardware.h> p6 {0 Z) c1 S" H F( Q* [
- #include <mach/irqs.h>
3 r- ^& V2 D) F7 w - #include <asm/hardware/edma.h>
- C1 T5 o+ Q& V: z5 ^' s) X. g
$ ? J$ Z# l; l$ {- #undef EDMA3_DEBUG
& B2 F# C: p) f1 ^6 C3 i4 ?2 Z& t - /*#define EDMA3_DEBUG*/# r) u$ w7 @3 ?! e0 O7 e0 {
' Y- g9 d* P; i6 {- `- #ifdef EDMA3_DEBUG# r( V1 K2 F% J" V2 K5 N) b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ J. }0 f) B5 U3 R! h* ~3 a( I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 K2 U4 S, R* {0 [, R2 G1 h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 k% v! x) w+ g B
- #else1 w1 J: o: P4 A! L* X
- #define DMA_PRINTK( x... )
" {/ `& F8 L* |; e - #define DMA_FN_IN
9 W; ]5 p" }, a7 L( v5 c - #define DMA_FN_OUT5 a" g# w+ G5 T2 ]0 c
- #endif
) ~5 _) B( U9 v& K" D+ ?7 \
' w$ B) z. S6 n* t/ v. G1 i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' K) V+ s/ S/ Q/ B! R* m0 |
- #define STATIC_SHIFT 3( s& r' g8 s5 e W! ^0 a# M: e
- #define TCINTEN_SHIFT 202 k6 ^0 U0 v8 c+ C
- #define ITCINTEN_SHIFT 21* e+ k1 w- m6 ]3 i c! C
- #define TCCHEN_SHIFT 22 {: ^' ~& t. k
- #define ITCCHEN_SHIFT 23$ S$ `) p6 F$ h8 g
+ `9 Z; n% |# U) T( d8 u- static volatile int irqraised1 = 0;" U( x# B% L, F
- static volatile int irqraised2 = 0;' z% y2 }/ d1 M) ~ }4 [/ _& x
) ?* k+ o! S6 u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) @1 T ^, u9 V8 ^: x g, { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 n; k% |" i- U0 ]4 D- K1 A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 |' ~6 [6 O! W3 k% Y5 H' L# Z - : }) V2 X- }# `- r3 L9 ~
- dma_addr_t dmaphyssrc1 = 0;
) S! B' s5 W8 ?1 \+ E5 _* U7 U& t - dma_addr_t dmaphyssrc2 = 0;
2 E) ^; H5 @& m* I. M# \ - dma_addr_t dmaphysdest1 = 0;- ~9 `- @2 Z* o% e
- dma_addr_t dmaphysdest2 = 0;
+ A( R& _2 O+ T: o
m [3 e) l, `& w# h, c- char *dmabufsrc1 = NULL;% f7 z0 u& W4 m0 I
- char *dmabufsrc2 = NULL;
& S% E: P: h" a' n# a" T - char *dmabufdest1 = NULL;5 Q6 V+ c- l$ { C F/ x8 N
- char *dmabufdest2 = NULL;) h2 Q+ \, j% z/ z* j V6 {
- / Z1 m+ h3 G6 J- p& X4 P
- static int acnt = 512;. O2 b1 t" b. _6 _& ?) F4 l
- static int bcnt = 8;
' e9 o e! A0 J8 f5 H1 Z n, S - static int ccnt = 8;2 ]1 p5 _! w, L" |2 e) _
- ! n C2 B- ^, }. O6 y+ @/ K
- module_param(acnt, int, S_IRUGO);
/ K7 F& P) \& O' o* g+ W. j - module_param(bcnt, int, S_IRUGO);
; K+ d) y2 V1 F' B+ ` U - module_param(ccnt, int, S_IRUGO);
复制代码 5 b9 k2 x& ^2 E
, Z; W# M. G3 ?6 ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 A' f& P. f' w5 {# r. marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 l0 T( j1 V9 `0 z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! C( b2 n5 |5 G. z7 `
9 W. f9 c. [# c7 m% r
1 x- }1 H* W" o2 j
|
|