|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - g3 h4 L& I: S" Y# J/ I' {% r) k; o
- [code]EDMA sample test application" b/ D$ g- G$ _
- /*; J, x! W. P7 i) W/ W
- * edma_test.c
8 W- D, o ~. G3 T" F1 [! X - *: B. n; }3 y% t8 N l
- * brief EDMA3 Test Application6 Z! e/ K+ {) G! i$ v, e
- *7 g8 r: i* P+ W
- * This file contains EDMA3 Test code.
; N# h7 K* `/ Z - *
4 z- B3 N, {$ ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ S- ^+ a9 f' M- y5 T9 } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. i5 z# u1 b3 r1 V+ n - * TO CHANGE.
7 U- E ] x$ P+ E - *# I" t# ]1 N5 h! E6 W& U1 h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- e3 c2 I$ }: L+ I - *: Z+ ?" J& K3 m, V, i% [% i
- * This program is free software; you can redistribute it and/or. J. g# K$ W0 B* ]! O
- * modify it under the terms of the GNU General Public License as# A: Y7 r8 d: B. s- g4 ]; X# K
- * published by the Free Software Foundation version 2.
& R2 m( V: k/ I# ~! h% i- }6 n - *: D. W) D u$ ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( ~% |# u" T0 k - * kind, whether express or implied; without even the implied warranty
9 x( c% O4 ~+ t9 |9 L( ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 F- v4 P1 g; x Y$ f3 o4 h% a" ^ - * GNU General Public License for more details.
# D/ u V; g# J z - */
; V- A/ a/ T# d4 [( F d. ] - W3 P$ r7 Q. [8 X, ?
- #include <linux/module.h>" u& `7 W1 |8 g/ t9 ?* f- {1 r
- #include <linux/init.h>8 X1 b' L8 Q( {* x* n" }. R7 ]
- #include <linux/errno.h>+ D% P/ S. N7 L, L
- #include <linux/types.h>* ~" z7 K( G+ [! f) f
- #include <linux/interrupt.h>' `' K' Y3 [& n, c
- #include <asm/io.h>
! @. W# L6 Y2 S3 C - #include <linux/moduleparam.h>
( @& b1 E5 p) \( f2 V# H1 } - #include <linux/sysctl.h>: _7 Q, u" {) I6 c; F, |
- #include <linux/mm.h>
7 q) R% S. _- ~% x: u' z0 f; n - #include <linux/dma-mapping.h>
, B4 A* g# W7 S8 F) {( Q; K3 m - / ^( L$ J3 \1 L
- #include <mach/memory.h>
: e8 C% L1 N) p. _; ^3 ~2 ` - #include <mach/hardware.h>
% `1 ^; E4 _; S( n9 ^1 q8 [ - #include <mach/irqs.h>
0 `3 l; Y0 F: i* {* e! P# T - #include <asm/hardware/edma.h>
1 R0 x# D% I* w4 Q2 `" h
8 A- I! O2 F- |* l6 g* _ Z- #undef EDMA3_DEBUG+ N: L( A; R1 m# h1 E5 I2 e
- /*#define EDMA3_DEBUG*/$ Z/ M5 a8 A2 N1 m# B X3 m
$ H2 H8 k$ t: c# X# ~5 J# s/ _" ]- #ifdef EDMA3_DEBUG
1 j7 P& X! e, b+ W, [0 c7 g: c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) o9 Q6 p9 `+ n* l9 A0 s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% T6 l8 a1 I2 [0 b1 [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 l+ S/ C2 \5 a1 `$ v* i1 \1 a
- #else
0 B0 d2 `6 e7 N6 v - #define DMA_PRINTK( x... )
8 ?7 G- _& X% j) k% R. r: n# O - #define DMA_FN_IN7 Y; g# B* \: Z- `7 I P1 q l
- #define DMA_FN_OUT/ a0 g" K3 e9 Y8 u. o; |2 v
- #endif( b1 X* I( C* O# ?7 h8 ^, g- H2 w# K& e
- , j+ P3 B& I7 C* v3 H0 `8 w. e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! o; \% @/ Q) h" r5 A* y x - #define STATIC_SHIFT 3
9 a, u5 u+ a1 r+ Z - #define TCINTEN_SHIFT 20& e9 l, q, i! [6 c3 C
- #define ITCINTEN_SHIFT 21
g/ q7 [1 b( [3 P. B/ | - #define TCCHEN_SHIFT 22
$ l/ T" Q% h0 z/ f - #define ITCCHEN_SHIFT 23
5 ?6 N$ E) K$ e
7 j7 v4 w& N4 h9 J6 n; ~2 K- static volatile int irqraised1 = 0;
# m; X% l* w% x2 J5 j - static volatile int irqraised2 = 0;) h. w' K: M0 P. Y3 w0 o
- 0 }& d! p! F2 P" ?4 }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) n6 l2 t7 d! G# t5 [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- n1 w& c4 ]/ z# ^, W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, i3 d& W0 J) e. |+ ~
L, K3 e. X5 K. K) ~: C& e- dma_addr_t dmaphyssrc1 = 0;
! N( e+ A3 J' h. I - dma_addr_t dmaphyssrc2 = 0;6 }+ H) k# ~; C* U. o4 f
- dma_addr_t dmaphysdest1 = 0;( a9 H3 g: j- E9 _! Q
- dma_addr_t dmaphysdest2 = 0;
' W0 A6 N: b* s0 E - " I. h# ~& f9 {' I0 D* r0 H% {
- char *dmabufsrc1 = NULL;
2 F) r+ Y+ K' e; t. n$ g& Z - char *dmabufsrc2 = NULL;
+ t/ m! ]( v2 v, _3 K - char *dmabufdest1 = NULL;
9 J/ g& d% z" i8 T - char *dmabufdest2 = NULL;
7 {5 a/ [, d \. k - % k( p r( D! ^3 c; b1 R6 P8 d! \' c
- static int acnt = 512;! K( h5 ~9 X8 m H7 r$ Q8 q7 @( b
- static int bcnt = 8;, E1 Y4 t8 g# M( D
- static int ccnt = 8;
7 O2 c' ?- j& W3 p
2 I {2 ~9 R8 V0 V- module_param(acnt, int, S_IRUGO);/ i% I F' ?* ]0 a
- module_param(bcnt, int, S_IRUGO);
, d) V" s( j @ - module_param(ccnt, int, S_IRUGO);
复制代码
8 S( C, l( C- _- d7 R9 r2 g% a3 G0 j. E5 L" S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: K6 g3 l3 l& `! e f' |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. }6 K' X! C J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; _4 ^3 ~2 p' a' w
; N+ a, [) }4 L" b5 ]; U
* g2 y0 k/ Q; K. k5 \$ [+ L |
|