|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : g8 F! R/ u( ^0 y* r
- [code]EDMA sample test application% J3 t( Y6 T- \: k! ~- Z: l1 u; m c
- /*/ u, T$ K! E# ~2 ?4 O
- * edma_test.c
# E/ N! @+ f- \- B4 y L7 s9 E - *
* D% A3 F; G2 v" A* \ - * brief EDMA3 Test Application" b! Z3 J4 u7 ?$ |% v1 C
- *8 C8 a* h5 y: k6 [9 u
- * This file contains EDMA3 Test code.! b4 s2 Q' \4 Q( |+ ]) p7 m' w
- *. l2 q' d b3 F: E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ h8 b; @4 a) W6 M) P/ F* S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* ?0 U- q& x4 w' H7 S- x. v
- * TO CHANGE.! s0 L, Q9 F% ?4 M
- *! y2 R( C& l7 s7 |6 t% Q% q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// I v% r' I- U9 L o
- *
3 j" F1 j4 b% f, u& ^7 Z: k - * This program is free software; you can redistribute it and/or* _5 Q" w0 W' ]+ L- v
- * modify it under the terms of the GNU General Public License as. v. d7 C4 b# m. o& t
- * published by the Free Software Foundation version 2.) e S% K- m: S
- *
0 K" S$ ]- j- {/ U! Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 p7 E4 l9 C9 _8 w& b
- * kind, whether express or implied; without even the implied warranty
3 t- w' |7 @+ d4 O1 T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" v0 [- _) T0 ?8 E8 a - * GNU General Public License for more details.
6 q2 v9 I) `/ j6 p - */
3 ]( |: i; |* t' d - ' H* ? c9 H ^, H, E3 q
- #include <linux/module.h>7 {' Q% j9 O- a* n
- #include <linux/init.h>
) ]! @9 p9 O; ]( k+ x. o - #include <linux/errno.h>
- N% S3 `8 @4 _# I; D - #include <linux/types.h>
! S6 [0 k- ~4 {0 V* C) T0 ? - #include <linux/interrupt.h>* F: M9 {$ C! {; |. u4 m, O
- #include <asm/io.h>6 E+ ]. b- r6 Q. c6 @/ ^4 S
- #include <linux/moduleparam.h>
8 h+ D9 C( l! d$ _0 h - #include <linux/sysctl.h>
( W* n1 ] f. Z0 s - #include <linux/mm.h>
$ _2 N+ z! H' o0 h2 I, ~! a, T - #include <linux/dma-mapping.h>/ ^$ h3 D; Y E. {1 s5 G7 k
- 1 t$ y4 p& l6 D) I
- #include <mach/memory.h>
2 S2 f" ~) o4 ?6 m - #include <mach/hardware.h>
" e, z! V, o7 L' O; C3 ^+ b - #include <mach/irqs.h># E! l1 t, h1 u) M
- #include <asm/hardware/edma.h>1 } `4 K# ~" H% y! S& v& U
' A$ K8 h8 C* L# x- #undef EDMA3_DEBUG+ x. p! [! \! o7 ~$ c1 |
- /*#define EDMA3_DEBUG*/& @, ?0 Q8 ^% |( v
& ^* Z* l: |4 I- \" @- #ifdef EDMA3_DEBUG
0 u4 ^, G! K4 I" F+ F. ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 N, E. w% G7 A$ W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 Y6 b6 J: E5 @. h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- F4 B2 t6 ~- L5 }8 C; |% y; F# q
- #else
h+ M% g- P6 v: g0 B - #define DMA_PRINTK( x... )
% J* `* n1 O* c. W A5 v - #define DMA_FN_IN4 d3 r+ |) ~. G- V, A) s7 @
- #define DMA_FN_OUT
* w" c) f% ?+ i/ _# U - #endif
% C1 x# z# r) Q9 x
0 I$ o. ^# H% }2 w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 y7 j/ X* m; |7 |4 R - #define STATIC_SHIFT 3, G& S5 u+ H+ x" q& \6 Q
- #define TCINTEN_SHIFT 20
! w% x2 P1 p1 |/ ^, q - #define ITCINTEN_SHIFT 21
( V [, v3 e c; h - #define TCCHEN_SHIFT 22
" `! U4 L6 ~& {' P - #define ITCCHEN_SHIFT 23
% \' J* q: g. i& O& f" w- n; o - # a6 G2 u, R* R
- static volatile int irqraised1 = 0;7 _; G# |8 P3 b& v r
- static volatile int irqraised2 = 0;* J) A( Y: W( j* ~6 `" X/ S( p* g% a2 M
- % s$ E x0 N6 s; F; z% E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& C0 Q( s. s/ l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! R3 H1 G! c& ^( Z. M% U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 a' @# f+ x! f2 d3 g - % X# j9 r" S1 m* [- {! b
- dma_addr_t dmaphyssrc1 = 0;1 q5 k& a2 b4 a6 h( M& C$ F
- dma_addr_t dmaphyssrc2 = 0;
' M- p* X& m4 [' X - dma_addr_t dmaphysdest1 = 0;# s' N* W% q; n1 j {7 k9 K/ A
- dma_addr_t dmaphysdest2 = 0;4 z9 X7 d" `: ]7 T* v! H; O- _" L
. ?& y/ O6 O h; i, ^* ^/ B- char *dmabufsrc1 = NULL;
3 |7 ~" n: f5 q/ i# @9 a3 T1 i - char *dmabufsrc2 = NULL;
- c: j, F9 v# L) Q& E - char *dmabufdest1 = NULL;/ W+ g% X+ G/ z; R! F0 }" J
- char *dmabufdest2 = NULL;0 M& f7 m2 _+ \) F9 ]( g* p$ k. n
- % Z o: E- R/ q' K7 V8 C, l+ E
- static int acnt = 512;
, U/ k2 F' X8 S* t - static int bcnt = 8;
* d/ N. V n: ~ - static int ccnt = 8;3 c! w K/ V/ c% @$ Z, p+ L
& r) b2 A& Z! q! x" H# L- module_param(acnt, int, S_IRUGO);
% o7 s$ C1 A" o' Q1 ^ - module_param(bcnt, int, S_IRUGO);6 p8 R5 \# u6 x/ ]. q5 r: ^
- module_param(ccnt, int, S_IRUGO);
复制代码
4 \- n4 T) P' t: M; f. E9 c$ M& w8 u6 E2 t( U) C; U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( m7 L% |1 e) @. B. N8 qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 W2 C3 N- y1 | ~7 Q- c. N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* D7 {8 J9 `& T5 q% N5 }2 S
* ~7 o* J- d6 v5 N
3 ]. v* E, h7 d* U" L& H$ d6 g: C" T |
|