|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ @* n# t, w4 U) ~1 a ~, E- [code]EDMA sample test application
1 _9 N- J& I" T2 }# f9 g4 L0 F - /*$ d9 Z: O k t5 m0 U9 j. _
- * edma_test.c
( b" z7 S- |1 ~: k( k* O; Q' \0 Z - *
5 d1 X5 h: g" P- F6 F - * brief EDMA3 Test Application7 R. s# v* b* S, p; k
- *. F' a6 q6 N; Y3 _2 w
- * This file contains EDMA3 Test code.
/ v1 L( \: [6 Z2 }8 W% u - *! Q+ G, z5 K# F% D; t( f3 e1 i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; O8 s6 n5 p& x3 _- G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ u V4 d3 \. e$ J Z! C - * TO CHANGE.$ N6 r2 D/ s- Q1 x1 h8 _) a$ x
- *
) ?0 E$ w4 ` h% @5 }; U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- e8 M( V9 f$ \ - *! w: }- b: ^7 a. x3 K4 y
- * This program is free software; you can redistribute it and/or
0 e* x3 s& r# x! l/ D$ r - * modify it under the terms of the GNU General Public License as& {: D( z+ R9 ]) f9 X' j* E
- * published by the Free Software Foundation version 2.
s0 L1 l2 A% t @! {# f8 q' q - *
: q Y7 U; u0 m5 Y) p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: O% Q. D9 E _7 y* m' X - * kind, whether express or implied; without even the implied warranty
& F6 j0 g: u9 g$ \# h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ I9 q+ w& V+ [% `9 w$ O b
- * GNU General Public License for more details.. z. Q- F" d/ C; r, F
- */
. z3 C8 H" F/ A- D4 { - . K; J: ?2 O1 Z% C D/ N; N
- #include <linux/module.h>
4 S$ v8 ^# d P# H - #include <linux/init.h>" E1 l* K8 q1 O" C: R
- #include <linux/errno.h>( |3 q* w0 Z6 d
- #include <linux/types.h>
" Y1 E0 P/ ]# k m5 i( d+ w - #include <linux/interrupt.h>
5 X# i5 u7 o* f' F. j2 q5 f - #include <asm/io.h>
0 _( W. F+ ]4 | - #include <linux/moduleparam.h>
6 J7 ~" \# S; R* ? - #include <linux/sysctl.h>! T, l1 i" o z# G
- #include <linux/mm.h>
; B8 |; K" K8 y" u9 S6 T- E - #include <linux/dma-mapping.h>
/ Y) T+ N: Z$ z9 Y; T% ~0 l" ?
7 B5 [; }1 \; E* h- #include <mach/memory.h>
# h. Q' r2 u# ?7 Z5 \/ h - #include <mach/hardware.h>, |6 x9 U6 D: E- [4 h
- #include <mach/irqs.h> D% i9 F' H* _8 ? f5 Q
- #include <asm/hardware/edma.h>
( G$ Y" `0 j% q5 Y) O - {2 o3 p+ J! X
- #undef EDMA3_DEBUG4 @- E$ W' w8 B1 f
- /*#define EDMA3_DEBUG*/* W& k( P" s& a: d ~6 \
& |& }6 A$ O, u" r- #ifdef EDMA3_DEBUG
3 n% v! h8 z4 b$ w* s. L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# k$ o/ @4 `7 l$ w, {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) @* Z! h4 a" g# d* U. \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 W/ z! Y# z3 |- X- j: F - #else
4 a& Z) D. D8 ~2 Y, r& U9 f - #define DMA_PRINTK( x... )
! [* p. K$ c( c1 n/ K - #define DMA_FN_IN4 v! a# \3 v/ X- u+ z
- #define DMA_FN_OUT$ f) E/ }1 X# @! d1 @4 q
- #endif
3 h* v6 S- [" s0 z& d - * `& K0 M e* o! E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& q1 I# C; L# V) `2 q* t( E
- #define STATIC_SHIFT 3/ Q2 V, t* F7 v6 m. H% a& Q
- #define TCINTEN_SHIFT 20
% A; w4 D+ ~2 I6 M5 ~2 ?3 { - #define ITCINTEN_SHIFT 218 H4 R! V; o/ p0 b) G
- #define TCCHEN_SHIFT 22
6 [8 Q( K; O+ p2 w, y5 B - #define ITCCHEN_SHIFT 23
2 Q" l# R$ N- w
3 v2 J. V) Z; d) q- static volatile int irqraised1 = 0;
; T! t; c! p/ K) ?/ k - static volatile int irqraised2 = 0;, J, H' r$ G' G. B% P
- / M4 v) x5 v7 y, z: z: l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# V: I! \3 d9 O* d, z& F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 ~! r9 r& J ]0 U% l& t# O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 U* I# L' @) R" X' d$ m
- 0 w5 t. v, v" H+ p: R
- dma_addr_t dmaphyssrc1 = 0;/ l+ @" J( N/ z8 F8 f2 l
- dma_addr_t dmaphyssrc2 = 0;2 M4 Y& G0 y1 X, L) p
- dma_addr_t dmaphysdest1 = 0;
3 v- C7 h4 u a' I) |, E; X - dma_addr_t dmaphysdest2 = 0;# O |- Q! n! \5 e' u& ]6 y! r+ @
. H6 a) y( J. F& i- char *dmabufsrc1 = NULL;" n# X. {9 {6 L: r1 w- E
- char *dmabufsrc2 = NULL;3 }: d- H/ z$ P+ ^8 N6 W2 X- n
- char *dmabufdest1 = NULL;5 n b; D" U' J6 k& }8 S) L2 h& N
- char *dmabufdest2 = NULL;
$ n0 v) q, W4 z7 |4 n - 3 q* W S' Y; U; R3 e+ n
- static int acnt = 512;
6 r7 X! a3 x0 b! }% a& ] - static int bcnt = 8;9 X$ i9 c/ E7 \( V
- static int ccnt = 8;0 M2 W6 U& N& t5 F s g
- " @. v& H# o" R+ K6 |5 y9 d* |
- module_param(acnt, int, S_IRUGO);2 g% u) b Z; V5 L7 d5 B$ s M
- module_param(bcnt, int, S_IRUGO);
~% C, Q% T9 w( Q t6 [ - module_param(ccnt, int, S_IRUGO);
复制代码
1 R9 _, B3 z1 ]: f
$ h% S) Y, ]/ }* y r" s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% x3 D) l- E; C4 e* _" n) i# _3 j5 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- ~5 n% [5 J+ X! ]1 y K! }& l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: L& f8 @+ b0 A5 ?& w! ^! o
% Z$ ]$ R( }& |/ B+ z& n% Q* T/ a ^/ f7 e2 R. U# |" ? P
|
|