|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : Y }7 R- T9 W( g7 q7 {8 [
- [code]EDMA sample test application6 ~3 Y) m: `" ?' V8 v4 _
- /*
* W. [2 }- E: N# p! Q r T" F( @ - * edma_test.c
" s f* E; g0 w - *
! T" x5 K, P& a' v - * brief EDMA3 Test Application8 R0 N3 a, N9 i
- *+ f* i8 `2 W9 g. x! }8 d' t6 ?
- * This file contains EDMA3 Test code.
& @1 Y6 m# A$ X) @6 i: F - *
* A1 J9 B2 X) ?. W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 |, ]$ l8 `6 Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) G- ~8 m5 T& y) ^( Z7 T* e
- * TO CHANGE.3 z. {0 P# m/ p' `* L* S
- *) L% @& `! v" r& `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ P% Z" D$ j5 G. I/ G6 M - *' h' }% A" M+ q9 ~) |) e) ]& J# u
- * This program is free software; you can redistribute it and/or
; i' O. j* A9 @) f' J ~/ V2 {; [ - * modify it under the terms of the GNU General Public License as% [8 c' v( E1 W$ @/ g
- * published by the Free Software Foundation version 2.
6 V( |, ?+ m- Q$ n' O1 A7 B6 \6 A - *" U0 v- E$ D5 c2 l, W* V4 I- _# ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' b7 Y; Y" x9 P2 }1 U$ { - * kind, whether express or implied; without even the implied warranty; K1 ? `: k( z4 V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' y) x+ N" W0 Z - * GNU General Public License for more details.& I! c% \( I- Y8 j# f1 {; v
- */- e7 f1 `7 u) [- ]4 G. x
- , n9 u* k, \# l9 A; Y
- #include <linux/module.h>) ?- ~* J: G6 x% d* E6 ~; w
- #include <linux/init.h># @5 K" Y l" R& c- |
- #include <linux/errno.h>
* ~6 ]. V7 s0 m9 C$ l - #include <linux/types.h># M X) O7 P9 \: A. V: \" A
- #include <linux/interrupt.h>. f' g+ U7 E3 m2 h% O/ |0 A
- #include <asm/io.h>
8 i; T* b) X/ n& J - #include <linux/moduleparam.h>
3 X# s6 l4 t+ }6 s) d - #include <linux/sysctl.h>) \& t2 c8 I+ Z+ @* {& o
- #include <linux/mm.h>+ I; f5 t/ m; x' x9 O2 n/ c
- #include <linux/dma-mapping.h>
- y: P3 I# `, F
$ f9 G$ {* a) d- v0 B2 o- #include <mach/memory.h>9 H0 z4 e5 S- {' p$ e
- #include <mach/hardware.h>/ f9 o5 f, T6 U
- #include <mach/irqs.h>
. r6 P* F# s7 _0 k- V - #include <asm/hardware/edma.h>
- q- [4 M, j; U3 j - & y4 t" V% P1 Z
- #undef EDMA3_DEBUG8 ^) k7 r) B# Q
- /*#define EDMA3_DEBUG*/9 ]( F2 Q, }$ r. r7 z/ v; p+ @
- / A1 H- ?7 {; v3 x, l1 ^- |, l! J
- #ifdef EDMA3_DEBUG% L- w/ B H J! s0 ]9 }4 Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* d) @/ K* r! H% Z0 l( @% A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 w. R9 ~+ ?5 t8 ?9 z1 X% V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; t/ r* p s+ D: E2 Y5 V2 M - #else+ s- e; v' @( \9 }1 q5 s9 f
- #define DMA_PRINTK( x... )4 `2 V- C, B1 x- [! H. O" e
- #define DMA_FN_IN
% y; A6 u+ \" }4 p% { - #define DMA_FN_OUT
- _6 Y; H1 }* V- P8 A/ w - #endif
4 O; g% r5 X& r; e+ l5 @ - M4 w& u* L+ i$ j/ M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, N2 F3 p: x% I& d% m5 T - #define STATIC_SHIFT 3' [, Q* z ^, ?* R1 a5 t
- #define TCINTEN_SHIFT 20! ?* J2 m% h" |2 U+ X
- #define ITCINTEN_SHIFT 213 R5 a2 V% {( [% x3 G; ]# w
- #define TCCHEN_SHIFT 22- b8 s( V! k/ t
- #define ITCCHEN_SHIFT 23. f3 B, D/ y# Y. e
- 0 f7 h6 j8 Q4 v% m3 G) A; Z6 B0 u E
- static volatile int irqraised1 = 0;$ U; c1 X+ c$ [; |
- static volatile int irqraised2 = 0;: R* F3 R$ @& g1 F
' ~, b" C, a9 X* u( @9 Z6 C% i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 f7 L( n: k' t7 s, f: { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 t% b& x G- c' c/ w1 ~! Y( G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: u; C- J8 j+ @) J8 f
" D0 @5 {( e0 R2 e+ i- b- dma_addr_t dmaphyssrc1 = 0;9 s9 D7 t0 b( q e9 s, y, c
- dma_addr_t dmaphyssrc2 = 0;
9 v( ]6 `) b: O8 H: d+ ?9 V - dma_addr_t dmaphysdest1 = 0;' r6 H% R+ Q7 j: u+ Q8 F
- dma_addr_t dmaphysdest2 = 0;
% D* p$ k1 ~* |5 L2 D& u9 b( Q
6 K* g9 Z/ m- E' ]$ H- P% l* G& N- char *dmabufsrc1 = NULL;+ |. i) H8 w5 W# z; R
- char *dmabufsrc2 = NULL;( L" A) p/ X% j, e Q- z
- char *dmabufdest1 = NULL;% X1 ]- U/ M! m. x! M6 l# \& Q! t
- char *dmabufdest2 = NULL;2 Y$ o6 C. \% B; a# U: R* {
1 [5 d, }' F4 s Z: U. V- static int acnt = 512;% M- V" `. q0 |
- static int bcnt = 8;
- O& }, F+ |# p: \+ |& g/ S& G - static int ccnt = 8;) G: M/ \9 O) c4 l$ S" g
1 S- O& {$ X _5 z4 {- module_param(acnt, int, S_IRUGO);: S$ u3 Z# [# H$ S$ N
- module_param(bcnt, int, S_IRUGO);
y/ w1 J- ]' T1 n* j+ c( S - module_param(ccnt, int, S_IRUGO);
复制代码 5 Y2 n( r# Z& ?' | \2 Y8 U
5 D3 S" V: F0 m" n+ {' x7 p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, x0 G+ z+ t+ ?% y$ iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 `' T" p5 o) {3 b& f8 P" c+ @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! M8 f# I. i/ `4 a# v1 F; L* H; Z9 ?8 a9 Q. N( N
) D9 R+ Z4 C$ J5 Z: O |
|