|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" J9 I' J% V, i$ ^ w- [code]EDMA sample test application7 Z6 h3 E; ?! U( M+ h, b
- /*% r+ A, c3 c( n& W d c( y
- * edma_test.c4 ^5 L) s; S# [* b1 f
- *. B$ r' Q/ u' w/ Y D4 @
- * brief EDMA3 Test Application
( Y! N: J7 ?; p& r! v - *
1 x9 C0 e a& `. Q# p/ S3 c - * This file contains EDMA3 Test code.
( L& C* p# \# C& g1 p! l - *
: F1 X$ [" a ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) L2 m6 c. q* | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 N! b6 ]# a2 r& n) g - * TO CHANGE.
+ Q4 A+ H# [7 i3 V E7 d L - *! O7 o3 Q4 p0 P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
j M: `. b1 I" S - *
8 a9 w$ N' [- r) Q; f: z8 Y7 @ - * This program is free software; you can redistribute it and/or8 d, {6 p6 M" F& K9 f: L
- * modify it under the terms of the GNU General Public License as' H- \+ N4 x/ U0 @! f; }, j6 @0 o
- * published by the Free Software Foundation version 2.
" Z. N2 U6 t9 T - *9 \( o& {4 T! g/ @0 i) o# p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: Y. R0 z- o$ |: \) {
- * kind, whether express or implied; without even the implied warranty
. K/ x3 A# ]- u& P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 ~4 o: V& m' r$ G - * GNU General Public License for more details.% L( Z! [" }% `" O
- */
$ l2 ]; y! M6 C. [+ Z( F
7 ~3 V7 \1 {1 j) j- #include <linux/module.h>+ P) U; s) K, f) }
- #include <linux/init.h>( r4 F1 v% a+ D+ Q2 T7 W
- #include <linux/errno.h>
' e* N! C% ^$ h4 J - #include <linux/types.h>
9 v3 {4 o2 Y' W M6 M8 o - #include <linux/interrupt.h>: o- d4 W# v: H# ^8 B
- #include <asm/io.h>) p9 }' r- d+ C4 A$ a: p) w! q! z
- #include <linux/moduleparam.h>
6 G% s6 ]( x1 ?1 D4 ~; q$ r. M2 W: ? - #include <linux/sysctl.h>& d/ s0 q* p$ c L4 e* O
- #include <linux/mm.h>
! ]! u" U: L9 I2 B$ J5 {$ u; f( H5 K - #include <linux/dma-mapping.h>4 j, \6 y0 l& @4 J5 |
- & o; q: m6 k: I3 t
- #include <mach/memory.h>
" K& Y- @! z$ B9 `# @ - #include <mach/hardware.h>
5 w: I. n6 y w: Q - #include <mach/irqs.h>. Q% B$ j. A. H8 e/ N8 r
- #include <asm/hardware/edma.h>
+ {- s& ]7 S( n
$ d. V" L' M8 ~3 F* E" c- #undef EDMA3_DEBUG0 W' v& L) M; p! e; }
- /*#define EDMA3_DEBUG*// x! R! Q6 A+ x; T, _
- 5 o; J: ^2 o X e3 w5 r
- #ifdef EDMA3_DEBUG7 [& V, D& s; A; {2 {4 `2 P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# g% O! E# A" Z1 I! @% E! n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 I" ~0 |6 T( l9 u# b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, D! g: J# I3 e& t# U - #else
; M9 p3 {3 t; ]& x* v% I, D) u( P3 F - #define DMA_PRINTK( x... )1 Z8 {1 d8 [( V) `* Q7 K
- #define DMA_FN_IN4 n' K) T/ G+ z4 G5 J& ^6 c# L* w
- #define DMA_FN_OUT
; F; A+ W6 j+ i+ x - #endif4 N" o* ~0 f# }8 r$ x. T; ^" ~
8 Y8 y9 F7 s$ u$ R# ]+ K; b" _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ E5 D7 g* Y! Z/ J - #define STATIC_SHIFT 3
% [" o9 M4 U: {( f, e" p9 ] - #define TCINTEN_SHIFT 20* x& f# C- H# S
- #define ITCINTEN_SHIFT 216 } C) E& d4 y+ A1 O7 k/ z
- #define TCCHEN_SHIFT 225 i) l; q1 a/ a3 w7 _5 l) h$ A
- #define ITCCHEN_SHIFT 23
4 \% a o6 ?5 X0 r s - . f+ E0 z7 D0 @$ F1 y& g' W
- static volatile int irqraised1 = 0; ? A, B6 L" U% c
- static volatile int irqraised2 = 0;, z$ f& v7 k! D* M9 W
: v& X2 h {3 d; O9 G. @3 ^6 x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" w% j2 r2 g) t& i2 J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* P2 }/ g9 k8 c# h; D* U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 U: A8 I1 u4 U$ q
- 3 I6 ]2 S# K( |0 Y/ W, ] V
- dma_addr_t dmaphyssrc1 = 0;
7 c/ R: l# v- B! V6 a - dma_addr_t dmaphyssrc2 = 0;
% C d# h; P8 H( _: q" H5 N: e - dma_addr_t dmaphysdest1 = 0;
4 U: R# G- m! t: F9 ^" D5 { - dma_addr_t dmaphysdest2 = 0;: k: _, W2 o& D, R8 c
- 8 i! P9 A* K- h9 _* L8 Q
- char *dmabufsrc1 = NULL;
4 z& i8 g. e5 N8 g+ c- W& c - char *dmabufsrc2 = NULL;0 C+ k0 o' L# X$ l$ ~& U
- char *dmabufdest1 = NULL;
v' Y) ?1 W( x" L3 `% v - char *dmabufdest2 = NULL;
& S4 d# J: O- x6 w
3 I) i. S7 ^) e$ U- static int acnt = 512;
* Q D8 r( g( v - static int bcnt = 8;
, X+ ?$ F% R- B4 u: }; M- @5 i. l - static int ccnt = 8;
+ ^9 ?. w6 _, \/ f& X. w$ c - / T% ?! I+ d1 ` x0 D% }2 ~9 Z# T
- module_param(acnt, int, S_IRUGO);
) u; G& q) E, P - module_param(bcnt, int, S_IRUGO);: B2 E8 x0 n- m, ^ Y: q
- module_param(ccnt, int, S_IRUGO);
复制代码 $ e9 p0 n' _- h! I2 ?
' S* ?0 |+ E4 @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# N/ D9 N6 b8 R) d- l* ~9 b1 ~7 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- l* h. V! T, u* F+ H ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 X$ L! t+ Y, n. ]
3 b) F. C) f. A" H
3 O! M" S8 R) P1 [6 U4 }. E |
|