|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 o% _, M2 H5 }6 E* u/ X- [code]EDMA sample test application# P: S" ~9 l/ F+ o* B5 U" x% \) A3 l
- /*
* V9 x: z* v1 y4 \# b9 N5 r7 A9 y - * edma_test.c
6 j7 n* f5 K- {: [3 [8 J - *
+ t' s4 b7 f- o2 k7 Y: M! O1 P - * brief EDMA3 Test Application! d3 ^( z+ t W$ C" ^. W
- *! x/ S3 H% |3 F+ F
- * This file contains EDMA3 Test code.
6 x) ^( A4 d% X5 J* A+ h9 j - *
! f: M& ~' W+ x8 _% g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 U- H( |6 Q$ U/ u, L; v* ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 {5 B; n* q, Z: V) I+ o
- * TO CHANGE. `; C U% s2 d7 x+ f
- *
# n3 `2 b( a, Q& O; o' }5 H' L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ Z, R! V$ _# }
- *
4 n {! ?8 r* l2 S9 X% c0 g/ t6 g - * This program is free software; you can redistribute it and/or( t9 C M% i) E0 }- s" F5 q& c0 p( B- x
- * modify it under the terms of the GNU General Public License as. d# Z$ c5 D7 a6 p( P
- * published by the Free Software Foundation version 2.1 j, O% M/ F G6 c; f
- *
5 v9 ?- {5 P w, ] Q8 J) s& Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 K) Y# z0 f& s1 z
- * kind, whether express or implied; without even the implied warranty
: z$ i, d. n8 |' j1 b7 t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- s B) O: |3 @, C/ l3 |3 J - * GNU General Public License for more details.
3 K( T$ j$ c; g$ | - */
2 q0 K/ k4 t* V p4 L
: [, `' p' n, E' Z1 f: X- #include <linux/module.h>' X) q- E. @4 ] P8 b0 Q
- #include <linux/init.h>
' l1 I7 W0 c7 J* F9 x; ~ - #include <linux/errno.h>1 e0 z" {/ v1 t, y. a( H3 D! t
- #include <linux/types.h>
6 Q9 x- U. _: [9 M - #include <linux/interrupt.h>* o, c/ K6 T6 C2 T
- #include <asm/io.h>
" |( W1 I7 c) Y$ e7 E - #include <linux/moduleparam.h>
4 L3 q0 x1 @7 O7 Y- I - #include <linux/sysctl.h>
3 n4 ]$ k7 [, r6 G6 I- m - #include <linux/mm.h>
$ M% [) T6 h& z0 _' ~( g" ? - #include <linux/dma-mapping.h>, {9 }0 M9 o$ v; A& c
- 7 s, ?3 |& }# `
- #include <mach/memory.h>' V i3 u; ~! L9 C
- #include <mach/hardware.h>
* `! a! G+ G9 R, J5 H0 e9 Y' C - #include <mach/irqs.h>; f( q0 d9 K) M- E6 l9 D
- #include <asm/hardware/edma.h>/ s, L$ C& L1 v" [" Q
- " y9 V. ?* F, T/ r0 c
- #undef EDMA3_DEBUG/ m# X& h) b, L @$ ^+ m4 C7 U
- /*#define EDMA3_DEBUG*/
9 E4 |& D; C5 D% w/ u2 ]
5 x" a+ ]# w* i8 G- #ifdef EDMA3_DEBUG+ M( K4 G* A- _# }( o, Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 F5 J- r$ E) C1 C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 S1 Z6 S1 Q& f4 m. Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 T, A8 y/ z9 k4 U: h - #else
: R. s) W. k) M8 B. h - #define DMA_PRINTK( x... )
6 `. w4 w& P* [# `6 p6 U - #define DMA_FN_IN( K2 x2 j u @2 P; l5 t
- #define DMA_FN_OUT
6 S( T- G$ k" d( ]2 _' d5 j9 u% e - #endif
* W; q3 Q! _. n/ S- g) }' u* _ - 6 E. K9 W: s. Q2 x, w; b( Y2 N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ W1 n) g! P, l: X$ p - #define STATIC_SHIFT 3
! t) o2 p; Y" v8 X6 e - #define TCINTEN_SHIFT 20
9 x' M& g' h- Q+ t. t v! p - #define ITCINTEN_SHIFT 21
# b/ y, m7 g1 L; B, _$ Q- R2 ~ - #define TCCHEN_SHIFT 22
: ]: ~8 B' L( C2 C8 X - #define ITCCHEN_SHIFT 237 w2 a5 L8 Q5 N* `" _
& E- U; u7 o5 C; H: c% \& A- static volatile int irqraised1 = 0;
4 m+ Z: c& r) Y! A9 x. ~( ` - static volatile int irqraised2 = 0;2 p* i. S' S$ V8 M
- ( d2 f9 \ K F5 C0 `6 s1 K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 _; R( | u& A7 v: G; ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* `1 L" Y" f. |. k4 w7 O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, j9 u$ u& ^# Q; v5 z& A
- ( v' \9 d9 K( H! }
- dma_addr_t dmaphyssrc1 = 0;. }2 C! o3 G `; i5 `0 C
- dma_addr_t dmaphyssrc2 = 0; l4 k! {( U% c7 x9 J+ S
- dma_addr_t dmaphysdest1 = 0;4 ~! @" ?, m1 z
- dma_addr_t dmaphysdest2 = 0;
# S5 ?* O" Z0 | - 4 m$ _+ I) |; P6 N# Y
- char *dmabufsrc1 = NULL;
. a$ ]0 m8 W5 }, v2 q" A/ z - char *dmabufsrc2 = NULL;
2 L" D2 W2 w, P' a1 n - char *dmabufdest1 = NULL;$ ^% A5 R& u1 D7 a
- char *dmabufdest2 = NULL;% H# I- Q0 G3 C7 v; [# V. d2 T- o W
+ c0 f; O( s* h: _* E- static int acnt = 512;: D: E$ T: B- H" T$ W9 P( ]
- static int bcnt = 8;
9 q0 ]5 O5 q X! ~- X$ H. E - static int ccnt = 8;
6 e* f6 I+ ]: b# M' s3 t - " j$ I, R# i$ X+ B/ G
- module_param(acnt, int, S_IRUGO);
' G0 N9 k& ]# n8 W - module_param(bcnt, int, S_IRUGO);: o1 K) n `+ {' a1 j9 ]: {
- module_param(ccnt, int, S_IRUGO);
复制代码 / e. F( ^/ n! I; y8 E; P( N
2 \& K' Z' _- e& J' P# l* O# l8 }0 L$ }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( H7 c, X/ ]' _0 J8 q4 o0 k2 Q! S- b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, H' Y/ G% Z' T7 X) l# g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' t. Z6 G; f6 I* Z G/ A
9 e$ s. d7 Q# @& F
6 {0 q: l' D+ \2 w: K( U" n5 | |
|