|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ N/ w; H$ R, }! q$ D% k- [code]EDMA sample test application
4 X$ V* F; S+ h6 m - /*
+ w! N0 L8 A- W& |8 v! P. K# |# X - * edma_test.c; c/ C7 n; x) Y/ s1 `
- *" f9 n# h1 Y& P9 ]( u
- * brief EDMA3 Test Application! ?0 I$ R! s g; W/ G# ~8 T
- *
3 u: O3 ~; f* R% f0 O8 H" Q0 M - * This file contains EDMA3 Test code.
" L2 A R" O( H - *
3 _+ }4 J, U, F7 {' ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% V* h: a4 T+ B: v3 a" K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% g) N! g* Z! b
- * TO CHANGE.
- d% z. p8 d: q" V' |( r) s7 ~ - ** U2 p8 K2 v& P. W. w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) H! O) d! q* ]# I. u1 a g - *
; f( [% I" ^ Z% L1 J7 G - * This program is free software; you can redistribute it and/or
" d: l& k. ^5 e. b$ L |7 i; @ - * modify it under the terms of the GNU General Public License as
+ X3 _) F9 }' \, p/ @ x - * published by the Free Software Foundation version 2.5 \2 b* f( O; y6 @2 t* _3 s
- * |5 }. ]/ Q9 i( _2 m1 l' c- T$ z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 ^! p8 H* M8 B/ H N4 U - * kind, whether express or implied; without even the implied warranty: y2 A& Y- F& y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 ~ Q/ ~/ H O - * GNU General Public License for more details./ b; g* d0 j+ E2 d
- */1 [$ f" t$ O/ [
- & N/ B0 |% o1 p! Q. y
- #include <linux/module.h>
0 J% l: @* n) |2 i( U/ v. T8 ^5 @ - #include <linux/init.h>4 O& o; F* ~. A Y( a# y7 P7 S7 |
- #include <linux/errno.h>
- V# }! \ R# N; |, i! E# U S - #include <linux/types.h>- l( G$ v8 ?* T$ V* c& U! K7 y
- #include <linux/interrupt.h>! }( ]; P$ a: F8 N
- #include <asm/io.h>
9 m. {) J5 e) [" U A - #include <linux/moduleparam.h>4 N# l3 a0 Z$ U
- #include <linux/sysctl.h>6 e5 v5 B0 r$ P1 j. ~) g
- #include <linux/mm.h>
/ u* b" M, [4 T9 h* b: ? - #include <linux/dma-mapping.h>
1 F0 L' f2 _6 P& }; |2 q
. ?2 h/ W$ K$ ~' p- #include <mach/memory.h>$ n7 _, H0 ~% d& f5 z5 q* O
- #include <mach/hardware.h>
- ]9 E- [2 v1 n9 _+ c - #include <mach/irqs.h>
2 o8 l9 ~0 |# z& e1 P - #include <asm/hardware/edma.h>
3 o' a, ~8 M0 T. R" K
' d" ~, W4 T5 K( a4 W+ x$ {- #undef EDMA3_DEBUG7 y. ]. h0 T7 f3 K( S' u7 q
- /*#define EDMA3_DEBUG*/
8 k, l, R" _1 P& ?8 S* U - % O# v Y& p P5 F& m
- #ifdef EDMA3_DEBUG, v1 t* L: S5 x9 f! r/ Z7 y; t1 t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); F2 F6 l! ~- A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& R. }4 M9 B5 J% _5 _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), f; c! G+ R( ?/ z3 K' g5 p; `9 S
- #else
* f E, u) U- B+ V% T - #define DMA_PRINTK( x... )
9 P) m# G) ], q) p1 @. B - #define DMA_FN_IN( J+ _( M- X$ ?) U4 d
- #define DMA_FN_OUT( n" F$ A8 V" P% D( Q" N* N1 I3 {2 v
- #endif: G6 {- {" ?6 ^: f9 Y+ O
" s; O* Z. f& N0 d. B/ X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 q- z5 K6 ]' Z, e" q2 e - #define STATIC_SHIFT 31 C1 b8 Z4 ^" E
- #define TCINTEN_SHIFT 20 K7 E9 e0 c0 L1 e
- #define ITCINTEN_SHIFT 21
) z- e* g$ X9 [9 X5 ]5 y( e }* y - #define TCCHEN_SHIFT 22( \2 z1 u/ n9 G7 j( y
- #define ITCCHEN_SHIFT 23% l* A5 R* y& w( z2 J3 k4 K
- $ ^3 K; b/ m! K8 o+ S; l6 z6 j3 G% K
- static volatile int irqraised1 = 0;1 ^) _+ ]0 k% ~% a2 H7 L
- static volatile int irqraised2 = 0;% P& Q* k/ n* _7 A7 Y% \
% A! g- G, R5 T! `! `- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; x6 f1 G# }$ f) \1 A. t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 ?: O4 h7 P, t# [& c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( i) ]3 I6 f- P/ S3 A! \5 l% @3 b - - `* i! }+ I6 v6 E
- dma_addr_t dmaphyssrc1 = 0;: I; X. d0 d4 R; u# J3 z, t& Y
- dma_addr_t dmaphyssrc2 = 0; H% G" F7 p3 W8 I8 L
- dma_addr_t dmaphysdest1 = 0;. Q' t8 Z3 e! b( f9 a, N
- dma_addr_t dmaphysdest2 = 0;& _" M" o1 x* S G& m. _6 e
4 y" W; z- M4 ~' P" F/ w( P- char *dmabufsrc1 = NULL;; ?8 \2 `" d) ^- B7 q
- char *dmabufsrc2 = NULL;
8 l% U3 l7 L. Z4 d/ \ - char *dmabufdest1 = NULL;
3 ~6 l- I2 Z" |' I5 z; N$ j - char *dmabufdest2 = NULL;
3 D; ^9 T! j% G$ w - 1 J4 o9 L# {: d) R% O4 J
- static int acnt = 512;2 i- n" ?1 s x' `
- static int bcnt = 8;
# h4 _" `; v' Y* p, Z% Z3 Q - static int ccnt = 8;
+ n+ l x) z) e" j% Y5 Y3 `/ w* `
[: K- d+ N' x- module_param(acnt, int, S_IRUGO);) g. ^! M4 z7 i" @6 @, S
- module_param(bcnt, int, S_IRUGO);- b! l, c5 P+ W, c, O" V; z
- module_param(ccnt, int, S_IRUGO);
复制代码
& j4 w0 O1 l+ C% a4 f# C: W0 w; `* @( P. }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# G* f) V: }. z4 _* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% m4 |# [" F4 ^" z9 z: J, | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- K7 j+ L/ U9 Y( D' K3 n1 r' G) E2 i# Z# w9 r' w% L% K6 e3 m
" C" r: W. L* h: F |
|