|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * ^& x! G6 n' q6 D L
- [code]EDMA sample test application
8 \( e) p1 z+ O# i3 N3 n - /* I* t4 V% T9 o; f0 C6 V
- * edma_test.c. e; ^: u6 @0 E" d8 _' I
- * s2 f6 O$ ?: y( {
- * brief EDMA3 Test Application/ v+ k6 @# u5 w1 n& e4 R
- *. ?' T# p7 N% p1 y' @& J) p, O! O" ]
- * This file contains EDMA3 Test code.# J) Z9 B# H( I$ E4 ~ D
- *2 g# y4 F% K$ H( K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 ^* s+ k- P. `8 R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: j8 f4 h; U( Z# b$ q - * TO CHANGE.
# t! d! f+ w+ `4 P- M" w( O5 C9 } x. \7 J% x - *6 N3 j6 c+ G( q/ S' h% R( q9 v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ j, V% `& n* S, r+ J5 a9 h1 l - *# T+ b3 L3 F; M+ k! V
- * This program is free software; you can redistribute it and/or1 c. H4 o+ v$ O+ x* g0 C) V. j/ T5 R
- * modify it under the terms of the GNU General Public License as
S/ x+ R8 W* r8 R4 @2 T - * published by the Free Software Foundation version 2.
: b ^+ f/ w$ A! o - *
$ ], }# o$ |3 D( w9 N% K, V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; J9 l+ n, c% L, y- G4 N - * kind, whether express or implied; without even the implied warranty/ Q- X9 ] v, \% F" @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ?' }) P) @( c8 {4 N - * GNU General Public License for more details.
1 N# ^% N! ~1 U2 J9 ~' { - */, p* `8 |& M) O0 G: S0 P
5 |1 a+ M2 f" G5 g- #include <linux/module.h>' ]9 }( ~* Z' E0 N! a% `
- #include <linux/init.h>
% Y0 }" i+ d# r! L6 s9 c- n - #include <linux/errno.h>
/ B5 c. W) M0 ]: o - #include <linux/types.h>' m9 c5 v+ u& I F
- #include <linux/interrupt.h>
2 b( `2 F7 Z! |+ N8 L$ a - #include <asm/io.h>5 m0 d- }, ?1 ~( w& F
- #include <linux/moduleparam.h>
1 b# }: X3 m4 M& { - #include <linux/sysctl.h>
; H) V3 I) p# I! C% r - #include <linux/mm.h>
6 u+ T, @1 f" G" Y9 c* H2 n - #include <linux/dma-mapping.h>. c: r% ]; M/ p2 |0 Z0 E; y
- 3 E3 a4 h; n1 |' _
- #include <mach/memory.h>9 F5 ?" u+ X' I% Q
- #include <mach/hardware.h>
, n. M* h1 _, v O3 Z - #include <mach/irqs.h>3 J/ o( x: i+ \' a) Y7 G
- #include <asm/hardware/edma.h>
9 b& D9 `5 I: w3 q5 ^
+ L7 d3 W; u' k; q% J, ]" F- #undef EDMA3_DEBUG
% B6 T6 B! ^/ X% I' J - /*#define EDMA3_DEBUG*/* P% V$ s M7 t* s2 a
M3 E2 V; F$ L7 u- #ifdef EDMA3_DEBUG5 d& K) G' s5 t! I5 I" k0 u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 }$ [5 n# b8 t( {5 ` O; B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 ^: F- e, O9 G& I0 ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 P* u% X I* L
- #else1 V- K) h- X6 z6 P! ?: ?/ i4 K
- #define DMA_PRINTK( x... )
3 t; G( {' _: X! j5 y* s' m - #define DMA_FN_IN
+ }! P8 [- L; o! ?4 n/ B+ a7 S - #define DMA_FN_OUT
, h* m7 l2 W4 z - #endif' i& J2 }2 t: u1 f: D- F/ H) Q
8 P$ z3 ?3 l) p7 V/ k* V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 J9 K# @9 c o5 ?9 B6 y - #define STATIC_SHIFT 3( |( w4 u( d% e
- #define TCINTEN_SHIFT 20# I5 ?. V L3 E& D5 u( x
- #define ITCINTEN_SHIFT 21
1 X# a* U$ B4 G$ p# ^9 d6 F- Y - #define TCCHEN_SHIFT 22, l: N/ \9 g$ @; n- L/ F, l
- #define ITCCHEN_SHIFT 23, P" x% {3 O- b
- # _2 d4 ]& w4 ?( P/ B0 J
- static volatile int irqraised1 = 0;$ P4 ^# {; F$ k& L) p6 V
- static volatile int irqraised2 = 0;7 } w& O$ s( D7 t) m; F
7 S) t2 \$ h+ P9 r; }. {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; m3 U8 O f, q* P" l( K- P/ X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# N0 K# l* f- O4 y# L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* C! U) {: i8 p4 k6 X
4 `! W b8 x# \6 L1 d5 X- dma_addr_t dmaphyssrc1 = 0;4 U8 X& Y- @, B
- dma_addr_t dmaphyssrc2 = 0;: G1 |6 ^# I% Q. p+ l' L
- dma_addr_t dmaphysdest1 = 0;
. S8 S9 l5 K5 \8 s) @4 H4 } - dma_addr_t dmaphysdest2 = 0;# U& d5 B5 O# `6 w u
- / n7 q+ B( Q: r- t1 p
- char *dmabufsrc1 = NULL;( y7 Z5 m6 P! n# H# P2 Y
- char *dmabufsrc2 = NULL;# A W H9 F, A+ M
- char *dmabufdest1 = NULL;, T3 `$ w, w$ z! X# D5 S
- char *dmabufdest2 = NULL;9 `, z% G/ H7 X
: D, H9 E* d) ?. M1 B) L$ o- static int acnt = 512;$ J5 z& I0 \. i" m r
- static int bcnt = 8;
* W- X5 f" u& p* z# O# T5 H - static int ccnt = 8;
; R0 T/ R' g! L2 y6 J/ |* o
/ q6 A2 _4 B& j2 F7 u" q2 w( {- module_param(acnt, int, S_IRUGO);$ R1 e7 n' W6 J0 M
- module_param(bcnt, int, S_IRUGO);. C+ |0 `2 i1 |. |
- module_param(ccnt, int, S_IRUGO);
复制代码 ( C- W0 G& v( W" _
5 U) c9 J9 F+ R# M3 h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ~# t. K% o E0 G$ Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 B6 s$ d. b$ G) m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 c% y$ U: h! y* A5 l
' I8 }3 W6 q3 F' ^
4 g- }: r: A% q0 G# b/ {; c- s
|
|