|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* b K; @6 L" ^/ B! ~- [code]EDMA sample test application' n! I( h5 y7 J% W1 y
- /*; @& P& ?) K3 w/ Y' P* J1 ^9 P( S% E* M
- * edma_test.c5 j7 D" }' A/ b5 s4 `
- *
$ d( C5 Z% T& } - * brief EDMA3 Test Application
P3 i: X3 L* m% y; U2 b. F - *
, b5 W" N. j! }! A - * This file contains EDMA3 Test code.
" i: M8 j+ g O - *
" |/ J& [* L; h5 w$ J3 S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 E$ w8 \, Q2 i W8 T+ U# z% \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; o2 w" _" W. Z5 Q* J* F9 |) d - * TO CHANGE.
0 `0 ?9 T4 i) `: ?* S8 ] - *
& V6 m' k5 p& y/ |* D2 A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 K7 V1 ^# d: J! J0 X) z
- *: S' I) s" v) S/ o8 x1 f
- * This program is free software; you can redistribute it and/or. k4 s7 d( r% {
- * modify it under the terms of the GNU General Public License as
4 U! a6 N; x0 l" i; }/ a" D - * published by the Free Software Foundation version 2.9 f, g" O$ z* f1 f: c6 G, `/ F4 Y0 V
- *
# P: ?5 c7 D" ]( h0 J& ~ H5 o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' N& q/ M3 [) H/ g3 Y! p( Q, `
- * kind, whether express or implied; without even the implied warranty
1 n8 b$ o2 Z5 t3 S; Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
B) O+ y2 G) M; Z' x" D0 v - * GNU General Public License for more details.
3 h4 o$ i6 i+ f4 h1 c( g7 `; Q; v - */
- L9 z$ i6 N1 j: p. } p* `, G+ ? - ; k& B# {0 s0 y0 d9 U" `" _5 }
- #include <linux/module.h>
4 H5 X. i* s+ ?# Y - #include <linux/init.h>6 d3 a7 l* G' {) G/ I0 A3 R; a' E
- #include <linux/errno.h>
8 m& R: A* T; k+ H$ R. ]2 { - #include <linux/types.h>; S4 G2 r- d' I9 |& L- T9 V' t
- #include <linux/interrupt.h>5 }6 j* [1 n; H9 U. v3 R
- #include <asm/io.h>
; ^/ o( C0 \4 P; r6 h* ^. d - #include <linux/moduleparam.h>
5 M$ k) N/ e1 Q* k - #include <linux/sysctl.h>
; K2 w- j" y0 m- ?- {" Z! k - #include <linux/mm.h>
2 e) Q. z( s2 ~: @( Z3 T, T, @ - #include <linux/dma-mapping.h>3 X" J8 _. }# q% J* [+ M) ?" l
- / Z! V' K0 ~, o/ r
- #include <mach/memory.h>2 C' \6 ]$ m) v6 A) R4 _
- #include <mach/hardware.h>9 }0 v# g; x$ J ]: e
- #include <mach/irqs.h>2 j6 g( _4 |7 J$ M$ l, F. A6 D
- #include <asm/hardware/edma.h>0 F/ A+ W: U j" C; R* E/ W
+ W. R. ]0 q2 M: \) ?* ?+ r0 |8 R5 ?- #undef EDMA3_DEBUG
1 C% e Z) }& Y - /*#define EDMA3_DEBUG*/- h& R, b3 [, T! S7 W+ M+ Q/ v
. W, h, q5 ]* Q- #ifdef EDMA3_DEBUG( U$ N6 \+ |) d- g, J0 F! p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ ^7 a: G4 h4 s6 o4 Y2 t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 D* S' F7 ?& w2 d& p" u" K5 L7 G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- H( b8 J6 W9 ^9 {% R7 L
- #else
" q: @& n f4 G! y8 X, i8 q - #define DMA_PRINTK( x... )
- u7 g( X/ W* b! L" b# s1 ~ - #define DMA_FN_IN+ y2 @& x9 [6 k" Z* p6 M
- #define DMA_FN_OUT2 N' l, G2 h6 t
- #endif2 \* Y. E; i5 c' o. _+ n
' s7 }1 q9 X9 T2 i1 S# g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# Z/ Z I- i) D
- #define STATIC_SHIFT 3
7 e: r3 w$ T6 A! s8 ~, x5 Y - #define TCINTEN_SHIFT 20
1 g$ H; `6 ]( @! W2 p1 T - #define ITCINTEN_SHIFT 21
) `- E$ U: X4 X5 @ - #define TCCHEN_SHIFT 22+ M! Z) D& e$ U1 s9 X" j
- #define ITCCHEN_SHIFT 239 W. t8 Y3 @3 Y8 ^1 @# O& A- G
. q. k) |8 V# W# _; Y$ u/ i3 Y- static volatile int irqraised1 = 0;+ }; O5 X. g6 O8 C6 U
- static volatile int irqraised2 = 0;
- K: l5 F) T: d% V _- ?
, d2 f4 s% D. s2 [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
J I0 N |2 v) }' x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* I( N# z. Y2 B& K0 {8 U+ h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' z* Y7 P4 K6 g+ a0 i1 W) w
- 8 l& K* S! e3 K Q
- dma_addr_t dmaphyssrc1 = 0;
0 r' B1 A# d: L/ B - dma_addr_t dmaphyssrc2 = 0;
; n& p& @- v" W) q) i* h7 @, J - dma_addr_t dmaphysdest1 = 0;
) ^8 B0 I1 r. P5 Q; q/ f! | - dma_addr_t dmaphysdest2 = 0;
, o& Q% A" c; r v
; F! k8 K$ r( N( \0 ]/ i. X1 U; g/ y- char *dmabufsrc1 = NULL;4 R2 D- g2 c% | S% {, |) G& P
- char *dmabufsrc2 = NULL;
4 E& I( x8 l8 u( k# E, P$ h - char *dmabufdest1 = NULL;0 G! G4 R. h$ a+ J
- char *dmabufdest2 = NULL;; E' z+ v% W1 b0 z' s9 ~& z
- 8 z& ~/ H9 N, M( ]) I8 W8 I9 R
- static int acnt = 512;8 G/ F0 e3 u0 W; O8 D
- static int bcnt = 8;# J8 n1 R @, i F: K
- static int ccnt = 8;
3 x' H( U' w$ i# a/ |7 N - & ~0 q. \$ M9 o7 M! J3 G7 B- y
- module_param(acnt, int, S_IRUGO);% B& e* r$ m5 Y
- module_param(bcnt, int, S_IRUGO);' Z' W- b: t6 A3 _ R; Y1 w" _1 P1 u
- module_param(ccnt, int, S_IRUGO);
复制代码
; a5 Q) o/ _8 y! b5 n8 d' J
* p1 u( `0 W+ a: Q+ a+ F9 T' A. H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 {/ g2 H3 }) varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; a0 M) l, W/ r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( M4 ?) l) Q* C, O2 I; f5 J
4 I5 t+ f) t+ X: J: E v0 G' y
0 ~) I+ ]$ \3 B1 d- x2 a |
|