|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 l7 U! E/ C# U! a' J
- [code]EDMA sample test application n* |# G; w. j$ n+ S
- /*! T* l$ Z' m( j; L5 c; |$ Z$ Y
- * edma_test.c
* ]/ c6 h; l9 o% u8 e5 p! g - *2 h, J, B1 C( l. g' {; ]/ Y! O
- * brief EDMA3 Test Application
% u" W) n$ ~( N, @ C2 h/ U7 a0 q - *
# m: O1 |( }& @+ i1 c" @' P6 b - * This file contains EDMA3 Test code.
: E9 u% g+ q: ]& N X" Z4 |; Y - *
1 D; n' @: L; C) r$ X; S b' e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( Y- o0 _9 q9 H3 V7 ]) f7 K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 }5 Z: Z% D u. ?" m2 v9 q - * TO CHANGE.) T6 b3 q1 G0 e& T
- *
% T' `6 a5 n T5 t' m. ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ l& E! z4 c4 h8 ` - *5 n' C0 U0 b# Y1 B
- * This program is free software; you can redistribute it and/or, L5 E8 H! g; T0 j: {
- * modify it under the terms of the GNU General Public License as1 j9 E, q# }3 K( V& b3 t- r
- * published by the Free Software Foundation version 2.) r& J9 l2 X# {" ?6 r
- *+ f4 g5 A1 K. p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( t" _+ m" t, P; U- C
- * kind, whether express or implied; without even the implied warranty! x8 q+ b b+ V& Z6 i3 Y8 b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ a# D h. _/ | c+ A9 O9 p3 ?
- * GNU General Public License for more details.
( _& X$ ?* V% M - */
1 M+ ? x: p' D# t4 v - 4 Y0 ?1 n6 o3 ]/ N
- #include <linux/module.h>. n2 q% p& Y' n p
- #include <linux/init.h>
8 q% e7 }1 ]4 s, H2 R - #include <linux/errno.h>/ l _8 A8 X# b
- #include <linux/types.h>% m: e p1 G8 Y2 ]+ b% m
- #include <linux/interrupt.h>2 U( o: P9 h! ]( D
- #include <asm/io.h>
# N2 W# m4 G. Z4 ~ - #include <linux/moduleparam.h>
9 k. ~1 l+ D8 I - #include <linux/sysctl.h>8 Y4 B6 ^2 D2 n
- #include <linux/mm.h>
! [) \) l$ ?8 E( m" ^1 P# j2 G - #include <linux/dma-mapping.h>& b( s* n9 ]1 X; C% h, x6 V
3 ^- J' `! q/ y: @; J' s- #include <mach/memory.h>
, P. H1 {9 T: _; d8 ?+ }0 H - #include <mach/hardware.h>) B# X. Q) [+ Y) H7 o9 {" Z5 s2 Q
- #include <mach/irqs.h>; G; G1 X5 }$ d& V- a; k
- #include <asm/hardware/edma.h>
2 v1 A# _3 j5 Z9 k# z
2 ~ q) V4 L- i* C0 `) _- #undef EDMA3_DEBUG
$ N! f/ c* l9 a8 x3 ]: Q0 e$ M - /*#define EDMA3_DEBUG*/
/ R" y0 x) l# L8 Z" x" x) D! a
5 i, B7 w7 S6 O, F6 n- #ifdef EDMA3_DEBUG, M% D' J* ~" Q0 t* `' P9 F s" w+ O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% K7 n5 i0 d @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), N0 U' q% J5 H' }- i/ z- Z3 |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), z( O9 M2 B1 y) }
- #else9 P& K- u4 c) I
- #define DMA_PRINTK( x... )
1 E6 P3 K- l0 a! h - #define DMA_FN_IN
# p/ h3 k. z* j( I - #define DMA_FN_OUT
( g3 n& j9 u- S0 p1 R3 T - #endif
/ x* Y8 s0 u$ z) Z8 H - 0 _& l/ t- i! N ?, x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" w) a' m# {0 i9 V2 m8 L - #define STATIC_SHIFT 33 Q8 W& v0 G( |' t1 H7 ]. d
- #define TCINTEN_SHIFT 204 ^( j4 F9 @ L; @
- #define ITCINTEN_SHIFT 21& A: |. q; N: {5 W, l9 T
- #define TCCHEN_SHIFT 22
, Z! `1 P: @" s# K8 G/ r I - #define ITCCHEN_SHIFT 23
4 h, ?& Z' S* @9 Z) J/ B @
. E! {3 n8 r- H, p2 j) I- static volatile int irqraised1 = 0;% c& a9 I8 y' l* b+ @1 O
- static volatile int irqraised2 = 0;
6 @. ?5 F' U) Q" ]- w5 m( K - , ]+ m5 a, J/ @( z0 R5 G7 G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 w1 V8 y3 c, G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 R6 [7 o. `; c6 ]2 Y; x. X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! F# {8 D2 } i
- 8 u5 x* [6 v# Q# O2 f/ D' J
- dma_addr_t dmaphyssrc1 = 0;" D' c- G1 ^, Q4 {9 h# T
- dma_addr_t dmaphyssrc2 = 0;
% `, E, ?6 F% e! R8 X: ` - dma_addr_t dmaphysdest1 = 0;; _; F+ h0 G6 E# ^
- dma_addr_t dmaphysdest2 = 0;1 L- A& |1 z* ?% @
- 7 j2 g' W( F% b0 I$ c6 i- g
- char *dmabufsrc1 = NULL;$ D1 x8 o3 s1 |
- char *dmabufsrc2 = NULL;
3 g4 {% @, d2 z+ n: I - char *dmabufdest1 = NULL;0 n. N5 M/ q" k$ [
- char *dmabufdest2 = NULL;3 A' E$ o2 c; ?) V% E- r
% C# Q5 ?3 X4 s9 C9 p8 B4 B- static int acnt = 512;, y( r& U) ?' Q/ ~4 k' |
- static int bcnt = 8;
, s, m0 m5 l& Y- F+ o& V - static int ccnt = 8;2 F8 n7 T8 M& I
" m1 \/ c% M& I& I% ^) K- module_param(acnt, int, S_IRUGO);
3 v7 T. [8 k0 B1 a. i5 q* @" ~ - module_param(bcnt, int, S_IRUGO);; ]% } ?. i. O* J6 }' ~9 L! a
- module_param(ccnt, int, S_IRUGO);
复制代码 - V5 z* `/ ?# ^9 I/ J. i: H
- ]* D5 J* y) m% R5 w9 E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 b! L. \! W+ m Z; O" ^* r4 b6 larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- w8 O k+ P$ Y% K+ j4 L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 w" ?" F) c0 h" V
6 _2 S Z* ^8 |9 b; n' F ]
* C& B X6 _& v* t7 D4 N |
|