|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 M5 k7 m! M3 k0 C5 o
- [code]EDMA sample test application
5 [' b5 d3 D* y# |7 U# [: r Z - /*
2 Z1 Y! P, s- L4 t9 ~0 R - * edma_test.c8 a0 J% P$ P1 ^1 B
- *1 P; R2 D. @; ^7 ^! B4 ?* G% Q& [
- * brief EDMA3 Test Application
$ y I" }9 S& j8 z - *
- ]9 w5 @4 ^+ | - * This file contains EDMA3 Test code.7 u% x0 x z4 W c
- *
: K, u. c& Y* _) j& @6 I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% ~$ d5 l+ A: a- ~" @3 w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* X/ ~ ]4 I+ @: u3 ` - * TO CHANGE.
1 A) E* l; H) F - *
8 n# O- U9 m3 f( u0 ?) V0 v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 r8 n& c+ W! s6 k$ H. l - *
% c) q) ~, m! T - * This program is free software; you can redistribute it and/or
0 R! X1 m% w/ A6 T8 S! w- b: F - * modify it under the terms of the GNU General Public License as
6 E; V. b( u; G6 B% {. {* d - * published by the Free Software Foundation version 2.
$ @ t! x5 [; ^! P2 P - *+ F3 @8 i0 _ f. R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& G3 r R3 e5 @4 ]0 |9 H - * kind, whether express or implied; without even the implied warranty
( s8 F) C; ?. H+ L( F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& u& ~* y# G# D# L! v: K/ S. Y9 D2 C
- * GNU General Public License for more details.2 e! Y+ K3 ]8 V/ I2 c& K" }; D4 T$ {6 ?
- */6 R" I2 J* B% ^3 v
- : H' J* @8 h3 n( q1 X+ u# N" Y. j
- #include <linux/module.h>
5 a& f. J1 M' r! J9 P8 B7 J - #include <linux/init.h>
/ @5 q' a! s! u3 W - #include <linux/errno.h>1 j2 n: |1 z1 ^ Q1 U/ [8 Q5 P
- #include <linux/types.h>
; K0 k! P5 w8 @2 J - #include <linux/interrupt.h>& y$ s# R$ d9 i k) p
- #include <asm/io.h>
. r7 W# p5 ^; x: q - #include <linux/moduleparam.h>
+ s" _: g- d' R - #include <linux/sysctl.h> B* K9 }* u9 j/ L8 ]2 F8 _
- #include <linux/mm.h>
7 u# J" j E* W* x - #include <linux/dma-mapping.h> P5 S" S, @6 `9 P5 K/ r) N6 |% m2 E
- 9 T2 b+ \- j- Q, }
- #include <mach/memory.h>* t, |9 `- O. t4 K9 w
- #include <mach/hardware.h>
# \* B& y1 c3 |' ^; Z - #include <mach/irqs.h>
6 g Z W; J* X - #include <asm/hardware/edma.h>
1 K @0 y# i3 c. ]& b
6 \# ?: m( h' d8 r5 o- #undef EDMA3_DEBUG0 b9 R' A4 @4 E: [' X" ~5 b
- /*#define EDMA3_DEBUG*/
2 U. o" ~8 _7 |& a7 g, }
9 G" _& d+ ?5 }- #ifdef EDMA3_DEBUG- A$ M# F9 i2 v/ Y- |5 O8 S" Q$ P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! w* l: u8 V- B' f/ C+ ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ Y6 b. O/ G* n4 R) ?, D$ W) M) _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' B1 U7 t/ r7 D - #else
8 u& P8 o% J, W8 ~ - #define DMA_PRINTK( x... )
3 M0 O9 a3 A- [ - #define DMA_FN_IN1 p1 d( o: |6 G2 J
- #define DMA_FN_OUT
$ B! J$ w/ H5 Q6 k - #endif( ^! [% y) o2 l$ z4 V
- " X |) d6 T) ~6 h: u7 }. @# G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" i9 N5 J' x1 W' P& m) P O - #define STATIC_SHIFT 3% b; G* x. C* R9 m2 E Z+ r5 b( R5 u
- #define TCINTEN_SHIFT 20% a) X4 K) l+ u# l
- #define ITCINTEN_SHIFT 21
% Q. m4 k% x3 ^2 Z' m - #define TCCHEN_SHIFT 22
\. ~. {6 `/ L: s. B - #define ITCCHEN_SHIFT 236 D" Z' ]2 V6 f8 f
8 x; L0 O; [5 Q% n* d* W. [7 Y: A- static volatile int irqraised1 = 0;
! f7 X, c3 I7 T' Z0 X0 N3 K - static volatile int irqraised2 = 0;
% ?, N1 F' c1 @8 j* {' d - 0 C" o( i! G! N. g: [$ M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 y; g v. L, a& a2 G1 I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 [9 ]+ [% [2 n5 D( i1 j3 k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# ]1 b, l# U/ f) r" C: b" u; M0 V& G
# [2 \1 |! r' v! m- dma_addr_t dmaphyssrc1 = 0;! J$ Y1 j" y! S1 T5 h' G* B
- dma_addr_t dmaphyssrc2 = 0;: y# r, b( H) }
- dma_addr_t dmaphysdest1 = 0;
5 A8 x( x' ?8 o' w: ]# P - dma_addr_t dmaphysdest2 = 0;" a- D, Y1 S1 h) U
2 |7 e, H: L, d$ x8 d* R- char *dmabufsrc1 = NULL;8 W# ^2 ?2 S* Y# g' _6 }5 v
- char *dmabufsrc2 = NULL; |' j1 m& l+ v( k& i. S
- char *dmabufdest1 = NULL;
/ R i; c' d( \$ u, W7 i - char *dmabufdest2 = NULL;
! z$ ]# \, L" E% U - 8 c5 l7 i; z0 _7 Z' D
- static int acnt = 512;
4 i2 V& v, t- @6 w8 B7 { - static int bcnt = 8;
% h) R& ?; p% w8 B2 W, _! J9 q - static int ccnt = 8;2 K; b7 L( Y& j; g% |+ k
5 k$ N X: L- L+ }8 n0 N+ }- module_param(acnt, int, S_IRUGO);
r4 F2 ~* w$ T) j6 Q - module_param(bcnt, int, S_IRUGO);
4 r+ Z8 b) d) u - module_param(ccnt, int, S_IRUGO);
复制代码 ; t' z1 A+ g$ n4 g
) b( f/ I9 b* _$ _! a7 I0 P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 i6 @. r* T3 O) qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: [3 L: P4 g( o; m- |4 a1 y! J( o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 t% i) @1 W4 V# W- T, u& m5 C. R$ M& _. l6 ~. _ D; }- _) S
0 G; _3 y: C0 ~ [; K. ^# n- n |
|