|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / ~3 M8 i7 i8 R* J( u6 |; d# Q
- [code]EDMA sample test application, u# [* M2 E8 p' o$ d" y7 p( E
- /*: Z- k' d& n6 t$ d1 c' B, ~6 n
- * edma_test.c0 Y) x7 s; ~; a/ c/ z! a
- *6 D0 ]4 _. s# v q- U
- * brief EDMA3 Test Application3 D' k6 r q$ H: x; x. L
- *
4 i& D2 x" c" o$ G" D - * This file contains EDMA3 Test code.) W3 k% U O6 I1 c+ i3 q' }: r, ^
- *" S( a8 k5 O1 o: W) v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 c/ j f( r+ @9 l6 r; `) Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
l( U8 T; ^8 N* ? - * TO CHANGE.
) f6 E: t& {2 W1 y8 E - *
4 Q1 O( {5 q, H* J9 s/ @: i+ D; z6 Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 Z. a; a' m, d; z) h6 F( Y& I7 C - *$ b. ?$ u6 t* K: r; h$ I% t% U
- * This program is free software; you can redistribute it and/or
. p* m/ S2 r7 d) `9 N - * modify it under the terms of the GNU General Public License as
) \' u8 O9 M5 a R& W' ~ M - * published by the Free Software Foundation version 2.' M/ s7 h1 @- ?" n
- *2 t, ]/ s0 F @1 f4 `9 y# H @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) W, d ]% n; B' \7 f: i5 ?. Q. @6 @ - * kind, whether express or implied; without even the implied warranty4 _7 N0 Z* G& Q/ H D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 t- C- j5 K; {1 o - * GNU General Public License for more details.
& a; B6 M7 L# [& ]# _# g! k - */: m+ p- `+ r8 M: U# C# ~6 I2 P
- " l, f& ~# q+ M1 g5 W& v9 u
- #include <linux/module.h>0 O7 H6 C) n) b) B
- #include <linux/init.h>4 ]% N1 [7 T4 t+ b
- #include <linux/errno.h>7 G$ Z5 ` Q1 a2 S
- #include <linux/types.h>
; U8 [. j6 G3 v& x9 N4 w7 l - #include <linux/interrupt.h>
5 a' A' `1 ^3 e$ l# D7 c - #include <asm/io.h>+ V8 e* e+ g. `) W3 O, q/ M0 K3 E6 a
- #include <linux/moduleparam.h>5 Q/ P2 Y& G% R m
- #include <linux/sysctl.h>
' @5 F T* X8 J - #include <linux/mm.h>
/ r, n: |: B' d& T; u6 h - #include <linux/dma-mapping.h>4 W! n3 I5 P) H
5 R p) W# ?8 E, P/ e1 `- #include <mach/memory.h>6 p, x, L) g L# p- n- f( E
- #include <mach/hardware.h>* Y" {' d9 l( T0 u* z
- #include <mach/irqs.h>
: u& E0 {4 T8 p W( v* q% E O5 d - #include <asm/hardware/edma.h>
8 d3 {% N5 u! Y - 2 b& ^9 W8 i) l$ d. ?/ |9 K. R- ?5 W
- #undef EDMA3_DEBUG0 m' {# ` ]3 P' r5 H
- /*#define EDMA3_DEBUG*/% w8 c% I$ R! k! `& l* |
8 E1 t4 I2 I# G! F# N; c- #ifdef EDMA3_DEBUG& r+ U3 x6 E5 Z' U+ A0 \/ i) G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 f1 r1 s: y& y! H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). F, h! j6 L( e; \" X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% U: J ?& Y( W# G c% X1 ^ _
- #else: ^, _+ x7 P; l' ]
- #define DMA_PRINTK( x... )6 P: m4 J( p" A
- #define DMA_FN_IN. K- Z- |* M9 V
- #define DMA_FN_OUT7 |, }" m" a8 J' m: d) z
- #endif
2 x& ^' Z$ l+ H# h" d4 K
% D/ K8 |, r$ F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
A" |3 \* Z; m T2 ?8 x- L8 G5 \% w - #define STATIC_SHIFT 3
5 r2 s/ _( [2 @ z d - #define TCINTEN_SHIFT 20# O6 D1 D) `: R' q% v
- #define ITCINTEN_SHIFT 21. X& I* d6 F! h
- #define TCCHEN_SHIFT 22$ @/ P" z/ M8 y W* a& B+ F
- #define ITCCHEN_SHIFT 23
" N8 b( U5 T. \& Z* O A - ) E+ Z. `# Q; ^: Z! ?7 S( L3 m
- static volatile int irqraised1 = 0;7 G* v3 F# H9 H" I$ Q; _+ X" x
- static volatile int irqraised2 = 0;
1 e' x2 M, I8 M/ a0 I5 B* m, C# e5 b - # E% W4 P1 X# J! J- Y7 R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 c( @$ e1 i2 R8 E5 T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 e# W6 k4 ^' l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 B1 b7 u# ~4 k' S3 g. B
- ) D6 P+ G3 l2 r o( |. l
- dma_addr_t dmaphyssrc1 = 0;7 ?! c6 k% L6 l$ b; s y
- dma_addr_t dmaphyssrc2 = 0;& q/ j1 t6 N6 z: R7 R
- dma_addr_t dmaphysdest1 = 0;0 f( l$ ~. h7 Q1 t- F7 U" B+ {, H, _
- dma_addr_t dmaphysdest2 = 0;
$ G+ G0 K2 @, g - ! A/ Z/ }( |8 P$ o7 b
- char *dmabufsrc1 = NULL;
1 U& ?+ v; N$ ^! j8 | - char *dmabufsrc2 = NULL;$ i4 Y0 Q' i' c5 X
- char *dmabufdest1 = NULL;
. x3 C1 p8 Y" D" o/ c - char *dmabufdest2 = NULL;
) p9 t7 ^( }6 X5 ]* r) F, d6 }
% J. v! @% Q" k- static int acnt = 512;& K5 }/ f' c A7 y& W
- static int bcnt = 8;
* S j, t M# L - static int ccnt = 8;) F6 R; C1 I0 y5 ]) v3 g+ B7 R' ^
- & _; `2 j( |7 ^) q1 B
- module_param(acnt, int, S_IRUGO);* `4 z/ p8 [" t9 f7 t7 Y6 r o% X6 t
- module_param(bcnt, int, S_IRUGO);0 t* g0 j5 c- P; s w5 d
- module_param(ccnt, int, S_IRUGO);
复制代码
+ v3 W& d) b' u+ H
& V- e7 h5 t1 ^) x: S7 ~+ V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! F: ?6 _! l7 Y; }% M/ varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 B5 D7 q8 _2 {& E }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( N6 ?# N0 r/ A; \" P
+ L8 H2 C4 K, v4 G) V, E* }9 e1 w, @2 K; E4 i+ l: o: D2 H7 |9 b
|
|