|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 t! h$ q% ^! W# ?5 _
- [code]EDMA sample test application
% H; ^4 s" ]. \4 L& s; b6 I - /*
( Y( n5 q: [/ ?! S - * edma_test.c" k! j" j+ ` S ^
- *
, V! A) `1 ]% P/ l8 X2 _ - * brief EDMA3 Test Application
4 T" ]. y- Y2 [# J% K - *0 o7 F p& k& e& c, \, f
- * This file contains EDMA3 Test code.
6 I- }/ M2 X7 Q3 B/ z - *: B, o9 ^# H" ~5 N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' \) S2 Y8 `/ \" Y7 E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 A5 B4 o# `+ ~1 Q( ~7 n" N' S: k - * TO CHANGE.5 ]9 n: N6 l; N6 q5 }$ n+ [' s1 ~
- *
! J/ C3 j/ }3 o9 i: y7 C* T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( U8 A$ Y" l6 J1 r
- *: ^% F6 o5 h& J6 K( g) c1 I
- * This program is free software; you can redistribute it and/or
) I- `* ]& k5 Z - * modify it under the terms of the GNU General Public License as& M' q! D1 F) {9 _; c
- * published by the Free Software Foundation version 2.
+ j! U5 W/ W9 D. V - *
8 ^' o6 B9 g6 `4 H8 T5 V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ A a# A5 M9 z s/ E - * kind, whether express or implied; without even the implied warranty# p1 o1 f# h& _' z4 z& ^$ ^4 a; ~1 R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Z- b' P3 {- R9 E7 s) h% b. e - * GNU General Public License for more details.( k" d ]3 c$ l9 C4 w+ c
- */
z8 y1 H* j' l: N
- |+ E, O6 D% ?; X( x1 W' Q2 g- #include <linux/module.h>7 n3 n, I' Q8 Z( e6 G
- #include <linux/init.h>& F! R! |7 ?) c' L! L1 n
- #include <linux/errno.h>
5 N& a6 l- I& Z3 d - #include <linux/types.h>7 t7 A) C2 A: W. F2 V5 G
- #include <linux/interrupt.h>' _+ {; `% }: p; F! X& A
- #include <asm/io.h>
G1 c. ?. D8 O- h2 M - #include <linux/moduleparam.h>, e/ v. r* i* C' D: t/ ~
- #include <linux/sysctl.h>, B( A( K9 A6 m8 C, c
- #include <linux/mm.h>- D! }+ h% j1 k6 {2 P- w }5 c% R
- #include <linux/dma-mapping.h>$ d- R" B/ z: `, ^9 h7 ~% I. ]
- - c9 \) Z8 S _% u
- #include <mach/memory.h>
% B; r( @" {/ b. t9 U2 ]. F - #include <mach/hardware.h>
6 s$ g) b% \9 i0 d - #include <mach/irqs.h>: O$ t% s3 s8 ?6 f
- #include <asm/hardware/edma.h> i% u2 U8 i; q; q! y: j1 c$ Z3 t
- $ Q( k1 A( q0 s) u4 C6 T$ O/ @
- #undef EDMA3_DEBUG- V n! f3 i* l( [: U3 g
- /*#define EDMA3_DEBUG*/
9 q. d/ e/ [9 N6 `- p' Y - & g+ V; ^+ B# Y) P5 ~ J
- #ifdef EDMA3_DEBUG1 K1 f4 G* ]! w- X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 T5 D4 e) [- l( C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 e1 p" T" f1 A2 S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# q1 p5 g" p; c/ O8 @& s - #else" C4 |8 T3 H/ |; J* C' K
- #define DMA_PRINTK( x... )
$ g; Q1 ?, x- V) c: ^* T - #define DMA_FN_IN
/ _& [. M7 T7 J/ x& ^ U - #define DMA_FN_OUT$ u7 ^8 c3 w4 z- t. W. X
- #endif0 s3 D3 W# u: E1 }# M+ D2 v* G! ]
7 E! n. S! u. X; L+ ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 ~: |9 U2 s4 Q3 u
- #define STATIC_SHIFT 3
$ q2 _4 d: i4 y+ U* l, j - #define TCINTEN_SHIFT 20/ J( |7 l7 c& a$ D8 n% y' S
- #define ITCINTEN_SHIFT 21
( g& d6 K6 Q0 @3 j) W - #define TCCHEN_SHIFT 22
. n$ W( f! r8 ?# e! Z - #define ITCCHEN_SHIFT 23
, _" A, `# u2 _& h9 n - 2 Q3 m9 e f& B# m }& V) X
- static volatile int irqraised1 = 0;% E. A" e, H* n3 x7 L" ?% N9 |
- static volatile int irqraised2 = 0;
: C, s0 Q. c0 I- |8 _$ r9 @ - ( f5 a8 b% b( P& O% z7 @; o$ X( A& W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 K& H1 i( x( U9 w8 p7 w* | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) h5 a- E& p, S& N" [; [5 I; w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 n8 ?. s5 P7 X. A b
- 8 _( r1 H) p' X+ \
- dma_addr_t dmaphyssrc1 = 0;, o! C7 D8 t( Y* ]( V- P) ^
- dma_addr_t dmaphyssrc2 = 0;
2 C* e' F) Q y1 t - dma_addr_t dmaphysdest1 = 0;
) ~4 \- N1 O V% p, F+ d - dma_addr_t dmaphysdest2 = 0;
. z; H0 z! S# `) ]: j3 Q - / A1 T& l% e% N8 K; B% Y$ q
- char *dmabufsrc1 = NULL;
& T# Q/ w* M% T- s* W& p/ P4 N/ I8 W - char *dmabufsrc2 = NULL; ~; ^( V3 q0 d3 M7 z) {
- char *dmabufdest1 = NULL;
- L! ~/ K9 y0 Z: _- D4 p# \1 x: X - char *dmabufdest2 = NULL;2 c- |) a9 j. O6 S" d; m
- 3 Y- h; L( h; ^% R6 w& Y
- static int acnt = 512;
# D. \# L' z! e* \7 ^4 O' s - static int bcnt = 8;, G* f! R' ?: e- Q7 [
- static int ccnt = 8;/ f3 _( E. z% ]0 o* D( T
4 m7 ^* |8 U& Z' U- module_param(acnt, int, S_IRUGO);; h# F# Z% Y* b9 o0 H4 e, ]
- module_param(bcnt, int, S_IRUGO);
: B6 B1 h2 Y; L/ ] - module_param(ccnt, int, S_IRUGO);
复制代码
5 s4 W& v! Q7 s: e2 i$ L9 |4 O2 L
0 f: Q1 j# I7 P+ E) h/ j! b+ D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, t# \6 D/ b+ u. W* F) @. A) j' |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; ~6 }& X9 d3 f9 T$ z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# v2 Z. c, [3 I8 D% y: ?+ ^
; @8 v4 l6 x) c& ~3 v& R8 t9 q4 g: b2 l4 Q- W" O, e
|
|