|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 ]4 h a) k9 r' Z3 ^9 r5 [3 {- [code]EDMA sample test application
r) ]) {# `4 o; \ - /*' m# v( e' Q6 n; L5 |6 ^& V+ A9 d
- * edma_test.c, `6 C/ N4 m! w7 v& M' z( G" y& n9 M
- *
E% x" R' S, i" J7 s+ t - * brief EDMA3 Test Application, L% }6 h/ I( l* |3 T* Z
- *. Z; h1 S! T* n0 _
- * This file contains EDMA3 Test code.
4 e' @$ u$ o' ~$ ` - *2 S: V5 B: d9 {- y* _9 Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' B/ S( ^% B4 U8 |; R) t: |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 ~8 o, k9 O9 B/ D k: E
- * TO CHANGE.) {- E; V4 w, Y6 _1 V) X/ s/ m
- *
1 f3 ]! S1 L6 U n/ |! x* | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; M8 T0 b3 x) ]4 x* q! O
- *
4 D: F4 }4 v, z+ B' e - * This program is free software; you can redistribute it and/or6 m; |! S- X( o7 o1 g
- * modify it under the terms of the GNU General Public License as
( S+ P, x# Z1 q( k+ z - * published by the Free Software Foundation version 2.
5 u9 I. B' `& {, C - *; V8 w9 \& P+ `7 A$ p- S# d h2 o3 @1 o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 U. y1 x- a4 d
- * kind, whether express or implied; without even the implied warranty5 V x1 V1 |# f% Z% l0 C% T1 L; e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* C+ A3 ?; x) S( M* T+ @# M - * GNU General Public License for more details. d! X+ O0 @4 {- v
- */" u0 |3 p& s+ L4 \2 S3 `
- X0 e$ M# w2 _9 P O
- #include <linux/module.h>1 h1 P' s2 B, U) J
- #include <linux/init.h>
. u' S# J( d' {+ ~ - #include <linux/errno.h>
9 T6 T/ W+ k" L! [/ Z - #include <linux/types.h>' _0 G; u+ y2 P2 H2 S
- #include <linux/interrupt.h>0 `2 r# q! e5 X) }" R B# q
- #include <asm/io.h>
- k: A9 ^" R# N$ _2 c1 ^ - #include <linux/moduleparam.h>
' t! Z( c9 X# T8 w* p - #include <linux/sysctl.h> Q: Q& t: g9 o+ T, R% [
- #include <linux/mm.h>
0 U/ z. x6 m! Q- g - #include <linux/dma-mapping.h>9 d' `; ~* f& I& F
- g. r1 c) S( H! V- k/ {- #include <mach/memory.h>2 A& W! U. ]; W9 Q' ?" D \
- #include <mach/hardware.h>$ Y$ Z# a4 D9 g+ y
- #include <mach/irqs.h>: J+ \# y/ ]! C* w9 l/ l8 d
- #include <asm/hardware/edma.h>1 j0 `0 v, [. F
( v7 d; \% y( f! c& j2 ^- #undef EDMA3_DEBUG
5 j( h2 Z0 t* J3 b/ ~+ S' J# Q - /*#define EDMA3_DEBUG*/
w9 ^0 a/ h v# Q# W) M
: e9 m8 H+ Y$ I0 _, ]; s- #ifdef EDMA3_DEBUG: U. C) `+ }7 }' ^: S2 \/ |, |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 N% H% g( q& S$ U7 ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( }7 E2 T" Z( @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( I$ n; i: V/ R, \9 K - #else
& d% B4 P( [& `% S% a% [, v" G - #define DMA_PRINTK( x... )
/ R. F: o+ k' q/ X - #define DMA_FN_IN$ }! [7 ^+ v. Z8 {! _/ z: ^
- #define DMA_FN_OUT
1 {, b* S: W0 D+ F* ~& u1 F( U! c$ | - #endif0 w+ H' W: A0 Y! M' e5 D# X: h8 [
- 8 C. k' ~, [" ~3 r+ e$ D2 u3 \! g+ a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 l; S9 h3 K( Z
- #define STATIC_SHIFT 3: `/ x5 |5 v$ l* e9 ^
- #define TCINTEN_SHIFT 20; ?9 J4 W, f+ n6 ]5 v
- #define ITCINTEN_SHIFT 213 x3 s3 x% V: F( r+ ]
- #define TCCHEN_SHIFT 22
. c7 A% C& @: ~5 r - #define ITCCHEN_SHIFT 23
/ D/ i, u" E( o1 j
: c% ]: g0 {$ b8 U- static volatile int irqraised1 = 0;# T, l1 q7 o0 F4 ?$ @; U, w+ G
- static volatile int irqraised2 = 0;
0 {/ J6 }6 S( E4 O
2 m; m$ M: p( }9 F; v7 W( Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 a8 G3 M# U" O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ s; \4 |8 b( C) F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ J& y6 Z- L j$ R) g4 [) m
' ?& ^8 w" ?" e, R# r- dma_addr_t dmaphyssrc1 = 0;9 w$ |/ `$ C0 ]) F6 ^% @
- dma_addr_t dmaphyssrc2 = 0;7 Q! _" f8 z& u4 n4 L
- dma_addr_t dmaphysdest1 = 0;' V+ Q2 Q8 v/ f. K! W+ ?4 p
- dma_addr_t dmaphysdest2 = 0;. f8 ^2 x' y' }: v2 @1 t6 G( u8 V
. b# H% ~$ O' N- char *dmabufsrc1 = NULL;
: t) B& d; D2 H' h, j! `3 o - char *dmabufsrc2 = NULL; s3 Z9 O- k( f, n9 e7 v: g: ?
- char *dmabufdest1 = NULL;" {9 ~ _# k d) n' z2 M3 ^
- char *dmabufdest2 = NULL;- _$ \: O& M; Q9 b8 \- \: {( h
- 2 ?* \5 k- V) J8 W# v
- static int acnt = 512;
$ y8 p: r; |$ H# t" D - static int bcnt = 8;7 y) J5 a, ?8 l! P
- static int ccnt = 8;2 s( s! r# r8 V1 [- _0 \
- - s6 x8 I X, l
- module_param(acnt, int, S_IRUGO);
6 [5 P" r3 C6 h, ] - module_param(bcnt, int, S_IRUGO);5 y# K, E/ @4 E/ h/ @3 I4 T, x
- module_param(ccnt, int, S_IRUGO);
复制代码 1 f% K1 X: B9 f
' j5 J- J+ J% ~; Q9 ?6 L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- M+ c' _! f. O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! q& ]- }' @' S. q8 O" ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' l: ?' Z' A2 d$ R# T" D1 |8 y3 U) f% C$ b9 g% T; n5 [1 h
0 {$ U; G3 T6 E1 D0 y2 u. |
|
|