|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 u s! ~( K' X6 q& `5 X2 A
- [code]EDMA sample test application
3 F% e9 @% x+ [7 {0 Z2 t - /*7 L; [+ Y: ~8 y9 x8 }. k
- * edma_test.c
6 \/ [2 c# Z; _# G - *$ n, S. d; Y v H( `
- * brief EDMA3 Test Application
, P# ` e9 \/ d/ z5 Z - *
; K4 y$ m8 Y6 h1 |0 s o; j9 d( o9 T - * This file contains EDMA3 Test code.
# j7 J) @3 M: A, {6 P/ F - *) L0 j8 ]5 e9 k, b0 S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' { o. d5 `) t! _; n2 _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, `. B" [0 z' ]4 e6 u - * TO CHANGE.
9 G; u( R# B: s. G - *0 q6 U! o- E( x2 G: {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 E9 \1 u; S" z% w9 A3 k& m - *
# r+ I; S% Z& p2 {8 U; E. F$ M& q. M - * This program is free software; you can redistribute it and/or
4 }, S o( `4 P2 P7 c$ M - * modify it under the terms of the GNU General Public License as6 c1 _/ z$ C( W3 [
- * published by the Free Software Foundation version 2.8 I6 P0 k8 C1 f1 R
- *6 i0 s V9 U; E& W2 v6 S2 ?/ p2 |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 n l9 Y$ h9 F: ? L
- * kind, whether express or implied; without even the implied warranty
( }, H: R. j7 K6 R2 | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 d; o, v v2 P$ d - * GNU General Public License for more details.
6 D& A! j0 {+ N) b4 X. v - */
. |% b8 d4 p/ Q$ |' i5 A5 L - 8 y0 {% b1 k; X1 r. A
- #include <linux/module.h>
9 d2 E9 ]' X% P/ _ - #include <linux/init.h> z1 W% J# h" Z
- #include <linux/errno.h>
( }# [) ^& | R0 E4 S+ T - #include <linux/types.h>5 g$ A+ k0 I" m+ {) y6 @; P
- #include <linux/interrupt.h>1 D$ _" s3 H+ I4 \- V4 |
- #include <asm/io.h>/ c& ]" J8 c: r7 K0 h
- #include <linux/moduleparam.h>
0 P2 v6 ]- A, X' r! Y - #include <linux/sysctl.h>/ [5 v% _1 Q( \! ]$ W# f
- #include <linux/mm.h>1 @0 q7 w9 Z3 I5 R' W1 B
- #include <linux/dma-mapping.h>- r, _/ c1 Q3 o8 Z" X7 t
: ^) K" |5 X/ I# r2 c- A6 D- #include <mach/memory.h>
$ g% r; i* F, E1 B. { ? - #include <mach/hardware.h>
: r2 m y* j3 G: J - #include <mach/irqs.h>: p) N1 j7 N) `! ]- e6 k* Q
- #include <asm/hardware/edma.h>3 d1 y7 t, {* B
+ b) i4 U3 f* p- #undef EDMA3_DEBUG
8 z3 H: U2 C" r2 l) K- R6 Z - /*#define EDMA3_DEBUG*/
) A# Z8 [4 d, s- C: ~
* x, o& I( p( l& x, ?- #ifdef EDMA3_DEBUG
( t W# M, I% z+ K# |* V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 ]$ {* F L# R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ y, B% m& b; [( f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): a* u; B7 k# i2 z! E# g
- #else$ }$ u, s# r* D# Q T! a: [+ w& \6 B
- #define DMA_PRINTK( x... )/ _* x! B: M y
- #define DMA_FN_IN
| n3 v" l8 D. Y3 c - #define DMA_FN_OUT) {: W+ v7 s3 x4 R" S" a
- #endif; b' u% i: ?; k5 P( ?5 X: }9 c) r
- k- v( ]8 A3 g- I$ ~; T. }+ B% [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( X. K2 X9 G0 {# M1 G$ w
- #define STATIC_SHIFT 3
3 L5 q$ [# J. |* a0 u+ q7 I - #define TCINTEN_SHIFT 20
& j. O' C$ L* \; l - #define ITCINTEN_SHIFT 21
4 r8 K( M3 z- l0 I0 O/ |9 V& K7 x - #define TCCHEN_SHIFT 22
" ^) Z9 B7 W9 d8 q - #define ITCCHEN_SHIFT 23
1 t# l1 S/ X/ J# w% D) t
. S8 V" Q2 b$ |- j, b- static volatile int irqraised1 = 0;
1 l$ y8 }* J/ `9 ~6 r$ o - static volatile int irqraised2 = 0;
p- X/ ?6 d4 M6 \! M+ p, D
3 ~( K; r y6 C0 d! A+ x" w, a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' m) c+ E& a* V4 S" @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 k, A% [0 S4 e; l( m: X( x# y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 C4 ^: W. o& z6 \6 p- M - , u0 N. o. S K
- dma_addr_t dmaphyssrc1 = 0;8 T/ F5 S5 S- w1 L. @: \8 k
- dma_addr_t dmaphyssrc2 = 0;
( h( M$ [) b) r( L9 V7 Q - dma_addr_t dmaphysdest1 = 0;
: ]) v8 J1 n2 f% ? - dma_addr_t dmaphysdest2 = 0;
" T; |: p( ~/ o - ; t9 A4 ^- o$ ^. g# B1 V
- char *dmabufsrc1 = NULL;
7 O% o; T6 g2 n3 \! X. w9 } - char *dmabufsrc2 = NULL;
# P N H. \* d6 S0 c - char *dmabufdest1 = NULL;* ^/ j. N6 Q" \% J0 o
- char *dmabufdest2 = NULL;
+ R5 [" ^' l9 T& N - ' v% ]0 X3 o d. H
- static int acnt = 512;
1 ^. `" A: S# C; w, y - static int bcnt = 8;" j% m' V9 E9 s& V3 I( D# b
- static int ccnt = 8;2 W; U- \* Q Y, a
6 c+ r: | e) s+ h- module_param(acnt, int, S_IRUGO);
6 q$ x" U1 m* X( s - module_param(bcnt, int, S_IRUGO);# c5 b! L6 a- M' e) \. Y$ c# q1 p
- module_param(ccnt, int, S_IRUGO);
复制代码 6 p% v; N; H, |, ?' g$ w
# Q" ?5 m6 L& c& j/ ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ z# S) C) Z4 M- k; R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
~' r2 W4 ?6 Z5 i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 t) Z+ K; \( W/ `
% ^( J# ]( Q1 l
5 |" H" e) j j0 t% g' j5 l3 {5 C
|
|