|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; \ h: j2 P. z1 {# n9 W- [code]EDMA sample test application. y& ~7 J$ F* d3 o% P
- /*2 ~1 ^5 X0 I% ]3 v E# H
- * edma_test.c# d; A$ c' v/ m6 ^( F) v0 U
- *! n v8 ~& Y) T# W1 ?# u, E
- * brief EDMA3 Test Application
/ o8 Y) ^; m, ?1 ^# ]- z2 z - *
2 s' i& F U9 k/ B0 ?, ~ H- R2 c - * This file contains EDMA3 Test code.1 i! n. t7 h4 u
- *- H% n0 C3 a" W7 k; _; S7 N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 i5 w9 q* Y8 e. N' A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 B/ @! Y" }% |/ [- K# D. x - * TO CHANGE.
/ C) T+ H& y2 n- P% X9 [& L9 }. _ - *, J" S" F ]) D& x9 e
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ T) E* g* p k& U( j - *4 C5 P( b" i4 w6 _4 K& x
- * This program is free software; you can redistribute it and/or+ K, G) A- a% Y; r% S8 W, G. `
- * modify it under the terms of the GNU General Public License as
4 g" X+ |( l/ J s - * published by the Free Software Foundation version 2.
0 H! `8 x& D) C - *
) B- {8 c$ H: ~& ^' Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ Z1 |3 ?* s7 [* H3 M6 Z! N
- * kind, whether express or implied; without even the implied warranty
! ?# w6 f0 m* x* B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( r4 v$ N: ]( v4 ` b) K - * GNU General Public License for more details.7 O% v6 s7 _# w [. l/ U
- */, y: D3 A) z }$ R. N' }
& J( ]: Q6 A4 q8 ^- #include <linux/module.h>
" B. @* [" w1 Q! B - #include <linux/init.h>
* X( z t) d0 Q+ B" A0 y - #include <linux/errno.h>
7 H+ `, H* a( ]' `3 O - #include <linux/types.h>
. e+ q& v. S( c; u - #include <linux/interrupt.h>. ^1 Y2 }2 Q9 ~( y5 W5 I9 f# P
- #include <asm/io.h>
' b+ N* q. u9 w' C1 D2 g* c% T - #include <linux/moduleparam.h>+ W' ~ U$ f; _) `% @ i# [9 h
- #include <linux/sysctl.h>9 P: D6 C' y/ x8 ~
- #include <linux/mm.h>
9 v" w% L) v0 d, w( Y* T: P - #include <linux/dma-mapping.h>7 `5 |# d' t* D& F, \7 d6 m( S) |7 P
- ) Q7 Q! Z3 j) h! w; W) U7 I4 B
- #include <mach/memory.h>
; q. m m" o5 [2 y* g - #include <mach/hardware.h>. ~# L) a8 |2 l. Y9 A
- #include <mach/irqs.h>( O& ^' H: L& b
- #include <asm/hardware/edma.h>
) k. r8 l6 H5 f8 L, }& c - " a. \; v: t; {2 M1 n3 Y
- #undef EDMA3_DEBUG
' U* S& _5 O, A& y; w - /*#define EDMA3_DEBUG*/
0 ^& i8 D' a$ T! ~ - - B) Z9 H5 m7 v5 ]7 n2 ?+ V3 H
- #ifdef EDMA3_DEBUG
9 U Z$ o* d8 m6 \% s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# Z; ~- Q2 V, u9 J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# |% ~9 _3 e* R8 R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# U, n2 d! s- N
- #else& k0 U; T) i, t# E7 O/ t% ?9 G
- #define DMA_PRINTK( x... )1 v# S P# Y7 ]2 S' F
- #define DMA_FN_IN
9 ~+ Z4 r8 J' R. x& l - #define DMA_FN_OUT
8 k: |* _; o7 T! M* Q$ p - #endif
! x1 L4 i& t- n/ o - * I- w* s/ S4 b9 b- W+ w6 C6 t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. t9 M. @9 E8 V9 S. _ - #define STATIC_SHIFT 3
; h8 a$ u# ~' |. r5 \, H1 E - #define TCINTEN_SHIFT 20+ Q2 U t, C1 \: R6 {8 [; r/ b/ c
- #define ITCINTEN_SHIFT 216 t& p+ S% u& S% `2 g& b, J
- #define TCCHEN_SHIFT 22
: f2 m1 D+ l4 W& s - #define ITCCHEN_SHIFT 23
( x% S' r9 K9 \" a" W5 w
; v- y# m! f& V- static volatile int irqraised1 = 0;
3 [2 u/ ^7 T, Q. c) u& j8 u: j - static volatile int irqraised2 = 0;
6 _$ H S' O( y% W8 Z' R
. y8 y. B: v3 Q/ f& `4 q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ {' x6 r1 X+ M1 r7 Z6 N3 j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 X F6 T' j& M. { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( K) H/ G( T u, o4 ]5 D' s
- 3 G [+ o ^* ~# V8 b5 g
- dma_addr_t dmaphyssrc1 = 0;
) \+ o( A6 d. `% V3 } - dma_addr_t dmaphyssrc2 = 0;
$ I; n Y) i# `+ q6 c4 Q# x/ E - dma_addr_t dmaphysdest1 = 0;9 ` m+ i+ X* F3 L" ~4 \
- dma_addr_t dmaphysdest2 = 0;
& I# z6 f4 J8 W; g; g/ K - ; Q; E. @8 E5 C+ l
- char *dmabufsrc1 = NULL;
0 O3 x. H* v' w1 }; X% b- m1 Y - char *dmabufsrc2 = NULL;. F3 o! `( O2 }6 }0 R4 l
- char *dmabufdest1 = NULL;
2 L5 l8 J9 u- k - char *dmabufdest2 = NULL;
$ p5 ~& _0 G% `: H& s* v - 3 [ k' l8 H9 n' w8 D+ M9 D: ?
- static int acnt = 512;- W3 }+ ^" H4 c
- static int bcnt = 8;
: u4 d: g1 O' }6 C% O% w - static int ccnt = 8;$ ?( C5 N w* [7 o& p% A
- + Y. W: i3 K* u3 W
- module_param(acnt, int, S_IRUGO);- r/ B" {6 B9 L1 G/ ^ \9 z( O
- module_param(bcnt, int, S_IRUGO);0 g7 R4 P9 S- b3 W# k
- module_param(ccnt, int, S_IRUGO);
复制代码 $ W& r# E0 s# O% `+ Z* L
' K- ]' M, ^3 M5 d7 x4 V% K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 \% d0 _; r' O5 u) t2 g7 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* T% w, T7 J% b: o: N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 E2 j# i) q* ^% M% [; C0 J% B$ A
\ Q! w; p8 S7 z+ {8 |% x
9 @, v5 [9 C% A& ]5 A0 N |
|