|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 `3 o7 Q# ^/ i- g, |- [code]EDMA sample test application+ ?/ y3 s3 k3 |, v" J" _* R
- /*; _. d. M4 k3 d$ n0 n" _) y
- * edma_test.c
# m! y4 @) l2 D- s) H0 f) A. k - *
- Z) \3 ]8 x2 V2 Y% J7 x v - * brief EDMA3 Test Application
; n6 q4 Y0 i9 L6 D, t5 q - *
+ V9 s) ]5 U n# y* k, y8 M; R - * This file contains EDMA3 Test code.4 }7 n( _* J/ q& h5 f9 H
- *
! U# I$ C$ J' d0 a5 r) ^" ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 }. f$ B% }$ s6 t) _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 p* g1 l3 l% X- |0 l
- * TO CHANGE.& E0 @. x3 S; }
- *7 Z' _, v$ j P- R3 `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" U5 l6 d1 f/ g, L8 A t1 _
- *
2 }7 f, u' n l2 ?+ f6 J - * This program is free software; you can redistribute it and/or% u4 w) u& @1 L3 m
- * modify it under the terms of the GNU General Public License as8 F4 r3 h: Z* s
- * published by the Free Software Foundation version 2.
1 t* n3 Y. |9 h9 M - *# O$ F! Z( j/ U# E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ ]6 Y# b3 E) V( P* M. b* L
- * kind, whether express or implied; without even the implied warranty
- C& i) `, g) C4 M7 W9 n) { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 J" K) s3 g5 p; n$ L3 \ - * GNU General Public License for more details.
% h+ g, `6 K. ~9 d5 l; | - */
4 `3 S+ \7 F5 z" N
4 h: K1 {# S! @$ q: ~6 C- #include <linux/module.h>
0 X8 }% C* M. p# n - #include <linux/init.h>
2 o- a* J& G/ ]2 n! R; W- h - #include <linux/errno.h>
* V/ b. y% Y5 A, N- F3 i - #include <linux/types.h>6 \4 w( m( Z _
- #include <linux/interrupt.h>) b m2 D* \. ^/ u/ E$ |
- #include <asm/io.h>( n. q4 D) g- g6 d% r! J
- #include <linux/moduleparam.h>: Q s$ l& |% B2 X0 D, h/ b
- #include <linux/sysctl.h>
: b- D& M/ O+ S" ?# P/ L; A. K: A. I; V - #include <linux/mm.h>9 v8 b+ N- _' n- O0 r0 C
- #include <linux/dma-mapping.h>9 U" b1 a2 P* \/ _. K, F' p- J' y
3 [- n' _8 F5 {& Q Q% a- #include <mach/memory.h>5 M6 d0 a2 p& u' ~' [' s1 n" V
- #include <mach/hardware.h>
+ X7 P0 a% `, \. W" S8 ?9 U - #include <mach/irqs.h>
9 q7 U! d5 Q7 r - #include <asm/hardware/edma.h>
. r/ T6 p W6 w8 q5 u
+ ~. Q8 z ? Q/ H' G- #undef EDMA3_DEBUG7 z" O. O8 K7 O+ U' h% R
- /*#define EDMA3_DEBUG*/
0 l [ x8 U3 q. p6 L9 j4 g4 Z9 z& f - 7 Q: H3 }+ s. h
- #ifdef EDMA3_DEBUG
( ?: E' _3 W- q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 S) J( D# {# V& d4 X: Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 j7 V) Q. V2 A8 a/ M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). _( p! _# B! w- N7 y2 U
- #else2 F$ U. |# G" m- X& \6 K
- #define DMA_PRINTK( x... )3 ~. Z4 |, g* e2 a) V {" G- \ n3 p( E
- #define DMA_FN_IN+ Q8 v; H' Y7 X# l# y+ x- c
- #define DMA_FN_OUT2 Y( I+ W+ |: ~. z5 g; ?6 n
- #endif8 v/ g+ T3 ~' e. \3 H @% m( b
$ O" U+ ~# _* `+ z- #define MAX_DMA_TRANSFER_IN_BYTES (32768); I6 |" k8 [8 b0 n; h j3 q& Q
- #define STATIC_SHIFT 3
3 \& t) H8 g; o3 } - #define TCINTEN_SHIFT 20# a: h S5 L3 g Y3 o6 F) i
- #define ITCINTEN_SHIFT 219 z& _$ k$ m, g7 `& S9 y
- #define TCCHEN_SHIFT 22
0 o- i) r5 y; Y6 u) ? - #define ITCCHEN_SHIFT 23
( V K" b! X% i% g - - r' J: K) \+ U7 i8 w
- static volatile int irqraised1 = 0;$ O) q. d; `: D( U) y1 }4 R
- static volatile int irqraised2 = 0;& K. \& v! H* w/ W' L2 U6 z
- 2 g- {9 c: ~) h6 Q2 z7 n; l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 n) V& n. I0 K- o0 Y$ A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); V4 H( | n% d) M/ e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 F+ B5 d0 o5 ?/ n# a$ V
. [/ Z$ b1 k/ I9 J- dma_addr_t dmaphyssrc1 = 0;
7 C; o* g0 X0 [7 K" D - dma_addr_t dmaphyssrc2 = 0;& l7 t3 W* H6 O/ E3 a% A
- dma_addr_t dmaphysdest1 = 0;
$ D3 }) i2 ~0 i. F+ c - dma_addr_t dmaphysdest2 = 0;2 S# K f2 K* h
- / f- s- ^8 ~: p E
- char *dmabufsrc1 = NULL;2 _1 t7 N4 H5 r# O& k* L
- char *dmabufsrc2 = NULL;
3 B9 h! C) z$ q8 }5 [ - char *dmabufdest1 = NULL;$ C3 X0 Q1 ?$ ~
- char *dmabufdest2 = NULL;' i$ Y% A9 R3 d# T2 ?( g5 y
- 4 b$ S& q7 s- M: ^4 A- d
- static int acnt = 512;5 b: D' m3 t# f7 u3 |
- static int bcnt = 8;: H4 I5 d- c. I" I: }/ T+ K8 z
- static int ccnt = 8;$ A* w; O$ Z, D6 N% c2 w! X5 W
% i, F( {1 R2 h- module_param(acnt, int, S_IRUGO);; {% Z6 ~. M2 _0 v9 `
- module_param(bcnt, int, S_IRUGO);
8 `/ y; |" H# l9 R; B - module_param(ccnt, int, S_IRUGO);
复制代码
' _' `. B! N' k8 e3 ^. v, R& i, g2 G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* j3 S. B: s# [4 ~2 c3 d3 e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) U( I+ B( A7 @, }" P% V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# R3 D' E3 v6 \* x( F, N
5 T+ E* V) T$ s" N l+ ` H1 z
/ f) `. f" S2 A* {* M, Q |
|