|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ z4 c: M% z0 B+ |9 N. K, i7 m- [code]EDMA sample test application
- x( D" j) m' [/ K# r6 @2 s7 w+ Q1 P. K J - /*7 J. G- m8 o6 c' L# F+ Q
- * edma_test.c h W! R' N# F- x, z
- *
( X' W5 U+ @# P+ e - * brief EDMA3 Test Application1 e- q; C5 z* T9 S: K6 {
- *$ K- E3 x7 ^0 ]8 A6 `
- * This file contains EDMA3 Test code. r s6 H! N L* K
- *) G" M( r! a- B I( i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( Z; k5 d" W3 A+ U8 x6 o; S+ | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 k7 X3 w( z4 N( Q* a5 c f# q) k
- * TO CHANGE. @5 h# Y( H, u$ B
- *9 V% M6 Y# `7 {" y" o9 j+ R5 T2 i1 T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% l1 v4 G! @% c7 v7 g
- *
/ A4 O" U+ L A# l; y - * This program is free software; you can redistribute it and/or
4 d' E+ k1 p* Z: r8 }" A2 m - * modify it under the terms of the GNU General Public License as* O( w6 i& K) o/ G4 h3 F# c4 O
- * published by the Free Software Foundation version 2.( x6 b5 _. s% `7 o
- *
% {; \' _7 W* n5 p y. G: }0 q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- `! \! R6 S$ c& ] - * kind, whether express or implied; without even the implied warranty# W3 _3 S! l! D0 S2 d1 k8 b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 O- S; ?+ Z: R W' W8 h2 ]& L
- * GNU General Public License for more details.
; X# O- ?+ ?. ~$ x6 w1 z4 @ - */
4 X( T& \+ e3 v& J) ` - / ^, Z# {; ]" ~6 D
- #include <linux/module.h>
* E8 e/ H% g) O' o- d' H - #include <linux/init.h>
4 ^0 T5 u, J) d! ]6 I - #include <linux/errno.h>
% W) f, e. I5 u( J - #include <linux/types.h> A- E% u6 d* l# |' e# {
- #include <linux/interrupt.h>
) T/ V" o6 B0 u: t - #include <asm/io.h>0 k/ i! u. z4 r6 ]! S) F
- #include <linux/moduleparam.h>, [3 a- z' i% X% S
- #include <linux/sysctl.h>
% \6 K6 M; ], K) _, I+ v - #include <linux/mm.h>
* `: }1 _5 G3 ?) k6 t8 N - #include <linux/dma-mapping.h>
% J/ [' c2 _0 V4 ?5 p3 y
& v# W4 k: `: H3 B4 p- #include <mach/memory.h>4 n- p% H( I Z; d
- #include <mach/hardware.h>+ r% ?9 F! S+ \: F; X4 ~; Q5 q
- #include <mach/irqs.h>
) ]9 d( {& V: c& ~" x7 d - #include <asm/hardware/edma.h>1 I$ h- l! B6 A# b5 W4 i$ |
; ]1 v. \ |5 \: o3 @2 [+ F- #undef EDMA3_DEBUG0 e: `6 B8 T8 ^' |3 m( M
- /*#define EDMA3_DEBUG*/
; a4 {* W8 y- k- K
) J/ y; S, P8 `- a5 D( z5 Y4 N- #ifdef EDMA3_DEBUG7 O& @" z0 _; j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 |' R/ y s3 |* _* F& @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 ~' U! M* D1 f$ A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). w' T/ c* ?$ u0 G1 F& q
- #else
2 k9 K; j# j& q+ x" c" \ - #define DMA_PRINTK( x... )$ r- @* z. L8 n K) L% r
- #define DMA_FN_IN
3 o- J: h* M' X2 ^2 j; f4 s - #define DMA_FN_OUT7 C. S; b! \! D1 s% n
- #endif
- D% u& S% \$ j - , c0 ?8 _, {. e# F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# z% t$ f8 |: t
- #define STATIC_SHIFT 3: L) i" E# e" t. M
- #define TCINTEN_SHIFT 202 K; m5 J" l+ Y p! y" M* M
- #define ITCINTEN_SHIFT 21
3 Q: b2 K7 V: g4 m+ Y$ R - #define TCCHEN_SHIFT 22
( _! f" y3 R c6 G5 Q4 t* C - #define ITCCHEN_SHIFT 23
: ^0 G$ r; c& v" ^ R" D - , T4 {( Z k6 O# m' Y9 Z
- static volatile int irqraised1 = 0;- F# T( D7 x1 W: G$ O
- static volatile int irqraised2 = 0;/ V) B, d, r$ W
- 5 N5 h0 V/ r7 k% ~! u! d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ C- E8 h" G6 `1 S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- ^. o# m: ]. V0 O* F3 a1 [8 W( W- m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 B& H3 j! o9 Q+ c' I
- 9 B2 s) g& b% \5 r# k3 C0 J, P% L
- dma_addr_t dmaphyssrc1 = 0;
+ r) Z0 E. ^$ m - dma_addr_t dmaphyssrc2 = 0;
7 J* p6 u8 g. ~2 f - dma_addr_t dmaphysdest1 = 0;! }3 O1 x" C& `8 }" g0 P
- dma_addr_t dmaphysdest2 = 0;
$ J5 g: p" K x1 ^" u* C9 k% G1 a - ) `4 T' [, f) u5 j7 l+ C. B- M
- char *dmabufsrc1 = NULL;; \6 e/ p. {% S8 ~+ @
- char *dmabufsrc2 = NULL;/ A1 w- H4 M4 ~1 ^+ m4 p
- char *dmabufdest1 = NULL;5 u1 B3 D, R/ ^0 o) w# y
- char *dmabufdest2 = NULL;
, H( r* D! G2 ^8 y - ( R, b' q4 g0 y2 U
- static int acnt = 512;
2 q. \' V9 d2 T6 W - static int bcnt = 8;
/ L1 J. b% c2 c, U# Y3 a - static int ccnt = 8;+ b) b+ h" ^6 _) I9 K% V2 Q( j0 j
( v6 c+ |2 \) t' c( f- module_param(acnt, int, S_IRUGO);
3 n; \" g$ ^( c8 B# y- m! F - module_param(bcnt, int, S_IRUGO);
& I% |6 Z% g. l. c - module_param(ccnt, int, S_IRUGO);
复制代码
3 W: p8 y3 V! V2 b% @
/ N" d/ r* z1 |* l( a) s8 ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, N" M5 W% ?: }/ a9 r7 B7 ~. x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ T* ^+ [3 h# j: ]4 ]; n2 Q, E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
f( E V1 G6 X& Z9 C7 w2 P" Q5 i& V2 z
9 `: J9 F# L. ?! }4 u8 w |
|