|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % H9 u& ^5 t* P/ i- i1 ]7 y) }7 Z
- [code]EDMA sample test application
# R$ P$ z* G2 U- l' w - /*# S, I* g6 {8 A# ^. i
- * edma_test.c
$ L, @' K/ b! X1 j - *! ]5 R2 A8 R: ?) S/ J2 f" d/ d8 f
- * brief EDMA3 Test Application
" Q) F% {2 J, n - *2 r# |5 k4 w2 [, o4 _
- * This file contains EDMA3 Test code.9 u b9 ^$ s7 D" P: s+ i, x; U$ k2 p
- *1 Q m; q- N; S8 \& m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- ~0 P) ]" a3 Z! N3 i5 ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 W- B# ~# a8 f( e
- * TO CHANGE.
- G4 h' K8 v, z4 t. } - *
$ {: n! d1 @, ?8 o l) J: r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& r+ }- m' q9 f+ M' Z6 x& g - *. o7 Q; Y# G4 _4 @9 K. a5 x( Y
- * This program is free software; you can redistribute it and/or
' o0 h& G" d D2 T0 p- M6 U* d, k - * modify it under the terms of the GNU General Public License as2 Q" l2 z# v% O6 J j6 H# A' g, y
- * published by the Free Software Foundation version 2.1 g! V8 W7 p0 }6 I
- *+ g- m9 b4 r( @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; r6 B3 Y; e4 r2 w- |0 r1 [- X
- * kind, whether express or implied; without even the implied warranty! [9 S) E4 v4 ?1 h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, F8 x( L( F4 W+ ~( ^0 h - * GNU General Public License for more details.
- q: m- R" i! [( |7 s - */* T! I3 E4 \# h( R8 i8 i/ w
3 h7 o' U: \. s9 A5 E) d& D0 s7 W- #include <linux/module.h>
; S9 R+ {8 y+ b - #include <linux/init.h>! q# V0 \9 |( w: r3 L- \) w
- #include <linux/errno.h>& `2 R- }1 N+ f& H7 o0 o1 J1 ^
- #include <linux/types.h>9 G( ]9 v. ^" h1 C
- #include <linux/interrupt.h>3 f- Q' A! ?# @: s
- #include <asm/io.h>
# N% N. X8 d. J0 i, j - #include <linux/moduleparam.h>2 H9 E+ ^) _ `0 Y& v( S# J
- #include <linux/sysctl.h>
6 B) q! b' C5 W- B, f; j( ?! r# B - #include <linux/mm.h>- @; `" W5 f! o; Z* d& R
- #include <linux/dma-mapping.h>1 k7 Y! V5 j3 V: g, B
+ B+ \' C; t2 U- l- d' ?- S! Z- #include <mach/memory.h>
9 S+ t/ [& N5 Y3 k1 y2 w3 M# c - #include <mach/hardware.h>' a- ` o* M: k' I$ k" j' V7 f% J
- #include <mach/irqs.h>! y. ?2 }( l4 W: G3 c
- #include <asm/hardware/edma.h># W5 R' e& k `5 D6 Q7 z
# U: L& H2 ]. [8 ] S N8 o. J- #undef EDMA3_DEBUG
* x" j& ~2 ?) c- A$ D' e - /*#define EDMA3_DEBUG*/
* L' H6 T/ W4 z7 n: s! o
. a7 M( Q4 ^1 _, }9 {1 y- #ifdef EDMA3_DEBUG
3 ?9 h7 K3 H* J( a) f* k& `) @- z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* i6 r4 R# c" R, z& r$ ^7 g* y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# g- c) ^3 t8 N) o4 L. B4 d' y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); k2 r( X, N# |, l2 ^, h
- #else
' _& ]% H$ E- _" F7 C - #define DMA_PRINTK( x... )* t4 D t8 V6 e/ z* U2 _ e
- #define DMA_FN_IN
) ]- c+ J. Q/ q& [4 a: ]/ | - #define DMA_FN_OUT
# W+ p- M4 Z, o( r; }! C+ f6 h$ x - #endif/ S' B+ }! ~4 T( U2 i4 _% C& \* f
- - O. [6 a$ O. J2 G. }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 K0 Z8 q. m1 n2 T$ X+ Y+ V1 y, c
- #define STATIC_SHIFT 31 E0 \+ r# f7 Q @7 }+ J
- #define TCINTEN_SHIFT 206 {1 L3 i4 k. \3 a
- #define ITCINTEN_SHIFT 21! W1 G3 n; M3 f0 i1 A
- #define TCCHEN_SHIFT 22
, w0 [* z g0 V( n - #define ITCCHEN_SHIFT 23
. \2 T$ {; A. O, t. ]; s: i! |
9 B: u1 p& Y w8 B7 \* o& k7 i- static volatile int irqraised1 = 0;/ [" B. d* p$ U! q
- static volatile int irqraised2 = 0;
5 B1 x8 p# b0 u$ V( N) k: ] u - 2 \7 s [9 n5 p% @- i; T. {+ f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
u1 D# p9 ]# V$ M1 B; v3 Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) S8 L9 v, r; o e6 H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; J7 \; G3 I7 i: z. O# `- m
. Z0 X+ x7 A- V# Q- dma_addr_t dmaphyssrc1 = 0;6 Z7 J4 Z6 U+ X! ^7 i8 y: y& y
- dma_addr_t dmaphyssrc2 = 0;7 Y) H, p( N3 A$ M2 F
- dma_addr_t dmaphysdest1 = 0;
" {! p% O% t- g. E - dma_addr_t dmaphysdest2 = 0;8 i& T P) t- s' ^% I
: S# a8 g7 Y9 [2 t- char *dmabufsrc1 = NULL;
/ V+ }3 P$ s2 [: D! x) h - char *dmabufsrc2 = NULL;
+ \, f+ P& k% Y) E4 u3 e - char *dmabufdest1 = NULL;7 _) [) t% _; x3 R! \" @
- char *dmabufdest2 = NULL;
% t0 P% O2 |* \0 W
% e4 M$ G: F6 T9 D9 l" [6 C) J- static int acnt = 512;+ b4 j' ]5 @9 b# k' Z/ V
- static int bcnt = 8;
4 j8 h. A3 a5 l3 H, P, @: Z - static int ccnt = 8;
* g3 j) s% Y! ^; t. n
5 K4 w, ~' z2 i' N( k4 w, p- module_param(acnt, int, S_IRUGO);
! B4 D! ~3 e3 w* K6 d - module_param(bcnt, int, S_IRUGO);7 I5 a0 y; ~% n. N/ @4 z; t
- module_param(ccnt, int, S_IRUGO);
复制代码
6 ~0 E' J# L# h- c. J. B c; e! {) n
T2 u* Y: L X" X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. n W8 _. R4 x: |) ^. 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' g/ q! m. P4 c/ t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 m2 H% A( y6 k2 N# x+ K4 _1 _+ P# N( g& O9 f$ b8 I; K8 n
8 a. y9 M0 ~3 K" I- E+ v
|
|