|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# ^( n9 o9 A, @ q- [code]EDMA sample test application
8 \) \# j7 L5 z' s - /*+ f' X0 i7 t* ]% M6 p$ g- z
- * edma_test.c+ W. ?1 g- _ X" X( P5 V
- *4 b5 h% R" e/ {! W( G2 a! w
- * brief EDMA3 Test Application/ v8 @* o5 A0 u$ o! T5 @
- *% _$ r& S7 ?; Q: f( o: e
- * This file contains EDMA3 Test code.
! Y% R8 |% Y$ W% x4 I. v o - *
+ y9 f" _( b( h. L( R! l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 [" t0 C/ W. `6 ~! G; @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 R) f+ G# I4 W5 ?6 X - * TO CHANGE.; p0 k# z9 }6 z" X% u F
- *! Q; B' E R c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 d* e. u% o1 F - *
) _. h n8 Y" {: N, v7 ] - * This program is free software; you can redistribute it and/or
: l- M6 D. c3 Z R) Y$ \6 W - * modify it under the terms of the GNU General Public License as0 T; k+ j" {( o0 Q
- * published by the Free Software Foundation version 2.! b( j; m: `9 `2 W9 Z' @
- *
; C. U7 K8 F8 R% e2 b9 r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 K+ @( u0 z/ [5 v
- * kind, whether express or implied; without even the implied warranty
; r' O. I1 `$ o& M. Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 c `) }+ h) q - * GNU General Public License for more details.9 z' _5 |' C4 H) a, H
- */
) q* L$ D- V3 V - 4 O6 J$ C; s) s7 ^1 \; n
- #include <linux/module.h>
' H8 y( Y4 @8 k& n* j - #include <linux/init.h>3 s, I' Q* R' s
- #include <linux/errno.h>. q2 ?" J" B/ m* g) C
- #include <linux/types.h>
. I. _6 f3 n% o I5 F, ] - #include <linux/interrupt.h>
' }6 w) W8 w- t( |8 D& P - #include <asm/io.h>
7 _" g1 t! Y) R2 h. T - #include <linux/moduleparam.h>0 i3 V5 m/ S: x- I2 K) w8 d
- #include <linux/sysctl.h>7 D. {! y* i- h; {
- #include <linux/mm.h>
+ r% _5 H6 o8 W+ M+ r8 i! J5 L5 a - #include <linux/dma-mapping.h>
5 K) }1 n( L$ [4 p
, n+ l; [/ u$ ~0 c x/ q) E- #include <mach/memory.h>
' x. }+ k$ \" J0 E - #include <mach/hardware.h>
& j2 g# [8 t+ }& V) }& r3 s - #include <mach/irqs.h>
7 p' B" n$ ^; p0 O' t9 t1 a - #include <asm/hardware/edma.h>. L W% o& x8 U& S9 Z, S3 n
- 6 | o, r- ]/ j' G5 y
- #undef EDMA3_DEBUG( Z) c1 k# _6 O% ]: c
- /*#define EDMA3_DEBUG*/$ O' f- b, x/ f5 I- g/ i4 p6 L- @
* n& P& [$ |2 D5 }' g( f1 m& `& n- #ifdef EDMA3_DEBUG
o- d8 v! g# E) S7 ?. w+ Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ {1 D0 {( [* ?; \/ B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 n6 R/ k( [: k' t) E; M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 w6 G, W2 ~' K% b" o7 W" W2 ~
- #else' p- M1 i, M- E$ `0 o
- #define DMA_PRINTK( x... ) `" N: m- d) F5 _4 M) d
- #define DMA_FN_IN& a. \1 o* B4 B
- #define DMA_FN_OUT. ]% |" n/ H$ y6 x" I% B2 m; [# n
- #endif
$ a c; ^" y( ?3 k- M - 4 P- y9 m9 n1 z. x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# ]0 \( e: k$ C1 h Z( N) y' S - #define STATIC_SHIFT 3$ L. g. o6 d8 m/ Q( R0 }9 [
- #define TCINTEN_SHIFT 20
& I$ [% I4 ]4 \, h& t - #define ITCINTEN_SHIFT 21: a; U6 l, Y1 g1 G9 x. U# Z, J1 X
- #define TCCHEN_SHIFT 220 X% n/ |- q7 `) H$ G
- #define ITCCHEN_SHIFT 23) p, J" A$ m* q0 E5 s# f) B
4 h# |9 A* w; R9 `# g1 T: V- static volatile int irqraised1 = 0;
7 ^. J7 @, R9 l5 J0 ^, c" Q - static volatile int irqraised2 = 0;
% S) m# y' {4 B0 ^6 _2 P, b
# l0 ?8 X$ l' W$ t- I. W1 Q5 ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 R! D" ^. ?7 H4 [5 c, K. u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 N- O) K, _! O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 Z% A+ D: g* a( `4 B - 0 r) {8 J2 M b
- dma_addr_t dmaphyssrc1 = 0;/ [. D, \8 x ~+ [
- dma_addr_t dmaphyssrc2 = 0;
; d( G3 V; v. M3 J8 F - dma_addr_t dmaphysdest1 = 0;3 _/ @) O* j$ ]8 c
- dma_addr_t dmaphysdest2 = 0;
2 s4 m# h) ^$ ?
r; a& a% g/ l; D& A# y- char *dmabufsrc1 = NULL;- _8 e+ k# N5 O9 P
- char *dmabufsrc2 = NULL;
, u2 Q& r% W0 g+ P5 j! Z" [ - char *dmabufdest1 = NULL;5 e. i1 M, {( v3 z
- char *dmabufdest2 = NULL;# b/ T& ~2 n$ \8 m( i
- 1 R+ r( D7 l' c2 w0 b, Z9 U3 A
- static int acnt = 512;
, `: `; b f+ j! r+ G4 Q4 y - static int bcnt = 8;( f& N! @1 i+ e: I" Q* q) E
- static int ccnt = 8;" \3 n7 a& o6 l# C' o
- ( ], N4 f9 q5 i, o& y* l' q% t; D Z
- module_param(acnt, int, S_IRUGO);) d5 N, L0 e2 K2 \
- module_param(bcnt, int, S_IRUGO);
; M$ u7 W5 K; p& W3 E- Z' Y - module_param(ccnt, int, S_IRUGO);
复制代码 ! Y$ G9 f. e0 Y! k8 B
6 A {& U7 H+ F! Y k; ~" i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 u# X9 H5 @* z4 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ d3 {2 J6 t' |. x5 l8 T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 |/ m! H4 I0 n2 ~: _. g
' `$ y0 P0 Z* t4 y
1 V' y5 F& @8 R7 U: U4 C/ A |
|