|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 p6 L( X4 c1 \8 `- F1 z' v
- [code]EDMA sample test application4 d+ Y6 e! ]- d5 A9 v8 ?; t
- /*9 L v& _( ] `
- * edma_test.c6 J! A3 X7 I, y8 v
- *1 I$ Q6 Z, p0 w' j p1 [
- * brief EDMA3 Test Application
% F' x4 U3 h6 X( W0 p( D3 d - *
% C) Z! y6 f8 W3 L; ?0 c5 G% Y! d - * This file contains EDMA3 Test code.
' y/ D* \1 t9 K/ r! n3 L - *
! O0 t. N. B. |7 J9 |! N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 d4 S I7 R7 _% m; m% H/ x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- o8 ?2 _! M" {* Z8 G+ F4 q
- * TO CHANGE.
; _( u% ^1 q9 p& @7 ^ - *
# K/ _4 S% ~. K2 G3 d/ n: b# j2 d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- E& u4 x+ a" D7 X+ p' s
- *
; _% P/ Z3 g( U; Y3 S - * This program is free software; you can redistribute it and/or
$ ^2 @: H R1 l3 y: x* n: s - * modify it under the terms of the GNU General Public License as* V, g L% b* J: L% R8 u
- * published by the Free Software Foundation version 2.
. _ z* K* V8 k2 F - *3 ^! o, k% f8 L6 ]- G6 f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 }0 F1 B. c2 o/ g7 q9 @5 _( c - * kind, whether express or implied; without even the implied warranty" N0 P8 g2 i. D# ] k2 V6 I! k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! t# w* Z$ d9 d- J6 d: r Y
- * GNU General Public License for more details.& G" b" d9 V1 X/ W1 ?
- */
+ i4 d% u$ E4 J+ R6 S: `1 o3 [ - , X8 S. Q( t$ L2 ]/ j
- #include <linux/module.h> t# S' W4 K E% H
- #include <linux/init.h>$ N' H* T% l- N4 ]2 U& }5 D }
- #include <linux/errno.h>; y" u3 v5 s8 o+ c
- #include <linux/types.h>
. }' V3 Z, }+ h- U& `0 W0 W' m - #include <linux/interrupt.h>
3 O( W& x, {6 A) m$ n# p - #include <asm/io.h>
9 D. g1 c c) A I0 L - #include <linux/moduleparam.h>
8 W) l, w1 x6 }. j9 ?9 S- c - #include <linux/sysctl.h>
, g; G+ }* {, } - #include <linux/mm.h>
8 T' c& A" h" r3 T) z+ V8 K - #include <linux/dma-mapping.h>5 t l8 L3 H$ P8 e! i. M& C% P5 V
- ( h4 T3 ]" f/ E6 Q6 |
- #include <mach/memory.h>
' S* o# n% L9 W/ q - #include <mach/hardware.h>
1 F* G. G0 c. S# e, H - #include <mach/irqs.h>
+ c: i1 L0 ?7 z* ^9 ~* F - #include <asm/hardware/edma.h>
- L* {, C7 Y- s, I% c - - {' |2 g8 y* d- ~7 R8 B
- #undef EDMA3_DEBUG! `: @7 t% c3 p% T
- /*#define EDMA3_DEBUG*/
1 ?0 A, a% L- ~0 y5 W0 J/ ~6 M4 v - # ^5 j. L- f8 y
- #ifdef EDMA3_DEBUG
. @5 [4 }' a- Z T- K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) i5 b7 O; D1 W+ i' G5 W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ \" n0 d' L/ k- _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 \0 _$ Z" R2 Z. P - #else: _3 A5 S6 n& { s7 O: U; t+ H
- #define DMA_PRINTK( x... )$ i# u% D6 A: c( X( q4 Q5 o; z
- #define DMA_FN_IN
' L: R# y& |0 D u2 N - #define DMA_FN_OUT- ~' x2 V$ c- [- D
- #endif
1 {+ {5 ~4 a, T/ h ?# ]8 J
: c9 O ~2 {7 n" l: A; J! C. w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# E# T- G9 Q; Z# R; m
- #define STATIC_SHIFT 3
: v9 Z) T" Z, a% Q+ z' I8 i - #define TCINTEN_SHIFT 20# Z) I4 L# T2 h$ M1 M
- #define ITCINTEN_SHIFT 21
+ [ S% o7 `1 ]: ] - #define TCCHEN_SHIFT 222 k% D- u" D b, |* p
- #define ITCCHEN_SHIFT 23
% |! l5 e4 n5 x9 b: g8 H
# [& \! ^( U6 P6 i6 {' l- static volatile int irqraised1 = 0;: g% V8 ^; M" C* R/ I! T; a
- static volatile int irqraised2 = 0;/ ?- O6 |/ N' E! B2 f K
- ; K1 n" \& m C) d+ @- ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* i' X& }. Y% t' k$ `" |0 |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); x" O1 h7 G) A5 H; k8 _& C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); F$ f; r8 Z1 j$ r( n i
. l) E- J0 V1 P2 p- dma_addr_t dmaphyssrc1 = 0;
1 ^0 O9 u& n% @ - dma_addr_t dmaphyssrc2 = 0;1 `' M2 @! }& X5 d
- dma_addr_t dmaphysdest1 = 0;
$ k3 {! U+ E. R$ N - dma_addr_t dmaphysdest2 = 0;
. t8 Y$ \3 S: i5 @4 u- q$ w
1 U: Y1 N. @* P3 a- char *dmabufsrc1 = NULL;4 Z/ p$ I, {3 M: F6 ^
- char *dmabufsrc2 = NULL;, x! `' @5 V. N. T
- char *dmabufdest1 = NULL;
/ C1 ^$ L& z# p2 @) u: G& M+ B: n: A - char *dmabufdest2 = NULL;
, X" d* A" k2 X _& d9 h
; K$ ` H* w1 N4 O- static int acnt = 512;% b9 P3 D9 G& l e. e, u' x
- static int bcnt = 8;
' J5 G0 F8 K" G" z" l9 E" R+ z - static int ccnt = 8;% R. L _& ^" k( P. K
- ; V/ M) w+ I4 h9 A' }# N1 _
- module_param(acnt, int, S_IRUGO);
* a0 f3 F5 J5 _8 f- t3 q+ S - module_param(bcnt, int, S_IRUGO);
/ E9 u9 z- m' i, g4 d$ T - module_param(ccnt, int, S_IRUGO);
复制代码 1 N b9 E+ X2 }+ Z) z
: G0 P* v' y- F% f5 M7 w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 p F H9 J n" carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
J Q2 L4 g9 X% X6 _ E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) b/ [1 [: N% x2 a8 @7 V( M6 h
7 x+ U3 ?$ U* T
' _. b# f. K( [9 W" T |
|