|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / n. m1 X v( a) T
- [code]EDMA sample test application
- H7 p0 D7 n& v4 R4 T - /*
* a# D, A1 O3 l9 A X - * edma_test.c9 V# }$ R5 V+ t& `1 M
- *3 T( G9 L3 i; H1 |& q' N
- * brief EDMA3 Test Application/ h7 y. V( N3 L
- *$ k2 a+ \1 G5 ?
- * This file contains EDMA3 Test code.' ^$ c& O9 F7 c
- *# J0 w1 l! y+ K% i/ S' b5 `) A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* Z ] O) j" O* f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 \8 _- l( L$ l/ m& d - * TO CHANGE.# G3 A& v, e8 {3 r* I
- *9 \! h, d( f. c. l* k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" ? {5 j6 R6 f4 n- ?
- * }3 U! k1 u: K c) m+ N
- * This program is free software; you can redistribute it and/or
5 K1 k) W. |9 F - * modify it under the terms of the GNU General Public License as$ t* Z: C" @: T1 ^2 P: d* L( A W
- * published by the Free Software Foundation version 2." `# b" c: W) B& l, f, x' ?
- *
. i" K4 |" n# L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ ^+ g& p6 D7 a- p4 S/ H8 }
- * kind, whether express or implied; without even the implied warranty, y/ Z8 T7 P! N1 u/ o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( d$ a; P; s# R0 `9 {9 m; ]8 v - * GNU General Public License for more details.
$ B9 C1 R7 ]6 [3 O - */
3 A; c R- A% r+ S. _ F# B. J
* }5 c8 G8 N; z E6 _- #include <linux/module.h>
6 U& a7 G" t; F3 t+ z1 m - #include <linux/init.h>
% m0 ?- Z, ^3 }+ t/ n" G( b( J' J - #include <linux/errno.h>/ M: ~7 h; d# O: H
- #include <linux/types.h>' V# p! O( p5 E E8 {8 f8 r
- #include <linux/interrupt.h>/ Q6 ~ ~; R& ^8 g: M1 T4 `' q
- #include <asm/io.h>
, s( V* W% u/ U: V! {% I6 B - #include <linux/moduleparam.h>
; h: b; `) |/ ` ~* P+ E - #include <linux/sysctl.h>) X, {6 Z4 u: V2 V
- #include <linux/mm.h>$ a2 p& \: B1 H& e8 v, T- Q4 }! N: H/ b
- #include <linux/dma-mapping.h>/ \8 W+ ^5 b5 W$ C: O2 s/ `
- E% e* a) L& \, y7 H5 {4 E# V+ h
- #include <mach/memory.h> B% o5 c" `, y* `$ M
- #include <mach/hardware.h>: k7 k: k2 i7 Y& y& r a5 d! m/ P
- #include <mach/irqs.h>
2 {- t4 G: E' S! E6 j - #include <asm/hardware/edma.h>
, J# J8 B% u9 _# J( S3 C
7 P4 `$ M# K c: g5 e' L" N3 S- #undef EDMA3_DEBUG
7 v H: G9 V& S - /*#define EDMA3_DEBUG*/" {0 ]7 z3 A* D& M
- 2 ?: C4 {. l( O! H% d
- #ifdef EDMA3_DEBUG+ Z* \' U3 n0 q+ V/ n) n/ L4 k! Y& g) X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( {: [7 M% J+ G `/ J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) p6 H0 F5 ?0 `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& J N6 d% c- t% g$ A. R, a - #else
/ [! I. S" ^+ F - #define DMA_PRINTK( x... )+ r7 r, ], i4 T% b2 ^
- #define DMA_FN_IN2 w- K5 `7 n' N2 J3 Y5 @* @" n
- #define DMA_FN_OUT
4 `$ W+ [" A5 H! O$ R$ } - #endif! x2 S& U& e) P% c6 H3 ~7 s0 l
- + v+ J( U) z! h4 a+ F$ j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! c# T4 t+ u% l) _* X& y n1 e - #define STATIC_SHIFT 3+ `1 U; Z5 C; B- S
- #define TCINTEN_SHIFT 20
9 N! v* Y2 S6 ] s* w: P `0 b" w2 r - #define ITCINTEN_SHIFT 21
9 @6 {. F f, A1 v% ~ - #define TCCHEN_SHIFT 22
% P5 ]7 C; R P3 _ - #define ITCCHEN_SHIFT 23$ J' w* O/ N0 x$ B5 ]& R
9 ]! R0 S- X& p, i! j- static volatile int irqraised1 = 0;- x. m' [, ~+ e% w% G; f# [' A
- static volatile int irqraised2 = 0;
4 F7 t N1 a5 f. ]4 W" E0 r
7 G/ h: \- g6 C! g& p" P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 Q& s2 l V( y8 C" O" Q' p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( d6 B: T8 n( J0 \+ g. Y% v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 u+ f, I) i$ U: X( K
/ I3 P1 @9 Q* C9 n t: l- dma_addr_t dmaphyssrc1 = 0;! Q* H! r5 Q: J' w% x
- dma_addr_t dmaphyssrc2 = 0;3 o, `" q8 h4 I# h0 s3 ^: @# h
- dma_addr_t dmaphysdest1 = 0;
3 s0 I7 W) z2 |. M# o - dma_addr_t dmaphysdest2 = 0;
* L$ L% j. D4 B+ D4 q& K - , J; m! P, R3 h: `3 ?2 K# e
- char *dmabufsrc1 = NULL;# y, o a9 U; m" H6 P* M) A
- char *dmabufsrc2 = NULL;" ? P' |6 c% ^3 _) k/ x
- char *dmabufdest1 = NULL;
6 g4 }1 U7 Y3 ]5 D* Q7 L - char *dmabufdest2 = NULL;5 x8 X( {/ F2 p u; ?
- $ U$ S1 {* g# P- F; f0 e! h
- static int acnt = 512;
W6 Y+ m4 B$ R( @) u- K - static int bcnt = 8;: O# d# d7 {' d0 V/ F9 }0 k$ F# t' c
- static int ccnt = 8;
# `- |( t5 A- E/ j6 U3 z
7 U; r/ }+ B* W- module_param(acnt, int, S_IRUGO);- s# Z7 ^) H, [: i7 _- ?2 L
- module_param(bcnt, int, S_IRUGO);7 h5 x' n7 y/ `3 R
- module_param(ccnt, int, S_IRUGO);
复制代码
( d/ o6 D9 }# W; ]8 Q/ R
( p# E" x) {% V P+ v' O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% q9 n* J+ q! t) o+ C; D) _' |7 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# O i, I! J$ T$ H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) W; o6 O: e2 V" ^& Q, @
; L. y3 B7 g* L0 l) `
' C& U) M# ^2 Z6 C P
|
|