|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - c0 a }( ]% R: ~
- [code]EDMA sample test application* y. g% V! H4 o0 R
- /*4 R* ~6 r& _2 `) R8 T
- * edma_test.c; t6 L0 {1 p8 F1 t. q6 K3 d. n
- */ W: B5 x: r' s
- * brief EDMA3 Test Application1 Y1 S( l3 p. t
- *" h0 K/ X* J1 t: U
- * This file contains EDMA3 Test code.
7 P& j1 d8 u; N4 a1 x! ]/ i - *1 A: }9 y' l8 O, x. K3 \* S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* C- f8 c" e1 {) R! Q+ F1 T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ e/ \+ K# F$ |" u! { - * TO CHANGE.
- H: q8 e8 n& |) L/ \: {, | - *
' F0 n' v& \3 }. J+ g. o( y: l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ }3 H4 O6 l. w s8 i! I
- *: Y( M) F3 `9 R* p( u
- * This program is free software; you can redistribute it and/or
# L0 }# m4 U: ~+ v" V - * modify it under the terms of the GNU General Public License as
( i/ }0 r8 `% l" h - * published by the Free Software Foundation version 2.
2 c5 M* F* \0 L - *: l" E, v) ?/ w, j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( p2 y8 l/ f; U2 I( A - * kind, whether express or implied; without even the implied warranty) V$ V- @- O, j+ u* C& g# K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 p. u2 x) v y. R* z5 a2 ] - * GNU General Public License for more details.! s, \4 l2 m0 E% [4 X7 j2 x9 T2 W
- */
! @2 q; y0 a& r
: H; q$ `4 U c- F: s3 W# }" k& f- #include <linux/module.h>: }; M7 k2 K- p. J# t
- #include <linux/init.h>
2 n3 ]. l+ A: A1 O6 O - #include <linux/errno.h> i+ F8 b( S6 f$ W8 _8 c, G
- #include <linux/types.h>5 v* h* V1 D$ [$ D1 p4 F, h* a, d
- #include <linux/interrupt.h>. u- \$ v3 e) u$ }
- #include <asm/io.h>6 e ]- \9 T& l; b3 j
- #include <linux/moduleparam.h>: ` L. u" h, |/ |
- #include <linux/sysctl.h>0 _5 m: @- q0 ^; g
- #include <linux/mm.h>
, W5 p( _( c; G/ D - #include <linux/dma-mapping.h>% ]* h7 P, V u8 ~9 N9 `
# I, F5 d/ T! k* e5 N- #include <mach/memory.h>: b& s+ _2 N* j
- #include <mach/hardware.h>
; g6 i+ a* N* \ - #include <mach/irqs.h>5 L7 W( M5 C# k6 @8 P
- #include <asm/hardware/edma.h>2 }/ g0 F, _4 |) Q' v; z. K
" O! w: ?: `4 o3 X: I$ f- #undef EDMA3_DEBUG. Q9 B' B. _: E/ h
- /*#define EDMA3_DEBUG*/
- ]1 W' r+ O: ]4 O* y! \1 k
) x! i* k" x3 z/ B+ T% [2 k- #ifdef EDMA3_DEBUG3 N) v" e3 u6 c% K# G# J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 z0 s j, Z j; \% i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. l9 S* ]2 S8 z9 i6 W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 Z+ g2 L5 b4 V+ p. T N3 D
- #else
. u* k5 q, i8 w, p8 h - #define DMA_PRINTK( x... )
: j- E0 s# K% F( P$ y - #define DMA_FN_IN
( S* H' Z! g3 g2 v - #define DMA_FN_OUT
. D, J0 f6 ^% J - #endif
1 H6 ~; h0 l- P0 Z% O$ S
9 W* S. |* U9 t2 q% H3 g$ h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& F# X8 h! E, ` - #define STATIC_SHIFT 3
1 @$ {6 A& G* g% T* |) l' H - #define TCINTEN_SHIFT 208 S' Y7 X8 d& k8 y. P* p
- #define ITCINTEN_SHIFT 21
- K/ m+ c' S% | - #define TCCHEN_SHIFT 22
- W }7 F& E5 z/ h8 x - #define ITCCHEN_SHIFT 23
6 \ K' p, Z9 `8 T - ( m# p' e0 V4 D& K2 K# z9 ^
- static volatile int irqraised1 = 0;5 v$ R' F1 f! \5 B* N% W& P8 k$ K
- static volatile int irqraised2 = 0;
2 W5 y4 x$ |) R& c( i+ l1 m
" i2 Q; x3 j; T. K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, o$ J7 S! t) [1 O" l* k$ \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 u: I4 r p8 P+ }" W4 _' E/ U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 T# y" f- a% O9 A( _5 h7 S7 x% R
* a5 d5 z3 `& C% ^- dma_addr_t dmaphyssrc1 = 0;
3 l8 x& z! z' n9 {! q, ^ - dma_addr_t dmaphyssrc2 = 0;& _ S3 f. L6 J8 g1 V1 |9 B
- dma_addr_t dmaphysdest1 = 0;
8 `8 |6 Z8 z& T5 Q; ^% v - dma_addr_t dmaphysdest2 = 0;7 P, P8 l2 N7 x0 d! Z- t. T7 F
- / ^6 R; \+ w" I
- char *dmabufsrc1 = NULL;. Z) |; O, W5 i3 i
- char *dmabufsrc2 = NULL;- y* v' s! G2 G3 o
- char *dmabufdest1 = NULL;3 d/ d; N6 r) {* Z
- char *dmabufdest2 = NULL;. X6 t6 E' B d4 @$ _
* z; a. P& N5 U; _+ }* j# O- static int acnt = 512;* \- A( F& i! x! ^9 I p2 h
- static int bcnt = 8;
* v3 m9 ^5 v' Y6 q0 A# L6 K2 P - static int ccnt = 8;
( u7 E& I3 ^6 t( t }
) h( Y; ^% ^4 P4 ]- module_param(acnt, int, S_IRUGO);
! A& z4 ]% l. B$ J, C* w- A - module_param(bcnt, int, S_IRUGO);
/ V I- w g0 V9 |& z$ Z - module_param(ccnt, int, S_IRUGO);
复制代码 7 X" ^8 b* R- x
# P( ~, y2 ]. `' u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ A: D6 ^. d5 {3 ~0 F+ o% Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# ~0 R; B. N7 n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 x% A, e! y$ x3 _- D8 \/ M6 E
8 _4 \* M& S! E" {$ F8 b0 ^# m. ^: Y: y/ N/ z! x7 _+ n4 H6 X& F
|
|