|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * v V* t" H, k
- [code]EDMA sample test application
3 g+ ^: o& k! K# X - /*
6 F9 Q& a- S( j9 `8 T( _, k& Y- J. ] - * edma_test.c
+ J; L% m2 W' ?- u# x - *3 ]( p, N {! H. i
- * brief EDMA3 Test Application* w' p( y) g; P8 x' Y
- *
, \; J4 a$ ~) x" y6 W/ r4 y - * This file contains EDMA3 Test code.. Q8 u/ r9 m& E* Q) K
- *
$ @! T W4 Q) n6 _2 _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE X; g* O& N" D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 J. e k+ f4 |9 C - * TO CHANGE.$ G6 d3 y" ]; ?8 e3 B, I
- *
/ O- C: @! u, J P4 i! h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( X- n/ p# `# a1 Q1 S7 C - *
% U8 {$ l0 ?4 v V V - * This program is free software; you can redistribute it and/or
/ u4 \& h ~5 i1 B2 y - * modify it under the terms of the GNU General Public License as8 @ Z8 {- {1 W. e. n( d0 }
- * published by the Free Software Foundation version 2.6 c( F( _3 T3 c: |
- *1 ? j$ ^+ J1 ? V8 K4 v" l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 ~ A- c0 [% L. c) G - * kind, whether express or implied; without even the implied warranty- F2 Q X" }# d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 q. J1 ?% n' H2 _8 G2 G1 P+ \ - * GNU General Public License for more details. ?' O4 y9 }( H6 _4 h2 C+ f2 B7 R7 [( Q9 j
- */
# G6 Z/ _& q2 U0 l2 E
0 ^) B+ r5 q: o& s9 }6 l- S- #include <linux/module.h>
5 H {! l5 x5 u - #include <linux/init.h>
' N; K: D9 k+ g* o. W2 J - #include <linux/errno.h>
+ u) u; c" ]4 h - #include <linux/types.h>2 C3 l# i, ^" W0 f
- #include <linux/interrupt.h>( S8 ]% n# [+ [4 ?
- #include <asm/io.h>
2 B; d# p& G! @ x4 g - #include <linux/moduleparam.h>$ E" b; I: F: R) U2 \) i
- #include <linux/sysctl.h>* E' C2 b" y9 L4 `# H- h+ V1 C
- #include <linux/mm.h>& t, q* K% `$ S1 `4 K
- #include <linux/dma-mapping.h>
6 _/ |* o# w* z
! i, C0 b: R# X0 Y! E- #include <mach/memory.h>$ Q5 u- ~9 v z) v
- #include <mach/hardware.h>+ e$ R& Q( d! C+ w, c
- #include <mach/irqs.h>. Y# l4 b& a1 u6 R
- #include <asm/hardware/edma.h>+ E9 t0 D, ]: Y. {# d' s+ K% d
' J% [7 u7 l" q! {! s& n& I- #undef EDMA3_DEBUG9 }" W y, }) Q
- /*#define EDMA3_DEBUG*/
9 N' m, E9 y- v$ I2 } - 4 E3 ~4 r& N2 ?- \* s7 z7 J! U
- #ifdef EDMA3_DEBUG
1 @7 P- s; f% s! E* N8 i& z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* o! o" @$ r$ ]+ H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. M" M) h- f$ a7 }/ F. V; D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ N6 s1 K! y* U2 H' Z
- #else; [7 V% E N2 v# l. a
- #define DMA_PRINTK( x... )* l6 A# L d* i& U% r7 T
- #define DMA_FN_IN; e( U, u0 y. h6 \
- #define DMA_FN_OUT( [$ P3 D3 i3 P" I' ]/ A
- #endif
$ v$ ~; H& [# H1 `4 ` g% X
6 K+ C: a4 Y7 H0 \ Y+ E+ S- r: K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 \: }( V; h& E7 u' X4 O4 I1 w
- #define STATIC_SHIFT 3
" ~1 F. _0 w: ^# Q - #define TCINTEN_SHIFT 20# u- X% C- c8 h% b/ q
- #define ITCINTEN_SHIFT 21
. A( @) C. s! o - #define TCCHEN_SHIFT 22
( _; q( a1 R5 O% v7 c) O+ u - #define ITCCHEN_SHIFT 23
- |0 q5 Z0 @2 p; t# l
% n1 ~4 c( n, V3 t& V# b- static volatile int irqraised1 = 0;( }; o6 b, d: x5 ^4 u3 Q. P' B2 O" u
- static volatile int irqraised2 = 0;1 G) H6 u. y& F, \9 z' M- g+ L* J
0 M/ X# L) u) B$ {1 b# Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 \' H6 H% C' ]9 c I6 L, Q+ { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 D5 e; F8 f, c% Q; ?- v( _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 [% Q4 I* I1 J. x3 L2 e
K/ Y4 L/ b- Q- r4 |6 {- dma_addr_t dmaphyssrc1 = 0;" k0 t* P) x) e3 W5 O
- dma_addr_t dmaphyssrc2 = 0;
* u$ U! h0 X8 T2 k p+ ^) P# M - dma_addr_t dmaphysdest1 = 0;6 s2 V" Y# u `3 m' F
- dma_addr_t dmaphysdest2 = 0;( m! d! f6 t+ ], p0 H
, ]. s% Z7 c8 I) }( o- X3 ]- char *dmabufsrc1 = NULL;
$ b- N9 z8 e0 p; f - char *dmabufsrc2 = NULL;, n9 t/ ~/ U f, V1 w
- char *dmabufdest1 = NULL;& X' U" _( E1 }0 {4 F3 k/ c) I( D0 b
- char *dmabufdest2 = NULL; Q4 p" |, |5 i5 D
- 5 q1 [) N$ J. e: t7 I
- static int acnt = 512;
* S! G5 [1 b' U8 M ^# N1 `1 c - static int bcnt = 8;4 i1 z5 _- r! m/ ?" J+ Y
- static int ccnt = 8; J4 h+ G$ t2 j0 Y" j- C( Z
- , q0 a* x$ H9 W1 f; Z
- module_param(acnt, int, S_IRUGO);
6 E: s1 k% S6 ^$ [: _( F - module_param(bcnt, int, S_IRUGO);
( U' M( B+ z5 ?- R4 B4 I - module_param(ccnt, int, S_IRUGO);
复制代码
, Z) l4 e: G6 T0 D4 c
! e( [1 r' z7 U& o! v; e+ J6 k( c: }/ i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 o1 @" x' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 M/ H! W7 _# f) D# L, r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# |. x; U' ?% s/ M" {3 g
! w) K3 v+ h8 U, e |$ f
8 Q* f# X9 f" ? |
|