|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - j( G' S$ G& w! J+ a
- [code]EDMA sample test application
8 ]) t: E, d* e& A% Q8 A - /*& V3 A7 W; [4 c* V; b
- * edma_test.c4 F4 V: d; }) B, ?" @1 d
- */ n! i' S' ] X3 T) y( z
- * brief EDMA3 Test Application2 n7 L/ P: R9 F' N( c+ Y
- *
! Z8 w2 N( X7 ~1 ?+ ]+ _ - * This file contains EDMA3 Test code.8 Z7 r' M$ m! @. {
- *
, g) l0 L {2 v i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% S8 [( X: I" M- S6 s" R4 h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( C( O5 R7 c7 R3 ?. m6 y
- * TO CHANGE.
& u* v, j1 F- i+ k0 b [$ d5 i - *
4 t5 U2 t2 Y# X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% }: j# q! j) i! H! [. O1 g. y - *$ X! u: A1 q z* B+ ?3 H1 {
- * This program is free software; you can redistribute it and/or
" `1 T2 O' L8 H* ^) O - * modify it under the terms of the GNU General Public License as5 t1 ~/ N( P) s, C9 A
- * published by the Free Software Foundation version 2.
, A9 A4 k( V. _+ z4 j - *
% p5 e$ I( [) U$ W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any h R0 \. }* p2 t' e
- * kind, whether express or implied; without even the implied warranty/ `1 E3 @& t2 h1 r- }" e$ A+ O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# r' x; j, l' Y# w - * GNU General Public License for more details.
# a6 l2 v- z9 j3 ?$ s, K - */: `' Y. F. d% R
, H0 _ H8 F6 o7 J/ r- #include <linux/module.h>: y0 M- J; q; j% @+ l* `5 ]
- #include <linux/init.h>7 {# J& a1 K1 H: d3 |' J+ d
- #include <linux/errno.h>/ Y' r# s. Q5 a) T1 j2 Z
- #include <linux/types.h>2 Q. n0 ]5 u* [+ B& K8 T
- #include <linux/interrupt.h>
, a9 I/ O! @! F - #include <asm/io.h>
' M3 }2 t( B: A9 M) [' \) ]& \ - #include <linux/moduleparam.h>' ^. }) u+ a1 F
- #include <linux/sysctl.h>
3 O$ }: e3 K7 }9 Z' l+ F - #include <linux/mm.h># }3 w0 ?7 X3 \- ]
- #include <linux/dma-mapping.h>
8 e t( b- o. _ |0 n - ( ~2 c( r# J% F. U; H9 V" j
- #include <mach/memory.h>7 D8 t8 F7 Y6 V) H- S4 s
- #include <mach/hardware.h>/ @! Q8 s0 B- ~, C2 x- _1 B
- #include <mach/irqs.h>9 M2 @, l0 l2 j, u$ @* X7 [
- #include <asm/hardware/edma.h>0 |3 D$ u2 y: |$ C# [
, F6 a1 f; s0 q. b+ Z% X7 Q* z8 q0 C- #undef EDMA3_DEBUG
% \7 t6 o0 s5 F( q0 @: ? \ - /*#define EDMA3_DEBUG*/
4 A- E$ P* k8 H0 y! [
3 ^% M% w5 Q k) ~4 Y. P" C$ m- #ifdef EDMA3_DEBUG* A. r' @6 W: ]+ R/ Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: y2 \+ o+ [3 e* V* i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) V/ R0 A' U! @1 Q) c* t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 ?" v! u) m9 d - #else4 D/ R% c- e1 q
- #define DMA_PRINTK( x... )( T2 N( l" |/ N2 \7 D7 l
- #define DMA_FN_IN$ Z( V9 e8 `- l1 @7 m
- #define DMA_FN_OUT& E9 h( D' N6 C, Z+ \+ S0 Q; b( M
- #endif
; r3 w7 [& l# U* v& v- r
9 g# |. W% l. y( v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 N* V: T# `& Y$ }& {; X" F* D' M- r5 Z - #define STATIC_SHIFT 3" O7 O. f6 G: Q1 Q
- #define TCINTEN_SHIFT 20+ N# O7 ]$ ^- `+ d
- #define ITCINTEN_SHIFT 21) X. X6 j7 X- B3 J1 R
- #define TCCHEN_SHIFT 220 s# x9 \" F' J1 s- u, }
- #define ITCCHEN_SHIFT 23
, a) r* @# V9 e$ O
; J$ W: b- u* T9 S+ }# P+ N- static volatile int irqraised1 = 0;
$ W7 c: j; z, U9 J0 `5 L - static volatile int irqraised2 = 0;8 h& i. S) @" ^5 M+ x d
- K% W# \4 r. @+ g( ~+ y+ t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 K& P$ F4 O" \4 v% w7 g, h. z% \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 n8 z C- @7 B* \3 t. t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. {$ v3 _; u# w
& k {6 n4 Y" @, D* `& i7 @( w- dma_addr_t dmaphyssrc1 = 0;
' M: Q, C0 {1 v3 K" f - dma_addr_t dmaphyssrc2 = 0;& ^- D5 {6 _. H* f
- dma_addr_t dmaphysdest1 = 0;
* A7 O1 k! ~) W! y& @ - dma_addr_t dmaphysdest2 = 0;# ^: t7 P n" c* B N0 s
" N/ D6 _+ }+ H/ m2 R, o0 B- char *dmabufsrc1 = NULL;
3 R6 V: y) H' b! Q - char *dmabufsrc2 = NULL;
. N0 j! h, k+ ]' q6 T9 e9 ` - char *dmabufdest1 = NULL;7 O4 l2 u8 |# b- v* X( C" T- E
- char *dmabufdest2 = NULL;2 R# F! e9 g( K @0 p" Z
- , {! k/ e% D- N) E9 |
- static int acnt = 512;
& l/ Z7 q8 P8 c7 s- S - static int bcnt = 8;
& c0 m7 b& a' Q& M# C - static int ccnt = 8;) L5 `* z" D% u1 x
& H" v6 Q7 T7 g- ^; Z B( }- module_param(acnt, int, S_IRUGO);
: X! p5 Z& m/ r8 B0 |" h. U - module_param(bcnt, int, S_IRUGO);
1 e6 E1 Y4 _" ]5 ^! d! M& J) J - module_param(ccnt, int, S_IRUGO);
复制代码 5 j- v# q- [, P! L( t" B& H
1 n1 T! n1 u3 ]. x! K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ g# l. e( O8 ^+ o2 zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) L$ a2 S. Z: n8 k! {% I+ Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ [3 x/ i! a4 x, p8 D
9 S/ p4 s, A8 k, ?+ A) p
C# o& f' C/ F+ F0 h& u |
|