|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 O% ~. D) ~3 C8 H& \
- [code]EDMA sample test application
. i- t' ` q, s4 T( \. H/ X; @% b3 L - /*# ~8 [% n& f* n$ e% p0 C4 A
- * edma_test.c
! {; N5 A6 B- _" E3 P - *
; [0 ^0 a! ~ }- @ - * brief EDMA3 Test Application
( @+ C9 N- |- |" `) _: I - *) J9 a9 Y+ c3 K8 {& m
- * This file contains EDMA3 Test code.
6 Z* t9 o1 L- J. u$ B1 r - *
/ z i4 Y+ x5 T$ ]1 g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# N ~, i6 K; I4 [6 @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! E) W( J3 w; E1 E* V - * TO CHANGE.
6 y! V. R7 P/ A8 p1 M' A9 S - *+ q0 R0 f/ _0 U* \: o( {7 c. n& @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. i4 }) S4 F0 U3 t& w' G
- *
E: Z5 b7 s" ~2 a8 _ - * This program is free software; you can redistribute it and/or
$ H* Q: z# y ^, t: ~5 S# R7 g - * modify it under the terms of the GNU General Public License as! v* h s; G9 ` d6 i' ?
- * published by the Free Software Foundation version 2.
9 ]& {/ m) f! p H. N - *3 q% F4 O1 J7 w; W# z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ ?# m$ z$ a# r' Q y
- * kind, whether express or implied; without even the implied warranty
% S4 n6 L* l9 t# t4 N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' D0 M8 H( M3 i; B1 o7 E - * GNU General Public License for more details.8 [! m6 r' y7 G3 z" l( T
- */
6 G3 S3 K8 Z( @9 Y/ H5 @
; X4 n1 o5 [" w C- #include <linux/module.h>
8 H# R: a/ G# r* a7 j2 h - #include <linux/init.h>1 P) k4 x& e$ r% h& k; |
- #include <linux/errno.h>0 t& ^, D5 m* e
- #include <linux/types.h>: f9 \0 K/ U0 W% G; p
- #include <linux/interrupt.h>) s3 H0 ^ z" p5 F
- #include <asm/io.h>
( e) B1 M( C# t0 c7 j - #include <linux/moduleparam.h>
# w. y, @3 L, L: }; w5 y - #include <linux/sysctl.h>
2 i6 k" m3 d9 x6 h) O0 ~& _: U - #include <linux/mm.h>. [: k+ V. ?$ g* O
- #include <linux/dma-mapping.h>% U8 E" X* f, Z9 c1 O. G
- - k3 ?7 j( F Q; E2 R
- #include <mach/memory.h>
0 l8 s- E# _5 h& e( f# e - #include <mach/hardware.h>* y) ?+ W/ Y/ h! u
- #include <mach/irqs.h>
. e6 f# D- Y# C1 B& ]& L" U - #include <asm/hardware/edma.h>6 h5 [# u6 R$ ^& ~- L
- / O) j8 J) V! I) m- b, C' p$ {
- #undef EDMA3_DEBUG
% }% Q8 i% c. ?# U - /*#define EDMA3_DEBUG*/
, ~0 r' }! G$ X. T9 F+ f1 i+ z - 8 a3 G1 L8 X: l( j
- #ifdef EDMA3_DEBUG% M, b" A6 D+ z. \' _" z g5 }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
Y1 C0 f( T: m o0 U+ a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" d1 ^- q# M( @4 {% z( X# o6 g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): c* D; i4 R5 J3 L
- #else2 x* H L; F! T6 Q8 i1 D
- #define DMA_PRINTK( x... )
7 m9 q' B/ Y! g( n/ M- w' F/ V - #define DMA_FN_IN& s# I& D* Q; x& ?$ G4 ?! f
- #define DMA_FN_OUT
2 p- [- `4 L# E4 ]$ t9 R4 ]2 p - #endif
, p- \3 l' s4 E! A/ t% Z - % d5 a: [1 y) z2 P$ b0 N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); q$ s. l* P1 h1 C! I; b. N3 N& @% i
- #define STATIC_SHIFT 3; f" g) o# M3 U' J5 S) i8 x
- #define TCINTEN_SHIFT 20
+ J4 Z+ ]! ~ l5 {5 I. H - #define ITCINTEN_SHIFT 21
! w# ?9 `: {2 D( b2 s - #define TCCHEN_SHIFT 22" R5 W8 m0 [, z
- #define ITCCHEN_SHIFT 23
1 z: p8 u2 ~ t9 B$ d4 w - & Y/ v' O2 c# B/ D! }' c8 W
- static volatile int irqraised1 = 0;9 ?2 z, O8 O, d% b0 r. Q4 _! I8 g n
- static volatile int irqraised2 = 0;
* O" _/ X8 c* c. M/ _( V - . \7 t7 }8 E* T- |7 z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( U! ?8 V" I- \: I- b* L( j& i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* _: k6 [$ Z2 B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* R% j$ I9 w6 \7 Z9 E* y
- u) {) G( X5 h) ^5 [
- dma_addr_t dmaphyssrc1 = 0;
, A' t3 d4 |7 M9 ~% ~9 H - dma_addr_t dmaphyssrc2 = 0;+ S# M& I+ K* V o1 ]! @8 i0 x6 |
- dma_addr_t dmaphysdest1 = 0;& m7 @, w: L% x( J0 ?% i
- dma_addr_t dmaphysdest2 = 0;
, F% k. G( i% {, h - ' w6 |! X8 D' d6 }4 l t6 f4 ~
- char *dmabufsrc1 = NULL;1 f% j1 z4 S& U' z) X6 J$ C
- char *dmabufsrc2 = NULL;
5 V5 H- b d9 P# R) S8 i - char *dmabufdest1 = NULL;9 N1 r j) h: F# @" K+ y* z& L
- char *dmabufdest2 = NULL;, y3 @. l7 a# T6 [7 ?
- . l6 Y5 r* v* T4 B7 D
- static int acnt = 512;
2 L) \4 ~( O7 \: S" z - static int bcnt = 8;
/ g) C/ s7 n1 o - static int ccnt = 8;
( y' k0 w- v+ f1 g, B
& `5 P- l) Q* g) Y7 G5 I* Q- module_param(acnt, int, S_IRUGO);. U2 D6 r: T4 V' y. ?- p+ f0 \
- module_param(bcnt, int, S_IRUGO); o9 P5 n2 Z/ q% t! U x) N6 ~" D0 f9 _
- module_param(ccnt, int, S_IRUGO);
复制代码
( W1 N: R) e4 R, @% c
: C1 Q) b7 k/ J8 w' F! B4 @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, `! J z; `( t) G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 S( y2 {8 ]7 c+ e% M, H# @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" c2 R, o6 s8 j" v+ d
' D0 t& a0 E* D9 X) C0 E6 M: X
|
|