|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 V7 @2 i1 K( I, j8 I- [code]EDMA sample test application
% J' n8 [( n9 K" @ - /*7 o$ X$ P$ R1 T: A' } R: q7 @
- * edma_test.c1 f- p& d) R: R. |/ W1 S2 `
- *1 I/ S, f! _( W$ M9 P0 H: E& t# g
- * brief EDMA3 Test Application
. R5 w; d9 `6 H" }6 _! |& X' N; ?0 D - *
/ l! x% p A" `3 x G - * This file contains EDMA3 Test code.
( X. a' b' G3 _4 A/ i; a& } - *
9 o) G) ^3 R; O0 o6 I' M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; w- M0 ^( {* H, u% ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ s$ z# S8 D- L) e& @, ~" B
- * TO CHANGE.
, F! P; O% R: i! C W }2 R - *9 w' F$ A {2 J& a) g& K% `/ _$ h7 L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' {1 x, J' |0 R: v% e! _
- *) r+ W; R" S% ?: ?0 q
- * This program is free software; you can redistribute it and/or$ Y1 e" y0 H1 Z: b! k4 a. b
- * modify it under the terms of the GNU General Public License as
* a9 F) E5 y$ u K) o - * published by the Free Software Foundation version 2.* e9 }; P: j& V" w, J2 R
- *9 F! l8 f/ {8 }: }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ m9 ]/ q' G- d - * kind, whether express or implied; without even the implied warranty
9 _. p: F! @, S" } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 s G5 c4 J7 d5 z9 v
- * GNU General Public License for more details.
9 R( x7 S1 w1 s - */
. V# E m& d) ?
' ]# ~3 n# q" {; g! k* }" N- #include <linux/module.h>3 ?4 y( m+ C. ?1 F* v- M
- #include <linux/init.h>
, G0 I& d- {; a% ~! J4 d - #include <linux/errno.h>
; t7 B9 N; h( A1 t% S$ b6 k - #include <linux/types.h>- D1 w9 e, s! @4 t4 _" M/ A4 k
- #include <linux/interrupt.h>
# l/ a. r# k- W; X - #include <asm/io.h>
. C( z* a8 f! v f- S0 r - #include <linux/moduleparam.h>: s& Q* o# J3 f
- #include <linux/sysctl.h>6 B% B: _( \" G: L8 o
- #include <linux/mm.h>
* a5 _ Y) a# T1 F: J+ @0 q - #include <linux/dma-mapping.h>
: e3 j0 t( `3 r, P& [% {
7 Y4 O% f, f3 S6 m% r- n% v- #include <mach/memory.h>9 E5 n) u+ G" M2 i
- #include <mach/hardware.h>( c- t& c( D0 C/ V6 c; q" J
- #include <mach/irqs.h>
+ L* k. E1 L; J) K - #include <asm/hardware/edma.h> |. u/ {' I( B C* Q+ t
- / G5 f+ U$ J, d3 L
- #undef EDMA3_DEBUG( d" `# S5 v8 Y# A+ G
- /*#define EDMA3_DEBUG*/: _; n0 a+ ?+ s
% o( A( ?4 ]% w% j+ b: F- #ifdef EDMA3_DEBUG
; y- R- g3 v4 v$ e& l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 [ `$ r2 r+ l! [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" j5 O: k7 j( z1 h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): w( C: y: E% M& r
- #else
4 M6 E, w& g: n - #define DMA_PRINTK( x... )- `' C: K* {: p
- #define DMA_FN_IN( R- h/ n, I# w, U9 f w, ~! @/ n
- #define DMA_FN_OUT
5 _6 J% S. \! t+ s# q" A1 i3 S+ v - #endif
$ L7 B% y, i% |* k; w
' F! O2 {' @' E; O6 b- #define MAX_DMA_TRANSFER_IN_BYTES (32768) {5 W+ y+ S& F0 H, p7 V$ W3 h
- #define STATIC_SHIFT 3
% C0 V7 q! P9 x& X* _" F - #define TCINTEN_SHIFT 205 i5 v: C3 X- M' h$ c1 K
- #define ITCINTEN_SHIFT 21
4 M, y6 y$ c* H0 d - #define TCCHEN_SHIFT 22
* |. |# [' H$ K6 g; K2 Q0 M5 K5 e - #define ITCCHEN_SHIFT 23; _9 x, r: `4 C9 I; n
- + q( o. R' Q' }# L
- static volatile int irqraised1 = 0;
1 N+ W+ }- T1 b. P: O) K9 v* M - static volatile int irqraised2 = 0;+ v) W7 `/ R6 v( ]
( B+ b1 c) Z) a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" H+ r$ Z0 @0 a, h8 g) t; u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! D5 z. {: h) }0 {( p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# J$ G6 Y) ]/ P& P: W/ k! M
- ) H, w1 [. g) `7 D6 S: k% F, k
- dma_addr_t dmaphyssrc1 = 0;
2 _. u7 P& G0 U# {' _/ K - dma_addr_t dmaphyssrc2 = 0;, L3 w8 t g) L6 s
- dma_addr_t dmaphysdest1 = 0;
/ @8 U3 p3 ]" }- |+ v - dma_addr_t dmaphysdest2 = 0;1 L- G6 F* x5 [: ^
6 G5 ^+ u9 G. N- T- char *dmabufsrc1 = NULL;
7 m8 F/ q5 `6 t - char *dmabufsrc2 = NULL;
$ U0 j0 ~ P& p* o. K. Q - char *dmabufdest1 = NULL;
. q7 [ ~! z; p. s `; U" { - char *dmabufdest2 = NULL;2 b* M: v7 d/ ~* D
- $ H( z$ D7 u( r) |( s
- static int acnt = 512;" x0 ~2 G h* H; \0 A
- static int bcnt = 8;3 }& Z, P$ c9 ?/ \$ b8 C
- static int ccnt = 8;
1 k$ `: t2 b9 }+ x0 {* X' F
" q' h5 `( [5 w& x- module_param(acnt, int, S_IRUGO);
& g" T3 D; S4 E$ A - module_param(bcnt, int, S_IRUGO);5 H7 w* f4 h% g' D; F% a
- module_param(ccnt, int, S_IRUGO);
复制代码 6 j* ?# [0 p2 r5 Q7 }
' A& i# I; f# E& c- G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ @& K0 o, N$ [3 G, F7 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! l8 j5 j7 Z, A( c" X% d& m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! ? d; w+ P* M* u8 G8 J; o7 [* y( K: ~3 D
( p4 N ]9 k7 m/ b
|
|