|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: S5 r9 ?% b) b8 c: w0 }" {6 [- [code]EDMA sample test application/ z8 J2 H/ A4 ]" ]! H
- /*
; T# u7 K6 i) g' J5 A3 k - * edma_test.c
a' d7 }2 |. \ - *
8 j, _/ U3 l# L4 s - * brief EDMA3 Test Application
& X$ s8 i# u1 [3 v - *
, {$ [1 v( _" N* |: {3 u" K7 i - * This file contains EDMA3 Test code.
' _% a. A2 ]! Y( \0 p# L - *
8 L+ D: b) { z2 }; Q& ]; d7 ]1 U4 W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, G4 r5 E2 W' _& @# ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, N# g) }: A* K8 H8 t- o- e Z - * TO CHANGE.
. F. l! j* n; T" {) k- z5 b* H* |6 y! }) ? - *
2 `4 @* c: D/ }+ @2 c2 N V q, ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' ~7 `4 [: l. } - *1 H) d4 c. ~, ?- E5 e# }& m
- * This program is free software; you can redistribute it and/or
: Y* T, ~$ J; [( Y( U$ k - * modify it under the terms of the GNU General Public License as
. e( O; {, {5 Z* |& U( t0 |6 T - * published by the Free Software Foundation version 2.
1 i0 |( w! {& r* |* G - *
0 p( [# H8 \$ R4 W# H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any }; o+ R7 P R7 A( F$ T& P5 x
- * kind, whether express or implied; without even the implied warranty
( f5 _, K) |- q+ u/ ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 V7 m9 L7 r9 q& g) R7 u
- * GNU General Public License for more details.
, @. H- ^" ]0 M9 h4 Q; j+ C3 h - */4 z! J ~( ?# d9 h$ `: G8 R
- / V7 a0 A! ]& c- d O$ M' b
- #include <linux/module.h>
' h% Y, a+ q* B5 j9 _% O7 K - #include <linux/init.h>
: F& N4 N. ?: E( i4 |& Y% _ - #include <linux/errno.h>
7 J6 b: C, t: w. z1 E# o& n! R# I+ W% U - #include <linux/types.h>
7 A$ m, E: ?: z8 P% W7 `8 c% ~ - #include <linux/interrupt.h>
$ E6 c# Z' d$ C - #include <asm/io.h>
8 s; H6 H2 X: [9 k4 Y0 R7 w0 u - #include <linux/moduleparam.h>
1 o, ^9 n C; E) j: |7 b: z - #include <linux/sysctl.h>
9 A& g3 G7 y# _0 |9 l0 G - #include <linux/mm.h>" q$ C9 f# {, o2 w8 G% W
- #include <linux/dma-mapping.h>1 E8 ~6 p# r1 P# ]4 c# s# ?
% w- W( b; H, ~4 p7 K5 ~! H- #include <mach/memory.h>* B/ K7 s" K" {# I- s- P
- #include <mach/hardware.h>
4 Q( V. s! J4 H - #include <mach/irqs.h>8 [7 {5 L5 u. z
- #include <asm/hardware/edma.h>5 v' x- d& z: g+ r
- 1 ]" }; i& l, _* ~
- #undef EDMA3_DEBUG
8 V3 I, y; o A. o' h7 w" f2 s - /*#define EDMA3_DEBUG*/2 v& G6 [" o5 H* _/ m# i
3 O1 U1 Y) X) R6 `( L- #ifdef EDMA3_DEBUG
( q" h1 K5 O1 k' [9 R# w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 S, d/ ^: B# v) P, p. B9 A" n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( _; i( T2 ~; P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ @: y1 Q7 W1 ^' ^ - #else
0 c. l7 t& I8 F K: Z1 q - #define DMA_PRINTK( x... )5 a8 f. Z3 B. ^
- #define DMA_FN_IN; `7 y+ v' I P ]% F
- #define DMA_FN_OUT, m' V3 j4 I2 h1 E2 E7 _
- #endif
% k$ @6 a8 P; E. e( i8 ]% k
$ w2 `9 O# {! m% L5 _- #define MAX_DMA_TRANSFER_IN_BYTES (32768) E0 X; C" Q% j z; K' a
- #define STATIC_SHIFT 3
. `6 D" N# X6 d6 o* H9 w2 ` G. p - #define TCINTEN_SHIFT 20
; P. k6 E/ ?% _+ O1 @ Z6 U* p - #define ITCINTEN_SHIFT 21
# F @$ G/ A3 A2 ? - #define TCCHEN_SHIFT 22
) B! w- k, H. T- R - #define ITCCHEN_SHIFT 23$ @: a7 W* a- \$ x
- 2 @/ |0 T8 ^0 H5 @% G( I
- static volatile int irqraised1 = 0;! I6 l2 ^ I9 h2 t$ s7 Q
- static volatile int irqraised2 = 0;7 ]; @+ _. D) \ H) [0 {# G) W
' W+ \4 n3 N6 f0 B& f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; w$ v! U" |; T6 Q/ Z% L {# r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ D1 p& h3 P; d8 i0 g# i& d* @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" B. v' i# m+ \ - : N; F7 g5 D O$ \, ?! b7 `6 t
- dma_addr_t dmaphyssrc1 = 0;8 _) J# w# h+ _- Q% f9 T0 j
- dma_addr_t dmaphyssrc2 = 0;6 ]4 ]% Z9 q0 u* t" [7 b, v v, v
- dma_addr_t dmaphysdest1 = 0;- j2 \+ T! l, H7 @" j8 S; f' W
- dma_addr_t dmaphysdest2 = 0;/ W" b0 S1 S+ F4 B4 f: p
& T9 X3 l+ {5 e m+ p' i! F- char *dmabufsrc1 = NULL;0 `# t& g# \5 o2 H; l% R& l
- char *dmabufsrc2 = NULL;1 I1 R7 E4 @% {* R1 w
- char *dmabufdest1 = NULL;
% M5 h" p( p' [5 _ - char *dmabufdest2 = NULL;/ E% u0 H: Y9 K1 J: C8 I; p
- ' o0 G- z& J5 i( W. U
- static int acnt = 512;
) j9 L$ J x0 _" G [+ B) \ _( R - static int bcnt = 8;
# I# e! K, e2 ]$ y - static int ccnt = 8;# v$ i( W4 P% V, K6 L5 l$ f
- ; a, }: y: r4 n2 }
- module_param(acnt, int, S_IRUGO);$ n& L0 S! o7 n1 ~# a5 e8 I
- module_param(bcnt, int, S_IRUGO);
$ S1 m9 Y8 e7 U - module_param(ccnt, int, S_IRUGO);
复制代码
0 l0 y2 n. I1 k; E( d2 U) N6 i% h+ {6 ^. l0 S3 a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 [6 b* _8 A$ Y. I; I! G1 h2 C. _
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 O9 D( W* L+ z* U- s# H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! s( X; N8 ~6 H5 T( h
, Q4 k- V8 Y9 [$ `4 D8 l
& a J( q2 K/ b! j" ~ |
|