|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# A8 c+ P% j% o' l- [code]EDMA sample test application1 t& q& t$ j4 [. k. f
- /*
' U0 B: o* n% Z: K& z* |5 V3 ]2 R - * edma_test.c
8 {5 V. s2 x5 o$ {2 z1 x - *
# }1 ^ ?/ s; z0 ]0 \5 ]0 J2 [ - * brief EDMA3 Test Application
- r6 G$ f9 O3 r7 h; }& N ^; Y - *
0 Y% q8 D3 ?2 _( Y5 o& } - * This file contains EDMA3 Test code.
& s* M! k, M2 O1 I3 \ - *
2 e0 K! b7 M6 C3 I+ P - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* G7 p- W2 i2 g8 x" F: ^( z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ L2 M: i5 G2 P2 Q. f, x$ \
- * TO CHANGE.7 [$ D5 V, T1 I" P2 X/ D: u
- *# S# b- d$ g5 J) `: g: b2 H5 R9 `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- Y) n3 t9 n9 @0 Q; H - *# y u z9 J# y. f+ P+ D
- * This program is free software; you can redistribute it and/or
, Q) T5 X5 g0 S1 g+ o9 A" @4 x9 q: j - * modify it under the terms of the GNU General Public License as
; u; m6 L8 [2 ?& A3 w - * published by the Free Software Foundation version 2.
& k& _. K4 b) h8 r1 G/ T; n - *
% P2 T1 w' W$ A1 @. W9 `3 n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 |! p/ I% @# w - * kind, whether express or implied; without even the implied warranty
' O% K3 }5 W* Q' ~4 i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! B1 ^' K% D0 X' ~( J - * GNU General Public License for more details.4 O9 Y5 @/ f- w9 B
- */' o! X1 ]' s: a% Q
3 Q; j& [$ k- S, V( R/ m3 x/ @- #include <linux/module.h>
4 e/ V8 y4 N4 t. t - #include <linux/init.h>, }1 D/ h, }* Q. Z9 J( H; d, M; {& m
- #include <linux/errno.h>9 o; ]& E* l& m1 E# F; k
- #include <linux/types.h>
7 V9 ]2 J* u \7 \3 O) r - #include <linux/interrupt.h>
" c+ K- c1 T/ p - #include <asm/io.h>
" H7 g; J% _% }6 F$ ~# ` - #include <linux/moduleparam.h>
9 K* R, Y( d( E! X: }0 ` - #include <linux/sysctl.h>
6 H: _- U3 o4 {4 A: @$ t4 d3 q - #include <linux/mm.h>
& [; K% _ r- S9 r* Y: h5 d - #include <linux/dma-mapping.h>
: p! ~+ w1 N: T+ V. |2 q
$ R& P: y/ P8 ?6 d C6 K: Q$ [. r( k- #include <mach/memory.h>
3 e& e$ J& L. R6 U' `# N* P - #include <mach/hardware.h>
2 x) b/ | H" ` b, e w, ]- j - #include <mach/irqs.h>
/ s6 I; _8 }& H/ O( \ - #include <asm/hardware/edma.h>
: Y5 @4 K5 B: H: J( P3 | - 5 h( E7 F* `$ a/ R8 l. Q+ Z
- #undef EDMA3_DEBUG+ G/ f0 h1 y2 N# U! R9 Y
- /*#define EDMA3_DEBUG*/
+ [' Y* ]' ?, d2 c - ! y1 O' k" u. ?# b- ?6 w
- #ifdef EDMA3_DEBUG; y6 Z# A; j7 T, {! }. T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# p' [1 ?0 U$ ]5 b; w( C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 d9 G. \8 ?' y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 c# c" j( x& K7 |) e
- #else
6 S9 {5 T* t6 |% l: l - #define DMA_PRINTK( x... )
; `3 ]; X: O7 ^% s: J2 s9 e - #define DMA_FN_IN
4 @4 l! F- B3 @( E {! k" I - #define DMA_FN_OUT
/ o' s+ P# b9 Q% X# C% R* O - #endif
* [) e" V# @2 c# z5 m/ _$ c0 Y
% |( r3 ]' \( q# t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! I1 w0 h9 G' ?6 K8 ?" z; d - #define STATIC_SHIFT 33 K H! r2 N1 f q9 C
- #define TCINTEN_SHIFT 20
6 h1 Y1 g4 g: A7 N - #define ITCINTEN_SHIFT 21
( K+ M! P. ~! b4 e8 o - #define TCCHEN_SHIFT 229 @+ G# E! M! L8 A
- #define ITCCHEN_SHIFT 23
7 W# v& {# J; @0 g" p; n2 X) Y
4 B, ?1 H& Q; U3 f8 D* w( W4 X3 T* x- static volatile int irqraised1 = 0;
5 ~% g9 V/ x, Q) _ - static volatile int irqraised2 = 0;
. g4 c# j* o5 q" o - $ A" Y X9 T' A6 Z+ t" O+ A/ d# p8 d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# ] N4 {0 F% Z+ q) I) a$ k7 n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 w j7 e$ v. n5 x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- v$ ], U8 i7 f! m3 Z0 N
5 n6 c4 @) O: x4 ?- ^' Z- dma_addr_t dmaphyssrc1 = 0;
& s) c! t1 |3 W% m; D/ Q( m - dma_addr_t dmaphyssrc2 = 0;
7 @. N$ e# y9 u, }9 } - dma_addr_t dmaphysdest1 = 0;
% k6 X4 [7 F5 R! h - dma_addr_t dmaphysdest2 = 0;1 _0 a% N0 p+ j6 V k8 Q
2 S2 l! Y0 y% q" h% ^9 M* [- char *dmabufsrc1 = NULL;
+ Z- ]0 `# q3 D5 z. L6 B - char *dmabufsrc2 = NULL;& J% `' a/ C. M8 C; a0 f* F
- char *dmabufdest1 = NULL;+ f) r% y( M0 `" M0 f' L
- char *dmabufdest2 = NULL;
& L) }% s7 S& a4 C/ m
+ e/ P {1 e' i* V- static int acnt = 512;7 e+ W" F% P$ m: z8 e
- static int bcnt = 8;
1 E2 N1 j. h1 v5 m% `) I% b# E+ w: s - static int ccnt = 8;+ C( h2 x$ C; H! w
- 7 H1 J5 @ P( M$ Q3 |
- module_param(acnt, int, S_IRUGO);
5 l: {- ?) l7 R4 o8 g5 b5 t" X - module_param(bcnt, int, S_IRUGO);2 N7 ]2 U- C, ^$ M6 M9 m' I
- module_param(ccnt, int, S_IRUGO);
复制代码
w8 w* p/ c: x. d% A' M: p J( y2 [# V6 T0 r9 _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# p: m7 n' A* g7 a+ {7 E, r7 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 r6 Y/ k% ~' U( f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' N, X! v9 I+ S
6 ]5 }. Z( N4 g q
8 W& i5 h. @# d' w- Z- ^ |
|