|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : s8 L3 Q- T }$ `/ u& @/ P G+ \3 Z
- [code]EDMA sample test application: Y! o2 X/ c% p9 d: ?
- /*/ ]9 [# l. s7 a% U
- * edma_test.c
, z- i, d: O/ k- W l - *# n) S8 |4 y6 s1 n! O! R2 ^
- * brief EDMA3 Test Application
8 S& }; I: N' B. J - *! d/ m- Q. d& r) i
- * This file contains EDMA3 Test code.: k; m1 V2 l# H( X5 V w' ?
- *
|4 |* d: o7 y6 F7 |& O3 J: t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 p2 S! _# t$ V6 ?% C" N% M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
[3 ]. @$ ~6 V' E - * TO CHANGE.
+ e" d) A. {; _2 l: u! ?/ L2 _ - *' W7 c, V. ]. O8 l4 a2 O+ L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 H. Y( d- v( K2 K3 _( } - */ U8 {. e7 ~4 L- [' c! o
- * This program is free software; you can redistribute it and/or
" P" Y0 ?. @: S% W6 a6 u6 Z - * modify it under the terms of the GNU General Public License as
! o6 p; ?4 T. T! A; H; i - * published by the Free Software Foundation version 2.
: G* Z K0 x4 O& u* J% ]( r - *
0 U& U& g: m9 d* B+ ~* B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# |5 ]6 G, x& g8 u
- * kind, whether express or implied; without even the implied warranty) Z( s' s7 N) f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% D. n5 ^% p2 `
- * GNU General Public License for more details.
# D: v- e! R. | A1 D6 s - */
- Y; J6 E. e+ x" e& [ - ! y. A8 h$ \. k/ F; X: \$ d
- #include <linux/module.h>
; l. |! i2 i0 J4 V" o! B1 V: y - #include <linux/init.h>) ?% z5 _$ j+ D7 o5 Y
- #include <linux/errno.h>
, \' Z4 h3 W# z: C3 a, t, d - #include <linux/types.h>
2 _: G$ u! N; E, d - #include <linux/interrupt.h>
- |3 j8 V- \6 C n4 N# y+ F# ? - #include <asm/io.h>
5 _% ]( R) c" E- b- R - #include <linux/moduleparam.h>
9 Q) w3 g1 o8 N. S% ] - #include <linux/sysctl.h>
" z+ V+ T1 M4 H4 k - #include <linux/mm.h>
& u3 H5 a M: ]/ k- c - #include <linux/dma-mapping.h>" ?1 G/ ?& G" u7 X2 M
9 w7 d* E: u" v0 L- #include <mach/memory.h>
4 k& G: r0 c& o/ E( O, m - #include <mach/hardware.h>
4 Y6 I: U. f8 H, r2 h$ g6 p - #include <mach/irqs.h>/ Z/ f6 n4 l6 [- G4 c2 z
- #include <asm/hardware/edma.h>3 s1 b: x) o) f* w7 t
- ; [! v! L# ^' m+ D t! X! H3 L
- #undef EDMA3_DEBUG* ]+ N: @6 F9 P* O
- /*#define EDMA3_DEBUG*/
& ?9 l6 s# J) \; l, D
/ ? b, `. n0 R- #ifdef EDMA3_DEBUG
5 m, ?: ^) n* L0 _ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 F- t/ _9 \5 j; P' d5 ~0 X& y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. O$ B1 n, p! n. p D. _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. W# a8 m! E. H3 l4 B* _ - #else
6 p5 `" D, |+ ?9 Y+ L! e3 j! }7 ` - #define DMA_PRINTK( x... )* R3 B# g9 b Y" _8 j9 ^
- #define DMA_FN_IN8 I) _4 B7 u( j% Q9 [; J
- #define DMA_FN_OUT
; g1 h3 P% ^1 o# _6 F# t! O. E7 ~ - #endif: W h d. d8 r( ~% l8 U
- " ?/ I# g0 {- i+ _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 \0 l5 A! `2 f; `% w( l2 d6 I - #define STATIC_SHIFT 3+ D( U" j5 A; ^2 w
- #define TCINTEN_SHIFT 20
7 P5 ?2 i* t7 C8 D/ F, ? - #define ITCINTEN_SHIFT 21% b1 o. B/ J5 [9 g$ W2 [
- #define TCCHEN_SHIFT 22! E1 T( Z- n# O# R
- #define ITCCHEN_SHIFT 23, {" y' A0 t7 o* J- N4 [& W u
8 w) o2 C- v: }. y t% n- static volatile int irqraised1 = 0;
; s s- ~0 D, ]5 z3 w( Q - static volatile int irqraised2 = 0;+ s2 E: @, o& Y$ u; n
- # k/ X9 P; v4 s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: P5 S+ u$ V: B4 G8 X: @& z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ b1 r4 r& z) c* w# F! U- x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& U! Y) O1 U1 v" k9 |5 L$ |
- $ W" f" [* a# u/ \7 Z$ b; p
- dma_addr_t dmaphyssrc1 = 0;
6 |$ ^; L* O( ?7 k/ F( s - dma_addr_t dmaphyssrc2 = 0;
5 \( u+ D' ^4 E8 ~ - dma_addr_t dmaphysdest1 = 0;1 F, y, N) R8 z: y
- dma_addr_t dmaphysdest2 = 0;
+ G4 q4 U" h/ `/ ^, \ - 6 j' j8 g3 s5 {! i! k. H5 b
- char *dmabufsrc1 = NULL;, ]" t7 z/ J6 b6 z
- char *dmabufsrc2 = NULL;
" ^6 d) ]. A* V* H1 E# y* B - char *dmabufdest1 = NULL;
- S. J8 y3 e. R p6 a) l - char *dmabufdest2 = NULL;
( p! ~6 V" v* l \/ S - 9 ?' v% ]. N0 Q5 Z( m8 }) m3 v, N
- static int acnt = 512;: f3 C/ Z* s' o2 o
- static int bcnt = 8;! W3 S4 g1 r$ f
- static int ccnt = 8;+ d* u- a8 x# Z4 p
3 Q( p7 j( W8 w% W- module_param(acnt, int, S_IRUGO);( M* A7 V% a. ?6 R# _3 C/ B
- module_param(bcnt, int, S_IRUGO);: s4 m7 R+ D% `, p6 l3 d8 R
- module_param(ccnt, int, S_IRUGO);
复制代码 2 D- D6 ^) b. l3 d$ a
2 x [" S/ w8 L5 B+ K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( J1 y7 h+ V4 y* M; {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' [( F$ F" N7 R1 ?* v }0 H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ g J, ]* q7 q+ c& C" a( O/ f ~( `: V& w
. o/ a; i* o( z$ q |
|