|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 G l/ L5 f8 i) d
- [code]EDMA sample test application1 m3 s' \5 G$ y
- /*
8 J) [) \5 R4 |8 p9 R2 V( T: c9 A - * edma_test.c5 m. U; d# O' e* }# y+ ]
- */ ?7 d" X p. n- j$ |$ i
- * brief EDMA3 Test Application
) ? C' y; X, Z- V - *( D+ f5 L3 L9 x# Y
- * This file contains EDMA3 Test code.0 l6 {0 g% N. R# _6 u
- *
9 O9 D. v) ^) ]- I9 |. W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ B" [& Q7 R6 ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 N( y8 Z+ s7 J! t3 x$ u) J
- * TO CHANGE.
$ X {' v3 Z h. l1 C - *6 v) t5 t1 d! D1 d+ `7 ]% e
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 F! E1 E; b5 b8 p% u2 C) L - *
! B; L5 c) c# n9 Y$ C9 U - * This program is free software; you can redistribute it and/or9 P D5 J5 H: Z3 \7 p' K t8 |4 k
- * modify it under the terms of the GNU General Public License as- Y4 E1 v, a( }& L! G D% R
- * published by the Free Software Foundation version 2.2 ^5 P: I5 H! I9 \, ~. ^
- *
* Y* W4 F8 D% ?+ ^- ^- c7 U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% s1 @4 a5 G; ^* G2 [& g - * kind, whether express or implied; without even the implied warranty6 B6 w7 W# k# {& g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 u6 l1 V3 F8 P: ]; v
- * GNU General Public License for more details.
) [- X" _- f% Z4 {; l) f - */
/ |6 y& Q! T$ L+ R$ L' x6 k9 U - 6 A3 D2 g" ^6 s+ {+ g1 C
- #include <linux/module.h>$ W- N1 y& r5 ~2 U7 ~6 R$ z# v6 z' T
- #include <linux/init.h>4 V- q6 S; \2 ^) o3 D
- #include <linux/errno.h>
+ Y% L3 M: c0 [, \ - #include <linux/types.h>
/ R: N! @: p9 E" E1 h" g! @ - #include <linux/interrupt.h>$ p6 W- \- l; M y9 t( L- z! f) m
- #include <asm/io.h>/ G/ @- g2 i1 c) L
- #include <linux/moduleparam.h>' v7 R z8 h W5 ^: l# ~
- #include <linux/sysctl.h>( s) A+ \1 }% V4 u( x
- #include <linux/mm.h>
1 u* r% j A# u' i0 q6 Q+ @/ W - #include <linux/dma-mapping.h>' a/ O/ \+ r1 [7 s6 K* u3 a
- / R3 C( H# ]9 Y8 r6 G
- #include <mach/memory.h>
+ ~6 H; x0 r, g5 d8 b: f" z - #include <mach/hardware.h>
& S) _1 s* a' @+ P7 I9 b/ X0 V0 K- r - #include <mach/irqs.h>
e9 m+ [# Q% F( Q( G - #include <asm/hardware/edma.h>8 n. n) b/ O% H
1 C0 h3 i' N9 Z9 V- #undef EDMA3_DEBUG5 G# a& g" e* [0 w# @( \, w
- /*#define EDMA3_DEBUG*/
' c( u$ C" a6 g8 h2 W! `3 @( ~ - " w6 {% T+ H/ n* o1 \0 Q
- #ifdef EDMA3_DEBUG/ w; Y0 c( ~ @0 G: k# [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 F/ C% o5 t# g8 G/ J- w- N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! t# p, |8 R3 ~# V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 @1 ]. U4 } H G( n4 S - #else
( V5 m0 C+ b3 B - #define DMA_PRINTK( x... )) n8 j8 c! W' ]( q, g) y! {
- #define DMA_FN_IN
! ?+ V) G2 ]6 a$ } - #define DMA_FN_OUT
- l* s8 z/ ]9 r - #endif
, l) ?0 R+ `9 Z: D; ]
. a1 X$ W, h7 o G1 U! J8 x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 w t7 C+ Q4 F5 T/ o4 s
- #define STATIC_SHIFT 3
5 R& ]+ D f* | - #define TCINTEN_SHIFT 20& V, B" y0 N8 ]8 X" H8 C5 d
- #define ITCINTEN_SHIFT 21
4 I5 s/ E& K& B - #define TCCHEN_SHIFT 223 D* } x1 [4 j0 @4 J' F
- #define ITCCHEN_SHIFT 23$ W; O3 p3 p0 ^8 |" M8 h
- ' Z* c/ B; Q8 L5 v5 J( T# K* r
- static volatile int irqraised1 = 0;
* N$ Y% I9 @' a; a - static volatile int irqraised2 = 0;3 S0 Q* j( T' b9 X; q
- ' [) {. d! A, w9 N" w+ l. W! w9 V1 R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! {1 W: o/ e# z+ z& M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' w9 Z( [2 h3 s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 h/ `( m5 b' }1 ?. p) Q: c; n
3 O. X" M/ ?' K4 W- dma_addr_t dmaphyssrc1 = 0;
$ H8 g' `% V( @+ R+ E3 ^ - dma_addr_t dmaphyssrc2 = 0;6 t+ U6 E8 x0 s) p- z/ m& q& G. K
- dma_addr_t dmaphysdest1 = 0;! \! o' Y/ i a/ V
- dma_addr_t dmaphysdest2 = 0;7 R) O& l3 c! c2 U' L
- p# `. J1 \3 X8 q* c8 Z- char *dmabufsrc1 = NULL;
- e7 ~8 p2 S% `4 I; n - char *dmabufsrc2 = NULL;* h5 z" a8 k& D0 g+ _4 K p) ?
- char *dmabufdest1 = NULL;
% d' }1 u7 A/ o1 E - char *dmabufdest2 = NULL;/ o/ g! J! b& o* g* C+ k% b. v& a
0 w; p9 c7 @9 \% K& Y" m- static int acnt = 512;- w) c& T* k6 v; L m
- static int bcnt = 8;2 B8 q) J: ?% @1 a( T- X
- static int ccnt = 8;& @* W) B( z9 y% n( K
- + z/ z' n* Y8 c5 k# u% D% ]9 y7 k% S
- module_param(acnt, int, S_IRUGO); ?( r8 u1 E* O- H7 F& y$ o
- module_param(bcnt, int, S_IRUGO);
+ K$ I& z" V. \8 ? - module_param(ccnt, int, S_IRUGO);
复制代码 5 v1 z! o8 L* R E8 G
" G9 Z8 l, }& k+ u3 ~: m4 J Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, y @& S$ W6 @. ^: f4 f0 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, e" D! q: W- ~# a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 @: X' P$ L7 X! U; T' H) D4 l# G |: A0 e' M2 h+ n0 I5 |1 I3 {3 W
1 u# C X. F* p* V2 M: T2 z, |! e |
|