|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % K% G9 q) o, }- ?8 U9 c
- [code]EDMA sample test application
3 o# u3 s6 z+ U3 K, t+ V - /*
, T+ M5 h& r; w% u5 j - * edma_test.c
% F# x% F; E' J0 d' `+ F0 G# g - *
$ v4 S, x( w4 {* x - * brief EDMA3 Test Application
% p+ |+ j- \8 E. e7 B6 [8 g/ ` - *
" h7 F' M o+ _& o) k$ ? - * This file contains EDMA3 Test code.
, M& v8 f" @# F5 w) o( J5 |) d - *4 _# Q' ^; X+ y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 ^5 ^& t6 C" q8 f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 Y5 _) z* w, t: ] - * TO CHANGE.
% P" U7 y( i$ @# j, O9 J - *! h' e' I+ ]* k3 Q0 U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 Z/ I0 C6 [6 b/ h: c/ Z! l
- *& F3 |% y! y. }( t
- * This program is free software; you can redistribute it and/or9 L! x/ P4 u: s5 ?$ l6 G
- * modify it under the terms of the GNU General Public License as
; {$ Y7 ?( |3 | - * published by the Free Software Foundation version 2.3 S5 h3 N5 s6 _0 R% p5 R# ^6 s) F
- *+ U6 P) S0 U/ [$ \5 N$ m8 t+ F9 T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 |& j; ^' m# A5 e - * kind, whether express or implied; without even the implied warranty2 }3 r7 Z: k' o- v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 y7 w) ~& v; `2 \ - * GNU General Public License for more details.
* i% W" } v4 u' W7 ? - */% U9 R2 H6 `4 X2 x9 x5 }. ?& b0 `+ g
- % ?7 s7 u4 R9 A- F; z) R2 X
- #include <linux/module.h>
8 T- V4 ?0 B- o" R! }/ c5 T - #include <linux/init.h>
# |+ y& z# F/ s$ l! A - #include <linux/errno.h>4 O h: ^! Y; a0 _ K; v- ], a& J* W
- #include <linux/types.h>
3 s: X" W4 C3 V2 U$ Y. W - #include <linux/interrupt.h>
' b+ M7 ^6 H' ~& A: g5 n! P - #include <asm/io.h>
7 n7 I+ ^$ q1 o/ @, Z% c - #include <linux/moduleparam.h>. W ]" \( c& C0 p! v1 d2 R! Y
- #include <linux/sysctl.h>8 {- V6 v# h2 ^
- #include <linux/mm.h>" ]* ^9 S0 u- h/ N( y% `
- #include <linux/dma-mapping.h>' B) M: W) [/ C& y7 w( U% C
$ h3 u( R- N1 R/ V1 ~6 d- #include <mach/memory.h>
: i3 q6 J8 v* S" B - #include <mach/hardware.h>
9 B# Q1 M; @* t- Q( F9 A1 z - #include <mach/irqs.h>5 {4 ]$ l5 Z/ F0 w6 J! p
- #include <asm/hardware/edma.h>
+ K; y; l2 _* V( q2 Z, ~) R
! [% C* b- P% |, t- }( s5 L; g- #undef EDMA3_DEBUG6 S" t6 Y0 X. l2 S' j- }% z
- /*#define EDMA3_DEBUG*/8 D/ t& ]/ N' k' [
- ; v& e1 A; |" ~) A2 Y
- #ifdef EDMA3_DEBUG
2 m8 y3 z. O2 Y* u# @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ @+ W4 h$ X, Z" Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- }$ j- d0 n0 Q, `& k# Y) H1 b6 [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" |6 k& `7 k- U) [6 O
- #else
+ L! k$ |2 Y6 ?" k+ C! @ - #define DMA_PRINTK( x... )9 l7 Q% b3 Q# S, R) V6 n ^) j% B
- #define DMA_FN_IN
8 g6 k2 n' F/ L1 y) j" N - #define DMA_FN_OUT
1 ~+ I, |+ {" d2 N - #endif
+ \" V9 s5 J% z7 G: J# `
n. B# \! M( @ g) A" J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; z0 ] Z$ J" {- G; g& F - #define STATIC_SHIFT 3
- V* u- \) z4 d r' I* p9 [! N: f - #define TCINTEN_SHIFT 20; [6 R' I2 t) ^. g: q: D# C9 Z+ ^
- #define ITCINTEN_SHIFT 21
" V( P) l+ |& o. [ - #define TCCHEN_SHIFT 22
- U |9 P# O9 Q, e, ^! L+ z# x - #define ITCCHEN_SHIFT 23
- X1 ]7 f% w2 n* h+ p - ( Z) S/ U2 w$ j, D9 |# n8 B1 ^; ~
- static volatile int irqraised1 = 0;
+ Z8 ?2 y* V' Z3 [5 ^ - static volatile int irqraised2 = 0;
- R* G5 E8 `1 @6 w' |5 v
7 L, R: j- U! v5 S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 r: D8 W- E: j6 ~& _8 g" [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! q6 m: V$ |& O9 C6 Z# q7 B% N7 X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; P+ K# B" S2 g
& U- d& r) _" i- dma_addr_t dmaphyssrc1 = 0;/ M4 x- t: {2 ]! M% D5 l4 @: n a
- dma_addr_t dmaphyssrc2 = 0;# G0 _9 I9 ~# E% I5 T. W$ K
- dma_addr_t dmaphysdest1 = 0;$ [9 \+ `8 ?; X/ ?
- dma_addr_t dmaphysdest2 = 0;3 z5 J7 P. d* V/ i3 Q0 `
. C0 P* T7 u$ l% h+ J! s- char *dmabufsrc1 = NULL;
+ ?: V9 f3 G: H. I2 @! q6 D - char *dmabufsrc2 = NULL;- ?9 f. O1 M8 X- I
- char *dmabufdest1 = NULL;
6 R8 g7 a& Q9 D9 R0 ]4 O3 x - char *dmabufdest2 = NULL;3 D6 a: B1 T; }( C. _: r8 M
, G- _, e, `/ t+ s- static int acnt = 512;
" ?1 b- g! y* m! q- S- P - static int bcnt = 8;
+ r8 P' y( ^4 J - static int ccnt = 8;
0 ^; x% X* J3 D2 h6 |! Z/ x! o - 0 X3 |# M0 j) W* t3 A: [
- module_param(acnt, int, S_IRUGO);
9 b. E) a" E. x0 l, F - module_param(bcnt, int, S_IRUGO);
& s" h& L0 q6 b; ^) g6 J# l - module_param(ccnt, int, S_IRUGO);
复制代码 - S, G! s+ f, G
9 k+ v- U0 w, B8 n5 O: F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( S) a; Q/ X& @; \0 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! X& ^; e. m6 p$ d/ g" H* v8 v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 r/ A! q* x1 I8 i7 ~1 R
% @4 t: o4 E7 E
# U0 h0 Q' J6 m5 } |
|