|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : u. u* {. g% q. R, i
- [code]EDMA sample test application5 G: h2 e" F: D- c. R
- /*
5 b) b2 s# K! n - * edma_test.c+ o M& `0 V5 K+ x
- *6 I. J# s5 G) \6 h' D% m: E
- * brief EDMA3 Test Application
" G! Y6 b3 n5 L8 s0 u - *
0 \3 Y4 s2 U6 | P - * This file contains EDMA3 Test code.) V( N7 ?- i: ?& y' ]7 @- q8 G
- *
4 i7 K/ J# X! t6 L1 D# _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 h/ z/ Z/ h% Z1 B% e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ R1 @8 Z* y* |0 q
- * TO CHANGE.# n% n1 b) M$ I' k V! Q7 X
- *
6 l$ l0 s) i3 o/ y: E- X5 N q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 K* i6 t M" ~! n" z
- * G8 I5 w4 P* T% `
- * This program is free software; you can redistribute it and/or+ Z; {6 _- d8 E
- * modify it under the terms of the GNU General Public License as
% q$ g p4 A% o - * published by the Free Software Foundation version 2.
" P [3 w% V" j - *
( f# G* u7 V. H: x% e3 `- h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( c2 X8 a0 u) L* P4 T
- * kind, whether express or implied; without even the implied warranty! s7 O; T0 ?, A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 C0 Y( u) M! Z4 t0 ~ S7 k
- * GNU General Public License for more details.
' N$ K( } K% R$ m - */
0 d! Q; Z4 m) \& X7 F2 B! B - h4 }/ O: d- V3 x# r
- #include <linux/module.h>
/ `5 Q8 J! Q& E& ?3 H3 f - #include <linux/init.h>; H4 {) m' l; f+ l1 g
- #include <linux/errno.h>
. f q: g* x- Y% E* J2 M- y - #include <linux/types.h>
) w+ c0 O% R- j5 g' d - #include <linux/interrupt.h>
( r& W2 w) B# N8 }' L - #include <asm/io.h>
" f+ D: @0 D; _7 u4 Y - #include <linux/moduleparam.h>
* S6 I& s! G0 |0 X/ r. i g - #include <linux/sysctl.h>
& O; n, v- J) ~! C7 j( d% y - #include <linux/mm.h>+ H. n$ L" }# `2 r
- #include <linux/dma-mapping.h>2 f! W, N# o, @
" J% v) \2 c8 |- #include <mach/memory.h>
/ Y) R% E9 ?; {8 B- V1 Q4 |- C, D# Z# q - #include <mach/hardware.h>1 l9 H; A' \. g' h
- #include <mach/irqs.h>
+ s: D- d9 L1 E4 O6 Y. P - #include <asm/hardware/edma.h>3 C3 G! ^: C( H2 |0 r
( Y' R, w: p* k' u9 y- #undef EDMA3_DEBUG
: z9 _. Z+ j; ^" i8 I# R9 s( ? - /*#define EDMA3_DEBUG*/
# ?- g/ C0 O& m. _, ^
- V0 w: x$ f0 e2 x8 s1 O- #ifdef EDMA3_DEBUG
- ~! r6 X' q8 h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 ?: j! l; B' B0 e" o# L1 `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) ^5 r& a1 k) j' Y7 _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) c% a' g" y3 ^5 k& K7 s! g - #else
! k: Q* e% k9 }/ |- w/ S8 p - #define DMA_PRINTK( x... )
" u- p6 N" J5 r$ k6 z2 j - #define DMA_FN_IN; F; k! c9 K- J; }' x' }
- #define DMA_FN_OUT `/ |2 i3 k9 K$ ]4 [2 f
- #endif$ B2 n/ [$ x; K/ J# F+ d& O
- : v# w* |7 l0 e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), i9 ]4 \$ s% V, H$ [
- #define STATIC_SHIFT 35 |( W" u- r' P% q+ ~1 h6 t2 G; ]
- #define TCINTEN_SHIFT 207 k7 @+ g9 G3 T2 U! g6 J7 Q
- #define ITCINTEN_SHIFT 21
, `& \. v- w1 ?+ |' q - #define TCCHEN_SHIFT 22/ ^( J: B4 |/ D9 }: w
- #define ITCCHEN_SHIFT 23
3 ?( M! |7 I9 [& H$ V# l5 c% S
; r t' q: S" T8 B" d- static volatile int irqraised1 = 0;# \" j& ?# m) N
- static volatile int irqraised2 = 0;
' I' p) v. Z) L# y$ f+ |
' F: l4 \" Q/ _& E) H& T# O: Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ D' P& k7 N$ _# k8 O9 Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! `- L3 G& ~' C( z$ U7 \, y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 _; j, Q" i9 }
y: e5 X/ |& s- g- dma_addr_t dmaphyssrc1 = 0;' o) r; N) e0 M* R# Q
- dma_addr_t dmaphyssrc2 = 0;! f! Z3 h4 R# d
- dma_addr_t dmaphysdest1 = 0;
2 \& N! V, b8 E7 x; [4 v V5 N - dma_addr_t dmaphysdest2 = 0;0 x) p% B/ W$ C; y
- $ t# l8 [% t$ p: c# e, c! J
- char *dmabufsrc1 = NULL; z: M' h$ E* Z8 I3 R& ?6 v8 Q
- char *dmabufsrc2 = NULL;" _- g" K0 ]$ i; H1 v1 ]
- char *dmabufdest1 = NULL;
: l n1 I) P" f9 L& z5 B+ }: N - char *dmabufdest2 = NULL;1 O) ~6 K0 B4 p0 k/ t9 y' @ z
- ' T* J) k' H) {' O U
- static int acnt = 512;; R7 J2 `1 i. x! x
- static int bcnt = 8;
, n: \# K) p6 N" E4 B - static int ccnt = 8;
& D' u# z4 Q* p" ~9 g - ( w6 d4 x2 W$ o
- module_param(acnt, int, S_IRUGO);, @, w5 d/ q( x. Y. d
- module_param(bcnt, int, S_IRUGO);% y: Y) L& ?1 a. u) j) k h; q
- module_param(ccnt, int, S_IRUGO);
复制代码
3 O) r! P& r L8 l/ w1 ?: ]4 u9 c" o! [( d w2 d- B: h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ j# l" D. P* ^6 Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 x" g, j1 i. K' {. r3 p3 S4 \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, Q3 k! Y/ ]+ L/ x* z& Y/ v
9 k( R& S4 ~) r( _- b
( z2 G5 k- W( }5 U) F% v" @ |
|