|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * ~1 a2 _9 e {+ a3 A, L# N
- [code]EDMA sample test application, U- }8 g: H ?9 W, Y, M6 @+ Q
- /*
$ Y K$ r2 W& [7 l/ i - * edma_test.c! U8 n `8 {6 U6 A9 Z+ O2 }2 n
- *
" g2 e! `: h- D _ - * brief EDMA3 Test Application5 X! q) ]. Q- N( @/ D0 I
- *
: H8 H% }* d: Y6 C% K1 O - * This file contains EDMA3 Test code.! R" e' z; x, H9 a9 B/ l7 x* u
- *, x/ N6 @: w; b: j( R2 e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* ~) f/ s- Y: N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 B8 V7 n# }) X+ u2 w - * TO CHANGE., w) h' {1 d+ `' R" J m- m9 X
- *9 g" K# \, e! l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 l6 v& o6 Q6 J( k' j! g7 V - *
' d7 n- Z; i3 ]" ^; ^$ V8 B. c - * This program is free software; you can redistribute it and/or) l" O; f- L6 S8 U
- * modify it under the terms of the GNU General Public License as
( a2 a' j1 J8 z0 A - * published by the Free Software Foundation version 2./ h& I1 W7 `; ]. k
- *
! F2 N, k3 r, l) ? - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 V; P4 x+ I( v$ \1 a" x
- * kind, whether express or implied; without even the implied warranty- E# ^% ~% b9 T1 B: X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- k: C; m0 _6 ?
- * GNU General Public License for more details./ u6 ^: ~7 E; f/ p0 C1 h
- */$ c. x% Y4 m0 ^8 F" r" n o0 G
- . v+ J, z/ Z' o; w$ W' k0 S
- #include <linux/module.h>
& i8 f3 A3 x! ~- A" G - #include <linux/init.h>
( B) P/ Z2 M& A/ O4 A5 z - #include <linux/errno.h>
1 k, w+ N) X- Q - #include <linux/types.h>
. B% E# |- \7 }# q - #include <linux/interrupt.h>$ v3 D9 y; s }! f; M
- #include <asm/io.h>9 ]% {: w4 o' Q& j @" n* J
- #include <linux/moduleparam.h>
$ m' |# I8 r, x1 {/ T - #include <linux/sysctl.h>
& i2 ]2 ?8 J1 z' b7 a - #include <linux/mm.h>
+ B/ I- _! W0 V \ - #include <linux/dma-mapping.h>
" a. R7 M5 [2 [/ E9 K - / v$ a2 s6 s# W3 I0 C. Z
- #include <mach/memory.h>9 q2 \" Y b2 z1 v& v% s. R2 d9 f
- #include <mach/hardware.h>
& b1 O& I) P/ r5 d/ V& \ - #include <mach/irqs.h>8 m- e, V- e0 X3 b4 g/ q
- #include <asm/hardware/edma.h>
3 i/ R5 m, F2 n: Z+ w/ ?: j' v( E - % u9 U2 N: g2 q
- #undef EDMA3_DEBUG
& B1 X2 l( X- l$ F1 W( y, J7 Z - /*#define EDMA3_DEBUG*/
0 N# r$ p j$ c: ?6 J8 K+ w - 0 ~0 {- v: i4 l4 x
- #ifdef EDMA3_DEBUG1 C, | h% N5 t: k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& O7 h# E! @. p2 H& f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- y( U9 P3 C( A* ^8 \! I: h6 `: v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' V/ A6 D: z Z# K, O% T* h) F
- #else8 ]# a0 X$ W6 W0 y
- #define DMA_PRINTK( x... )
, e N( L( o; m C - #define DMA_FN_IN9 i$ `6 A+ G7 i+ ~7 w6 F4 ~+ K. r
- #define DMA_FN_OUT0 J' _' v9 Z3 X* _
- #endif3 m5 L$ F( L1 a# |- `
- 4 P1 V. w d& ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ Y2 p/ C9 P; d8 {) ~ - #define STATIC_SHIFT 30 k6 m& l, i0 T" n3 V0 @0 E: m
- #define TCINTEN_SHIFT 20
9 \# c; z/ o/ W0 g - #define ITCINTEN_SHIFT 21
* M* k+ M6 t: W4 T0 Q' d, o& o - #define TCCHEN_SHIFT 22
: L2 R7 q `/ ? T, { - #define ITCCHEN_SHIFT 232 i* R9 _- s/ q8 \
- 8 t5 E4 n: K! Z. u8 `1 y
- static volatile int irqraised1 = 0;6 N' l# @, Y$ J5 n; R% K- o; N
- static volatile int irqraised2 = 0;* K# c4 T. i, S4 o+ e5 K5 p
. Z2 i; V- M# E' J& B0 I/ N3 V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 T6 B* b' T, M% h9 {: I% A8 C% f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 C$ O: H* r' N7 Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ]6 h, g5 p9 @. T t& ]9 d
- ; x4 b% l# R' o. \& O$ D [
- dma_addr_t dmaphyssrc1 = 0;
+ C* i' R5 a( A6 q7 ?) I# `# E - dma_addr_t dmaphyssrc2 = 0;. K" k7 f/ ~* h) R( y9 e) M S; H
- dma_addr_t dmaphysdest1 = 0;
1 O U. x0 i; e( W - dma_addr_t dmaphysdest2 = 0;
$ J2 {- Q" z0 ?7 C - 8 x- _0 J, g% L3 `) U3 U; P
- char *dmabufsrc1 = NULL;% @4 [9 p1 `$ Q. ?% H
- char *dmabufsrc2 = NULL; y" [$ U/ x8 f
- char *dmabufdest1 = NULL;
8 T3 I* }# N2 T- U( g: c' [ - char *dmabufdest2 = NULL;
' D4 J; e5 n9 t! A1 Z! `) Q - ( ?; x3 }/ E1 C! ]6 Q
- static int acnt = 512;1 r* `0 a1 x- q+ m" ?
- static int bcnt = 8;
- R, P6 d0 J! n# E, B) n/ x - static int ccnt = 8;& L8 o% T* W; o! v$ d( \/ m7 P+ S
- 3 H% j# Q% `% F& \0 I8 n1 b
- module_param(acnt, int, S_IRUGO);
|+ a7 V0 g4 x1 g, O - module_param(bcnt, int, S_IRUGO);9 `, K" a3 X3 i# c4 C+ l# B
- module_param(ccnt, int, S_IRUGO);
复制代码 / ~ T. b0 M) q( U* p- i
$ [$ M" c }% z" G5 S$ u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 y7 ]5 B- o0 w' Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# m4 E1 k) }+ ]; ~4 w5 h2 i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 A* J q- ^2 }1 X( f- n. O# r/ e
0 |8 n- T6 b; X$ U
" J6 h, O; v6 s2 W4 V |
|