|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 I! {! f1 ?6 T3 }; r- Y
- [code]EDMA sample test application
) D1 K, g# ]4 a8 n7 S p - /*
8 ?( L1 ]# j: E( Z5 I1 V% l, C - * edma_test.c/ L# N, _6 C, J( W" h2 U
- *# s! r' {# x: b, I0 }2 h' L
- * brief EDMA3 Test Application
. \& c$ O5 x/ h3 t5 H' p - ** L M1 t3 S g1 A9 D8 r9 t' u
- * This file contains EDMA3 Test code.
5 T; p- Y% n3 Y: B) {1 K0 s - ** @: g4 A1 y* y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; G; v9 B; W: V9 ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! k5 T' Q4 t: v, N' k$ ` a - * TO CHANGE.! o7 |" I1 J- U5 n" f- s
- *
7 M8 e0 z- L8 \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 e. a/ Q4 p1 i6 q a; e - *
5 ]! w# ]5 i" E z+ ~ - * This program is free software; you can redistribute it and/or
- z" D6 Z8 I+ Z1 Q- r8 U" c1 o - * modify it under the terms of the GNU General Public License as
4 N `! h8 {+ ^1 _+ @+ X6 J: f: M, T - * published by the Free Software Foundation version 2.
L* ^$ z' N4 C6 }9 R - *' I1 N) y" Q7 [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 P3 ~5 e' f# g: t% e, M- a2 Y - * kind, whether express or implied; without even the implied warranty5 n$ H; q, {) b7 S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ a0 |* x) z, ^; ^' n+ |
- * GNU General Public License for more details.
$ ~- O+ {- y# c* t - */
* {, C+ P) M5 i- E
9 s( [' J5 D+ w7 ?, I2 ^- #include <linux/module.h>; p. [; _, P% t
- #include <linux/init.h>+ B) n: u* w8 |6 X
- #include <linux/errno.h>
2 ^: v. E0 }7 P1 z - #include <linux/types.h>
3 Q+ g+ h) G/ ~# ]& n - #include <linux/interrupt.h>
; @& J0 _0 c, h8 b$ p- { - #include <asm/io.h>
* S: b6 `0 X# @% Z/ U - #include <linux/moduleparam.h>$ r2 U: m% g, c6 |8 B: O
- #include <linux/sysctl.h>% Q2 Y W4 X. ]
- #include <linux/mm.h># `4 c! b: N( W! ?1 @
- #include <linux/dma-mapping.h>5 V. q$ c: C; g! w. u
. J. `- Z% e! m4 C- #include <mach/memory.h># G3 j- ~. C- n9 Y {) X! l3 d
- #include <mach/hardware.h>' y+ N- {, Y* E9 |# @+ `! H( N
- #include <mach/irqs.h>! Q" w. `0 Y* y8 H' k- c
- #include <asm/hardware/edma.h>
0 P' y8 f1 \- Y' C7 l0 w8 c- v- [
5 V. P) @4 [" u- c6 l+ ^0 ]- #undef EDMA3_DEBUG
) d8 I4 ^# t& M - /*#define EDMA3_DEBUG*/+ P$ X; C: @, g, b& ]
- 5 n+ Z7 N* m0 s' R2 M6 m
- #ifdef EDMA3_DEBUG* O+ g* O5 v; X6 Q6 s+ l* I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ v' {/ e- D! e3 y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 A J6 q- p& [7 A7 h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& f! }3 B' Y6 R. `6 q O
- #else" N: S3 j" U1 B$ i
- #define DMA_PRINTK( x... )
; k3 M2 ~3 o' Y# X - #define DMA_FN_IN
! x! _- e2 F+ L4 g" x" ? - #define DMA_FN_OUT
1 |+ ^9 d/ F% b3 w - #endif* g' W# |3 P1 K) X' H
- 2 g( e2 Z! H+ J V3 i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) b$ g! h E+ N; _% Z: u9 b. g6 u9 ]
- #define STATIC_SHIFT 31 t2 I; o& w* E8 b% o
- #define TCINTEN_SHIFT 209 K. U0 t7 _8 g9 V
- #define ITCINTEN_SHIFT 21
& w2 l8 y; }; P - #define TCCHEN_SHIFT 22/ Q6 o- h9 f$ C$ q m
- #define ITCCHEN_SHIFT 23
; O2 D% ?% z6 x+ N; @3 G4 Z - . f C3 k0 E3 y$ n0 c
- static volatile int irqraised1 = 0;
$ T) u4 ^- o+ e' e4 o, r W- Z! r6 w - static volatile int irqraised2 = 0;
1 c- D/ Y9 ~: e8 X
4 ]$ `6 Y2 e' p0 M6 a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ E8 U5 P. A8 N; m/ w. z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# M. g9 R3 P1 _' y% ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 Y- O8 s! z F
7 _+ l8 F2 K9 S, y0 g' G- dma_addr_t dmaphyssrc1 = 0;4 S7 x$ `- e% O w! Z& \2 Q: |
- dma_addr_t dmaphyssrc2 = 0;! ]2 ^- d& ~# J ?4 Y
- dma_addr_t dmaphysdest1 = 0;: N$ P# e$ m6 K* S; i
- dma_addr_t dmaphysdest2 = 0;
4 }( l( C- o7 [5 F7 ^- m# `3 H
! v' W6 i* C& L; [- char *dmabufsrc1 = NULL;
1 \' _! }( m, D8 } - char *dmabufsrc2 = NULL;
" ^* ~- B4 W; I! c% h - char *dmabufdest1 = NULL;
' D) U- q" ?. X4 C$ Y - char *dmabufdest2 = NULL;/ j- S4 K0 w! A
- 4 V4 e, N0 Y ~1 R' K& V
- static int acnt = 512;8 D7 q# l) D3 M- b% x
- static int bcnt = 8;
# L3 ]6 u( s% ~/ i: r - static int ccnt = 8;
+ @% j+ \) ^% v( E# t$ }8 p1 y2 K7 m - . J3 f. l; q' i- Q7 G0 o9 W# Y
- module_param(acnt, int, S_IRUGO);: x) U- {& N: p9 P/ B
- module_param(bcnt, int, S_IRUGO);
- Z& i& p0 [. ?5 n, D" Q/ s - module_param(ccnt, int, S_IRUGO);
复制代码
& I! o+ ?$ e+ W. U' d' e! L" F, z/ o$ D! N' `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 t V) I9 n& p. A: O" b- Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: p$ m) t7 @/ S) C! U8 n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: L$ i* Z2 |/ B- B
& f+ t4 {$ x& j3 r) ~2 P" f; J0 A5 H2 H" ]0 K
|
|