|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & a9 z- ?: C$ Z1 ^, Q: U$ W% z
- [code]EDMA sample test application
- W2 B- c5 N& U) h6 K. p- A; C" u - /*
- \4 t4 L* i& A) k - * edma_test.c
6 s2 J6 p8 v$ N - * E3 b! x9 W1 S
- * brief EDMA3 Test Application
, l- A8 S: E+ w6 Q5 B - *# `* d- Z% ^. s" y+ A
- * This file contains EDMA3 Test code.
4 `2 |- N: l" F" v. n - *
& w* Q s# s3 L: E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 c9 _/ r' {# Q4 K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ t/ A u' i( W* j$ Q* T0 C# V7 p - * TO CHANGE.
! @. Z. x# Y# r8 {# O - *
' F9 M( K* M+ d2 | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% k6 P6 n8 W$ K
- *
c% V6 c, f) g' b# g - * This program is free software; you can redistribute it and/or3 [! x$ I2 |. ?2 O. g
- * modify it under the terms of the GNU General Public License as
* {2 [% C( r7 t; q; U8 B' D - * published by the Free Software Foundation version 2.* I& g y: A" X# S( N' q
- *
& r, s7 _ L5 \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 a+ p$ [" k2 a& m2 X
- * kind, whether express or implied; without even the implied warranty
. b* |4 m: j( B2 u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) q8 w. J+ k: z - * GNU General Public License for more details.' u0 Z2 Q7 D! Z. D1 K5 `* y
- */
. a2 F6 Z7 L8 Z6 f1 V( B$ ~
" }' ~# A0 l7 ]7 i- #include <linux/module.h>
/ a( J' l0 O! i1 Z: z" u - #include <linux/init.h>5 e* a( {) U W& R
- #include <linux/errno.h>( e0 Q2 \ b' _4 `- D3 t6 p
- #include <linux/types.h>
2 P$ s0 z7 o9 x3 z% y - #include <linux/interrupt.h>+ x; f. s7 w$ s" ]2 X6 J
- #include <asm/io.h>/ M8 K& x8 x- G& K) _2 H
- #include <linux/moduleparam.h>
/ V9 \5 x: }7 ~7 {2 j! A5 w; { - #include <linux/sysctl.h> ?# m3 h% c X
- #include <linux/mm.h>
/ k; B- ?& r- ?8 h- p) k8 Q2 N - #include <linux/dma-mapping.h>4 X4 d# g" B: @' ~ p$ Z3 |
2 T( q, ~4 o9 ~; K% t- #include <mach/memory.h>
$ _. t# h+ B+ A& h9 w1 h1 @ - #include <mach/hardware.h>
( d; N8 `+ W9 a* v2 Y: W* o - #include <mach/irqs.h>
3 ^" r2 ~; \0 H+ U - #include <asm/hardware/edma.h>
4 B( w: m3 K }( b: j - & w5 ] ~4 D! g, X u
- #undef EDMA3_DEBUG
! @8 ?9 a, f+ {7 y; u0 g6 T. | - /*#define EDMA3_DEBUG*/' v% v L; T( ?3 S
* u( _% c' D' \7 Q! N1 [* o! ?- #ifdef EDMA3_DEBUG- q& f4 {2 z3 c3 n: V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! G$ m! Q6 r2 a( z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 s4 a6 X9 H4 o- m! j0 C8 l8 R4 x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 \; S4 q' {# Z( C( w - #else
: d& ?0 J. V( ^0 `; U6 l9 C. a - #define DMA_PRINTK( x... )
& Z( Q; H& n* _: w - #define DMA_FN_IN$ h4 o8 I8 u1 j+ q
- #define DMA_FN_OUT
9 U4 k/ ~, B5 y+ H$ {5 Q: `0 M9 q - #endif5 k q0 r) s% M e/ y0 u1 O
3 @( o4 M; T- h6 l: j) Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 ] m2 w' w' C: e: T4 T0 v% @ - #define STATIC_SHIFT 34 g. J/ j2 |" R; p V
- #define TCINTEN_SHIFT 20
) U' y J, m# i - #define ITCINTEN_SHIFT 21
& r/ R; o; v% |" m# }0 ~ - #define TCCHEN_SHIFT 22
; Q4 H6 q+ Z7 w& a - #define ITCCHEN_SHIFT 23
2 t+ P7 y3 B' @7 K2 j9 t7 ] - ' E3 m' I( G- S; y a) C7 t; ]
- static volatile int irqraised1 = 0;- k: p4 H) B% C! J9 r- }
- static volatile int irqraised2 = 0;3 [1 N" B7 t0 ~4 L5 b# _$ ^
- 7 i% K( A7 I0 g b) \8 F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) G. Y: D, o, A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 T0 w: ^7 W+ n( d: ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. H9 u r# g/ a
* F, d. r" b' ^9 H3 t/ J1 t- dma_addr_t dmaphyssrc1 = 0;- e' v; @2 l/ Y* Z4 Y! u3 A
- dma_addr_t dmaphyssrc2 = 0;" K9 y5 i1 t- w. c4 X$ |
- dma_addr_t dmaphysdest1 = 0;2 J* w4 s0 y \
- dma_addr_t dmaphysdest2 = 0;
. s) R1 `( C" h0 R( ~4 y - Y! F3 m: K6 R/ C8 y: g
- char *dmabufsrc1 = NULL;. o7 }5 _% r/ U0 G) y
- char *dmabufsrc2 = NULL;! f( o+ N5 p* k5 m) m
- char *dmabufdest1 = NULL;3 H2 K0 M' H" [
- char *dmabufdest2 = NULL;
; a% _( p+ I7 U* @7 b6 o/ s. r
9 m4 x8 p6 w# w1 z, o- static int acnt = 512;
5 g, c% j' y$ S# Q: h7 U7 q - static int bcnt = 8;
6 w: [, d" b5 g6 { w# v - static int ccnt = 8;" \5 J7 O2 h. A5 k# b4 [# W7 l
- ) P. f& O0 m6 N# R* ]
- module_param(acnt, int, S_IRUGO);) K' I" k T$ V! g5 e
- module_param(bcnt, int, S_IRUGO);
: H* |" N4 f" |9 m: f3 y: t# W - module_param(ccnt, int, S_IRUGO);
复制代码 + \" G, s; O, t2 S
j. X: O1 @ ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: Y/ y1 e+ Y. U+ M: C, v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* k8 q) z4 l9 `7 u5 ^) o& J9 U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 R+ y; j, M" A- c0 F3 g
0 \; W2 P5 {3 p+ w5 P, ]3 p
3 b0 o4 a" d& s+ w! c |
|