|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * N% j! k% |. ]! u8 r
- [code]EDMA sample test application
! L2 @6 ?9 @* f3 D4 M7 `( O! u - /*
" @9 N( P% p% ^ I% Z - * edma_test.c
) E8 A; x2 q- ^4 @5 I G9 y - *6 o; X3 N# W- |3 L/ S/ u% e3 Q
- * brief EDMA3 Test Application& M6 c9 X0 g3 P* I/ K
- *8 U8 ^! K0 s* x! n
- * This file contains EDMA3 Test code.( f. F/ a k& C- R
- *
* q( ~. o4 N. O! \, D+ ?6 K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# w6 Z. W4 m1 J# Y! V: f: j6 } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" M' h$ I2 R- I5 t: G1 r" i - * TO CHANGE.
$ V( x* p _9 E4 j3 j - *, o& m7 j* A' w( J: c9 j8 ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% J; a7 g* ?- _9 @ - *$ m3 W& P1 _: K/ d" L/ X
- * This program is free software; you can redistribute it and/or
" A- r- \6 a8 q L! B. p2 L - * modify it under the terms of the GNU General Public License as
( c( ^$ r) b% w c4 ] - * published by the Free Software Foundation version 2.
" {' B3 r6 `6 S/ G+ W - *8 j% n2 F0 K5 n- l/ ] |3 d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 J$ o* e- m C
- * kind, whether express or implied; without even the implied warranty
( y6 [. P( g1 S, Y; T! i3 w; J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 _" F0 |) _+ j: }9 U4 o M4 | - * GNU General Public License for more details.4 i; N W3 i `4 F
- */ Q+ y4 m$ H9 g& \! v) D g. Z! D) r
- & e. b2 m/ h3 ]! W8 x( g6 h7 j
- #include <linux/module.h>8 G) U4 `, z4 A9 p- i. O
- #include <linux/init.h>* |6 E! P& S& X. A' h1 ~) T
- #include <linux/errno.h> b: ]2 i. p2 E' G9 f' A! x2 v
- #include <linux/types.h>
4 ]5 I6 f9 c) z9 y7 I - #include <linux/interrupt.h>
# V9 N3 m* J6 s6 V" ` - #include <asm/io.h>
' M' J# J0 P* W g! F+ c, A! r - #include <linux/moduleparam.h>7 \9 y0 G9 M$ }
- #include <linux/sysctl.h>
9 L I1 {, j; K# t& M' W - #include <linux/mm.h>
9 F/ z: `7 H3 v - #include <linux/dma-mapping.h># V/ J0 h' I/ s5 j. L1 s' D
) v. R+ h/ i- b6 o; R1 b- #include <mach/memory.h>
4 a* H: |. @+ d P# C" r6 x7 b - #include <mach/hardware.h>) J* t; R7 T1 r8 w9 {: `* _
- #include <mach/irqs.h>$ j3 T1 i d* x" H
- #include <asm/hardware/edma.h>/ I; p. Q. d: k2 }: `
- ; K K/ p+ C: L
- #undef EDMA3_DEBUG
1 N/ b _ C$ U7 V' e. S) T6 n - /*#define EDMA3_DEBUG*/6 S; y q* C7 ~0 N& w
- * Q# C7 u( H# V
- #ifdef EDMA3_DEBUG7 j* n0 b+ ?- ?: F) U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): i0 n" c+ [- r+ ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) H- E# h1 r' U# L7 ^/ m! Z( Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' l6 v! s. Q2 Q0 r: S6 F - #else
3 A; h3 d/ Z. Z& `( d - #define DMA_PRINTK( x... )% b) r! T5 Z& m7 ?/ y& Y# M
- #define DMA_FN_IN2 ?) |7 a; `" r. S& T: N* y
- #define DMA_FN_OUT$ H# c+ B: P( }/ ?
- #endif: C4 M" B! H7 r, P/ Q. `3 Z
" @ S' `4 g6 e: ]% h, K- #define MAX_DMA_TRANSFER_IN_BYTES (32768). W, s5 t9 l( p* k7 F5 @; x
- #define STATIC_SHIFT 3: ]; o8 i# W/ w
- #define TCINTEN_SHIFT 20
( x9 l1 d7 {& R0 l - #define ITCINTEN_SHIFT 21
. ~% O. t) w2 S9 m - #define TCCHEN_SHIFT 22
8 @: h' U, L; d- d - #define ITCCHEN_SHIFT 23
% K. g4 n4 X& R8 X4 j
2 M% J* T% s: ]8 z- static volatile int irqraised1 = 0;. \5 C& \( m; N; n: T! O5 z
- static volatile int irqraised2 = 0;1 K* q5 x' [5 ~$ r$ T( p
, D/ M! U) }3 @% ^) @+ \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 S9 k9 u, u6 t6 _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. m8 @# m+ j/ \2 S' z1 } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 |1 _' G1 G) k' L
* p0 H$ s% _5 \9 {- dma_addr_t dmaphyssrc1 = 0;4 @6 l i3 h7 {* _
- dma_addr_t dmaphyssrc2 = 0;
! [7 I9 v9 G+ b! L - dma_addr_t dmaphysdest1 = 0;
' g6 V& c( Y+ { - dma_addr_t dmaphysdest2 = 0;9 v$ h) i+ q( h5 X- Y) h/ X* m
- ; B5 q4 S# w6 `6 S1 _/ Y, {
- char *dmabufsrc1 = NULL;% l5 L, ^$ D/ s. h4 `$ m/ [; g6 x! S
- char *dmabufsrc2 = NULL;
# ^/ c8 m( ]9 [) {. I" w D! b - char *dmabufdest1 = NULL;
+ ]( p# X9 u" G5 l$ S - char *dmabufdest2 = NULL;
% \' P: r% Q* ?5 P9 I# M5 r
# [. x$ e# K, ?) M& H0 Q# f- static int acnt = 512;
, v) w ?9 I" s - static int bcnt = 8;
3 H% D) p. r8 t" z6 z0 Q0 j' M8 e - static int ccnt = 8;
% M& M9 Q/ [- \! S1 h6 y - , f1 J6 V5 h# j. J x
- module_param(acnt, int, S_IRUGO);! H7 H; @$ {8 K/ S8 W0 ?, f
- module_param(bcnt, int, S_IRUGO);
/ J2 m; ?* x" r! j' S" _8 R - module_param(ccnt, int, S_IRUGO);
复制代码
& c4 ^% F. c5 z4 f6 c
- E' L- k9 E3 W, \1 \) I. { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 j1 b' c: v6 j) f8 B; X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ l) P5 n4 W- n( I2 ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 s! C4 V6 n# |$ ?0 x6 ?/ a; F1 e: J3 ~4 u2 K* G; C' L
9 C% }* p) v% R( Y! z3 _
|
|