|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- ]/ x' d- c* ]0 b' j- V/ u- [code]EDMA sample test application0 M) b9 t) K( \ e3 E4 A
- /*
% Y( U" ?$ `) ]8 Z - * edma_test.c( t) l, Z8 s! r# A' D: j3 M
- *
2 Y" P9 Z, j' P6 G) A/ _4 p - * brief EDMA3 Test Application5 F6 Y9 t+ M5 \/ q, _4 `
- *( u6 F9 Q a3 @9 t8 s# X% R3 w
- * This file contains EDMA3 Test code./ T) F) h# r/ `+ f4 `5 c# H- q+ y/ s
- *
9 N) o9 \. ^/ F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 W& @4 f. A# N( B4 B: c9 l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 Q. T7 {: x) B; p0 f6 r8 F - * TO CHANGE., x9 ~1 n7 P1 T, M7 f- _
- *5 V2 i* {0 c. t! L7 o W& E$ O$ q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 {; J9 N8 l; H* n' r - *
) \: T/ x" l4 n+ V8 E1 G! ^ p* D; n - * This program is free software; you can redistribute it and/or7 K5 U! [! W |0 E4 S: Q
- * modify it under the terms of the GNU General Public License as
7 S6 Q3 z- W3 f - * published by the Free Software Foundation version 2.* Z" ~- n- }0 X6 f; w
- ** g% K2 Q) i3 P8 B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 F$ w- R4 O3 i5 q3 j2 c - * kind, whether express or implied; without even the implied warranty
}9 H# L" o) M% \/ Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& G$ q: T' j. Q2 \& ?+ P - * GNU General Public License for more details.
7 b' {! s, X" { - */
7 h, W7 y, x/ n0 c. t5 q5 U - ! [3 U0 ~ X) @3 ]& B" w
- #include <linux/module.h>5 R0 Y/ v2 @6 ^9 `' d+ u
- #include <linux/init.h>
, M+ o. e* i' o l/ s* C! h - #include <linux/errno.h>7 n. Q/ j1 @5 p. q) J6 e8 a7 z
- #include <linux/types.h>, ]: k3 B4 Q2 y- x7 K! l9 S$ W* n' ?
- #include <linux/interrupt.h>2 M1 ^, x7 j5 N H/ c7 C2 V
- #include <asm/io.h>
+ q6 j/ X, y& q d @# ~5 O - #include <linux/moduleparam.h>
/ l0 U" f1 h* w% w; q% X$ O! f - #include <linux/sysctl.h>6 A) M7 ^% h7 l- o* p: Q4 S& i
- #include <linux/mm.h>& l I2 p& i* a( |
- #include <linux/dma-mapping.h>
0 J" ]2 Y/ t7 K9 n8 H" I, B8 x7 C/ o
( B7 R0 F. C; q/ @- #include <mach/memory.h>3 Y+ Z! S z+ m
- #include <mach/hardware.h>
8 @- t& o$ W% r: T4 B* J8 X3 c. ? - #include <mach/irqs.h>3 G S* z; s3 B1 v
- #include <asm/hardware/edma.h>
( l6 l7 J M8 H7 } \; b+ V" D8 U4 S - ' K. {3 @9 c7 k' ~
- #undef EDMA3_DEBUG
# w, w' U% M7 V( g5 U$ M - /*#define EDMA3_DEBUG*/8 G7 C. \: ^0 @3 C
( T# |- D6 r1 |" a- #ifdef EDMA3_DEBUG* Q8 V9 C1 n# ]! M8 Q% O0 h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). n) R" l, m9 H/ m- D" @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 T* R% A6 V" N6 e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ i4 {* H) p0 w - #else. ^/ S; z5 m7 u* }" V" |
- #define DMA_PRINTK( x... )8 I2 ^% E% { n7 C
- #define DMA_FN_IN1 O; ~5 m+ T' S0 o
- #define DMA_FN_OUT, N. D9 z5 E s
- #endif
- K) n0 A" E; R8 r+ D
$ m; R+ U0 v3 Q5 v+ N! Y4 T8 s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 u4 ~3 k/ L- J5 \
- #define STATIC_SHIFT 3- U' A7 Q: R5 \0 s( b
- #define TCINTEN_SHIFT 20, w, i0 ~7 F' a8 ~7 B1 {. u
- #define ITCINTEN_SHIFT 21) V) B, k+ r; n( C6 `2 _
- #define TCCHEN_SHIFT 22/ A& j( |* d1 |7 D8 A
- #define ITCCHEN_SHIFT 23
' f1 v4 B' L, K& X - ( m6 i! i+ Q0 F' I) _4 E
- static volatile int irqraised1 = 0;
* A; e2 i' G' P& ^- v# g - static volatile int irqraised2 = 0;
- C' i+ J- H2 H/ }
2 p ~( P$ V& m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 O) T6 e0 \& ^. r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ D j9 R. M4 ?4 F, ]1 e# H5 g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% o" c) U. a2 S2 e
3 z! _1 Z3 d9 n- q1 K+ {7 \ u- dma_addr_t dmaphyssrc1 = 0;
2 d) W8 ^* k1 t( G4 k7 M - dma_addr_t dmaphyssrc2 = 0;+ s( u+ D- _. T8 A( I1 N
- dma_addr_t dmaphysdest1 = 0;
p' @0 |0 Q/ N2 Q U/ T+ k9 { - dma_addr_t dmaphysdest2 = 0;/ D% l2 d8 [: Y: \9 ]- h* n
5 |3 q! w3 f+ R- char *dmabufsrc1 = NULL;9 Q0 `& K" ~# k4 ~3 Z
- char *dmabufsrc2 = NULL;& L" R' z! I, m3 m: i
- char *dmabufdest1 = NULL;, |9 \: Q# a9 K4 S$ ^" c
- char *dmabufdest2 = NULL;
+ Z+ G% h+ Q+ d/ ? - + d- z3 O* I4 @) u2 ^& G/ I7 L$ m
- static int acnt = 512;
' [0 r. }4 M# d3 x7 |' W - static int bcnt = 8;1 l( [& f) b. z3 t' y; J
- static int ccnt = 8;4 u1 i3 r0 `4 Z) J0 J7 t0 I
7 c; l0 R* W8 B- module_param(acnt, int, S_IRUGO);
0 O: G3 `4 z: c: K - module_param(bcnt, int, S_IRUGO);& X* k4 W( P3 `8 L9 F7 [
- module_param(ccnt, int, S_IRUGO);
复制代码 0 z$ o$ u% H! ?0 v; c
n8 \+ p$ R; o# }+ e9 f4 H6 m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, @( }+ T! J$ k3 N |' R! t% V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 J: w. Y- U* V/ f7 d4 @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 A2 x% m5 h y2 A9 Y' O
( p7 @, ?: s) P* g" M
7 h6 E# N" ^8 T |
|