|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 v! T7 d8 x3 k I! @) @
- [code]EDMA sample test application# D: _/ X8 h! P2 ]- T
- /*, q. v k$ o* ?- Q3 t
- * edma_test.c" ^; B3 ]" d6 ]2 f
- *1 A+ J8 B: s* w) e) z( F4 J6 d3 r
- * brief EDMA3 Test Application0 l) L( G4 f" F% {4 w3 n* ^! F
- *5 ~+ D0 b0 h- D1 t
- * This file contains EDMA3 Test code.
4 X4 H B* e1 B - *
+ Y" I# l& T3 | ?) Q" k s+ e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" w: x9 E4 F* y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 o( x3 _& t; {% t3 ^" T - * TO CHANGE.
3 U( o K+ ?! [* m3 `( \7 v - *
2 s' i6 r; p$ o) O8 t( U- s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 d& H- p" ^& {& L - *5 c/ o* I7 h1 e B- d
- * This program is free software; you can redistribute it and/or( a( U) Q% W% S
- * modify it under the terms of the GNU General Public License as
- z% s& G: i0 F% N% s# Z - * published by the Free Software Foundation version 2.1 N' `, e! G/ k* L& t& \8 N
- * f7 Q$ U0 s) d( c: Y# l8 Q* W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 u6 M& M6 r5 h
- * kind, whether express or implied; without even the implied warranty1 O0 i8 y1 Z" c5 l) n: D7 h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 @3 c% Z' E# \4 O - * GNU General Public License for more details.
8 v: L4 ]0 V; F4 _ - */8 C. a" F1 Q3 e; E) u
( A1 |8 e! I- ]& ~$ d- #include <linux/module.h>* D3 k. C: i0 O. f3 Q
- #include <linux/init.h>* s# X# E: {9 q# i( Z$ r+ q
- #include <linux/errno.h>3 D# {- j8 A+ \7 ?; h; r
- #include <linux/types.h>
& s8 q& |7 }% A - #include <linux/interrupt.h>
0 O; Q) t+ L8 D% c9 i - #include <asm/io.h>
) U: ~% z5 _6 t3 H; D) x - #include <linux/moduleparam.h>
9 S1 Q; F( D- v$ Y - #include <linux/sysctl.h>: Z3 ]+ U& R$ P
- #include <linux/mm.h>% K+ F* r# z0 E6 D, r
- #include <linux/dma-mapping.h>5 u" I4 E# N5 ?. f+ z* [0 Z
2 u7 N- ]! g, }7 C! S" U- #include <mach/memory.h>
" `) @% t$ T0 O. I5 Y, ^7 w7 B - #include <mach/hardware.h>
5 h( y6 v" t+ B+ O+ Y# I+ k - #include <mach/irqs.h>/ s% S% S6 h9 O+ Z! S
- #include <asm/hardware/edma.h>
5 j! v, N* o+ E- r - " l R+ A' G% r7 J7 d" ^
- #undef EDMA3_DEBUG
% b6 I* p9 _+ t$ U9 H/ C - /*#define EDMA3_DEBUG*/
# W: Y( M" m7 t: T: w
$ r+ [5 N% l( S d- #ifdef EDMA3_DEBUG
2 j# G9 y8 A& ]) S5 h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ d3 l2 Y4 K1 y1 X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 \1 `; q5 N0 k6 L4 x9 E. T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 r8 Y2 R) D1 m4 p7 l
- #else
3 [0 c5 C6 t7 ^ - #define DMA_PRINTK( x... )) k4 i3 i$ [8 h" k I& \; ?
- #define DMA_FN_IN
, ^1 x8 V) X7 v' I$ W - #define DMA_FN_OUT, F% |3 [2 F: K- F, d& U
- #endif; n% m6 k3 _2 f# N7 }
- * t! j6 n9 M) h: c* h) @; ~6 Q! M- I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- z5 c3 N I4 W* E4 _* w- H
- #define STATIC_SHIFT 3% d( a3 f3 ~1 s: o& M
- #define TCINTEN_SHIFT 204 o$ A" P4 K! W0 |
- #define ITCINTEN_SHIFT 21
$ {3 t# Q+ G4 ~7 ], V - #define TCCHEN_SHIFT 22/ x; P6 j% v# H4 h# t9 L
- #define ITCCHEN_SHIFT 230 l% ~- x7 s1 x; y! q
Z+ Y! U; T2 g! d- static volatile int irqraised1 = 0;& Z- L- p5 x0 n- n; V* T3 ?
- static volatile int irqraised2 = 0;
5 r" | Z9 y& @ W9 _ - ' O8 U9 |' T6 c2 [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ J& @1 u0 }# S; `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
[0 n8 L( @6 l; ^) ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& h* ^8 x9 b$ |# e; U5 N
1 R: R- t: \3 I/ `' K- dma_addr_t dmaphyssrc1 = 0;
: N' ]4 G+ Y9 o9 A9 \) L - dma_addr_t dmaphyssrc2 = 0;
' r9 D6 z5 @! p$ b6 C5 c - dma_addr_t dmaphysdest1 = 0;' G2 `$ \6 N1 b: n1 w1 B4 G) U F8 e
- dma_addr_t dmaphysdest2 = 0;
: x2 S/ [6 m, w
) v4 g- D) o# o$ ^0 Q+ u, q1 M- char *dmabufsrc1 = NULL;! R0 L9 h; z& I3 U' B
- char *dmabufsrc2 = NULL;+ ^" x- k' C0 C# C: W5 e f( e% V
- char *dmabufdest1 = NULL;
' {% L+ O1 p0 x3 B6 F - char *dmabufdest2 = NULL;
. o, A X1 {+ n' O+ D) B
9 c. {& b/ @0 D& R- static int acnt = 512;8 b; \5 v' H/ l
- static int bcnt = 8;
* j. ?7 P# s- d7 J/ G2 l - static int ccnt = 8;; M) u/ n" Y7 e. p$ }
3 c) O( U! \5 n/ W- module_param(acnt, int, S_IRUGO);
- r, ^+ j$ A B# L ] - module_param(bcnt, int, S_IRUGO);
! E w2 Q; I2 ]' Q4 _1 r - module_param(ccnt, int, S_IRUGO);
复制代码 0 n, P# @) Z5 \) W2 u" Y; g$ Q
. g3 U; G) G/ v" o5 T) p: P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 c0 E! Z6 r, L; o4 larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 q- f! j+ @ |& l$ v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: i0 H7 I/ t3 E; l4 l' _6 i/ f7 a* L! }
' \( C2 p) i- C2 ` |
|