|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# N4 I0 d4 G& h/ p; w R- [code]EDMA sample test application. s1 M o5 m' Q
- /*
$ b8 U6 v$ t; G+ K9 K4 u* G& O5 K - * edma_test.c, c8 l. X. z# `3 d
- *
4 R) g$ h7 q9 u, Y' x( ~) p+ m. P) k - * brief EDMA3 Test Application
* z% K' i _6 x1 D% d: C! [& h' L' ` - *- }1 b% b# g: W& D! \6 ^' @
- * This file contains EDMA3 Test code.- r9 a) K( _ X
- *! S+ ^" B2 o% j( C* ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, V1 n% k/ M3 J' F$ A# F2 }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 P9 @ e+ {! `8 O" i: {5 g5 a! q# a - * TO CHANGE.
: e4 o5 _; @5 k: E7 \ V0 Z - *
+ [- x. t, } z; U0 F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 x/ c' }, k! \7 y: `6 }. t" ~
- *' a" [8 E) I* E b- r1 t
- * This program is free software; you can redistribute it and/or5 W8 w/ q4 b% R) ^7 d9 @
- * modify it under the terms of the GNU General Public License as
' V5 G; }& X5 L& Q+ Z1 q# ? - * published by the Free Software Foundation version 2.
: [+ ~6 P" u. A: t - */ ~( a7 a, Q2 S2 C" b% @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 D% W9 t* {* E3 h! @1 U - * kind, whether express or implied; without even the implied warranty
( ~2 V$ T% ^* y+ \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! u; b: ]& \! p1 R - * GNU General Public License for more details.
' C2 x$ x+ S1 j! {3 C' Q - */! O( N; B0 B* j6 e6 @; [
- / ? e# Z( |: K; Y1 }. C _. i7 i
- #include <linux/module.h>* h& w8 Q7 J- W% [
- #include <linux/init.h>
* y* w, Z" B* W5 s' R - #include <linux/errno.h>" C* ?$ f3 t9 v6 g/ [" m. O- g* K
- #include <linux/types.h>' F9 `; x5 ?! Z% O8 ^
- #include <linux/interrupt.h>! N" U" f2 o' v' _! [) X/ o; l
- #include <asm/io.h>
7 [; X- O) c r5 ~- C0 B1 w4 q5 I8 L - #include <linux/moduleparam.h>6 b6 ?$ P; x( p6 Y1 q$ L
- #include <linux/sysctl.h>
: i! S: k+ d1 ? e5 C - #include <linux/mm.h> h8 e" e0 J$ q# Z$ `* Z1 ]( M
- #include <linux/dma-mapping.h>
4 e( Y* F& E0 d, X% z6 P
8 u; g& c3 J( m0 j* U+ u" P- #include <mach/memory.h>
$ g1 Y! ^/ G3 Y1 Z* \" O# k - #include <mach/hardware.h>+ y1 N6 ^+ R; c
- #include <mach/irqs.h>
) ]0 @) ?% j% n! F$ G - #include <asm/hardware/edma.h>- M' t! r' v$ ]
- ; S7 F/ j$ S7 m2 u4 {2 F
- #undef EDMA3_DEBUG
! m! @8 \' _9 F8 _# @" g8 E - /*#define EDMA3_DEBUG*/
% v& W* h9 }& q+ v4 {1 _" R: u7 V9 S
! c" w$ T! v' y* q! G; \- #ifdef EDMA3_DEBUG9 [. s7 J7 O3 N0 f) Y+ z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 a; m: t8 q5 `- l$ Z l! f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ O" L; t) {% E- E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) a6 u* k: o6 v/ h% E6 N) Q" o
- #else! w5 f( o; X4 ]- _* s
- #define DMA_PRINTK( x... )
. H% L9 i1 W3 T - #define DMA_FN_IN) C9 R. z0 _) H8 m6 R4 w. G; o
- #define DMA_FN_OUT
2 q( f1 X4 F& S0 K5 W4 o, v/ T - #endif
. p3 \) `+ F4 d1 W, H8 L* [
+ P' d6 c# L7 }7 T6 V9 C+ F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 l) Y( g( t- [, ?* s2 s
- #define STATIC_SHIFT 39 S+ R7 b# f2 [! ?1 ~4 F' `
- #define TCINTEN_SHIFT 20
+ {- Z8 A" L& V - #define ITCINTEN_SHIFT 21
- m, m. C9 ~3 ?9 [ - #define TCCHEN_SHIFT 22
! f' D3 ~. H8 r# d& I k - #define ITCCHEN_SHIFT 23
! {6 h z1 ^- ]5 Y# v
) F" d5 P4 h% d! `) I- static volatile int irqraised1 = 0;
1 H$ \3 Y' d7 ~ ~ - static volatile int irqraised2 = 0;0 y3 y+ v' N' B) ~- ?
- : W2 d( |6 u0 w8 ?: I6 }& |& |4 k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( J0 ^' `* F9 V- o8 Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 P/ M. t% J0 r9 ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, A0 l9 _0 M% B7 C
. a2 j0 C: {" R, Y0 Y- dma_addr_t dmaphyssrc1 = 0;4 O7 t1 B% g, U" m4 U
- dma_addr_t dmaphyssrc2 = 0;
6 `: c7 U0 v, w' y+ ^) | J @ - dma_addr_t dmaphysdest1 = 0;
9 `- o& C4 g1 {7 F - dma_addr_t dmaphysdest2 = 0;- O. I7 C! M* E' M3 N
- ; F# u: S7 y1 E' x- d
- char *dmabufsrc1 = NULL;
. ~; q/ S6 `/ b' v - char *dmabufsrc2 = NULL;
6 G! e4 T: G) f+ }5 |' k- ` - char *dmabufdest1 = NULL;
: x' Q' H' d) s |% y' U - char *dmabufdest2 = NULL;
+ B2 \' s1 x. |5 r* N( T
" b3 A3 o4 m& o$ B- static int acnt = 512;
/ e8 [. a, J! s - static int bcnt = 8;
& |4 d/ K( f' H0 ^9 _% z* ]( k6 X - static int ccnt = 8;
9 J$ ]8 \2 ^* C+ A6 ?8 t( V: [
+ x* ] r/ ^2 ^5 q+ y2 z" b0 U- module_param(acnt, int, S_IRUGO);
& j$ m; O- p0 E0 n - module_param(bcnt, int, S_IRUGO);
8 U/ y4 }9 g8 h' h( h+ ` - module_param(ccnt, int, S_IRUGO);
复制代码 " N" I5 x$ \1 g# Y. G! m% P
/ G& v" j1 S9 m0 L+ J" G6 N! ~0 c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) f: f6 t9 k9 N" j barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' k2 G* K! L6 F& \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 u4 @* E. ?# b5 d3 l/ r
- v8 A% K, j" |7 V3 Z
' W/ [& d) _- O6 n: ~# }' ~ |
|