|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 I7 z9 F( D8 V1 [( w9 B
- [code]EDMA sample test application6 ?2 J2 V+ j3 y8 A# U5 `
- /*
, _8 M a4 w6 R/ w! \4 Z( e - * edma_test.c
8 f5 M* Q- K6 [3 I - *
' c$ H% m' B. ~* ^3 o - * brief EDMA3 Test Application
$ m5 p9 y* v- Y+ P - *7 q$ _ v+ z: Y% {4 S) j' i3 H0 F
- * This file contains EDMA3 Test code.
* e. B- ]* B+ G/ k - *
& C. @ f) F# @0 c1 B; k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 b* ?- ~4 O; z- q+ b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* a5 ~- T8 ~* A( @* u
- * TO CHANGE.4 ^3 j C2 B$ e. {
- *5 m! Y+ }+ v7 _; Q v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* v$ U2 [; T9 o- w1 T d# ?
- *
. @% [ \9 a! W- F9 c$ s4 ~ - * This program is free software; you can redistribute it and/or
8 W8 D; q% Q$ ]+ h% G* o* w - * modify it under the terms of the GNU General Public License as
$ L4 h) U% Y# f - * published by the Free Software Foundation version 2.5 E/ W# @7 f) M! s6 B& h* X7 _* k
- *9 w5 L5 x' A. C" \# V* [ |2 G8 s, [0 z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! Z4 V g5 t6 N& ^
- * kind, whether express or implied; without even the implied warranty- p2 B9 L0 |( ]# D. C3 E7 M. q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 z& @3 [& ~6 i- Q: N
- * GNU General Public License for more details.
0 F2 }, e3 o3 M3 i! r+ \: ~: ^" F - */
# B" U( m' ?2 u# Z" F - 0 p" f. l0 ^; q l; k8 s2 q
- #include <linux/module.h>
h" Q$ S# K6 p% W6 \ - #include <linux/init.h>
1 q( P f1 H' P8 x2 v) E4 k0 b4 b" N - #include <linux/errno.h>) S& U' ]/ F- T5 Y. ?6 \2 [- q
- #include <linux/types.h>* W, t7 e9 K4 ` Z' a% d
- #include <linux/interrupt.h>' N! }# E! _/ i/ L
- #include <asm/io.h>
/ F! l9 N8 w) ^+ c$ j - #include <linux/moduleparam.h>5 ]% K) ~ K" R, P- S7 d1 W
- #include <linux/sysctl.h>
+ a# p: G) \3 {. c4 }. N2 p - #include <linux/mm.h>% M, j3 `2 W8 s) W$ e
- #include <linux/dma-mapping.h>
6 b) j! {) N% Q; c9 S5 z
% u# b7 ~& K0 l% B& Y+ w- #include <mach/memory.h>
3 @$ k& X- s# r x% n - #include <mach/hardware.h>) ^9 @2 c7 Z: v$ \; m
- #include <mach/irqs.h>$ g! p9 M" n/ v3 P4 U
- #include <asm/hardware/edma.h>8 g( d( D6 L- f+ y0 ?& m
- " Z6 |7 c8 U# w8 c" ?
- #undef EDMA3_DEBUG6 w% |# k+ f" l/ y5 T
- /*#define EDMA3_DEBUG*/
2 f# g! x' K: ]4 j* Y
/ {, k( E% [3 |) a3 _' z y5 _/ V- #ifdef EDMA3_DEBUG
* X: h, o* s7 c/ u4 N$ e9 S! R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 z4 o& I! P/ x; i# j8 F' L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& W' v' O: }7 p0 i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" I5 F: g* c. o+ k& V2 f - #else
2 ^$ e" q. ~" i! _ - #define DMA_PRINTK( x... )% k, E9 ]8 H2 i+ ^3 z! u3 ~8 g$ [
- #define DMA_FN_IN
, ?; F9 c; [6 K/ w5 A+ J/ B, V7 ] - #define DMA_FN_OUT
3 K+ a) s! Y9 c) F. p; L+ W: P. w - #endif
4 I: B( N; m1 I
/ R9 _( |% a# h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 T7 M% Q7 ]9 h$ `4 g/ S - #define STATIC_SHIFT 3. r% A2 ~# K% w
- #define TCINTEN_SHIFT 20) ^- w- X# u9 x M8 C
- #define ITCINTEN_SHIFT 21
) x9 a- R, n/ Y4 O - #define TCCHEN_SHIFT 22
. X3 A0 ]" B% i$ N6 e1 V - #define ITCCHEN_SHIFT 23
0 ?& }- K4 V' t5 K$ P% P4 o
, c4 x# W) k$ z3 i r. M9 \" { d- static volatile int irqraised1 = 0;
8 e* k4 F5 l/ g/ E. M J( H' | - static volatile int irqraised2 = 0;
7 X L" }2 ^, N0 X
/ t: n' Y3 N2 v3 _, u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 z+ l* Y4 W3 o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 Y* w# H) G6 S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ k' @* }/ g# s% y" _8 l
6 H3 L4 z- G& s! n- dma_addr_t dmaphyssrc1 = 0;
* y; n5 u6 Z5 S B+ m. r, j1 t - dma_addr_t dmaphyssrc2 = 0;9 g A/ `* B' w& T6 X/ S
- dma_addr_t dmaphysdest1 = 0;
7 V/ d! e5 P" n- W2 l - dma_addr_t dmaphysdest2 = 0;, Y9 `; U* X$ D4 ^
9 K' i' Z v6 y, m9 v1 g6 y- char *dmabufsrc1 = NULL;
7 z: v) @* k& r" n9 I - char *dmabufsrc2 = NULL;
7 i3 E- u. D+ I$ c( v - char *dmabufdest1 = NULL;
3 Y! ?+ u6 `6 v8 T& M2 Z4 W8 R - char *dmabufdest2 = NULL;
H# D; N) ~) N! w2 w& F
0 _- j2 Q2 L1 l+ g% P& ~- static int acnt = 512;
) Q7 T+ I6 F7 o9 r8 A. B - static int bcnt = 8;
* Y, ^9 p' r! r3 V6 n; ~& H5 Z. e - static int ccnt = 8;, c5 F$ _! q3 m% Y$ K2 z: r
- % A3 c4 ?+ ^, `' E8 g
- module_param(acnt, int, S_IRUGO);+ L" x, |: @+ a5 d6 \! I+ H
- module_param(bcnt, int, S_IRUGO);7 ^9 ~& P% U6 E+ u9 a
- module_param(ccnt, int, S_IRUGO);
复制代码
3 `4 B, {- I' [/ v$ A
0 O! C1 y' D1 M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- N% N% F X% C: ]: |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. X# T$ G6 c, L+ A6 h" [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ h; t3 O* i9 A% L: I. V1 k6 e$ J" A- b, C' w3 q# y
0 U" d& h1 N6 J7 A3 B* K |
|