|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 {5 e% w" G4 d; C- [code]EDMA sample test application
2 r0 g# ^6 x$ ^6 g. l - /*
( ?# V* d9 I6 g1 k* w - * edma_test.c
5 z2 C- D- ?1 x i7 N% s - *
* `1 P: S) ]7 L) } - * brief EDMA3 Test Application
' j* S6 N9 ^! M8 I7 Y - *
$ n1 g) f" j) I& Y3 T; X) n - * This file contains EDMA3 Test code.
1 f. G: r" v9 L6 @- u+ A - *
3 D6 X8 M" N4 X! O1 R u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE G4 [+ w8 H- F9 \" U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- B4 ^& y" |3 W; G* U - * TO CHANGE.) W2 F; H" ]$ R5 A- H$ b+ [( j7 l
- *# g3 U* O( |- o/ b3 y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% k% k) }, |+ F% S6 f/ T$ U! F' q( H8 @
- *
# m* p1 x/ b/ u- n/ L0 O' i0 J/ F - * This program is free software; you can redistribute it and/or, w* M! \' M) \3 V
- * modify it under the terms of the GNU General Public License as$ D9 ^# D: c5 J
- * published by the Free Software Foundation version 2.
) c% _8 c/ Y9 B5 }- k. c4 y - ** T7 {# T4 ~8 M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" ]+ v$ A' o! R9 `/ b - * kind, whether express or implied; without even the implied warranty
& P' a& L% Z% \& g5 R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# D1 h3 r2 R0 q. Q2 l0 O
- * GNU General Public License for more details.
4 [4 B' [( _. s- k8 \; i* l" n - */
& i: O$ H) ~8 j/ J. G$ s - : p; k" x/ }+ I+ l( u( f8 u- Z
- #include <linux/module.h>9 {1 B+ N# x6 z3 {) C( U5 m
- #include <linux/init.h>' g# a, Q* g" k8 }# y
- #include <linux/errno.h>
o ~; u1 ?5 E. N H - #include <linux/types.h>
9 v5 [/ {: w- D# M' h/ K - #include <linux/interrupt.h>6 P, R$ `) S% k
- #include <asm/io.h>
- R9 a+ x9 z+ k/ y9 _9 O$ X+ k - #include <linux/moduleparam.h>1 m7 i/ T/ m- D! k3 E8 h y
- #include <linux/sysctl.h>
. E* a# x- V2 Z9 E% a, X& \ - #include <linux/mm.h>& R- j( Z6 t: u& c1 R& s
- #include <linux/dma-mapping.h>
) @( y) V: L/ g- Q
: { w6 h7 J: m1 ~& v6 s: {- #include <mach/memory.h>$ a6 \& Y; N0 X# _. I# f, M5 o
- #include <mach/hardware.h>
8 W# \6 H8 N1 ?) D$ J Y/ `; K - #include <mach/irqs.h>+ z/ x# C* Q* W8 Q
- #include <asm/hardware/edma.h>
( a' n4 {& ?9 E' b
O% c% `7 R$ E- #undef EDMA3_DEBUG9 L3 C. `; i* H
- /*#define EDMA3_DEBUG*/ M0 s' u2 Z2 d3 u V$ o# j
- . W0 C3 l, [4 v2 ~; D9 z1 t
- #ifdef EDMA3_DEBUG# ^3 Y0 L7 e* P: {* E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% E) B3 z& _7 g! | M. C0 f2 T9 j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 a: h" P& z {" w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! I' M$ L9 `% Y& l0 V
- #else( v- G3 ]" I4 x( u
- #define DMA_PRINTK( x... )
" }$ p# |5 S7 c1 m - #define DMA_FN_IN
) K, I: q9 ^4 X! l; R K - #define DMA_FN_OUT- d1 ^ M8 V. K: V6 X1 ]! P u
- #endif4 A9 Z: n% q4 ?% h* k) W8 |* ]
- 6 W4 r$ D* d* b, u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( H/ Y9 r2 U2 g! Q9 F$ G/ c - #define STATIC_SHIFT 33 W. o* p& }/ o5 h+ @7 W
- #define TCINTEN_SHIFT 20
3 U" e( \ P9 K! b4 T - #define ITCINTEN_SHIFT 219 h8 C& S) D6 E) L
- #define TCCHEN_SHIFT 22; V+ m. K0 C1 \" b! r
- #define ITCCHEN_SHIFT 23& B) h3 y7 g, ~2 K. k* {$ ]5 ?
! z. P7 m5 o% w8 z' b& f! L; H- static volatile int irqraised1 = 0;
. h( L* ?- Z" k0 s$ d0 G6 @ - static volatile int irqraised2 = 0;
$ @3 p9 c3 b- r- f* W - i3 l) u# j. a" B H) }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); G& M# Z6 `" D( I* _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) V% J6 F6 y0 u0 Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' R# e& a* G* P
" o: K* x5 ]9 v3 \: l& T5 K( D" c( _- dma_addr_t dmaphyssrc1 = 0;
. R' U$ i [1 x! g& h8 c- {6 p2 @ - dma_addr_t dmaphyssrc2 = 0;7 Y0 v% k, M9 v4 P
- dma_addr_t dmaphysdest1 = 0;
7 N- R4 f- b! i' f4 c4 |. u - dma_addr_t dmaphysdest2 = 0;% |* V. W( P+ I* ~% L* [. `/ ^
2 p, d" P# }. z0 ~9 w/ A# n, i- char *dmabufsrc1 = NULL;5 d2 \; w( g! k2 r2 ]
- char *dmabufsrc2 = NULL;: ]8 {; D4 L/ u" g
- char *dmabufdest1 = NULL;
$ P/ v' g. r7 n - char *dmabufdest2 = NULL;
: r k6 B% b5 v' A) b/ D$ {
5 h( L; C4 N* G& Q- static int acnt = 512;. |) H* P' `* T8 f) T7 T+ k& ^
- static int bcnt = 8;, L: y/ K! Q6 {7 ^2 r- k
- static int ccnt = 8;2 [( Q9 T3 @( g. Y' [: B
- % t/ n$ X* u4 A6 H3 }
- module_param(acnt, int, S_IRUGO);: h9 ]/ o" ^0 g) }+ M( {/ _" s
- module_param(bcnt, int, S_IRUGO);
: G$ c6 Q5 S5 n - module_param(ccnt, int, S_IRUGO);
复制代码 2 J/ p) N, E1 T" S5 f
4 ]! d* g2 G5 }% H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ ~7 C+ k/ ]# ^+ v, darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 l- I6 `3 F2 M% B; O& H& {* R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' j7 V6 I" g+ J1 d6 H4 q" }
1 G8 r: Z" M2 E A r
4 X3 A& x; N& b; |
|
|