|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 M" D/ b4 r( C9 ^/ C
- [code]EDMA sample test application2 M" h y# x. c0 y
- /*
) d" d3 {7 l1 {2 h1 J' t4 Z5 A! } - * edma_test.c2 J1 N6 n7 k, p
- *) j% m& [# n. k
- * brief EDMA3 Test Application& ~( T P% j& B' _5 l# P
- *3 C: Y( p1 {, w9 o: L1 y5 H
- * This file contains EDMA3 Test code. O4 V3 X6 M( J4 g0 n
- *
% L1 U( N! a9 ]# W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 V3 a" m# c4 s) }3 B$ q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) s, l. e7 x$ G! p
- * TO CHANGE.
+ H- w% q2 e+ H& P& ^ - *+ G; l7 H0 b& M% J. a' G9 A& r; S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 u) E( d0 O+ v& z: R8 f - *
2 j$ l; Z* O6 A - * This program is free software; you can redistribute it and/or: {9 r I3 u! l3 z
- * modify it under the terms of the GNU General Public License as
4 D8 j3 {+ k( G - * published by the Free Software Foundation version 2.0 T3 x4 f2 i! W$ g% }
- *
' G' [0 I: s7 G7 v Y+ k7 ^8 V7 R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- h( d" p/ Q, n - * kind, whether express or implied; without even the implied warranty S) q1 j& Y$ \) {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- j0 O& P% A7 N1 y7 h - * GNU General Public License for more details.
$ Y4 _ c& Q3 a% L7 O - */
1 _& M0 v! u$ {# w A - ' ]0 }4 o/ `- I: ]
- #include <linux/module.h>" y- n5 N D# h. J
- #include <linux/init.h>
]# i$ U3 K8 M) _ - #include <linux/errno.h> F) U9 S$ { N# j) M
- #include <linux/types.h>4 \ n$ c/ I1 r! Y/ }0 q Q9 p
- #include <linux/interrupt.h>
6 C/ U, d& k9 j - #include <asm/io.h>
8 _7 d" M t( u# q T - #include <linux/moduleparam.h>
: u& O5 Z" d0 u/ N; C+ R6 h - #include <linux/sysctl.h>6 f2 q# \/ Y* `" O8 M' _2 [
- #include <linux/mm.h>
; A" V- k; R+ v7 s+ h. B- G7 L - #include <linux/dma-mapping.h>
/ E4 Q: y0 E& h: y - / y! D- J7 u9 j' j# Z
- #include <mach/memory.h>
- t, g/ {7 @8 @$ T - #include <mach/hardware.h>; \6 Z) c! {, s4 i* P6 k
- #include <mach/irqs.h>! I* y* Z4 a! ~# C& V- d1 q0 L
- #include <asm/hardware/edma.h>
% K/ p# ]* \7 p7 ] - 5 Y1 o, E; J: W
- #undef EDMA3_DEBUG, G* U6 u- x# t
- /*#define EDMA3_DEBUG*// e# B6 ~, P |& q5 ^1 j
- ; I9 n: W. h" b/ a$ S1 c( B. E
- #ifdef EDMA3_DEBUG
; e, x9 q- l# `, j) D; `3 f m# o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' P$ g2 F! }4 p4 T2 ~0 X( Q$ D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 @! Q, O, r/ k S' K& u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ W) S% ~: K1 G7 J
- #else
5 a y5 A3 o' v0 v, n6 u9 O. t7 l - #define DMA_PRINTK( x... )
9 N/ a/ J" G/ d7 X: ~ - #define DMA_FN_IN% B+ J1 m; v- ?3 h+ @# V9 a1 Y0 p; x
- #define DMA_FN_OUT$ ~5 C, T1 W; q: a; r
- #endif B' j$ h; m5 Z2 I# M- r7 c
, ~$ u4 {0 b$ p3 p, R3 | N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( j/ X6 }% ?# \; }! W" B. M - #define STATIC_SHIFT 37 e Z3 {4 b G% j/ }; ]/ O
- #define TCINTEN_SHIFT 20) I' v% C) S1 a3 l+ V
- #define ITCINTEN_SHIFT 21
0 N; z) a) d L9 f2 M - #define TCCHEN_SHIFT 22
* Z5 [* f; `$ j+ [ - #define ITCCHEN_SHIFT 23$ k E4 g" C) K- u3 r; b5 k
- ! a! A! F8 G3 V8 _- F0 ~
- static volatile int irqraised1 = 0;" Z0 U; ~# n( g1 { W
- static volatile int irqraised2 = 0;# x+ g; L7 I+ f: ?; C
2 I. o8 n+ k/ q# v6 O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 b H/ ?" q' |+ l- p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, l, \3 @: t1 d! M: ?% ^: Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, ^7 d: G' ?( W - : E: u& L; z& Y* s/ Y
- dma_addr_t dmaphyssrc1 = 0; \ ~/ P* w/ W& u
- dma_addr_t dmaphyssrc2 = 0;8 v, ?$ L# V0 G; O1 |3 g
- dma_addr_t dmaphysdest1 = 0;
! j9 U8 J' Y% O1 q1 i0 |! n9 | - dma_addr_t dmaphysdest2 = 0;* R# a9 k2 {% Y, A1 q, ]
, a8 ], t4 V7 X/ j/ V Z- char *dmabufsrc1 = NULL;7 y. C* h) w/ g+ }
- char *dmabufsrc2 = NULL;+ U; k2 `: A0 @! m: G0 s
- char *dmabufdest1 = NULL;- q3 ~. {3 v: L" e. k7 i e
- char *dmabufdest2 = NULL;( h, v' W5 q U+ y( U/ L3 _" _, `
! E, z6 a/ n" l( r- static int acnt = 512;
( o3 {; j8 y4 q+ g# z! K' x - static int bcnt = 8;
( h! r' i+ M8 r" o, N% C+ p - static int ccnt = 8;
4 @! k# i# X+ x' B6 f+ x- a
; y3 a, L1 u" t7 c d- K8 A- module_param(acnt, int, S_IRUGO);
/ o+ S5 `8 `/ h5 d6 Q O - module_param(bcnt, int, S_IRUGO);' U$ h2 P7 o# A! t2 T
- module_param(ccnt, int, S_IRUGO);
复制代码
" q+ ^6 F) z! ~5 ?9 r/ r" A0 y8 i) B' R1 @( @2 @& M' w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 p0 s' w, k% J/ T/ K' i$ @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! \+ `! ]; V' e& m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. [4 e+ K4 }, I! l" ?5 [# o, V+ p
1 x( A2 L. u1 G( k" o4 e* |! d! |' } S' P7 h
|
|