|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! \* R! S' H2 M8 ]* {+ r. V
- [code]EDMA sample test application
5 S8 a) ]9 }6 L" `, q& w s# E - /** p `2 Y" h. |( v+ }
- * edma_test.c
# W0 c! y: q- [ - *2 o) l0 M" T( y& f. y( z
- * brief EDMA3 Test Application
1 f- M+ Z) k8 S3 ^3 q0 R9 }% o/ | - *6 P/ f% c/ I, V6 \# g/ W
- * This file contains EDMA3 Test code." t. k! P' L1 u# ~' Y7 P
- *5 V( S/ F9 U2 x( g3 I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' Y7 ^4 j J7 ~; [! h/ M! a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& G6 B7 V# i4 d* X* P4 d - * TO CHANGE.
* T6 a; g9 k2 W. }, o: V - *
+ _+ v T/ g; C7 }$ W$ Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* J. y+ p7 [. A- q' L1 Z1 _ - *! {5 D& L ?7 `
- * This program is free software; you can redistribute it and/or
+ K6 e }8 q) k z - * modify it under the terms of the GNU General Public License as- Z9 @' ]! m H( @+ D- q
- * published by the Free Software Foundation version 2.
* _! J: i. s4 Z1 K# | - *
' v, p6 e: G, r6 G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* w8 x% k4 P2 g; n6 f2 R# n7 i+ ] - * kind, whether express or implied; without even the implied warranty
& J" }! M4 E4 u' o1 _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 a# H- {. G& X. M0 t
- * GNU General Public License for more details.5 b9 I3 E/ ~2 p" n. v3 c+ _, K) `& j
- */
# e! d# A# [+ R1 Y# G4 x - ! T2 u! ]# L# X2 G- u y& \0 Y" I
- #include <linux/module.h>. C5 H, |, @; ^& O. l% X
- #include <linux/init.h>
- I# ^! y1 X7 n/ Z3 y - #include <linux/errno.h>5 U; M1 J' \, x. F( _7 `' Y4 `! Y
- #include <linux/types.h>2 c P0 Y$ H( I1 u2 I) U
- #include <linux/interrupt.h>
2 ~* h4 A0 a- N - #include <asm/io.h>! `7 l5 {% ?# S
- #include <linux/moduleparam.h>
+ C, C% h; i7 B! O: G3 S - #include <linux/sysctl.h>
4 _: j; M" p: M8 Y" q, s - #include <linux/mm.h>( z( ?9 E% a; R! P% S& c
- #include <linux/dma-mapping.h>5 Q$ C) g( [0 w
- ; j }3 j- r5 ^9 P$ I1 `, }
- #include <mach/memory.h>
) w0 ?- _) L1 `3 C& ?5 c - #include <mach/hardware.h>% X! a* P5 |) N. L9 N8 G
- #include <mach/irqs.h>
/ z8 P/ m5 i/ x9 W - #include <asm/hardware/edma.h>
~" c$ z0 v/ e. l
: `4 S/ A# Q% p% |0 @% Y9 j7 E- #undef EDMA3_DEBUG
8 Q5 k O: i- R - /*#define EDMA3_DEBUG*/% _+ M1 D# r3 c7 S7 r, r
- ; ^1 r1 R# X2 u/ l
- #ifdef EDMA3_DEBUG D8 |5 Y4 c8 X% R. p8 u2 `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" w6 o8 O6 b. R, b' r: {' `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), q7 L8 j" a& b( f" n2 T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) o* {0 w& }' P& \9 M - #else
) i4 {, i5 x1 W* n6 v0 o* @% u% Y - #define DMA_PRINTK( x... )
% u4 F7 C, N. M* _8 F- p3 W - #define DMA_FN_IN
; W) i- L% \- J1 E" m1 y - #define DMA_FN_OUT2 U) N6 g) F0 _0 _
- #endif' j+ `3 T. Y& C. n) F6 m8 p
- I* Y) X) H0 Z5 v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 ], ~* b C3 X% V# s - #define STATIC_SHIFT 3/ Q0 A! y* a! J3 Q
- #define TCINTEN_SHIFT 20+ l: j) w6 r/ t% P: Z) @! V
- #define ITCINTEN_SHIFT 21. l/ v! \ g; ^# w; j0 P
- #define TCCHEN_SHIFT 22, C1 F4 K! [/ x8 A+ O! A7 F, ^
- #define ITCCHEN_SHIFT 23" F. ?+ b# r5 J
9 |8 P& X) q! v! P* H- static volatile int irqraised1 = 0;
' M6 a1 ^8 _# g* S4 N% H' o - static volatile int irqraised2 = 0;: ^) ]4 F3 _6 h) m/ @. L! E
- " T: Z1 [$ Q3 T+ L# h( L+ E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 I; A1 e2 |/ W5 d, P2 f0 M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 m* ?! @/ v9 d8 {& o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ D& ^! R% k0 f! d$ z! u2 Y* I2 j - 8 s% v+ B' L. A3 |9 U% _' C
- dma_addr_t dmaphyssrc1 = 0;
4 A9 s$ W0 g/ L: u - dma_addr_t dmaphyssrc2 = 0; S1 r3 A# \7 A6 F; e. L
- dma_addr_t dmaphysdest1 = 0;
& f: o7 L6 `& | H& p& z - dma_addr_t dmaphysdest2 = 0;) L. M1 a; k, N' V/ v0 A
- , D! t9 J; k6 l3 f( W
- char *dmabufsrc1 = NULL;
# }" x/ I: _$ G$ k( e+ o - char *dmabufsrc2 = NULL; M% R. E/ }( h/ d9 g* P
- char *dmabufdest1 = NULL;1 Y( C7 e+ O( m0 h: f
- char *dmabufdest2 = NULL;% |& j% M4 Q0 o- [8 M% M
- ! r% D5 f9 j6 A
- static int acnt = 512;
# N, b7 o/ i, @ U3 r- e - static int bcnt = 8;$ @$ s$ V, X! K: H9 N" {5 k/ d
- static int ccnt = 8;
8 _4 ]+ r. F% E" n" |
! e% ?2 g. b) \1 @# r- module_param(acnt, int, S_IRUGO);- r. D. P; a; v4 d$ v) f7 A
- module_param(bcnt, int, S_IRUGO);
# y/ k J9 C. `9 Q3 w - module_param(ccnt, int, S_IRUGO);
复制代码 ) c9 W+ F2 p3 r6 [: I
/ ~! W/ ]( T% \$ M: _: b9 X. O0 Z% ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# t4 I3 v' B, K& ^4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! e2 L- R$ f+ T9 {! Z( q8 L0 M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 {* p4 O& E$ l6 G
/ @( c& _7 D$ ~: ~
: o. ]2 G* n6 E% z1 x- k# `
|
|