|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! f x5 Z* n! E$ N* k1 M; K: M- [code]EDMA sample test application
. D( _, J+ G w4 j9 i# `# L - /*3 ] y+ Q# c( P2 {' f/ m6 t; }
- * edma_test.c# V f. w3 t# T4 B3 q
- *
! r$ v* y) D6 j7 p- c: A; e - * brief EDMA3 Test Application0 y! V1 Z J6 |7 x( A
- *: f0 I4 s& s# L7 ^* [2 i
- * This file contains EDMA3 Test code.9 H* e% E6 K* {$ t
- *
4 [3 u. e3 ^% c( [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 B; F' j# H5 U) s# n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, y0 [$ p; L0 D' p - * TO CHANGE.! E% d1 z4 @/ V
- *. L( g0 w8 ?) Y7 ~. n5 J, Y" P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 T- k% d! Y, B: S0 F
- *
. c+ `+ u2 X- u+ f - * This program is free software; you can redistribute it and/or0 l: ]/ N( c9 s& N% d
- * modify it under the terms of the GNU General Public License as; h, o" s) n6 h1 n% J/ p0 H
- * published by the Free Software Foundation version 2.- G- v1 K0 [0 Z% l& d8 s) w% ?
- *' r, R7 W" H9 ?! h0 A; h5 [9 T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 n3 U( |! R1 D) u' D2 ?; l - * kind, whether express or implied; without even the implied warranty
_9 R F5 N& s8 P1 N. S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* D: e$ y% z7 O5 i6 G - * GNU General Public License for more details.5 K2 g0 }, m4 Q" V9 X/ C: [) t2 C
- *// o! k1 n, z- W( R, I% w9 h" _
4 J1 g- h' G* Y4 P! c" \- #include <linux/module.h>
. f5 F! V+ @3 p3 J - #include <linux/init.h>" {) Z* @" Q$ l5 @: l6 K
- #include <linux/errno.h>$ T* R: H1 L+ k$ s
- #include <linux/types.h>
# @% b; |" e5 h - #include <linux/interrupt.h>
' @# T. _6 `2 h8 z+ w( H0 |) L - #include <asm/io.h>
% T, e& |* i* j9 X/ ~1 L0 f$ W6 ? - #include <linux/moduleparam.h>
1 A! N2 P4 ~5 s9 ]! _9 O - #include <linux/sysctl.h>+ L- `; J9 j6 f# Z% ?
- #include <linux/mm.h>
, G/ p* n U' [) r- ~ - #include <linux/dma-mapping.h>- x; S, w4 Z* l' z8 {
- : m' u j2 ^+ a
- #include <mach/memory.h>
) J0 s D( s" `( W+ B. m4 S - #include <mach/hardware.h>
0 g. a8 a$ q" D/ I2 B# c H - #include <mach/irqs.h>
$ Z0 L; R: R! C$ d( o4 { - #include <asm/hardware/edma.h>* N5 `9 Y/ a6 g! V
- + ?. h1 Y, x% h$ W! E
- #undef EDMA3_DEBUG
5 ]# n: |2 P# f% z& k - /*#define EDMA3_DEBUG*/. ^* t0 p. c& u* Z$ m+ W
- ; c0 F+ r9 z/ P8 x% o1 ^( U
- #ifdef EDMA3_DEBUG2 O8 q2 b7 I& i2 P0 H8 g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 J) Y" F6 C, K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& H/ J. B* s! o% f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), h$ V2 H" j8 I
- #else
! r7 T! a% _6 j - #define DMA_PRINTK( x... )! G; o7 T$ S8 ?4 R
- #define DMA_FN_IN9 M P# v' P, `( ^- b2 c7 V
- #define DMA_FN_OUT
2 Z& W( v1 u5 L% C3 F% N H - #endif5 @! r, L: ~& Y) P& S2 X
2 v) u% F+ ?' k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; J# x, k/ A5 I3 |- H$ ? - #define STATIC_SHIFT 3
6 U0 C, \7 g* t- @) n - #define TCINTEN_SHIFT 201 p# Y9 n+ n' M
- #define ITCINTEN_SHIFT 21
# {: C2 r6 k+ |0 E/ _5 \) Q! ] - #define TCCHEN_SHIFT 22
3 a0 K# U% G+ N. q0 g - #define ITCCHEN_SHIFT 23
' M+ O; e& i: V8 i" n! [9 i7 ^
8 A% O: k: d* G! j V/ B- static volatile int irqraised1 = 0;
- {% U* L% o1 w/ r2 w$ o1 c# K% o - static volatile int irqraised2 = 0;
2 H! W* F/ B c: e
7 s! X2 o s; ~+ g/ Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# n" s! W* |5 K4 Z; z) U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% Y% C# N8 a, N, `! _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ q; t# w: l6 j$ w& W
, e+ N2 x! }9 H6 N- dma_addr_t dmaphyssrc1 = 0;7 S$ b6 J ~& e$ H$ x# [, s3 |
- dma_addr_t dmaphyssrc2 = 0;$ d# g8 m/ g' B- u& T
- dma_addr_t dmaphysdest1 = 0;- J7 \7 f- F! T" z' i9 f: p$ r
- dma_addr_t dmaphysdest2 = 0;& s: w r4 j* S2 v: O
7 Z. w. }0 B( X7 ?- char *dmabufsrc1 = NULL;
' v1 }2 C, o- j! x [$ T6 M J - char *dmabufsrc2 = NULL;& z: I( X, ]' q" U/ a4 O
- char *dmabufdest1 = NULL;
- [( j- z4 | \5 S2 G2 |9 _, L - char *dmabufdest2 = NULL;4 } H" J) ]3 P. b% D( b
; R+ l7 i5 [: P' I4 ^0 H- static int acnt = 512;9 m7 V1 e: S7 _7 k0 w
- static int bcnt = 8;% M2 k% |0 k: x( N
- static int ccnt = 8;
5 R" }4 w2 ^+ A4 o- Y
5 {, q* H# I9 G- module_param(acnt, int, S_IRUGO);
! r. B% o* G0 w- o) S- C+ j! U+ T9 L - module_param(bcnt, int, S_IRUGO);/ A. Q8 W8 Q( C r5 [8 Y: W0 Z
- module_param(ccnt, int, S_IRUGO);
复制代码
# Z: j9 n% |7 O9 A! S( B& ?# e" y- g" D) Y- X- F! K2 G$ {& h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 P6 b1 L# O1 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# f' P8 [& _, j( P: r- x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" h9 ^7 a5 b5 @/ ]
. _# V/ i; Q% V0 g: P! x! a
7 L7 T5 {( O S: k/ ]; B
|
|