|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 O# a7 y8 D" G: G: U- [code]EDMA sample test application( t4 v- [' L5 I" G/ h
- /*
; v9 C1 ~) ?; t- m - * edma_test.c
) L( `( i4 v y) X$ @" p - *3 A, H E& r3 r `
- * brief EDMA3 Test Application' m$ x0 E& Q0 k
- *# W7 P9 [: U7 |/ _, Q c; W. m8 |
- * This file contains EDMA3 Test code.5 [( f( a3 Y+ d, N, {( D. e
- *
7 Z; i$ k" H+ g1 M& z8 |: T3 [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ j5 [: H1 R, k" @+ ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' D+ S# {; b, A) ^( a t3 n - * TO CHANGE.
5 F# x7 z3 N( P7 c- a! V: N& j0 W, q - *" a, ]- D1 u4 U5 D+ n0 P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# J0 K6 @5 a7 R/ U
- *- O6 g/ h4 c; Q3 ]3 l2 Y
- * This program is free software; you can redistribute it and/or
5 p) k* r6 l2 o# ] - * modify it under the terms of the GNU General Public License as
1 c- D8 R0 f8 \, C# b - * published by the Free Software Foundation version 2.
% g+ `" Q1 `3 _ h% ^7 u - *; U! d2 F1 w, E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 R# R$ z; `9 I& l8 [( b: S - * kind, whether express or implied; without even the implied warranty/ l3 W; M) x( z6 s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ N& n) T3 b- j8 W2 u; _0 v% i
- * GNU General Public License for more details.
( q" L0 Y9 ?! E9 S: H0 m" l - */
& l' y9 w5 J$ y- G3 d - 9 w0 m7 n$ `! R* k# k0 w& b2 l
- #include <linux/module.h>; m5 z1 w0 _7 a$ ^9 f2 @# ~7 d
- #include <linux/init.h>
. m, O# g. @& `. o: ~0 P! X$ r - #include <linux/errno.h>
( Y+ Z& n J- y; T+ u - #include <linux/types.h>' i* e8 n3 |( n
- #include <linux/interrupt.h>
8 N9 A: S# s. I4 Q) F$ E' X - #include <asm/io.h>: f* O" K U6 n( `2 g
- #include <linux/moduleparam.h>
' @) n" G: c4 R7 C( B - #include <linux/sysctl.h>
& F5 e; I& t* V2 p1 }0 \6 e! | - #include <linux/mm.h>
% }- ~; J0 ^1 k/ _/ f1 Z- t - #include <linux/dma-mapping.h>
# F* C5 Y# A) F( B: n2 d h% H
. d" `7 r. v8 _- #include <mach/memory.h>
) ~' p6 {0 m7 D$ s - #include <mach/hardware.h>
) T% G9 Z! ]% M( w' I1 D) d; l - #include <mach/irqs.h>
& I6 R8 o+ N( _: n - #include <asm/hardware/edma.h>
/ O$ d. I7 f9 [: n0 ~ - ( V2 H9 ^; b# T+ ~ i% L3 ^
- #undef EDMA3_DEBUG
) P0 W0 g" p% t/ [ - /*#define EDMA3_DEBUG*/
3 `+ l/ ^6 |3 Y7 Z2 E2 ^, F
! U) A5 D4 J3 w$ S- #ifdef EDMA3_DEBUG5 D, ?% u0 L! \3 a0 ]# @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# G5 E/ f- D& X) ]. c8 s: h: R - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 o) b: r5 h* C0 L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 I: m0 R% a0 F3 S P4 g
- #else
; Z' \) V5 t2 M) ?. c - #define DMA_PRINTK( x... )9 s2 Y6 t. B2 c1 I) k0 B
- #define DMA_FN_IN
; j, F$ u3 t, \5 h0 r9 P - #define DMA_FN_OUT
: E% K; I& Z" l, A& H1 ? - #endif
0 q! k: m8 @# l$ d" @) l) D - 1 u. x" C6 Z y3 ~ q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ ?* K% J! I( h - #define STATIC_SHIFT 3+ ]2 d o, [& A% c
- #define TCINTEN_SHIFT 209 \4 O2 { G2 Z* B. G
- #define ITCINTEN_SHIFT 21( i s% U1 o7 z
- #define TCCHEN_SHIFT 22
" E, o& \9 I: s: w% C( u; f* j* o- x2 S - #define ITCCHEN_SHIFT 23* ~; q- C5 j) |9 b( {
- 8 F* a' o0 Q6 n2 X9 o+ ?
- static volatile int irqraised1 = 0;4 U& p2 h& [& b& B( ^
- static volatile int irqraised2 = 0;
1 K; y8 ~( I1 N& @7 D
* @4 W4 ~! c6 Y. R2 j) ~4 A' |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ]; g2 W6 X8 P' W* a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 c+ F8 U$ M& f: [( w! f: ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 v" j% d" ?) e& O; a4 T
+ A" D/ }* H" d! e& P9 k- dma_addr_t dmaphyssrc1 = 0;1 F3 d7 P. C5 V1 A/ M1 _
- dma_addr_t dmaphyssrc2 = 0;, X2 h! {" Z- B O( E# `
- dma_addr_t dmaphysdest1 = 0;! d1 w! D: c& W4 j, D
- dma_addr_t dmaphysdest2 = 0;
/ j8 \! o6 t$ n( `& } - 6 q- B: j2 J8 M, V: q
- char *dmabufsrc1 = NULL;, G( T% S3 z- K" \$ L/ x
- char *dmabufsrc2 = NULL;
# b& l c+ m( a: { - char *dmabufdest1 = NULL;# ^: R+ g& I& |% T2 z0 s
- char *dmabufdest2 = NULL;1 d e% P) Z0 C
% F7 y% ~ ]8 e; R" p( X- static int acnt = 512;
$ f( V _3 Z2 E- t! V2 [ - static int bcnt = 8;4 \% m# Z' Q. x0 s* F5 P( `
- static int ccnt = 8;
4 g& n& n( a: H/ { - & x! l9 V( h/ V! S
- module_param(acnt, int, S_IRUGO);
! e' s1 d) Q& x! T - module_param(bcnt, int, S_IRUGO);' h4 ?" s4 O0 e e
- module_param(ccnt, int, S_IRUGO);
复制代码 & }- r* B# ^# \# c8 q
! v. o( H, t |- ]' F, ^% L0 [9 B, b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 | N% w; V& [" r8 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, U k' l" q8 D! `( Q. ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 F( O! @% C/ h* }/ b0 }
" J6 _: r( g6 A$ e
' c1 s" n! D. p5 @, E6 h: r. t0 ~+ E |
|