|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) y; v2 a1 |. ^/ x- {* d3 ?; x, q1 e
- [code]EDMA sample test application
4 G2 B" n" s8 |# c% i! X - /*
* T: u% V) b2 T& D3 ? - * edma_test.c1 ~; B3 K! l; l- z0 ]
- *
" @: `: ~/ B1 H& | X( C - * brief EDMA3 Test Application/ _$ ?. g+ k* c
- *
2 x# K! x* g, U3 j5 d' m0 S - * This file contains EDMA3 Test code.- L- a/ ?& P/ ?0 q. x, `
- *+ D) w/ m& B8 ?' J. v; o8 l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& G! P- q# e! }9 f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 L: f% ^, R6 J - * TO CHANGE.
9 q( q: {1 k1 B* _! G1 V! B' k - */ @4 c% n" r1 }6 v! L% q6 x) g1 H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 m9 O3 J! g! v! a! S- Y - *+ O7 U. X: Q; U- u5 @! U
- * This program is free software; you can redistribute it and/or- C& {4 }, x2 H$ J3 w
- * modify it under the terms of the GNU General Public License as
5 O r. _$ Z. f* |! ?) _' S - * published by the Free Software Foundation version 2.: `3 P2 \6 I- P
- *, \8 V: y& ]( v7 p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ k, a# D6 b! }6 y: @0 {
- * kind, whether express or implied; without even the implied warranty
3 E# W' T1 _, d! R; }- ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' `! F% B) ]8 B
- * GNU General Public License for more details.
( ?0 C; }" c4 V1 f - */
% j. W! W) L1 U
9 L' a) ]8 {. H+ K3 c- #include <linux/module.h>7 G. @6 ?- p3 Y3 T
- #include <linux/init.h>* F. k& Q# v" `1 J* a
- #include <linux/errno.h>
2 M% ~1 d9 n2 c8 j, x, m - #include <linux/types.h>
; Q8 K& p# n1 H, p+ k' \ - #include <linux/interrupt.h> n6 E$ [' e( k' p8 w2 `" U% p. L
- #include <asm/io.h>
0 s7 S6 b5 l' h2 T" Z - #include <linux/moduleparam.h>$ |% M$ q' { R, ~* f4 _( V1 V
- #include <linux/sysctl.h>
+ Y; f, X! d+ ? - #include <linux/mm.h>
/ W' H- {* B0 R6 }' B8 e8 N; R) x - #include <linux/dma-mapping.h>
/ u. Y2 e; W, ]" |$ G( t9 m
1 o6 X$ ?. I" N4 j8 ~) V; B- #include <mach/memory.h>
* n! V r1 x3 _" ^ - #include <mach/hardware.h>
$ Z* L2 s! X3 c% | - #include <mach/irqs.h>
# A/ U% r5 p" D. P - #include <asm/hardware/edma.h>
) v1 G0 q8 n. b" j4 p& w4 a1 ^ - / G X3 }: y3 p/ c
- #undef EDMA3_DEBUG' E$ q; p$ i. h
- /*#define EDMA3_DEBUG*/3 v/ A* _" X4 k6 n; l% k
- 8 @% I1 N0 ~6 i
- #ifdef EDMA3_DEBUG) U( I% w7 [* Y6 s! B8 {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# c# w* b% X* p1 Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 b( T( y8 _- e; j6 i& I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, A2 R4 n+ s# t( j# _4 m3 l - #else7 U* {0 _; q2 j% V9 K% k
- #define DMA_PRINTK( x... )8 |7 N) i* ?1 l e( S9 N
- #define DMA_FN_IN4 D% A1 M5 Y* b! p9 ?7 H2 @
- #define DMA_FN_OUT: m4 V! m/ j3 ], U- E
- #endif( v- F6 ?5 W. P9 c, ^9 h
! j- E |, B9 F1 k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 Q4 _9 P$ M, ]4 |5 l4 J, s5 b# }
- #define STATIC_SHIFT 3
+ F# V6 N& }' w; q6 D* [ _ - #define TCINTEN_SHIFT 20
# a- W: X% @ E0 f& `4 n* N X3 Z - #define ITCINTEN_SHIFT 21
- Y& u! K0 w4 U! I5 g - #define TCCHEN_SHIFT 229 G/ g5 @0 U" v- ~6 f' N% a9 b# q
- #define ITCCHEN_SHIFT 23
# J6 ~! h" j" c - $ w- o3 p7 J ^6 ^+ H: b
- static volatile int irqraised1 = 0;
: k) k% O/ u' ]8 d6 w - static volatile int irqraised2 = 0;
- c* W$ M. u1 l8 G( R/ a
0 u: e5 g! z+ u6 J, u0 I3 U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; ^/ U5 p/ W8 l1 i H, L) U+ H; D& D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# B( x) z8 }+ \3 S. }& l( C7 q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' F n# Q6 s2 a1 F - " h7 r% R8 U2 H9 i& z
- dma_addr_t dmaphyssrc1 = 0;/ q3 H, D4 n1 S
- dma_addr_t dmaphyssrc2 = 0;
1 A& P( |* i9 N6 I5 ]! D+ {/ V& v - dma_addr_t dmaphysdest1 = 0;3 ^$ o- E# M8 d+ h9 t, b! I
- dma_addr_t dmaphysdest2 = 0;
: B) t% }" k2 S( c* g
8 @5 {0 h# E; M1 m3 k- char *dmabufsrc1 = NULL;' C! e/ j0 k3 v4 Q
- char *dmabufsrc2 = NULL;; h b8 y. t$ R) q
- char *dmabufdest1 = NULL;
/ c' N9 d) a3 |2 Y - char *dmabufdest2 = NULL;
- M/ }2 ^/ V6 V; d6 L
: v5 r+ `5 z* p S2 C1 h- static int acnt = 512;
) y- p4 _. e6 W: F - static int bcnt = 8;
1 n, r5 U1 Z% F3 S - static int ccnt = 8;
. `( s9 S6 ~# }( ]
# f5 }. {2 }2 f- module_param(acnt, int, S_IRUGO);. o1 a' p1 v7 H/ c% W; _* k
- module_param(bcnt, int, S_IRUGO);$ I& `0 n; w" b4 y5 I# F
- module_param(ccnt, int, S_IRUGO);
复制代码
2 z# k( o: i' y- D
/ q& Y! J2 e/ }/ k4 m8 v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 k) ?! k a! s8 T- D) o9 h4 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 V$ {, a% l( ?! J; g( c3 p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" P3 d b( n8 Q' ?
2 G8 D! @, p+ W5 W- f3 B% S, u+ z% }% B
|
|