|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , ]$ m7 {3 v# @7 i" z
- [code]EDMA sample test application
) |3 t! h+ E! l5 m - /*8 Q4 }8 ]5 [1 I8 p; Z8 V
- * edma_test.c
! t8 ^) F. E5 L4 X8 ^: l+ Y* R, f - ** \4 p/ C+ T6 c, D% {8 o, A
- * brief EDMA3 Test Application
( X0 o6 z' U! D9 `; c - *! B/ i/ A: g& C5 V4 r
- * This file contains EDMA3 Test code.
& p+ t% a$ J& U/ i" w" D - *
; U/ q7 l8 ?, U5 y& ^( _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% B1 }/ R/ X$ L9 Z0 @. s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' `& L% y' j% Y1 d9 { - * TO CHANGE., u9 N- ?5 M0 O5 b! H
- *3 i% o9 f& l% c% S9 Y3 M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( b$ t" P7 H( B# l- ?/ W - *
! m5 Q+ b$ g- z. `' s- a - * This program is free software; you can redistribute it and/or
$ I1 w9 M9 D) z9 H# _. C4 Z6 W - * modify it under the terms of the GNU General Public License as! m6 S1 M9 z6 f
- * published by the Free Software Foundation version 2.+ a. U e" k: p8 n; Q8 u7 U
- *
9 i4 ` O3 M* M- X, G8 y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% f( Q2 \8 A- J V5 \ - * kind, whether express or implied; without even the implied warranty
3 W& J+ c# {& p) \0 h( p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& ~) W: b! G2 R0 s - * GNU General Public License for more details.7 ^- p# w3 j; p( ^3 x
- */
# ^; X o; t# C8 W1 g2 c; Y6 Z
6 l' x p% P7 I- #include <linux/module.h>
9 y+ P" Y* |. Z3 p j; f* N( \ - #include <linux/init.h>
5 c4 \& e4 `( e6 p' w9 {/ g - #include <linux/errno.h>1 J3 F# C( V5 g- M4 N0 S5 g
- #include <linux/types.h>
8 k4 m- x" n5 g4 @: B4 y, D - #include <linux/interrupt.h>
* k5 \3 q; D1 c9 f" k* _ U - #include <asm/io.h>
0 n7 P) \* p/ Q1 g/ T& f - #include <linux/moduleparam.h> H* H1 m7 h" N
- #include <linux/sysctl.h>
( e, g' G% V9 [: S. M. V* I - #include <linux/mm.h>
& ]( P4 D7 L' E0 p, C9 l' x/ O/ y$ U - #include <linux/dma-mapping.h>- S* i: h5 F- a$ h- Y) |! W L" L
- k) ^5 N- O; I! I# s3 C" `- #include <mach/memory.h>
O" G# q2 D, g8 K8 C* ?9 t- j - #include <mach/hardware.h>2 N5 ?+ ~ r, b
- #include <mach/irqs.h>
0 a' U# \4 ]# a( ?$ Y - #include <asm/hardware/edma.h>- o" p' d9 ]- k9 H
' [: L" m# d. Y; N8 z4 C7 f- #undef EDMA3_DEBUG
& b1 Z; w }, F* V - /*#define EDMA3_DEBUG*/
9 b1 ^5 G$ u ~
6 f! W5 b; J: L5 \/ T9 r- #ifdef EDMA3_DEBUG
" P" }3 D8 ?) m' ]+ O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* g6 H! F, P' H: E5 Y6 l7 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 y* `. v3 i5 _ f( ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 C# j/ z" l) l - #else) z: G" B3 r9 `+ @0 X
- #define DMA_PRINTK( x... )
" q/ Y) ~* C: r7 K/ J( e' c - #define DMA_FN_IN5 {; a$ N: n9 d. ]
- #define DMA_FN_OUT5 W7 u3 i+ e2 S, i9 y, Q* }
- #endif5 ^1 h' U% |* E
- ; u/ A8 X* \9 X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) ], m. [* l O
- #define STATIC_SHIFT 3
( _1 r3 [1 {" m7 o' J5 W6 h# A" V% c - #define TCINTEN_SHIFT 205 s$ B. W; W4 k
- #define ITCINTEN_SHIFT 21" G$ U) l2 U" F5 s
- #define TCCHEN_SHIFT 22+ T: u# g: p6 x3 |9 v! b5 C
- #define ITCCHEN_SHIFT 23
' E* m5 \/ m# R
: X6 x! D2 j2 K% A* z: w6 ^# y( E- static volatile int irqraised1 = 0;
! ^1 W( W* t) m6 S$ z: M9 C9 w - static volatile int irqraised2 = 0;+ ^$ i p0 k6 W* }) S* C( \% L
5 l5 k2 u* _3 v; F) t( j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! k3 o: O+ @0 I. D: ~" @: L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 V" H" K! d3 V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 i# c2 |2 A2 `; H& M7 ]
- $ y$ y4 A2 `2 X# c. r
- dma_addr_t dmaphyssrc1 = 0;. J+ O; |/ _1 i: E1 ]8 G3 ^
- dma_addr_t dmaphyssrc2 = 0;
- m' r# S4 L) D( Q. j - dma_addr_t dmaphysdest1 = 0;
# R' i6 S( h5 l1 K. q( e8 H! f/ r - dma_addr_t dmaphysdest2 = 0;
7 J6 {2 O( f) g" e/ X" Y. N
. v% x% y# f4 K$ H# x- char *dmabufsrc1 = NULL;; x" x# T) b, E
- char *dmabufsrc2 = NULL;( e b6 T# e9 l' r
- char *dmabufdest1 = NULL;
0 U. ~. r1 O$ s) n- l3 [ - char *dmabufdest2 = NULL;& ]5 P$ R9 ]9 l' N( V
- 5 ?5 }8 Q# y' }1 Y9 z; }- F. D/ \
- static int acnt = 512;
9 r D2 s0 ` j# O2 s u - static int bcnt = 8;
1 Y2 }% c* O' b - static int ccnt = 8;
2 j8 S$ C2 ?- {, t' c% {
. f; E1 Y4 t. m7 h' P' O5 j$ @" C- module_param(acnt, int, S_IRUGO);
% g% H% M$ l) i1 b7 ? - module_param(bcnt, int, S_IRUGO);
2 J: ~9 E+ E7 A! v6 u9 H b - module_param(ccnt, int, S_IRUGO);
复制代码 2 a i4 E) U- Y' @: i, i5 O+ H+ {
$ ~0 z0 Y1 ~( s: p5 \2 g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: @ K6 A c' [+ ^+ Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 c5 U6 l* G4 p" {; `& R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. h D. t G5 Z
0 ]2 W, r7 X+ j# E, l& n, M0 o' @7 ^' _% ~( j( Y! W
|
|