|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* b4 o1 R! W4 U- [code]EDMA sample test application9 }4 J! w+ N" n# R' @# U; b( R7 |+ k
- /*
: s: A/ a! u3 i2 c" I! |% x7 l - * edma_test.c, g/ ?: Y- m( y
- *) }9 }3 i/ T) [" `/ U" A; _3 J
- * brief EDMA3 Test Application) W5 V) D# f* z* U
- *
" w5 t* m5 i) p( V( M$ B - * This file contains EDMA3 Test code.
5 f, q1 ]$ k' M( E4 @3 w - *0 d7 |* D) O% }3 r% _8 w4 r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 n% Q J) R) ?- _! Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: K# M$ T+ n4 h+ v; ?7 \# g - * TO CHANGE.
$ V8 b4 I5 \+ F( S3 Q - *
9 S, g: d3 b/ H1 B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% b5 N5 y( S8 L7 J - *
6 @3 q; I" P* ] - * This program is free software; you can redistribute it and/or, O# J5 b' i4 I% T+ z2 t" z( p& R
- * modify it under the terms of the GNU General Public License as/ a) _3 ]$ o0 p& ^
- * published by the Free Software Foundation version 2.7 ^* G3 N# ~* V7 H# [4 _' d% I
- *
1 z2 T- l6 \, G: U; z, E7 S) r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! a6 m' j, f6 O ~2 G) B7 E
- * kind, whether express or implied; without even the implied warranty
' `, V& x" m- l. l x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% I+ Q! K' q) K7 ^2 c - * GNU General Public License for more details.
n/ |" c( Y! m9 U" }" y" W: E - */$ p1 r( C9 j& `, S+ m
' P$ z4 e; B" |* ^- #include <linux/module.h>
6 }* z8 _8 A4 F% C1 i% f - #include <linux/init.h>
& w" n# f8 l& ?" ~. r9 T. M - #include <linux/errno.h>: X; W& n# f4 n& \1 S! Z% i6 s- M
- #include <linux/types.h>
$ n* W& a, Q, [% O" j: d - #include <linux/interrupt.h>: y* Y! p2 a9 u. B6 M' h( b# R
- #include <asm/io.h>
. O# C3 ^/ \$ L4 M. h _. ~ - #include <linux/moduleparam.h>
; I+ X' d: I% i- f, e - #include <linux/sysctl.h>2 b* Z$ q+ b. a' ~6 H4 r0 X5 o' o
- #include <linux/mm.h>
; n) g. h7 O) c. e+ [9 F0 j - #include <linux/dma-mapping.h>- d5 [& H/ F( F9 U" |" _; Y
- 0 y' E0 {* l1 \/ X9 C
- #include <mach/memory.h>9 C5 _5 B0 G) I. Z) A
- #include <mach/hardware.h>
7 P, Q2 g0 k& H* U% I! u7 B - #include <mach/irqs.h>0 H6 K3 m# l8 w: k; l2 }
- #include <asm/hardware/edma.h>/ J5 g7 d" y# g4 l& b: f- u
0 V4 q# P C7 H- #undef EDMA3_DEBUG5 |' Q7 r9 F4 Q9 R( ]7 h4 S4 r
- /*#define EDMA3_DEBUG*/0 i* q. ^1 ^8 }0 p) j0 o ~
- % G B) u5 F1 A3 I( |, O* _! S8 f
- #ifdef EDMA3_DEBUG# a" ?# W4 h! q3 y. K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 R- K3 @) |1 f+ V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ D+ \3 I# x7 g; E0 ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 R/ N& D* [- Z: {& m: |5 k g- ]8 a - #else
1 l1 p" \' `' @ - #define DMA_PRINTK( x... )) T; [: Z0 E( d: k7 N
- #define DMA_FN_IN6 C/ R# X' Z( |. ?: O. e
- #define DMA_FN_OUT
" T& I' w1 f6 K - #endif
! ^! N& L; S% ]( w2 `
& ?0 y2 [4 Q: v2 Q, N5 ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" y6 k( c S0 M) h* S - #define STATIC_SHIFT 36 @) e( M D& d. |7 W% K
- #define TCINTEN_SHIFT 201 G9 q. t; l& {/ _
- #define ITCINTEN_SHIFT 217 W) D$ s; G3 ?; u( k( D% L
- #define TCCHEN_SHIFT 22
/ y. u4 R3 o" y. O8 W - #define ITCCHEN_SHIFT 23 b; u5 N, p1 T+ w0 h
; s# z5 G- g& f/ n, a& q- static volatile int irqraised1 = 0;
( g: S) N# R8 g8 g - static volatile int irqraised2 = 0;. h) x! i7 L& h7 c& T, j
- , _( `& p. ?6 s7 t6 N) }, p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& n' b5 u R- A- K7 A5 G. _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ B' G8 q- D# [5 L% K3 g. t( k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ M9 l8 m; X+ z
- , i1 P/ L& M9 V( [, _3 a
- dma_addr_t dmaphyssrc1 = 0;
1 C- k L5 T. a( F1 S' d - dma_addr_t dmaphyssrc2 = 0;- P/ H5 |* q3 a& H- y
- dma_addr_t dmaphysdest1 = 0;
' L& g. q& w: G% J% Y - dma_addr_t dmaphysdest2 = 0;
! o9 a" I/ H9 T) Q
2 j. z s" p4 N9 Z- char *dmabufsrc1 = NULL;4 [, W, g7 l' \6 I3 u$ _8 S" o
- char *dmabufsrc2 = NULL;2 m' M; s6 ^5 d* x; @
- char *dmabufdest1 = NULL;
' I/ p/ I) l" _$ s b/ |! P9 E - char *dmabufdest2 = NULL;
) s' }* d- V/ ]# q- F - ( {. u7 A8 A0 T% a6 [
- static int acnt = 512;4 n9 _# t: W9 C: L
- static int bcnt = 8;) `3 T0 u% m& ^# f& q/ ]
- static int ccnt = 8;
7 O1 k+ K/ y) o7 d' T
# g1 Q1 b: c/ a& A+ i- module_param(acnt, int, S_IRUGO);
" J8 W8 p, Z( V7 h7 G7 z4 h, { - module_param(bcnt, int, S_IRUGO);
5 Q: a/ V5 |( M' B, c0 a; D - module_param(ccnt, int, S_IRUGO);
复制代码 . Q5 ]$ ^9 Q6 r6 l- ^: d
5 E* b6 ~; X" h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 l% O' q$ ]3 o8 }+ Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 [' {2 S9 D9 {* S( K# H) R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* S! C- N8 X% b8 O9 ?. Y$ l
- ~4 C9 R( I- i& z: D; Y& h* B `* [# V! L
|
|