|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 M$ G' T1 y" r- [code]EDMA sample test application
1 Y U& ?8 p, @ - /*
* Z! |) T. v4 @ D - * edma_test.c' h, E: e2 t, i7 x. K2 n7 N" G6 z
- *) @) r, ~/ c' V5 b! v
- * brief EDMA3 Test Application
6 O5 }" l2 w! c - *) g# V( N# W8 Q; [" f5 G1 v
- * This file contains EDMA3 Test code./ g7 `4 m3 I+ w3 q/ Y7 V7 J E
- *
4 G- i$ W( J2 f/ E7 P' c3 F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- O3 T8 E9 @# j. d" Y; [7 ]! g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* }6 @9 U3 \- I# z - * TO CHANGE.
7 E& d1 k+ F7 V- n - *6 L7 \1 x9 Y6 J3 x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 H: A O9 U L. [
- *; @& z* r6 y- d
- * This program is free software; you can redistribute it and/or
7 B0 f0 i1 I2 `% n, N0 _ - * modify it under the terms of the GNU General Public License as
+ h. r6 K& \9 X8 v! W - * published by the Free Software Foundation version 2.
: u* R L D4 ]; t8 {( L' ` - *- t$ X1 D( j$ _3 ]8 K0 _+ A. J( B& B; L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 c$ r& W! P$ j; E. m; U$ N# ` - * kind, whether express or implied; without even the implied warranty
+ l7 _$ h5 b- ]# ]* d* Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 p8 E0 O; b* H" v; c8 u
- * GNU General Public License for more details.
, _" W- \0 T* U - */* L* c) ?8 ]4 T: W1 ?
- " `1 M2 c7 {( Y( @1 W; u
- #include <linux/module.h>- g& n2 D. a. c. T* U
- #include <linux/init.h>
F" U5 \1 H$ N# Y0 s+ w3 X - #include <linux/errno.h>
( a" r+ A5 f3 n6 y5 J - #include <linux/types.h>
: m6 Z2 D, h4 d) ? - #include <linux/interrupt.h>
. v6 E$ _0 M0 {# ^0 A7 _ - #include <asm/io.h>5 G3 y4 x* e0 a$ U9 \
- #include <linux/moduleparam.h>, u; n6 S$ B) ^4 y3 k8 Y
- #include <linux/sysctl.h>
0 @" o* C8 {! K) V - #include <linux/mm.h>
: @/ j; T+ `8 n4 w- h - #include <linux/dma-mapping.h>
D* G" D5 o8 R& x8 D/ v - 4 I9 l$ o# l3 s* @/ {2 o
- #include <mach/memory.h>
. |) A% M; q7 E2 g. H3 h& x5 d/ c - #include <mach/hardware.h>
$ M+ ?! F M( M8 d3 X: [6 g% a - #include <mach/irqs.h>
4 |4 \/ Z3 | V5 b2 M& ~$ o& V - #include <asm/hardware/edma.h>
/ Y. x( x. r! ]
: k- A8 n3 G; W; T( U# L& ~1 Y- #undef EDMA3_DEBUG
& ^/ E6 ]' K4 F9 N. U" W8 k - /*#define EDMA3_DEBUG*/
5 l" Y3 C& N6 ]( T8 K7 o
1 P+ C( g4 [! t- h7 Y- w8 i: _- #ifdef EDMA3_DEBUG- r. b; N }' ~4 B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ K. @0 v$ }( s" _: t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% {* V- w% ?% r0 R! Y! V+ Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# Z+ | [4 y+ W' F
- #else9 i! z5 k: Q; s; l- {1 a* {7 Q9 c, h
- #define DMA_PRINTK( x... )
- m! K8 k. N! P - #define DMA_FN_IN
6 g6 x o: C+ X5 J Y - #define DMA_FN_OUT
" o$ H! [6 _! z( [ - #endif( c r) u, t6 f! R
- / b% q; y D; p$ ]" A9 |% \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 ^0 I' |8 o' Q2 v e
- #define STATIC_SHIFT 3
6 {2 r7 Z/ h; N# d3 C - #define TCINTEN_SHIFT 20
0 P; u7 K( z9 R - #define ITCINTEN_SHIFT 210 r/ h+ f$ A% X8 \+ H: Y
- #define TCCHEN_SHIFT 22
1 d: {$ b0 ` p3 L - #define ITCCHEN_SHIFT 23
: ^% @/ ?: X2 B/ Q' H - ( ?7 B7 H0 \3 K& Q
- static volatile int irqraised1 = 0;6 X8 J2 x5 {) ]& y5 o
- static volatile int irqraised2 = 0;3 W' t% t4 c0 h2 h' y. u4 [
- " V2 L# Z5 M- D, `9 Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# `# W+ I# s: K' u5 H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 i+ `* K+ h6 v( l2 t4 t- ^! Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 i& x d' s8 E% [2 S - / L7 @ w3 }2 P' _, ]
- dma_addr_t dmaphyssrc1 = 0;: u9 i" Z1 {0 L& `
- dma_addr_t dmaphyssrc2 = 0;- }, n+ Y6 K9 m# n+ n9 b
- dma_addr_t dmaphysdest1 = 0;( \5 l1 R0 D1 g% p' m2 ]. A' a
- dma_addr_t dmaphysdest2 = 0;5 X# q) C2 y2 a$ E1 U x! P/ c
3 c3 j' g) W! o$ Z7 A, l- char *dmabufsrc1 = NULL;' }* F/ @! M$ H0 p$ W S3 z' I
- char *dmabufsrc2 = NULL;
# G8 n( Y' c9 S2 Q8 o! j4 [- q - char *dmabufdest1 = NULL;+ L9 d" J% ]! X
- char *dmabufdest2 = NULL;
, P( x+ O- \, ?4 x) ~( }- h8 I: H - 1 d$ Y% A6 P4 H5 _
- static int acnt = 512;3 ^7 A5 z# r8 o5 `: i. g- h
- static int bcnt = 8;8 S5 L4 A' e! z0 l3 b2 V
- static int ccnt = 8;) l* y$ u. G7 Z% k
- * o% v; O Y ]6 R( O: G
- module_param(acnt, int, S_IRUGO);
6 m9 X @/ [" b+ J) c" ?# d - module_param(bcnt, int, S_IRUGO);3 ~$ f: p1 Q/ F7 ]: l( {2 D% d; t
- module_param(ccnt, int, S_IRUGO);
复制代码
8 i3 ^% s% h$ @/ k; _
0 |) a0 X" z$ Q4 [) \/ s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 g# T) m; c7 y/ C0 n1 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ b: n, `* m9 w& I6 U0 y* R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) l- Y. S! I' B& v1 Q3 d) j
9 `9 g0 Y! T0 K, w3 [: ]* E
$ S# @; B3 P w; s |
|