|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
_+ O. T5 o: O4 _% d& O- [code]EDMA sample test application! r( y1 P' @9 r5 Y
- /*/ d$ M' \: o/ [4 c8 ^; C5 C
- * edma_test.c
/ x2 P) T9 M, h0 `, U8 J# P - *1 G9 x) o) Y$ L' ?
- * brief EDMA3 Test Application9 s. _1 c7 q: V0 s
- *2 s' M6 e. I1 @! V; Z+ G
- * This file contains EDMA3 Test code.: q; L1 g& V+ R( x+ P
- *( O- } G# L- ]4 G+ f2 E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 Y+ B! k/ F) A, v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 J( K# S! U9 N! e! F
- * TO CHANGE.
# A, Z- }1 _2 S( Z! b5 I - *
" ^- R- f, d" @& Z, |, d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 c2 B$ x. _, K9 @ - *
5 Q+ w: H D0 g' h) R4 I% R! ] - * This program is free software; you can redistribute it and/or! @0 d5 Q* H1 F0 D
- * modify it under the terms of the GNU General Public License as
4 o6 M% A% V( g - * published by the Free Software Foundation version 2.' w% a- L- Z% U$ l3 w f
- ** M4 U0 S( u2 F& Z) B$ h+ A# U% D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- j3 O% T( y( H6 ?- ?- b8 r! w4 t
- * kind, whether express or implied; without even the implied warranty
2 _- A6 ?6 m% N p& n9 Q5 i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! s: D7 W* i6 G; h# x0 _6 i; B
- * GNU General Public License for more details.
4 u& w; s E4 S5 R# l9 ^8 I - */
, [9 @& L G: ]( N2 J - % _3 M5 U# `' h5 t9 u
- #include <linux/module.h> l/ Z, t3 g/ h3 g7 s1 c' t5 h d
- #include <linux/init.h>+ u X4 L: E# n9 r1 x* `, L
- #include <linux/errno.h>
) m2 V! s4 E A H# p2 X/ y( j - #include <linux/types.h>7 ~6 I1 K E2 ` t+ R
- #include <linux/interrupt.h>
6 A( N+ U, M+ R, ~9 y# z - #include <asm/io.h>
# s. b6 @ D0 [* w - #include <linux/moduleparam.h>
% g, |$ v3 o& D9 c+ r1 X - #include <linux/sysctl.h>
6 V7 z: V$ B, X+ K" B. H. ~, V - #include <linux/mm.h>
2 f, K, V s; y! L8 U: } - #include <linux/dma-mapping.h>
9 j) n1 {) i. i0 T - " R5 n) o) D* {1 q0 V4 _
- #include <mach/memory.h>
/ \& Y2 x& [4 u; ~. s# f - #include <mach/hardware.h>
$ N+ N( D i! V# c$ s1 a - #include <mach/irqs.h>/ b9 _- F. n# b1 N' N
- #include <asm/hardware/edma.h>" c1 @: D8 }) p5 ^9 \
1 k9 e6 g+ k* ^- #undef EDMA3_DEBUG" Q7 Z- y5 ~- J8 A. j6 J$ Z! ^
- /*#define EDMA3_DEBUG*/: d; l& X& J9 e3 n% E' h& [8 s
' ]- Y/ X' Z* H) \! r# C6 }- #ifdef EDMA3_DEBUG
8 U; J) K8 [' w* u$ d6 Z8 l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); `% n! z: F4 c( W0 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( w1 I& V8 V0 P9 H4 H6 @; w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, \9 q2 L4 G. z5 B' w - #else
* o5 w& e5 f7 Y - #define DMA_PRINTK( x... )
. m. c) |; C( I7 C - #define DMA_FN_IN0 U2 F. i. m& K5 w) M2 @4 a
- #define DMA_FN_OUT
& g" p+ E8 E: X# {4 c - #endif
0 q5 K7 r* |$ y- u0 H# U$ u! A
& z' X% M7 ~8 H1 E& N, ~$ P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 R9 h$ i# k6 B- X# e# S+ q
- #define STATIC_SHIFT 3' L8 w$ r# J% a( \% s- S
- #define TCINTEN_SHIFT 20+ U) m; O( b$ N" Q4 G
- #define ITCINTEN_SHIFT 21
2 z# f! g( P0 A4 W0 g2 \/ \" h - #define TCCHEN_SHIFT 22* w `) t7 J F5 `' L
- #define ITCCHEN_SHIFT 23
/ F; l2 o( m. |+ N; S
( W/ S, F9 j8 }0 K7 `% s- m# b( c- static volatile int irqraised1 = 0;" W2 x; o- O3 s: P0 G- E# }
- static volatile int irqraised2 = 0;
" C3 J+ k7 [* v - 1 F r5 L8 [ [" M" f7 Y' C5 f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ _* h e8 \: }, R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) x4 a3 r" c9 w4 B$ ]5 k' `7 Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! N6 @ h |- U I2 F: }% \
# N7 z4 h4 \; H1 z `; C4 O( \! C- dma_addr_t dmaphyssrc1 = 0;
( x6 g3 J z* G, l( Y- j% J% m - dma_addr_t dmaphyssrc2 = 0;
$ S# `) w b' b% w3 u9 | - dma_addr_t dmaphysdest1 = 0;9 X. H0 \3 A5 P/ Z
- dma_addr_t dmaphysdest2 = 0;
/ N Z4 w) M" @$ i( H; w
- b. P4 {7 f% s" _, i# g3 |- char *dmabufsrc1 = NULL;3 \# c: K9 @8 ~3 @6 o% A4 U% z( C5 ^5 X
- char *dmabufsrc2 = NULL;
: l) I/ i, d' y7 W* G% k' ` - char *dmabufdest1 = NULL;0 O6 @) U c! @1 V9 O$ c( ?
- char *dmabufdest2 = NULL;3 r- f7 a8 T# J+ f
- 4 O. J$ {& y3 w# } J
- static int acnt = 512;4 u4 h4 x, q% p6 Z, E( }+ f. S8 E
- static int bcnt = 8;; t. M) M# T: m( Z
- static int ccnt = 8;
- V& W; a- _9 k' t; H5 k- }
, l! E0 ~' t$ ~" u- module_param(acnt, int, S_IRUGO);1 L/ }+ t8 x3 I) r- u; F; F
- module_param(bcnt, int, S_IRUGO);
5 o) J% A! G7 a, G A+ A2 b - module_param(ccnt, int, S_IRUGO);
复制代码 ) O; z( t5 f$ y
) O( p. u" E G6 X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; H2 J) a/ b& f3 R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) t# ~* ?6 e5 I( b% }5 d" R) A" @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ e3 b( h" P& c- ]( L4 j& q6 v( b: K4 q0 s
2 s6 _1 X. ^4 N' Q/ W) z; V
|
|