|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 R" S+ t1 {5 F. L3 a7 w
- [code]EDMA sample test application/ t/ K3 S+ U5 x, V: ^
- /*9 g2 Z7 O( r( t' H3 z% V# j
- * edma_test.c! {1 o# w$ q9 p: |0 Q% F; I6 I
- *: a' r* P/ E% ], j6 ~! D
- * brief EDMA3 Test Application
4 E2 `6 q' S5 j+ c - *5 F7 b+ D8 L% n) U
- * This file contains EDMA3 Test code.& B) ~- R: l! t+ j
- *% m% }* |: t- ~: y" n, F7 a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- o7 Z7 Q% x. {# m" V; g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& | F+ X/ K/ H' T$ _ }, R' @2 k - * TO CHANGE.) c+ a3 \" E7 x. k) a! u
- *
# h0 w, g3 K" \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# i8 O3 |& H0 h
- *
1 u- r) c; Y5 @9 X2 w) b - * This program is free software; you can redistribute it and/or
' A2 E; ]* Z9 N: w- |" k4 Y - * modify it under the terms of the GNU General Public License as
1 _4 G! l C; T' c3 J9 m) z! G: V - * published by the Free Software Foundation version 2.1 X- \! W" | {# S( Q
- *
3 p @7 l+ L6 |" l1 l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 [3 N% h' \8 j X: ] - * kind, whether express or implied; without even the implied warranty0 v; I; C4 d& G! r7 V8 }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 |4 [$ a1 D4 P7 B; P - * GNU General Public License for more details.
! Q% Y, o' P% ?8 |- `+ O* Z8 Q. | - */
! H- f. a) s: @. o) u5 f
( `2 }, F$ u6 T* x: g" W. ]! g- #include <linux/module.h>
! j6 U) P# e1 D6 Q+ k3 Q( \ - #include <linux/init.h>; b/ r* f# a3 h- ~& p
- #include <linux/errno.h>" F1 s$ l/ y+ Z6 `* Q( a$ n8 P# X
- #include <linux/types.h>
2 i5 n8 S6 m( ~1 f - #include <linux/interrupt.h>, H5 Y3 N2 V, @+ q! x. n
- #include <asm/io.h>! w( \0 c. I. \6 R) w# \2 U% p# ~
- #include <linux/moduleparam.h>% p0 Q$ V' ]' f4 Q# a. `3 d
- #include <linux/sysctl.h>
q4 N9 Y2 _5 a$ w7 O$ ~ - #include <linux/mm.h>
/ A# E$ \8 u5 W - #include <linux/dma-mapping.h>9 ~6 M' J5 m& n
- 7 d4 E) b7 ?$ n. x% Z
- #include <mach/memory.h>
$ Z6 c' P0 }0 g+ T - #include <mach/hardware.h>
3 z* B( D3 q1 D8 V; y - #include <mach/irqs.h>6 n+ m0 M+ s7 s& \( N
- #include <asm/hardware/edma.h>
" o0 v: p, i) l5 b - ) W$ k# T+ Q* z$ E/ A- W% x# a0 r& e' F
- #undef EDMA3_DEBUG
0 \/ w# j- h: j+ V% M4 w - /*#define EDMA3_DEBUG*/
7 g, ]7 }# b9 t! L - ! J, w0 b' N% R& T" I/ D7 x
- #ifdef EDMA3_DEBUG! `( b( Q- c2 n5 }6 Q) a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 [2 S/ ^3 `+ v) Y3 c% o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, @, _& i4 M, S* ~& ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 L D6 B, R" [- J
- #else
' C% P7 M* r1 V S4 y# A - #define DMA_PRINTK( x... )
' E5 s0 Z. n* l6 z- J; Y - #define DMA_FN_IN
3 Y7 t# w$ |# e! W6 H - #define DMA_FN_OUT
' h; G1 E4 e* N/ I - #endif
9 f% K2 N" @$ L% C7 X
' h" j, g, \9 T; ?" [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 T' S4 n0 ^8 G* k9 y - #define STATIC_SHIFT 3
1 Z! W* s9 Z# H. v% C - #define TCINTEN_SHIFT 206 }, y! X7 q# G! T+ @# @
- #define ITCINTEN_SHIFT 21
3 Z8 p6 F9 n% C. W9 _; Y G7 p - #define TCCHEN_SHIFT 22
* y. d1 [- w$ H& i6 m) C* } - #define ITCCHEN_SHIFT 23
' ^! I/ z9 B9 z4 p1 X - 6 Q9 d. e. v+ Y1 W
- static volatile int irqraised1 = 0;' T. {; k, j" v$ s. i" B
- static volatile int irqraised2 = 0;+ f% N7 w" n2 V+ Q! W- i9 Z" O
- ! n$ |* u( Y3 S. B6 O$ }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, p, i7 l2 a5 E* v' S0 U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 N1 _7 x) Q# Q* J6 A5 } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 g) C" ?, c; t/ |+ {& U
- * j- z+ u& n3 a8 |- \! t8 O0 {( I
- dma_addr_t dmaphyssrc1 = 0;4 E7 f0 {- Y: l' Z" V
- dma_addr_t dmaphyssrc2 = 0;& i, c: c. v7 t1 q8 D$ M( ~0 n
- dma_addr_t dmaphysdest1 = 0;! ]9 \/ M2 s& a* m
- dma_addr_t dmaphysdest2 = 0;/ j: A( m$ F, P' G" m
. g' c5 m. m( p( K- char *dmabufsrc1 = NULL;
6 S! D4 G1 i& |9 z. x3 ^! Z - char *dmabufsrc2 = NULL;
( n2 ?# Z' m4 Y" ^6 p" n B - char *dmabufdest1 = NULL;* n5 i9 i! c; z7 ?7 x
- char *dmabufdest2 = NULL;! d. B9 i% Z! w+ g4 h4 @% Z
- ) a* w) E3 w, ]" n2 c$ {
- static int acnt = 512;4 p) k( |. L) G. `0 a
- static int bcnt = 8;
" j* z5 K( ]: d4 D - static int ccnt = 8;
) T/ m2 o R6 ^* A& i) _; { - ' w/ I( K8 ]6 S0 K; Z. j
- module_param(acnt, int, S_IRUGO);- e1 z, y5 g. C) D, Z0 w* f( O' `
- module_param(bcnt, int, S_IRUGO);8 W2 x2 w \: K
- module_param(ccnt, int, S_IRUGO);
复制代码
. \* l# i+ g1 C2 h6 `" w0 E5 ]9 z& F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 R0 q. [6 t0 A7 r j& y, 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 n6 L0 V' m% ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! @! _* @7 n% h1 D0 d( h3 b; `
, T1 O& d' h4 M8 l
) ~8 i$ t Z. f# j9 m/ c
|
|