|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 v- v+ P, S. S% w" f/ {# U' `- [code]EDMA sample test application4 f* n1 B/ Y; {2 b% B! ]
- /*/ [7 x. c( n ~
- * edma_test.c
2 I& g: `) g4 U, O2 q4 V - *
3 V7 o" H: K5 }" v - * brief EDMA3 Test Application- b- A" K% c' G
- *. U8 z& C5 x5 O& m
- * This file contains EDMA3 Test code.2 t- w1 _* u* X% O/ n& n7 f
- *2 ]! P& ]) T9 ^5 B$ r" Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; b+ o0 e2 T2 l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 ^: Y/ O: J! b! Z% \9 m4 d - * TO CHANGE.7 o0 x r, k% E4 Q9 v o' I' N; t% H
- *
6 I, T# n! q0 @5 e0 J0 u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ s; k/ t2 l5 _9 h$ \- } - *5 q' p7 _1 z! f. j+ n
- * This program is free software; you can redistribute it and/or
% G9 h0 }. @) ?/ M# S7 \4 H+ }) R - * modify it under the terms of the GNU General Public License as
8 n/ R- G G- \ - * published by the Free Software Foundation version 2.
4 c7 T5 U: ^% g0 T4 Q - *
) L! j& y: b" Z! `" u" n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* ?. w& N, p6 x: T* c5 P3 H - * kind, whether express or implied; without even the implied warranty
( }; O3 ^ B" d1 k+ I$ g2 J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) e8 o/ ~5 a) R3 [7 O - * GNU General Public License for more details.
% s! C6 H5 d4 L' M$ _ - */
& Q x# s; c4 [) A4 \ T$ W9 O8 ^ - " u: x, C( w4 W& F7 Q+ ?
- #include <linux/module.h>8 R$ |4 X r, B: G: k7 O* }
- #include <linux/init.h>
: M- W4 k# ?0 U9 J7 |$ _9 `. Q - #include <linux/errno.h>5 ~" I ^' a# e
- #include <linux/types.h>
! [! l% Z* v, v' z: X, w w) Z - #include <linux/interrupt.h>
1 W1 D0 j4 e& p- S$ ^4 l - #include <asm/io.h>: p+ H Q" g# W- R, H" i R
- #include <linux/moduleparam.h>, @, T8 h$ J- r! z; i. w: w
- #include <linux/sysctl.h>
l u1 c* |4 p U! { - #include <linux/mm.h>
V2 o n* X% H/ i! E( P - #include <linux/dma-mapping.h>
! M# ~- i0 n* A; I. u4 |, M
: l; P0 a. K7 I! j2 [3 F- #include <mach/memory.h>/ z! ]+ _; I2 l2 g
- #include <mach/hardware.h>( `$ \, `2 E4 Z% s
- #include <mach/irqs.h>
$ [) W" x9 a5 B4 ] - #include <asm/hardware/edma.h>) Q6 T9 d3 x9 d' [3 E: x
- ! V( r& ^# M0 I% I
- #undef EDMA3_DEBUG: r$ s a P( s a) D e. p
- /*#define EDMA3_DEBUG*/
8 a ~2 v7 Z3 C7 C) X7 _( m- P - ' l) |3 `2 _7 M$ w. n- T s
- #ifdef EDMA3_DEBUG
a. x# c( p) k5 y6 e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" \1 i6 Q# }8 P& k6 p" K! m6 N3 }7 R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 m6 H" d" R9 Z3 @* ? N C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- y' W' z# s0 z8 ]; c' ^" r4 C - #else6 l) |# w- G3 \/ \) h
- #define DMA_PRINTK( x... )
: x: S h7 U5 C6 z! g& D3 ? - #define DMA_FN_IN0 F* ^& i1 h1 J2 n1 o% m9 P
- #define DMA_FN_OUT( q2 Z6 G/ L7 r- J. m8 d* X' n
- #endif
+ f5 h- _8 c; \1 ]0 `5 ^( O
/ \8 p. J7 R- a' j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% ~5 h9 Z0 z4 j9 }- z3 Y - #define STATIC_SHIFT 3
! j3 W# |8 t, b - #define TCINTEN_SHIFT 20
0 ^: I4 o5 {$ Z7 R - #define ITCINTEN_SHIFT 21+ { _7 o5 K' M) M
- #define TCCHEN_SHIFT 22! j" Z& v3 e M: y
- #define ITCCHEN_SHIFT 23
0 Z. l2 i x- B$ o
! H. l. ~2 ]; X+ F Z% H6 d( t- static volatile int irqraised1 = 0;
1 V/ z# a ~2 X, d9 { - static volatile int irqraised2 = 0;
' W7 J: h9 S/ ? - & `; H: \2 a9 p* P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* Z) q! L$ Z& f9 ~* T; z: k- R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
A' b$ V4 D/ A& q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" _2 t0 ~6 G, ^% Y* H9 b
. L- w# Q# `: b0 N2 e$ [. ?# h- dma_addr_t dmaphyssrc1 = 0;% a. [5 r: j4 J5 b) i3 V
- dma_addr_t dmaphyssrc2 = 0;
& F( J. v- K9 `) I2 P3 h$ x - dma_addr_t dmaphysdest1 = 0;
: r6 v# ` y9 m4 {, [; S - dma_addr_t dmaphysdest2 = 0;* H& D, P# F. t) k0 c2 j
- . g* b3 T9 ^3 _9 k, X7 l
- char *dmabufsrc1 = NULL;3 l z5 Q+ ]- l, G# p. f: _
- char *dmabufsrc2 = NULL;% l; z' F3 n( B3 `' w' H2 x( A U
- char *dmabufdest1 = NULL;
e( l# G7 D3 G* s - char *dmabufdest2 = NULL;2 E8 Y( `% u# X$ @; m) s
, B9 t) M! b8 |/ I! z- static int acnt = 512;
2 }3 r! ^( X/ k+ q$ x- ] - static int bcnt = 8;
+ D, v0 B7 W) M; r - static int ccnt = 8;
) F1 n/ u4 G7 r* k& J
* ?: o3 T2 k& L: u1 B9 X* I9 F: p4 `- module_param(acnt, int, S_IRUGO);; K% \ S1 w% B6 _/ _+ F
- module_param(bcnt, int, S_IRUGO);
: R& K" G" u9 r; V - module_param(ccnt, int, S_IRUGO);
复制代码 0 ~5 P; ?$ X% D, m6 _' ^- {
8 ]0 y$ @+ W/ X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' K, _! Z2 u$ oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. U2 m2 T9 r# u0 v) Y1 M* S* ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: g0 M7 A) Z8 z5 T* D# x
0 B. h0 J/ b+ T4 o$ v
* M) \, G' E( Z |
|