|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & h, L/ O. j" `' U/ @5 m1 v8 X
- [code]EDMA sample test application1 d2 V) [$ Z4 h! Q( K5 A5 H
- /*
$ v, B' \# u0 @/ O- x - * edma_test.c
( b- R! [+ f; }2 d) `' N5 v% c0 w; J - *8 ]0 E5 L( m6 z7 O7 x X* Y
- * brief EDMA3 Test Application1 X2 W F) P" a6 f& w0 B: A
- *7 `/ l# ]/ d! r0 B* S
- * This file contains EDMA3 Test code.
| D4 b1 s. g" \/ ?: o% A6 j - *
) X& V$ g& c- h0 n+ }* _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, v" X6 ?) S& _# ]6 {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 U* x- _3 M8 u$ q
- * TO CHANGE.1 G# e& ]; b, L) h) I* i
- *
. f" P( \( k4 R- c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 o; x- D' C: @5 I# w. ^8 X - *6 m i4 B$ e' Z ^1 ?
- * This program is free software; you can redistribute it and/or% K: C: G. Z3 a6 d
- * modify it under the terms of the GNU General Public License as# V7 x3 R/ |4 @# V8 H
- * published by the Free Software Foundation version 2.
i( {: T" ~. P4 w: R - *2 |9 a" H% z$ y+ ?0 T. Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* s" @5 U: Z m$ q9 D: r - * kind, whether express or implied; without even the implied warranty
! n: E$ }7 _" l3 ?7 b# c( q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
O9 H! y3 G6 }) \- t - * GNU General Public License for more details.7 n K% f. {1 F1 l" X+ W
- */& D1 j7 q& c. b
+ ?6 `8 j. k9 c/ @) v2 ]9 p8 G- #include <linux/module.h>2 O3 v7 L' x$ u% {2 r7 g# N/ V, s3 E
- #include <linux/init.h>
2 a* M, N C* K - #include <linux/errno.h>
) v. T3 j- Z( p - #include <linux/types.h>- U3 X0 O% z q0 F
- #include <linux/interrupt.h>- D! X5 s5 h8 h# f- v& n
- #include <asm/io.h>( O+ I+ l0 \/ P( t& c W9 G' c
- #include <linux/moduleparam.h>2 V f( o. s1 b% O; ~6 g! m1 E
- #include <linux/sysctl.h>; m5 ~; I# T+ ~! ]& M, m
- #include <linux/mm.h>+ a1 Q+ x6 g+ T. ^! ? x
- #include <linux/dma-mapping.h>3 v5 B2 l6 L7 P7 h$ p, |$ h
5 `; \& u z& j7 p- #include <mach/memory.h>/ C$ F! F& W8 C, @/ x' B
- #include <mach/hardware.h>
( u6 i. e# J0 K - #include <mach/irqs.h>
. a5 W. R$ Y4 Q3 R( C7 {1 E - #include <asm/hardware/edma.h>. @5 L8 d' [' A* W/ l$ o
- 2 F& a) ~7 V5 u3 v" j) } l
- #undef EDMA3_DEBUG! S& S: {7 d1 p' }" x1 e, v$ h# j
- /*#define EDMA3_DEBUG*/# \. @, n4 n, w2 w8 l
- 0 ?( Y6 Z4 j( P/ X! y& b) u1 G& Y
- #ifdef EDMA3_DEBUG
; `8 M! C6 Q4 F6 m* M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: m& D2 B( ]$ \, X" b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- @' r7 c+ E V9 K$ y& U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ A+ ~1 `% d# e* y) A0 Z( p
- #else) i5 c+ Q: v; C& e# e6 u, I; F
- #define DMA_PRINTK( x... )
( }8 C6 [1 c4 x/ h - #define DMA_FN_IN! A# X* h; b8 H0 M' {
- #define DMA_FN_OUT
/ P2 e; c/ E5 e, @1 }& B* x - #endif
& K3 D- ]* @! e1 x - + t! e& D2 O W$ x: y7 d; x' Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ m0 S; s! a* D& R0 |/ u6 B
- #define STATIC_SHIFT 3
% h4 x! I# L, o/ \/ w - #define TCINTEN_SHIFT 20
7 U9 W! h3 a& K" ]& |$ X" I - #define ITCINTEN_SHIFT 21
+ A0 X4 c, c, s; c - #define TCCHEN_SHIFT 22- g+ I8 e$ D% F4 I4 d
- #define ITCCHEN_SHIFT 23
/ ]7 J( b* I' t2 f. r5 o - ! ^$ ^# f: D# O% n. q, B3 u
- static volatile int irqraised1 = 0;
* g" k4 h# G" `0 A - static volatile int irqraised2 = 0;2 m) Y& O/ p' G2 w
; f0 P- w" U! ^2 r' v2 J1 E- J; i- y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 n/ n. f" k% K3 g3 W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" T" t% U# \6 C( d$ v: l! p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% K! {5 U' t4 F) _
8 E3 }6 T, R+ o. [; _5 S- dma_addr_t dmaphyssrc1 = 0;. `' H3 w3 e( _3 A8 @
- dma_addr_t dmaphyssrc2 = 0;
2 U# }+ \" |+ ~$ } - dma_addr_t dmaphysdest1 = 0;! D R6 D1 p8 {. p3 N
- dma_addr_t dmaphysdest2 = 0;3 E* V+ E" A* T5 w) y
) q1 U+ z5 V9 y% g/ w3 V$ g8 w- char *dmabufsrc1 = NULL;6 Y" H, Q$ _3 }" H t, A
- char *dmabufsrc2 = NULL;! q1 ~+ _! d6 z. t, A. C$ `! y
- char *dmabufdest1 = NULL;- P/ x) z- t, s6 D5 w! c
- char *dmabufdest2 = NULL;
9 R$ p+ U" ?- c9 o
5 y, {: X/ z. k- static int acnt = 512;
5 m" w9 b; g) I# r3 A - static int bcnt = 8;# w, z. { k* z- R" Q- Y/ u
- static int ccnt = 8;- S/ {$ T0 @( A5 u H
- . G; O) ?* B! W4 u
- module_param(acnt, int, S_IRUGO);
0 ]1 @5 X8 n3 n0 C& y4 O6 S* \ - module_param(bcnt, int, S_IRUGO);$ h4 k. K) `) X0 |' |
- module_param(ccnt, int, S_IRUGO);
复制代码 ( N j6 p4 \2 s6 l! L n
; A" G% }( Q! P w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ D; w) b# Z. R% i
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 h0 ?' M( O$ O; q+ s _8 W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# f" X8 c/ ]3 ^2 @7 u4 f7 `5 I
# P' k0 ]& m! S a) U$ @" }1 O
" h! h1 d$ k9 N6 e- _7 B |
|