|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ {3 B. |# x% W; v, | h& ?( f- [code]EDMA sample test application
, }% g2 \3 L2 P3 V$ d( {( F - /*: G g& J5 o( ^1 N
- * edma_test.c
/ D# m l7 z9 [5 x& |" ] - *7 A6 j4 q! Y |1 [. R
- * brief EDMA3 Test Application1 ]- k, P' V, L
- *
$ v$ g" R) q+ [! ? - * This file contains EDMA3 Test code.
! W- Y- }( y) I - *
% _4 _- x0 q% i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& K; I/ \; T6 H% t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 B$ X, ]2 j# B# `) @+ e( Q/ I - * TO CHANGE., o/ N/ A4 ?+ S* Y
- *$ C: }/ |1 t! d8 _5 S( A3 T! D, z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 g: n) A( X' r+ {8 n - ** c* B( X" A: F6 r
- * This program is free software; you can redistribute it and/or; O5 V( A# X1 b" A( m6 N8 E
- * modify it under the terms of the GNU General Public License as3 L$ ~/ S5 o6 g% A
- * published by the Free Software Foundation version 2.& r8 S. L" M7 ^; ]) F3 ~ T
- *; d. M% N W( s- l$ C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ q6 P! y9 P; B" j) W& ^6 p - * kind, whether express or implied; without even the implied warranty% w* d- E d2 C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( L( Z( I: H& I6 V# o - * GNU General Public License for more details.. V! J5 E3 |" E! W( Q6 ?9 S- e
- */5 f, \& O! ^5 R& J" \! I& Y
: |- s& i9 r2 q. J* m- #include <linux/module.h>
" X2 a4 d- \: X5 z+ E - #include <linux/init.h>
" U% f4 I9 e- t# B: k - #include <linux/errno.h>
; q5 q# u4 q" c T# [" p( V! j - #include <linux/types.h>
; d& V( o+ w+ L4 f$ A. M - #include <linux/interrupt.h>6 X ~0 c( G2 ^/ A2 b- J
- #include <asm/io.h>9 I) o" ?0 Q! b7 r
- #include <linux/moduleparam.h>2 W0 v2 G! W- U
- #include <linux/sysctl.h>8 `, b R( `) p
- #include <linux/mm.h>
( `: S3 ~5 d, x, c8 \ - #include <linux/dma-mapping.h>
+ \" Y2 I2 `" m
3 j5 b" k6 b; K) R2 D* v% v- #include <mach/memory.h>
: h5 z) E) F! u8 F - #include <mach/hardware.h>$ k- o9 c, i0 r( z
- #include <mach/irqs.h>% j* K0 B# w5 k
- #include <asm/hardware/edma.h>
: v, p/ d3 T4 G* `# U4 Z8 b - ' F0 P) R3 w+ G
- #undef EDMA3_DEBUG
4 k4 V; X! @) L5 P( _ - /*#define EDMA3_DEBUG*/
7 Q: ?/ T$ T& P4 F: J, f
% \7 M: f9 e# H2 H2 v- #ifdef EDMA3_DEBUG4 A; G( M8 G2 j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 w5 c" \& j; k4 ?" p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 I' M0 F2 P" A8 V. M0 X/ |6 ~7 n: C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 c! P! B8 i: f
- #else
. R: ?& A" Y7 B/ f; c* @; {; k - #define DMA_PRINTK( x... )7 x, I' k3 s+ g8 O6 i8 K
- #define DMA_FN_IN7 v2 F2 p+ N4 k4 s; ?
- #define DMA_FN_OUT
0 \" k( L, R: g+ ? z& {; T. U/ X - #endif+ T7 a- u5 ~6 G% w- X% w5 y% m
- ; m, D- q D9 Q8 D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" D D% G1 L7 G$ ?/ E2 D2 Q - #define STATIC_SHIFT 3
" W9 ^* j z: \& p - #define TCINTEN_SHIFT 20' H2 B( A; T7 k4 y) }
- #define ITCINTEN_SHIFT 21
' ~- X- d w4 t0 A5 B' u6 s" h/ b - #define TCCHEN_SHIFT 228 H [0 v- Q: |' H5 L, ~. u8 K) T
- #define ITCCHEN_SHIFT 23
' L0 E! b0 D5 S$ q4 z. @
# l& b& c( V8 P0 t& Z. S5 s- static volatile int irqraised1 = 0;
0 q' R9 |, J0 i$ A ^! A; i- J - static volatile int irqraised2 = 0;0 M. d" M& x/ y2 ]
& a5 s' d$ W9 t4 l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- \7 d v( L% b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( M/ L5 ?, a6 Y. `8 O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% ]: l" h, j/ V: |& c5 Z1 G" I - ! w: _) x6 y% s/ L' w
- dma_addr_t dmaphyssrc1 = 0;
1 h0 o% ?4 P# ~) _( } - dma_addr_t dmaphyssrc2 = 0;
: E" r3 |& i/ M" X) j0 K8 j - dma_addr_t dmaphysdest1 = 0;
( W( p4 X% J8 `: B) [ - dma_addr_t dmaphysdest2 = 0;
# \4 `2 {& T$ m9 k - ) [+ }, F& a O g, v
- char *dmabufsrc1 = NULL;' l& P4 S! g! \# x$ W: j: U
- char *dmabufsrc2 = NULL;& X+ I3 y+ J; {1 F
- char *dmabufdest1 = NULL;
3 H. {$ w/ ]3 ] x) M - char *dmabufdest2 = NULL;
' o8 t0 `. o' Q* S% R, { - 5 u$ d) H% C4 K# ?/ M8 S( `$ E ]
- static int acnt = 512;
! {- {3 `9 S+ V* f2 a( B5 k - static int bcnt = 8;
* Y9 T& E3 G4 M! s# `# z, o - static int ccnt = 8;
5 a U- m5 j5 c$ m- [% h+ Q
. m2 V- A8 Y7 m$ q4 e+ O- module_param(acnt, int, S_IRUGO);8 z2 x& Z0 {, e, V
- module_param(bcnt, int, S_IRUGO);
' K! g7 i. M5 Y2 O- |4 T* ?; o - module_param(ccnt, int, S_IRUGO);
复制代码 m) \ `9 |/ f7 e7 f
/ A: y7 \) A8 {' E& m2 V: W/ J7 x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 L( \. k) Q/ R8 |2 D; n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* G* v$ M# ]; b. y4 r. \) m4 ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; b$ P' t$ ]5 o$ Z2 D
8 p3 a+ T2 Y" X4 N
# W9 H) u* G2 e7 S+ k6 u |
|