|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & m" D$ n! d3 o# L" {) P
- [code]EDMA sample test application4 y2 d/ }2 V; h3 x! o1 s) C0 {# p3 }
- /*
2 r7 M9 W* J& M: q4 @* y2 D - * edma_test.c7 ~1 B0 v7 T6 V' }/ I+ `
- *
5 Z9 H* B% y1 ?/ H - * brief EDMA3 Test Application; i1 h/ H+ O m- V3 z
- *
6 d) j/ s" W& o7 ]4 U" ] - * This file contains EDMA3 Test code.
7 a! H$ F/ |. s9 k; e; ` - *2 v. p$ \' p- ?; N9 ]4 e8 V& k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 D4 k0 b8 g7 K" ~$ m6 u# W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 c7 h, D B3 a) j9 Y9 W& a- d$ a: M - * TO CHANGE.
" r- o! w& Z0 Y7 [% S4 N; S5 U - *4 ^: x+ Q; Q1 c* e, m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 w0 w% k7 ?3 ^5 I& N2 j- m - *
. K8 j1 V8 W/ W6 n - * This program is free software; you can redistribute it and/or2 N. G' w, q) i6 n& ~8 U5 U
- * modify it under the terms of the GNU General Public License as2 G# N4 M2 j( Y5 j$ G% s9 v
- * published by the Free Software Foundation version 2.: H$ T; ^- E4 _" L* \
- *
8 U3 w: b) D/ C, _4 b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
g0 o `2 e+ Z/ v6 _ - * kind, whether express or implied; without even the implied warranty8 e9 {. A5 z, S( H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; u4 I1 k" H5 E6 l: c" S# b6 V8 @( Q
- * GNU General Public License for more details.* C+ x6 {- b, @5 o
- */
+ M2 @1 j2 i. ?5 U% ^9 \) o* P - 2 S% d" e4 g) y5 }. i
- #include <linux/module.h>
: [% F4 _9 f. \' ?/ [ - #include <linux/init.h>9 |1 j4 j* c4 q# U- ^' p, z
- #include <linux/errno.h>
: N3 B0 |: `' O5 W. c9 e - #include <linux/types.h>: s5 Z/ r& U) s6 @
- #include <linux/interrupt.h>
0 o' g2 ], S) V0 o1 i - #include <asm/io.h>
! |4 ]" [8 N7 K, w' ? - #include <linux/moduleparam.h>
+ T. S$ i; K! v" Z' R f2 p; w - #include <linux/sysctl.h>
; m: Q2 S4 B x6 I( N* K - #include <linux/mm.h>
/ S6 B4 l" v3 d2 X! w, Q9 Y: E - #include <linux/dma-mapping.h>$ I4 D* P0 x$ B& L- G* F
- - i8 m0 Y+ _2 }% ^
- #include <mach/memory.h>
7 K/ |9 t' W& r8 | - #include <mach/hardware.h># l- G" z1 T* m! P# p6 z/ x
- #include <mach/irqs.h>' C' R0 ?% S a7 e
- #include <asm/hardware/edma.h>5 _2 s7 e1 {. \4 F* x
5 P$ a/ A/ b. p& ?( N+ g- #undef EDMA3_DEBUG
/ |) A6 c) [$ Z/ b - /*#define EDMA3_DEBUG*/7 \3 m1 k$ n. |& d; j
- 6 ?) e% q7 `* {& c- E+ r
- #ifdef EDMA3_DEBUG. ~1 K2 [4 v% G0 `9 B; ~1 M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# A4 n% A2 R* j5 C+ j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ }! a" e: A3 S' V+ a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" b: o' I7 {: s, C! P) y/ k
- #else
- U" g0 e! w* a4 U: M: ?0 }( }# Q - #define DMA_PRINTK( x... )- q. I7 W* h1 P7 b$ g
- #define DMA_FN_IN& a; {3 V' M4 @6 {5 R9 c
- #define DMA_FN_OUT, k/ E+ P& D# M% y$ w" ^; O
- #endif
4 F4 D( f8 \0 Z- O- z - & ~& u) R/ }6 Y m: @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); P/ w4 u- S/ M2 z4 q/ j- q
- #define STATIC_SHIFT 3
2 w$ b' |: j7 O, B; a2 R' @9 \ - #define TCINTEN_SHIFT 20
/ I2 }, D# K! d3 y8 P - #define ITCINTEN_SHIFT 21 O' Z" c. x7 t8 m* d* B
- #define TCCHEN_SHIFT 22, x9 k. r) p/ O% ^; T* j
- #define ITCCHEN_SHIFT 23# J! x) n% @; D0 \ e0 T
- 6 C! I) {0 \4 B- h
- static volatile int irqraised1 = 0;1 c/ L, |1 a. \( x: q+ G, L
- static volatile int irqraised2 = 0;
2 g! W f& R" F, J; Q$ r - ; ]$ c$ T% X* E6 G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' z9 t3 ^- V/ }( P2 h/ i- P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 u( U1 t# P9 s) j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" u3 C: q+ w! x# q) F1 l
+ ^6 F/ f1 W/ p. o$ R) F- dma_addr_t dmaphyssrc1 = 0;4 f9 y* ] ]/ s6 e3 r6 Q
- dma_addr_t dmaphyssrc2 = 0; Z0 z" H4 Y2 j$ B- L: C) i5 ], e
- dma_addr_t dmaphysdest1 = 0;3 R7 S6 a0 p6 e3 d3 S
- dma_addr_t dmaphysdest2 = 0;
1 _0 V; C. c* ^3 g7 G2 V4 X& } - 6 p* J0 ]& ?8 A8 a6 N6 }" _9 f# L
- char *dmabufsrc1 = NULL;
. H4 p6 Z8 L! O9 d! V - char *dmabufsrc2 = NULL;% n* {5 \6 i F8 l- G, @+ H/ X& ?
- char *dmabufdest1 = NULL;8 {3 t: p9 [. v8 @) c
- char *dmabufdest2 = NULL;* h) ?5 i6 A6 X4 l# I
& @! B2 E+ W; A+ d, N: e9 n9 Q- static int acnt = 512;, ], [2 E! _" h7 ^ _2 h# H
- static int bcnt = 8;6 l- ~( b0 H' R. S: c, F- k0 ~0 f
- static int ccnt = 8;
. [+ j5 I" {* R' [/ D4 m4 l" B
5 X* S( l6 a+ u. l3 [0 u y- module_param(acnt, int, S_IRUGO);; h! H1 P5 S* Y- M+ l- a5 q6 J* d
- module_param(bcnt, int, S_IRUGO); Z+ q/ X4 v: ?% W8 X
- module_param(ccnt, int, S_IRUGO);
复制代码
@* c* h& }7 U1 b1 y. z* L7 H! O8 T, ]0 H' e- j& ?5 d Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 ]" s$ U0 X% V6 ?5 b* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' k2 L8 f( `3 Z) S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" e8 @. h: S5 ?4 ?( ]% { ]" h
/ V$ a( R' ^% s. J0 |! E8 p( a
# T& w# ^+ E% ^" H4 Y1 n |
|