|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 i Y8 c( c4 u. f
- [code]EDMA sample test application
5 G# q6 A- \( j) ^: y7 w# ^ - /*
+ {$ U2 i% O7 A% k - * edma_test.c
" J: @7 X7 L5 b2 O& r - *9 o9 g8 q: k G+ e; T
- * brief EDMA3 Test Application
' i$ B- u, m I* }+ Q) G1 ^! {% q - *: o5 P$ \8 E% `4 p2 W
- * This file contains EDMA3 Test code.
( L6 w& W. m; n; p) O& Y - *
2 X D% w% S" f! j8 t! M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 H7 I1 a+ V4 O! g! U9 W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 S6 ~& Y) W1 A0 v$ i - * TO CHANGE.
) D$ ?5 K& A" e& r4 Z2 x - *) v' H: f! }$ Z) d) U; G% f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 X8 K' G( ?: h - *
, Y$ B# C& ?& a- B - * This program is free software; you can redistribute it and/or4 {; R; O4 _3 V8 D9 r
- * modify it under the terms of the GNU General Public License as
2 J1 h' x% G" d( ~ - * published by the Free Software Foundation version 2.
7 }( i: K; z; e' F& ~! M% x7 h - *7 L# u) \' q1 r; q. S1 c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 I3 ]% r6 O( E/ z - * kind, whether express or implied; without even the implied warranty
! i6 O9 {0 J+ k1 |% m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: F9 r2 ~9 m8 J v, o0 b: G6 d
- * GNU General Public License for more details.( a# s; X( a2 x- p' i$ s7 P; i
- */
7 A! j2 X, u. Z; R% s1 G0 z2 G, b3 _
/ i8 S9 B- E5 Z/ Q0 r+ c- #include <linux/module.h>7 _5 ~0 q# h- t3 U9 [8 H4 @3 @2 P1 `
- #include <linux/init.h>
! {0 |& v9 k/ ^: W5 \ - #include <linux/errno.h>1 @; t9 q3 e! B/ y
- #include <linux/types.h>; F0 D4 r: I+ d, r& [$ W
- #include <linux/interrupt.h>
4 N) E9 \( y+ o4 _" c, D. c& Y - #include <asm/io.h>. v4 k. u! e5 e B4 L4 C% B
- #include <linux/moduleparam.h>$ ]# b7 N; r m: k1 f v
- #include <linux/sysctl.h>
! _- @4 Z9 H. S9 _$ e* X+ K - #include <linux/mm.h>2 d: |1 _! ^- R' f/ w( ^
- #include <linux/dma-mapping.h>
6 _, }1 j: A1 s$ G8 [" Q. e4 f* ? - 6 Z' v) J: t. x9 d' ~( _# D
- #include <mach/memory.h>
# n H! B0 ]" ^" L - #include <mach/hardware.h>5 N% D/ h5 v; |% K# n0 \) u8 W4 A
- #include <mach/irqs.h>. l ?$ F j: n1 s0 `' v; o
- #include <asm/hardware/edma.h>9 E; t% k3 s4 c6 V- m! R: e) E( t0 W
- & Z [- k2 a4 a n0 o" e; e
- #undef EDMA3_DEBUG5 J" E, N4 R% M* D* V5 \! n
- /*#define EDMA3_DEBUG*/3 G% S: ^. G/ d7 Q0 d' @
( c: e0 d( `2 n# i- #ifdef EDMA3_DEBUG
8 y* ?; J) J! Q5 m" e* ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; l# p3 d; m2 W" }" l' Y! { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 T9 G \8 B1 c- N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 r) N0 }0 q n, A& ^9 s& o1 c! y1 j$ @ - #else
5 {! ~9 I a: Z- P a - #define DMA_PRINTK( x... )
4 C3 F9 F% d+ I3 ? - #define DMA_FN_IN
( ^8 ^1 E) ~9 I0 F: d. j - #define DMA_FN_OUT i) w4 j5 a4 R2 ?; c& I5 Q) j
- #endif
7 A- c* c7 x2 R8 K f, |
& @$ P* P/ X* L0 ]/ M* @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 w7 r0 }: k9 l7 q- A* e, {1 X/ A - #define STATIC_SHIFT 3
+ `: J, @3 Q4 k$ k - #define TCINTEN_SHIFT 20
! B' s4 A& [% b/ N% r - #define ITCINTEN_SHIFT 21
# U3 |, w1 }, x1 L - #define TCCHEN_SHIFT 221 Q6 Q' ^# h8 }% G) |+ X* S: Q
- #define ITCCHEN_SHIFT 23
2 T" D6 E$ s2 q, D. @ - ; I( W! ~; Q: i
- static volatile int irqraised1 = 0;
8 v B/ N9 Z1 ^. I4 f' b5 f6 z9 X - static volatile int irqraised2 = 0;: ~) k& Q% {4 }; a
- 3 ~9 d5 u' ~2 M1 n* H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 a2 x, i; v. u( \8 x" F1 }) H6 y0 I$ d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. L" v+ H l: U+ F+ u: C/ Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( s6 `0 H. c$ ~5 a+ l* j - + E' q$ c9 D- x5 ~/ R( |
- dma_addr_t dmaphyssrc1 = 0;1 O2 s# ~! g, u4 d9 L
- dma_addr_t dmaphyssrc2 = 0;
5 f! q5 O5 m7 C9 u - dma_addr_t dmaphysdest1 = 0;
- u( W6 j, \3 b6 w" \0 Q - dma_addr_t dmaphysdest2 = 0;
& E& b; ^& E$ e
9 I4 S) K) `" f7 \& V- char *dmabufsrc1 = NULL;! a" i+ V* D* | |
- char *dmabufsrc2 = NULL;. [% H! ^9 s2 f
- char *dmabufdest1 = NULL;
* i$ Z( b) v8 i' A5 k) X; Y+ z3 d( v - char *dmabufdest2 = NULL;
) E# {; G/ J2 a - 1 V6 @/ d2 p- D# {$ ?/ Z
- static int acnt = 512;
& N G5 o% U) B8 ~3 ? - static int bcnt = 8;
, W& a3 _ C# m7 @3 f. \) K4 [/ f - static int ccnt = 8;
% Z; _- @! ?5 K, f+ E1 V
2 P* I: ~6 o9 C$ h- module_param(acnt, int, S_IRUGO);% A4 \+ [# |! k( c
- module_param(bcnt, int, S_IRUGO);6 D: ]8 l# \" j. H* b0 c
- module_param(ccnt, int, S_IRUGO);
复制代码 ( o9 D" X3 B! s
& k W2 O. R0 I( J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. Z5 \. j8 w% _* v$ R. E. ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
R( Y4 \# m0 {3 M/ U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" \4 W9 m2 t5 @
, a) U- q* E6 p. ^0 G$ o- x6 l4 T* O/ H" O1 e- e
|
|