|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) l" s( L" ]1 T9 T) E4 S4 s
- [code]EDMA sample test application0 R% e( }4 {* u; u) H
- /*
/ N* O- M& ^7 r8 h8 s( M - * edma_test.c/ A6 A9 A" c" f, M6 F' m4 \* b: c7 o
- *
) w. h7 Y4 e( u2 F3 E( f% R( f" K - * brief EDMA3 Test Application- y& N1 f! B. [8 x/ p8 N; j$ `
- *
, ^# \/ A& C& S e8 h - * This file contains EDMA3 Test code.
) b& s; O5 s# ]( X' c; M. F$ o - *
7 P, F2 q8 r9 o3 p8 d" [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 \# }8 |2 r3 y" x) \, R2 [1 e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* ?# ]: a5 u3 F1 m2 I5 Q3 W - * TO CHANGE.( E& I6 P; r v% @
- *2 w- e# Z$ _( u& t( V0 c6 ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 q' n+ T0 O6 {% ~
- *, p' Y; T) ^% m
- * This program is free software; you can redistribute it and/or1 f, f3 @* o2 [1 N! L8 N! h1 x# C
- * modify it under the terms of the GNU General Public License as. I! U6 C! ^7 n$ M$ b
- * published by the Free Software Foundation version 2.
}8 D& W; L3 E - *' o9 S) w" S3 Z% [: b/ l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ @0 A c: E- l5 q; ~ - * kind, whether express or implied; without even the implied warranty
1 w- p. A @9 V; F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 a% X, C: l9 e8 E3 X! `
- * GNU General Public License for more details.
8 {" m2 h' k/ t2 K - */
/ X8 h% ~) E( {) @+ o5 b/ K" [0 P
' t4 p" k2 F8 I7 K" y: }- #include <linux/module.h>
0 j. r! }$ f$ y/ }8 G - #include <linux/init.h>* P! Y8 ^/ C& O1 a4 r
- #include <linux/errno.h>
" Q; q( @: k$ r3 G - #include <linux/types.h>
6 o7 y7 @, {/ V$ W6 p - #include <linux/interrupt.h>* p3 N! `, D& }0 K
- #include <asm/io.h>; |5 f7 |% A6 k/ n; W; R6 w
- #include <linux/moduleparam.h>
# l5 y. Z9 m% d& R( t - #include <linux/sysctl.h>
b8 A* `! q1 K - #include <linux/mm.h>( ]# X- i6 Z; i; ~ C1 C
- #include <linux/dma-mapping.h>
5 N7 U5 q. h3 V% { - ( `+ p( k; r" N2 M2 G' _# Z
- #include <mach/memory.h># H) G. w8 M7 I# y1 w7 e
- #include <mach/hardware.h>
5 [* F' N: W# P7 F1 n9 u - #include <mach/irqs.h>/ v5 O i) Q$ F) B g
- #include <asm/hardware/edma.h>
/ h4 e8 P. x3 w" ~- X - 0 N- h0 c! H! F- D1 F/ v
- #undef EDMA3_DEBUG9 `! l+ n) o: X% F" y. D
- /*#define EDMA3_DEBUG*/0 ? Y0 D2 g, L
; C6 ~( @8 H) x& k% b- #ifdef EDMA3_DEBUG
7 ^- `& E* |& f) M* M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ X# ]2 T2 N1 U- z7 D4 s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ j4 R5 A8 u7 a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ I& d& _& o( E0 V9 s - #else; a6 ?8 M2 ?5 r1 I. `& a: f
- #define DMA_PRINTK( x... )
; P( _' s; H4 l% e; b5 I5 |6 x - #define DMA_FN_IN
% [5 X, N# U$ Y - #define DMA_FN_OUT
9 c" N: e! Q7 [2 O/ k. i - #endif
) C( K, e, V2 N/ H+ K
3 ~8 q# h+ A6 j) t+ T% f6 p( C; I. k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ C% a9 t+ _- g3 f - #define STATIC_SHIFT 3
( N E1 m) u$ B8 \7 t0 t - #define TCINTEN_SHIFT 20
% @8 d# x8 ^! v7 P& n2 V# e! i - #define ITCINTEN_SHIFT 21
* n, g% C! m5 \6 g! k - #define TCCHEN_SHIFT 224 @, y' F) Y% W; [' X Z
- #define ITCCHEN_SHIFT 23 M9 Z8 U. s: |9 R) G
- / Y( c6 L/ D: L+ t' s% S
- static volatile int irqraised1 = 0;
1 U+ M5 g/ W& I+ F) M: a& J# s( K - static volatile int irqraised2 = 0;: G M3 l& ]. p
1 ~0 c7 X; V: u& O3 S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 K# u2 E9 Z% W1 o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' K& B9 j8 F" M) y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" b1 L( W+ i; [
/ q5 F3 @/ v7 _, R: s* c5 L+ T- dma_addr_t dmaphyssrc1 = 0;
+ Q R! P2 V9 \5 x+ J - dma_addr_t dmaphyssrc2 = 0;
) Y/ r5 U: z. l: ~% p# [ - dma_addr_t dmaphysdest1 = 0;
# q$ Q" b, T4 {7 D! ?+ l - dma_addr_t dmaphysdest2 = 0;
' g e* e, |5 s, y/ u
2 s5 V4 Q& u/ K( b" t- y- char *dmabufsrc1 = NULL;. U) a# u# n6 |( Z* }: r( K
- char *dmabufsrc2 = NULL;
5 c* E' l. {1 c - char *dmabufdest1 = NULL;' ~& e# f3 a4 Z/ F2 u
- char *dmabufdest2 = NULL;) O+ Z1 `3 @5 I, W9 }) X. A3 x1 m
. } q8 J2 q( H3 o6 U# E- static int acnt = 512;
5 K" t" q: l3 s - static int bcnt = 8;
- R# @+ _ T: b" `, h - static int ccnt = 8;
+ T: A0 K, I& Q# M. d6 k8 e - ( {8 L" Y$ l' K$ C9 X9 K# S
- module_param(acnt, int, S_IRUGO);
% D1 @0 l9 ^& m" d. X - module_param(bcnt, int, S_IRUGO);) ~- q! C5 ]8 X, P N
- module_param(ccnt, int, S_IRUGO);
复制代码 . ]% Y G! ?4 N
: A- t" r( C8 {: a0 I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! b2 ~8 T; {8 z$ [5 @: v5 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# O) L. v4 c& I+ Y f" D, I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 J! o6 n4 ]9 k7 v
( p; A/ f& u8 ~* ^0 W
9 z( ^; k, H. P |
|