|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 d& G1 A! y8 h% t
- [code]EDMA sample test application- K/ d2 i6 }2 m, C$ \# c% d
- /*
# ]; r+ f9 u( B& p+ k9 E1 B/ P - * edma_test.c7 T. \" ~; A. z3 U
- *
# s. P3 N* H- i3 c' T2 Y - * brief EDMA3 Test Application
' g+ @8 N( R: P( M+ Z1 L% u - *' F2 h1 Q6 y* Q8 J
- * This file contains EDMA3 Test code.
- Y, G' o3 ^# i( n5 Q - *; ]% q/ `8 Q4 ]2 a7 W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ q5 ~$ e6 n( a% S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# n) }% k7 W. P9 c: I8 X
- * TO CHANGE.
8 B/ E: o* e v H - */ I4 j& y; ], j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, Y8 x4 W6 m7 I! m! k - */ {% t: E/ K2 ~+ J+ |" u
- * This program is free software; you can redistribute it and/or' `, \& ~- t, O; ~- ]
- * modify it under the terms of the GNU General Public License as( p) j8 f S1 h/ [4 c' \
- * published by the Free Software Foundation version 2./ X4 {, M b |& L [ o
- *
( A6 Y- l9 I X* b! J4 v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 W3 z+ v* k5 \2 y9 b# O - * kind, whether express or implied; without even the implied warranty. b$ w# b4 ]( `0 x8 U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# H$ p9 m; z+ }/ S/ v4 J - * GNU General Public License for more details.
8 v y4 }* Z7 U - */
& o% }: x( X, X- O( x# X8 b
7 s* z; Z- b. M- #include <linux/module.h>
" v+ A, x; |' @9 Y/ x, d7 a - #include <linux/init.h>; t+ _) I3 `3 ]; u
- #include <linux/errno.h>2 | Z5 F6 D9 W: R8 P% r1 l9 L7 k
- #include <linux/types.h>
9 Q1 U- j# T7 s" C, p( O0 n - #include <linux/interrupt.h>$ `# I" \! c$ d- ~/ @
- #include <asm/io.h>
1 k% I! L$ u" i& s - #include <linux/moduleparam.h>
4 f/ V: \( u& A - #include <linux/sysctl.h>! d9 a2 O& P' W4 q
- #include <linux/mm.h>
! H# H9 T$ n1 V$ r2 l/ S2 _2 E - #include <linux/dma-mapping.h>
% M2 Y }- Q$ U) k4 w, ^5 w% Y8 K- k
Q7 M. h( I3 A) E- #include <mach/memory.h>% }9 P7 F0 d: M+ z* j3 T0 h5 N) J
- #include <mach/hardware.h>
! }! {5 M2 ?2 E& |) [) A8 ^4 I2 ]- S - #include <mach/irqs.h>
+ G0 @6 {4 M, T) G+ V - #include <asm/hardware/edma.h>5 J% H4 _" W) [0 D% j& O
3 S+ s ^( a- n5 \. y- #undef EDMA3_DEBUG& D5 c- n' A1 K% Z- W$ y
- /*#define EDMA3_DEBUG*/
9 A: \3 m5 E4 y" J2 F p - w# a* u/ Y- G
- #ifdef EDMA3_DEBUG. @+ l! T5 Z9 i7 W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) P1 x9 F* s$ H q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ A r# e7 r8 ^9 a/ a" [5 } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& K6 O9 H' g; L+ x/ ?9 j, | - #else
4 d8 \3 I8 ?* Q" Q7 K4 y5 l% g - #define DMA_PRINTK( x... )
! j( h* n! [# ~3 y3 \$ k# T - #define DMA_FN_IN! s k* k2 v4 _5 P& A. B+ C
- #define DMA_FN_OUT
' x9 \# a% t/ m8 v. p j3 [ - #endif( r7 A3 Y% N0 Q' S4 K! W4 E7 v
/ u/ ^5 x5 ~$ g- L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ \3 t. Z2 o0 a3 F# ?0 t
- #define STATIC_SHIFT 3
$ m% | s0 [+ }% l! |+ e - #define TCINTEN_SHIFT 200 O$ s7 r: `/ @" b# N- | F7 d
- #define ITCINTEN_SHIFT 21
y! b) r$ }: U/ [, K9 E; o0 y - #define TCCHEN_SHIFT 22" E4 a: v8 g- P: u1 b1 Y! k
- #define ITCCHEN_SHIFT 23
" E* D3 g5 n" x8 D9 w& a0 ?% c8 Y, ?* v - $ E6 t5 f4 q+ u' P( h) t9 x
- static volatile int irqraised1 = 0;: I$ ~5 L; {- U; ~
- static volatile int irqraised2 = 0;: @& d) J1 T# ?, n+ l7 @
- 7 G$ }' h8 U$ c* d5 [- ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 |- [' }. U, U* b/ ~% e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 b$ @. n7 V% f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 ~! [! A; g. x" t
7 Z* k6 D g! J h8 R4 C- dma_addr_t dmaphyssrc1 = 0;
/ D4 t2 b" j: o0 p z6 ] o - dma_addr_t dmaphyssrc2 = 0;3 A0 c8 N% d" E+ y8 k
- dma_addr_t dmaphysdest1 = 0;6 m' z$ x3 l" B
- dma_addr_t dmaphysdest2 = 0;
, h9 w% B4 w7 O8 c - 3 w: _) V4 h6 m
- char *dmabufsrc1 = NULL;
: M( C' G9 l0 W F- w. O - char *dmabufsrc2 = NULL;6 m. N" f! z; S; k
- char *dmabufdest1 = NULL;) }+ X0 s4 L/ I( }7 E/ c0 T
- char *dmabufdest2 = NULL;0 U, D d4 S2 L: z+ D& g9 j- \
- }, _4 S0 E2 N
- static int acnt = 512;
; a6 \. r& h; ~ G7 B6 e. i - static int bcnt = 8;
5 V+ \; \$ S! p, W6 M - static int ccnt = 8;
: d/ ~; w7 B: Z0 m - 6 o+ y* Q ~8 b* I2 e
- module_param(acnt, int, S_IRUGO);$ q; T% W1 }& y$ q3 ~: X: x# F
- module_param(bcnt, int, S_IRUGO);
& j" Y2 V7 B4 D- B - module_param(ccnt, int, S_IRUGO);
复制代码 ( g2 H5 J4 s h9 A* o/ Z
& M% G) M/ D% E+ t: Q7 T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 m$ ?$ A$ \9 M' d- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( c8 Y$ @, U9 P$ N; x9 n2 p7 G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 b; y0 [9 Y; Y
2 @4 u/ x) R! j9 n! p: K' w3 p
& {, W- U- b. ?( Z! z4 q, z |
|