|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! `" e* ?& V0 o7 u0 K8 k6 f- [code]EDMA sample test application+ z1 m% x7 V0 G2 \; }4 Y; T
- /*
4 ~3 R8 R) c* R# C7 f | - * edma_test.c3 ?3 t/ L/ [6 I9 f1 p ~# I( n
- *
' }. O; Z O: X- [8 {6 u6 h - * brief EDMA3 Test Application6 H: c0 s" K- Z( u) j
- *9 K5 m8 h9 |3 R
- * This file contains EDMA3 Test code.
$ U3 s( P6 `( T3 b! k - *
. m! @. P* W, p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 w4 G( _; ^5 p! q2 Z% z: L( c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: J: ]5 ]: J b; ^: p6 W4 K6 k - * TO CHANGE.
$ }1 B! {6 f8 {% K' C5 c9 R. z - *
3 a, `/ p6 y+ v% r( O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' f' A3 \" G! A6 ~ - *( ]1 |! T1 X+ v: y7 Q
- * This program is free software; you can redistribute it and/or
/ K( h8 E- F+ i0 { - * modify it under the terms of the GNU General Public License as: u) v2 L% F( {. \" K
- * published by the Free Software Foundation version 2.4 X* Q7 i# A. O, K6 |
- *& K0 ?, |/ K! \" P! m0 ~; j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% K8 J9 n4 ?1 `6 }
- * kind, whether express or implied; without even the implied warranty
, v* k1 o" Z& m3 h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- p% z, J" p5 _* k# [6 i - * GNU General Public License for more details.3 K( q. A3 H7 M! Y) Z
- */
) e' q# r8 ~! |, q1 R% C& C$ [ - 2 C5 d! l. |/ P
- #include <linux/module.h>9 e7 O) F+ c# B( R
- #include <linux/init.h>* l# e' R* C$ [
- #include <linux/errno.h>6 X- W/ L4 c: \' a! R
- #include <linux/types.h>3 M }& Q. V" |* N0 d
- #include <linux/interrupt.h>+ @. i5 x+ }6 M l" ]( J& E W
- #include <asm/io.h>& v/ G0 w* C. X0 V; R/ C E" c
- #include <linux/moduleparam.h>
! J- }, h* f0 h* G) q - #include <linux/sysctl.h>- G+ ] }& o7 U; o
- #include <linux/mm.h>
7 k W: X# q8 u I( Y, } l - #include <linux/dma-mapping.h>
# g) j, Q6 J$ o( @ - ) Z; z8 `# M4 }4 I& O' z7 E0 P5 N9 |
- #include <mach/memory.h>2 ~% [3 }' _' P8 F+ Q) l
- #include <mach/hardware.h>0 l8 d2 {: |1 z; f7 a2 S
- #include <mach/irqs.h>+ u: Q) q; @ r% i
- #include <asm/hardware/edma.h>
: p/ z3 b- ?9 M7 o
8 @6 H# m0 Z% I ^- #undef EDMA3_DEBUG
9 k7 ]) ~) | i7 d. U3 q - /*#define EDMA3_DEBUG*/
. R& s$ f- d7 v; C' ]7 e" i5 f - 6 t9 f( n* l+ F% j
- #ifdef EDMA3_DEBUG7 v1 f- g( Y/ n# D' Z+ j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
U$ Z z0 c4 X# ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& W: a6 c4 o, R' A# x: ?, x/ E5 V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ d& M9 Z X6 G" h* f3 }! m7 C - #else
( n7 ~' C4 ^. n - #define DMA_PRINTK( x... )
! g. R9 p0 [4 L* }# T f; v! P - #define DMA_FN_IN
( q/ [# G" o5 m9 T' K0 @; H7 E - #define DMA_FN_OUT
+ I* N- E9 e" C6 V - #endif
, D8 J. Y: B& }7 @/ H( v4 P - 2 x. f' J' ~' {' K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 o( y* \, t2 M
- #define STATIC_SHIFT 3. S/ o' Q- @3 H
- #define TCINTEN_SHIFT 20
& W; c' C r) `/ `7 U% V4 ~1 a - #define ITCINTEN_SHIFT 21& }7 [' w1 D; O% B' l. Q. ~
- #define TCCHEN_SHIFT 22
2 V4 [0 d# u+ P2 K, S' N0 k - #define ITCCHEN_SHIFT 233 y6 l: p; I) ^6 d7 q# F f* r
- ) X4 j. g$ K* O& N
- static volatile int irqraised1 = 0;
1 m5 v6 Y( Q8 I. x3 |+ e2 n+ w+ D1 O - static volatile int irqraised2 = 0;9 r/ `4 A/ F: A$ W2 ?; Z4 r
% N4 s) K$ V( B! \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 m, V0 a' H1 Q# y1 H, |5 y. O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, c' I. B! F: L d ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' R' N2 z4 c: R0 {5 d* M
- 0 ]! l9 R9 G! k- n( ~$ ~
- dma_addr_t dmaphyssrc1 = 0;& l, l$ \1 W9 t% b
- dma_addr_t dmaphyssrc2 = 0;9 _6 `+ x' h( O( R# d, d
- dma_addr_t dmaphysdest1 = 0;
, ]! x& u. ]* J. s2 D0 k. q - dma_addr_t dmaphysdest2 = 0;
! ?, z$ Z, w2 h# U9 g9 v
. }# \% p- Q0 C( P' R l" s- char *dmabufsrc1 = NULL;
- w8 w5 {+ [# z - char *dmabufsrc2 = NULL;
* X* g1 d8 P6 G3 P2 i& Y; K - char *dmabufdest1 = NULL;
. ^" c$ G: n6 y y' D - char *dmabufdest2 = NULL; K9 J- S! J+ X8 T$ N
' P/ k4 w& K3 _4 F5 B- static int acnt = 512;" R1 C, L+ f2 ?( \. O; b
- static int bcnt = 8;
- w# ?4 f* h8 _+ D - static int ccnt = 8;
0 z3 V2 Y3 u ?4 E5 f. m - % S0 e4 L2 N2 a/ l; D; A
- module_param(acnt, int, S_IRUGO);
$ u5 R% _1 ?' G' n9 z( L2 {3 g - module_param(bcnt, int, S_IRUGO);) S, [: _ L4 u" T: ^3 |2 c$ h
- module_param(ccnt, int, S_IRUGO);
复制代码 & N3 A4 [8 [7 `
- x) k. }2 F _2 S- \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% V8 p' p7 @6 Q6 g/ F" narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' m8 y# i p+ T8 j9 @' G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 Z P+ m/ J- Q
( G! P$ h; L# y/ J7 N. b) r5 ^3 v# y! c# H6 _/ C
|
|