|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. k4 z* y( z$ g% }+ m- [code]EDMA sample test application0 T+ E# | m- S3 {
- /*
& X( p3 _ b6 C- M# [' b9 c - * edma_test.c+ M4 R7 X" y% O: Y T. Z* P2 q
- *
( N( y; j, ^5 c5 B( e) S - * brief EDMA3 Test Application
/ Y/ l/ u5 Q' s; W4 _! {( T - *
. n) A: h# C* r4 a5 t5 O - * This file contains EDMA3 Test code.
8 d7 P! b; c4 ?$ X3 ~4 [% a6 ] - *$ L& w* z# t& O# T+ z- k5 Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( I6 u: \$ q1 N2 }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% D- l1 J0 S7 \8 J( Z - * TO CHANGE.! z" ~& m L: i6 ^3 H [# C; e) f( }
- *
$ a+ i+ `1 k M& C h: @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: D0 Y u' _1 e/ y$ l
- *, v l) _4 z# C0 _2 o% H
- * This program is free software; you can redistribute it and/or
( y. v, W; j* F( k+ d9 Y% {- C - * modify it under the terms of the GNU General Public License as
# D/ C& m7 u$ J' k# H% l - * published by the Free Software Foundation version 2./ ~/ ^6 z9 h4 [ h5 D* z- s
- *4 b: U& p. K! m8 v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- K: m2 d! x0 m, M i - * kind, whether express or implied; without even the implied warranty
2 S- U- I& c* W3 t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 `& V& @* u% s. M2 ?) M - * GNU General Public License for more details., ]1 L+ x3 X9 ^1 b: B
- */7 N* t+ s$ ?: w4 x) o# W& W. E
" P% C( l/ j% [$ }3 }4 S% W- #include <linux/module.h>
1 H) z/ c2 H" K8 z3 L) F" }1 s - #include <linux/init.h>. o: X W8 I3 H6 F0 Z& |# K
- #include <linux/errno.h>6 g$ s1 e5 Q9 l4 v( N
- #include <linux/types.h>
4 X ]( ^' n4 i4 r1 _* d; G) \ - #include <linux/interrupt.h>
5 S" X" ]+ o* `) G2 k* d - #include <asm/io.h>
( J5 n8 v/ G9 | E, Y - #include <linux/moduleparam.h>) f2 w& O7 G5 m: G: j
- #include <linux/sysctl.h>
" j! N) \( y% E - #include <linux/mm.h>, e5 ^; }2 ~- c3 ~. R
- #include <linux/dma-mapping.h>
& W2 P$ G# W( J" Z2 J1 c - - M( a1 n- q( L Q6 b
- #include <mach/memory.h>
$ M1 ?. [& F1 p! q8 t& D. } - #include <mach/hardware.h>1 h0 A8 F0 {0 C
- #include <mach/irqs.h>
3 l5 d( f1 v- r9 m0 P9 Q7 a6 T - #include <asm/hardware/edma.h>; F( U. m, Q5 M" @6 K6 V
1 o2 P% y. Y9 j; ~; R- #undef EDMA3_DEBUG
3 c" {5 g- d% D% F { u - /*#define EDMA3_DEBUG*/
& d6 A* c9 S8 c3 {/ V7 x8 y7 H
1 E$ F8 \" [- }% \- #ifdef EDMA3_DEBUG7 Q4 D, I$ R9 _2 ^( a7 e3 m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 w3 a' B; q# X# A9 s: L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 i* k2 N/ T* E" g% A6 P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% u: r6 t$ Z' h3 K v. R - #else
' ~ F- e9 z. z - #define DMA_PRINTK( x... )
) Q8 c+ b8 |6 S5 y8 T! f/ T8 Q - #define DMA_FN_IN
; P6 \9 M& c0 u7 [& K - #define DMA_FN_OUT! `, J- H1 p6 C/ D6 @6 N/ e8 k+ f
- #endif* Y2 q3 {$ T3 a) x& y( {4 Y8 _
1 q1 E' l8 J* Z/ ^* m' X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) H7 [" A: S; o1 A5 q5 X- Y5 [# v
- #define STATIC_SHIFT 3
- ~, [/ ~1 c4 W - #define TCINTEN_SHIFT 20: l# Q" L! w0 W$ s; o3 Z( @
- #define ITCINTEN_SHIFT 210 K, b' \# \+ [& P; [' w2 R+ y
- #define TCCHEN_SHIFT 22
& i9 p: B% d! p: n" L4 b; A - #define ITCCHEN_SHIFT 23. k+ \/ x8 z4 P J- |4 {& M# U
2 X0 @2 S5 e- s0 F- static volatile int irqraised1 = 0;
, r# t! y& h) `* X - static volatile int irqraised2 = 0;
- ?7 a+ a; b- `' O& ~& [/ W2 a
! {( M* {9 w, A, `0 U; {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" l8 K. |) o% s' }9 F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 I3 H$ u. E u6 H" d) V; T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. x: d! e6 x" u0 S$ Y2 l - ( x0 R* u3 {# P4 a; D8 P) h" |
- dma_addr_t dmaphyssrc1 = 0;! G: e- Q0 }, N' y8 R1 d
- dma_addr_t dmaphyssrc2 = 0;% N% X* t% i# K9 R! G; O
- dma_addr_t dmaphysdest1 = 0;
. [4 o) i3 D& p/ G - dma_addr_t dmaphysdest2 = 0;) O9 X, g9 {$ M
9 W1 t/ l3 [% W; U! @, h1 k- char *dmabufsrc1 = NULL;7 A7 \' p; Z+ y4 x1 N
- char *dmabufsrc2 = NULL; I3 b) D& z# b* }
- char *dmabufdest1 = NULL;
9 y, D% J+ M7 ] - char *dmabufdest2 = NULL;2 L6 C& q* H/ L/ U: ?
- ; I& L6 |6 D8 O& g$ N( A" u
- static int acnt = 512;
$ n5 q) N" u5 P d* `& b - static int bcnt = 8;
: o' J/ x( p8 g% h - static int ccnt = 8;
! c' M/ E0 @& r1 t( @
- d" ?/ j* _8 ^& {; O- module_param(acnt, int, S_IRUGO);
8 u* b! X4 { P - module_param(bcnt, int, S_IRUGO);, ~4 }: O( S( z
- module_param(ccnt, int, S_IRUGO);
复制代码 8 e0 n9 n- X9 Q2 o" A
4 a3 j: C+ D# d2 F* S. E4 n% r! k( c4 i) C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( y P d+ o' H) m9 W6 j* i; C5 Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. d7 B2 m8 E0 G% H+ E1 d/ P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) ?: {1 z4 O& e# `4 G
# O% y: g" g' |
& H6 i# T/ q% J Q/ O$ g; y |
|