|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 @# C$ d1 V$ C7 w1 R
- [code]EDMA sample test application
& Z6 r( s! x L! Y$ w+ g& R - /*& K- Q3 S1 T. W7 H$ j
- * edma_test.c- h" S' W. ~, Q4 e
- *
: P% n6 A( }, s( Z - * brief EDMA3 Test Application6 V5 E) L! o' }% }# j
- *
' S) h# R' H5 { - * This file contains EDMA3 Test code.8 p% k+ \+ l" D
- *
0 Q* ^, C4 f# O: ~' M+ r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ P+ v9 w9 T) ], w5 f4 C7 i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: A6 J8 H2 C" M" ` - * TO CHANGE.) O) J6 T N# N+ D( a9 ]
- *
. J' i4 _4 h. |( T) q" O1 ^- n2 G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ R( |* T9 n7 Q3 ^& `9 }$ q
- *
3 i, \4 k8 h8 X7 _! l8 ]6 W# B - * This program is free software; you can redistribute it and/or; T0 B# J9 r8 S2 }2 l4 a5 W; R
- * modify it under the terms of the GNU General Public License as/ ? S8 b! K. \9 X$ q3 o! N
- * published by the Free Software Foundation version 2.# e4 w) y) T" ?, y7 C
- *7 K: }3 X, ~ s/ l4 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ n* x1 q7 ?, i* w' @8 k" w - * kind, whether express or implied; without even the implied warranty: E( D9 w1 A' y# H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% E& ~, `8 \+ `' t! y9 e - * GNU General Public License for more details.
" A6 f/ n G. U/ L* s2 D9 c - */
7 A1 A4 [% b1 v5 a a" z
4 l d* x# R1 g. n# V) X: o- #include <linux/module.h>
: w h, k) \ b6 m# a% }; v - #include <linux/init.h>! Y8 F8 _+ F5 c# K& w
- #include <linux/errno.h>5 M0 J7 B9 B. U
- #include <linux/types.h> X* @+ l5 c9 O$ b; D' A
- #include <linux/interrupt.h>
2 O0 K9 X, f- f* m. I* e/ D3 [# c - #include <asm/io.h>
+ t- c# J* b$ } - #include <linux/moduleparam.h>
* ?. C/ a- N9 O - #include <linux/sysctl.h>0 S0 \+ {/ O# J4 h) ^5 W4 z# H
- #include <linux/mm.h>
7 c" Z( @; u- L - #include <linux/dma-mapping.h>
% q6 p8 c2 X4 A
, P& [* J: n0 O* S- #include <mach/memory.h>
, x, j4 W e: G- ?( _) K - #include <mach/hardware.h>
2 u& j5 X- d ` D6 y1 u - #include <mach/irqs.h>
7 B1 f2 ^7 U; W4 B3 V1 t - #include <asm/hardware/edma.h>
6 G2 Y3 W/ y# E$ g f
: N1 P$ v9 e" i6 j8 Z4 M- #undef EDMA3_DEBUG( e! O9 R8 v) i8 q- P
- /*#define EDMA3_DEBUG*/
* b3 q0 `5 }7 h0 I) Y5 N - & X0 k: l3 `6 O! Q0 f V
- #ifdef EDMA3_DEBUG/ R8 p+ |* R) W/ r2 L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' s$ @; {$ W+ {6 d1 h6 O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% k; \, `) c l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ |0 x2 {- T! H- W% `) ?$ W
- #else
, G6 k4 T, w5 }1 A; j2 f - #define DMA_PRINTK( x... ), T, R, O) M. C4 H
- #define DMA_FN_IN: c& o$ A% i% W! D- G- s2 f3 [& ~
- #define DMA_FN_OUT, d; Y. V0 U. _5 n2 c
- #endif
5 N7 s. {: P0 R: L; O7 f1 x - ' g. D, O* @6 I* D, A1 E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" Z7 ~# \( l+ W* p! B+ t' | - #define STATIC_SHIFT 31 W {! @8 H" l# x. P S' H9 e
- #define TCINTEN_SHIFT 20* U% _/ P: ]* E3 O+ L8 c) R3 P7 X
- #define ITCINTEN_SHIFT 21
. P% a$ k, } B6 k, Y4 D, M# ` - #define TCCHEN_SHIFT 22$ W H7 F0 K: J* j+ R( E& d
- #define ITCCHEN_SHIFT 23
$ E9 O/ o; U+ n( G) E
1 y& e% l( d0 G7 l: m- static volatile int irqraised1 = 0;
6 n, B$ U1 g1 }1 \( E1 S6 Z W; H& y - static volatile int irqraised2 = 0;1 g( C* n& k+ {& P
- # U9 ?6 P A0 x, b) a! ~- k7 a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* g% B' }- {% D) s6 y3 c1 G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! o+ \4 M2 V* h- }$ } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 J- u5 f8 F* W7 I- n' D& J! r
$ z* m, ^1 |! Y- dma_addr_t dmaphyssrc1 = 0;8 V) X- j: ]" ? h
- dma_addr_t dmaphyssrc2 = 0;8 V8 O6 c' y2 g
- dma_addr_t dmaphysdest1 = 0;
4 J' K0 d& n, K5 L! d+ m - dma_addr_t dmaphysdest2 = 0;: A. S3 n: Y% @/ }, D& t
5 ` z1 }7 u) D" T! E+ `4 a2 L- char *dmabufsrc1 = NULL;
) M0 ~* ]0 G# U- i K9 a6 g - char *dmabufsrc2 = NULL;$ A+ v, }; P. U! z% N( f" J
- char *dmabufdest1 = NULL;) H2 d) v& e, b3 b2 K8 Y# H1 l2 E
- char *dmabufdest2 = NULL;
- N$ O" ?1 G3 {! k% o - 0 u. g9 v8 @+ i* E
- static int acnt = 512;
0 q* b7 \4 T5 ` d, k - static int bcnt = 8;% h5 R# y- N5 x5 o, _$ B
- static int ccnt = 8;
2 n$ L6 {8 t9 I7 W; b5 L4 B8 ?" O( x
- k. c& Y/ G3 R f/ e9 D- module_param(acnt, int, S_IRUGO);4 E1 X* D: m/ x
- module_param(bcnt, int, S_IRUGO);
1 K; G# D+ K( g2 e0 X8 J - module_param(ccnt, int, S_IRUGO);
复制代码
4 C" b2 K, x F) p% _* P7 _
5 H( o/ D; G: S$ W& t0 | 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, p! E+ n; T, karm-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 a' `5 x5 _# `* i, r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) k4 U. j9 m. A( b7 n5 B9 B$ V: \
! W( `3 F1 P8 q7 b2 {3 J' X6 g6 m6 h/ g$ ?& i
|
|