|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , N% R: q0 a5 K& A [: A3 Z5 W u
- [code]EDMA sample test application* g& T6 R4 ~/ y# T! ~# R x
- /* L( Z: l! K6 e- _8 ~7 t& `# Y
- * edma_test.c2 q5 D5 y0 _% T) J
- * R/ [0 U1 p) j' B, k
- * brief EDMA3 Test Application
$ V" {' m/ i7 E: S9 ]" S - *& u. G2 T6 z4 t
- * This file contains EDMA3 Test code.
! c: D$ M+ ?5 r8 _ - */ @! O! x- l- w4 j* l5 _/ a$ y4 o0 P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 C0 a: L2 i2 {# q3 Y$ h7 G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ A7 C# }( L7 l% \ - * TO CHANGE.
: O E' m( | ^9 b - *4 x5 r9 G: S8 b& r: @: p( K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 D+ P$ W: r: H3 O7 b - *: ^$ ~8 x2 B, T, b7 A) J. h
- * This program is free software; you can redistribute it and/or# ]% v. Z+ w) x+ Z) V
- * modify it under the terms of the GNU General Public License as
* O \9 R' M) c+ t) J; g - * published by the Free Software Foundation version 2.* d9 v: f* s' w Z# n' e9 n
- *
8 j$ w' o4 a) K( ?3 V% m& R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: Z4 u% o3 t$ D W8 E
- * kind, whether express or implied; without even the implied warranty
- z7 h2 W( ?" W( R- K+ p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* V9 l; o; B" k9 h2 R/ c$ t- q+ i0 A - * GNU General Public License for more details./ V3 H/ u n% D/ f s
- */
( e# f) i1 A5 W( s/ z - + I+ i) F; r4 a$ c; |0 |, p- G$ m
- #include <linux/module.h>5 y( W3 q! m% @
- #include <linux/init.h>7 i% ^/ Z3 ~8 u, c. k2 w% W
- #include <linux/errno.h>" r0 @. A3 m) M$ _4 P& \
- #include <linux/types.h>$ J: B9 {2 f; ]/ \9 I( `( r |
- #include <linux/interrupt.h>
2 q/ h: R5 \3 F4 G7 z% q- k3 Q( l, ] - #include <asm/io.h>
5 c O3 F$ o( e - #include <linux/moduleparam.h>
* C/ A+ y! `9 _0 U$ f1 w - #include <linux/sysctl.h>
. P6 g3 o* V0 e) x' U( L - #include <linux/mm.h>
# y/ R1 l! a F3 ? - #include <linux/dma-mapping.h>6 c# P* O* i2 @$ J( k! T
- 7 j. L2 n9 ^# M9 n, O
- #include <mach/memory.h>% L' D- ]/ J% o' b: E
- #include <mach/hardware.h>, U, o% k9 i! ~4 ^7 e( A
- #include <mach/irqs.h>
3 G9 }4 Y, Z6 v8 e/ P4 }; x - #include <asm/hardware/edma.h>
8 x/ z" f8 V. W0 D2 t6 ?
2 y! Q1 G! z6 r8 Q; ^- #undef EDMA3_DEBUG4 ~6 b. R7 @6 _8 e7 Q- M
- /*#define EDMA3_DEBUG*/ r+ p+ @ R# @2 r
7 Q) r; i! s7 W) U- #ifdef EDMA3_DEBUG
) J' I, G8 U* v; `4 Q; ?. s4 ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, F$ H. X: C+ s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 x' E' x9 {, c* o1 b4 n$ ]. `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- M$ P1 T1 Z4 w7 ?" y5 l$ ^ - #else
0 [0 Y4 `6 q9 E, p, r* ~ - #define DMA_PRINTK( x... )1 _# ]% Y; U, d/ A3 i- Q
- #define DMA_FN_IN
3 _: W; s6 s0 }0 f. \! d1 M/ x. E0 } - #define DMA_FN_OUT
1 s% ^1 O4 H. v$ w) O- T v - #endif; y7 f4 u# _3 [% [* k: ^3 {" h
- ( V* e. @% Y z I& Z7 ?' A9 A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 ?, _0 r$ S4 T( S: z) ?9 B
- #define STATIC_SHIFT 3* H2 L! ~( P, l
- #define TCINTEN_SHIFT 20, X6 X) [( t; p$ ?) x/ s& x
- #define ITCINTEN_SHIFT 21
$ m/ r8 C& L0 k1 K& b - #define TCCHEN_SHIFT 224 M* A' N$ C8 Q1 A) k
- #define ITCCHEN_SHIFT 23 b: N) {9 A: w4 I- j1 f
7 g) T9 F8 H s( [ _% q- static volatile int irqraised1 = 0;; M2 _! a, j1 z- x- b
- static volatile int irqraised2 = 0;# [1 M( m5 d7 f: L+ t; L
- 1 r9 }& V/ n" R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% g& v; B! J, [: o4 a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ?# y. p# }, |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& E" J) H) ?, u8 Y% T7 a
) s w3 L( @2 q6 O; m- dma_addr_t dmaphyssrc1 = 0;
! L- o7 j6 x h# Y: y* i; B - dma_addr_t dmaphyssrc2 = 0;
4 l% R9 l4 u. h6 H - dma_addr_t dmaphysdest1 = 0;, t: R$ |/ G5 C L
- dma_addr_t dmaphysdest2 = 0;
5 ^: S, s; X9 h! _- K3 h - ; J( b1 J0 ? x5 |3 @' _5 H
- char *dmabufsrc1 = NULL;* d# C5 S) S9 ]) a9 S& |
- char *dmabufsrc2 = NULL;; i) x9 k" Z; }' l
- char *dmabufdest1 = NULL;
: \% j# Q! {; ? - char *dmabufdest2 = NULL;$ J2 s: x1 @- d" b
- ; r! O! b9 z8 M! [( }8 a+ J) o) c
- static int acnt = 512;
: q: y, |9 P3 I1 ~% e, P+ h; d - static int bcnt = 8;. n. T$ b0 l. n4 @( L* b
- static int ccnt = 8;
. ]; L+ w/ m9 k j( ^2 ` - 0 y# y, _/ t: {8 n6 t) b, q; j' ?
- module_param(acnt, int, S_IRUGO);& H! {* F4 a. o5 }. w/ \) p. _0 A
- module_param(bcnt, int, S_IRUGO);; M4 |% k; r! X9 ^3 k) ?
- module_param(ccnt, int, S_IRUGO);
复制代码 ! P/ l) {6 N8 I8 @ J
G% K2 k! S$ |- t6 L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: u$ x! C/ C2 e- S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ w! F7 A6 Z0 K# X: H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 x* d! d! E4 e& P8 W3 z1 q# F; t
( R/ r" l# B& Z2 i |
|