|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 f; C' \8 O: K+ m! y% C6 e- [code]EDMA sample test application7 d) B6 E a) Z: q
- /* U% d% p( O! C
- * edma_test.c$ O' Y! T+ F! w( E1 ^
- *
' A3 l7 ~+ d" Y5 q. w, A - * brief EDMA3 Test Application. v ^ @2 I- T$ x
- *
/ [* \% b/ w- `) L, }5 o* l - * This file contains EDMA3 Test code.
3 G4 p8 @2 W9 M1 P8 c" m5 g - *9 ~% F. F+ g, _# r' G. E& u' X) q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, j; L+ k6 U1 Y3 v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- Q) J& I; |) g7 P
- * TO CHANGE.$ J+ X/ M" {& |) F# Y0 T
- *; J* W9 S4 ~7 }1 A! H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: T' D6 b1 w" W: j3 n& V
- *
7 I8 G8 X- e6 E/ M - * This program is free software; you can redistribute it and/or0 Q) ~4 e8 ~2 ]# d/ S6 ?
- * modify it under the terms of the GNU General Public License as9 g) _. t" i6 p; r" Z+ y" N4 S: ^
- * published by the Free Software Foundation version 2.
" u | P! O! C M - *
/ }* ?0 D' K+ q/ X @" r& j, l/ [8 X: V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% j" j. j& ]$ V4 |/ H0 S0 C - * kind, whether express or implied; without even the implied warranty; G) n2 d8 i- T* e+ w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* r+ P/ f" Y2 Q
- * GNU General Public License for more details.2 e/ s, K" b' p7 k
- */6 o& d1 u( V' V
- : a7 \, z7 z' ^4 s8 {5 {- t1 M8 C
- #include <linux/module.h>
% ]1 u& ]; @3 M - #include <linux/init.h>9 P; l# [" L2 T& S# Q( J1 o1 V
- #include <linux/errno.h>
& R$ \7 ^* |! w( y - #include <linux/types.h>
% n% ~/ m. u; d* Z - #include <linux/interrupt.h>
; ~* t) n+ H' X3 B. e - #include <asm/io.h>
7 i; w! ?; t0 ]- c - #include <linux/moduleparam.h>
# W/ {6 ?+ {* G# L! F* ]& o - #include <linux/sysctl.h>- \0 l9 \- }/ h% A, J9 F' i; v
- #include <linux/mm.h>6 d& Z/ z8 G0 {
- #include <linux/dma-mapping.h>
( U, m4 S r6 ]( L+ _$ L# C/ j ~
% F. c2 Y% v4 `6 j- #include <mach/memory.h>; X1 A9 P; N. W- Q# X! U% W9 j
- #include <mach/hardware.h>
% H( N, V3 ~: x7 h/ K- s0 t& n1 B - #include <mach/irqs.h>4 y$ t- S0 d! ^& ^: w
- #include <asm/hardware/edma.h>8 [4 l3 h3 y- z0 s) @
- ( r' g/ `8 E1 ~0 y' ]* ?
- #undef EDMA3_DEBUG
2 S5 v2 H$ Y4 t- N6 L5 [ - /*#define EDMA3_DEBUG*/
Z+ M5 M1 A/ h1 ` - * M. z8 A- e8 G- @5 L
- #ifdef EDMA3_DEBUG$ A+ B9 V& v D% E/ }; ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 z7 B6 h8 X$ R7 h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 g6 W# t$ T* `2 d: v+ g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 f& g: `' B- j0 k5 y" \ - #else
& ?" N9 J1 K3 N6 @2 P - #define DMA_PRINTK( x... )
- o' B3 E7 L/ K" w- f1 U* i - #define DMA_FN_IN+ k0 i+ g. F" E, p& l
- #define DMA_FN_OUT
8 X k; g1 [9 p- d2 ^$ s h - #endif$ l- U& P9 ~: j4 g, ^
3 A# B/ P6 ?: X; ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 u! [- _5 P( z9 y - #define STATIC_SHIFT 35 ~0 B% `$ u# C% G1 }2 v0 M1 f# ?) H
- #define TCINTEN_SHIFT 20
( w# M' V: D9 J' v - #define ITCINTEN_SHIFT 21
" v( R8 ^* l8 B# Y7 J# s - #define TCCHEN_SHIFT 228 j! P3 h* R7 X- p) [( H- j4 E) ?
- #define ITCCHEN_SHIFT 23
# Z, D: D {( E! W- w
5 f( W7 y" e) S0 Q- static volatile int irqraised1 = 0;% w* j& Z: b' q! W$ t/ J d
- static volatile int irqraised2 = 0;
+ n. p3 n4 N- I; D! W. d - r, E" R' ^: [; t! V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 \$ A3 T& r) R; t8 D9 H* l/ s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. w/ f# l0 z, j7 x4 u( |) Y4 z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ r- o+ ]. h" @
- 4 T7 ? m; V5 Q" ?
- dma_addr_t dmaphyssrc1 = 0;$ }, Z) ]% r' n% C7 q& ^
- dma_addr_t dmaphyssrc2 = 0;
# [6 G' @5 g. X% N - dma_addr_t dmaphysdest1 = 0;
( P) g6 |' E: u, e5 M5 j - dma_addr_t dmaphysdest2 = 0;4 B; y3 Z3 C6 |& ~
- 8 i) \3 c0 {- y4 Q# ~6 D4 W/ T
- char *dmabufsrc1 = NULL;
; j5 A; A: V. l U) v/ v" J - char *dmabufsrc2 = NULL;" Y: D( J6 l& F' G) b! H Y
- char *dmabufdest1 = NULL;
* d" s* d* Y* C) J9 o - char *dmabufdest2 = NULL;" u; ?# E- m: b* b0 h
& B' j0 a8 O9 A- g% S' J- static int acnt = 512;3 y6 z6 C" R4 L/ N% W9 [# k4 T' h
- static int bcnt = 8;
7 g3 I- f9 ?9 d, }. _ - static int ccnt = 8;
7 v* T5 v+ e& y" z2 z9 T$ M4 `
6 K" b1 H; p" L" k, |. p3 ` V% e- module_param(acnt, int, S_IRUGO);* i6 e% A1 @* ?
- module_param(bcnt, int, S_IRUGO);( L2 T: J! _" H" h& m8 D' X/ I
- module_param(ccnt, int, S_IRUGO);
复制代码 8 q9 m) ~/ ]( O& {2 s9 |
) v+ }( @- A4 t& b" v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' Y1 s7 u% ^" I s. W* h0 r
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. l! |2 j( V [7 D4 L; X1 H! N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 ]6 ^' M" b' p) ~) Q8 `
0 Q9 ]$ R8 \; Y" t2 c( S% u
+ Z& Q' a8 V5 w' O3 C ?
|
|