|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 l, y ~ Z& G& z7 I$ R$ [* c
- [code]EDMA sample test application
; w. c2 R1 n, z4 m' ] - /*
8 s$ z* p4 d- ]7 C5 @& d& |5 j - * edma_test.c5 N5 U+ F" p5 }8 `
- *" ]/ G; l0 V B8 \" f+ h2 i
- * brief EDMA3 Test Application
8 Z: f/ j2 x8 W) @' f+ ~ - *: J- f% A+ `+ k
- * This file contains EDMA3 Test code.
9 T8 Z5 ^ ]0 k% ~+ M8 m+ H% @% a - *
% ^$ |$ v, c2 Y% T. p) b* i }+ _5 h9 b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ R, I; ?& M1 d& d y# v& N: j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. ?* c5 p3 |+ D9 R
- * TO CHANGE.! O0 X* K8 p4 {' K. L1 q3 m
- *9 S, I" f) J G" g6 j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- n- S3 [, V. k7 f
- *+ F) ~/ \5 t7 ]8 c& A
- * This program is free software; you can redistribute it and/or. ~5 t8 k4 }6 v- f7 X X6 G
- * modify it under the terms of the GNU General Public License as
. z5 S. W2 L7 J - * published by the Free Software Foundation version 2.
. R' S3 e2 W L! g! u - *
0 j' z% R% o9 ~/ N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ `5 i2 D* n( U( A: z. ^
- * kind, whether express or implied; without even the implied warranty% q4 M `6 O; a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 r4 B7 U/ `$ Y9 y5 B; @4 T
- * GNU General Public License for more details.
3 L& @7 [! f- y: o- g - */
" i5 V; N8 q/ ^- A8 ~5 {
$ \6 ^6 Z# i# y/ P- O- ^. U- #include <linux/module.h># @4 s2 e6 d5 e: _& }$ g; j! w6 ~
- #include <linux/init.h>/ i$ g. E$ g& n/ u8 c$ }9 Z# T1 ~
- #include <linux/errno.h>
2 e, g7 R4 Q8 t% l+ t( F - #include <linux/types.h>" h7 n! O) `8 m( e4 |2 H& A
- #include <linux/interrupt.h>
g2 e+ I0 R7 o* y - #include <asm/io.h>
$ N- Q; T: a1 T8 L7 r - #include <linux/moduleparam.h>6 y8 Z# t8 _4 C% M5 N
- #include <linux/sysctl.h>( h3 Z" t7 z) ?
- #include <linux/mm.h>) _9 c8 \- A; x8 Q/ B. {& A0 _
- #include <linux/dma-mapping.h>; i; b& i" x, E' l' r
. h1 b, j) N% S* y6 \- #include <mach/memory.h>
% j2 o8 E2 D3 X; h9 l& Z" h - #include <mach/hardware.h>1 e8 I. V, s% b+ y9 k
- #include <mach/irqs.h>
) O( I- { M) W: K - #include <asm/hardware/edma.h>7 z& C- D! U; }1 x8 l/ M0 |
7 }/ {" [ Y9 V+ ?% \) H- #undef EDMA3_DEBUG& Z7 q) V7 }- |1 f1 S* L# v" Z
- /*#define EDMA3_DEBUG*/: y! ^( q: j8 O3 h6 v! H
5 e6 N* x9 ~! f2 }$ M- #ifdef EDMA3_DEBUG
7 {3 c. x2 i" `7 E/ A5 ^0 O% v: W( a4 F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 x" P/ I8 H# j8 F4 b& Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 u6 h/ k; N# H, v1 t1 G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 s/ N/ u; `6 ^+ F
- #else b0 H7 @# F- A* U; F1 W, @8 ^& L, ^2 Z
- #define DMA_PRINTK( x... )
3 _& t' j7 U+ n! A+ S - #define DMA_FN_IN
; i' K L. a) x* K - #define DMA_FN_OUT8 e- O; C& V2 S
- #endif- b) J+ {! r2 v9 M V) _
2 j' u& ^; @% B0 S: h) ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 Y d( {3 i7 b* L3 U, ]& B
- #define STATIC_SHIFT 31 E( o; `# n; H6 v4 R0 U0 h
- #define TCINTEN_SHIFT 20* J6 n5 ] K5 F4 `( G0 k; M
- #define ITCINTEN_SHIFT 215 N! v1 v4 I5 U' y+ F0 C! p
- #define TCCHEN_SHIFT 221 q A; d! _( h1 I
- #define ITCCHEN_SHIFT 235 V, \$ G: X/ x# |
- x) l0 @' ^- C2 j d
- static volatile int irqraised1 = 0;
- x) t0 q' v8 x3 Y4 [+ g - static volatile int irqraised2 = 0;
7 @) E8 G8 E% ^* ` @
% R& I4 L$ u: f5 b8 \( Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 o" ^% K2 J/ l" p: K) H) t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! B, `' X9 g. V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: ]3 {2 K9 P7 g# R* i/ e3 Y - 1 H3 Y# n: ]* R# ?( `
- dma_addr_t dmaphyssrc1 = 0;
& |* @, W0 _5 L+ ^) ]5 { - dma_addr_t dmaphyssrc2 = 0;
2 h( Y" [: D) W+ a% D: q - dma_addr_t dmaphysdest1 = 0;
, c' p& f% l: w+ E. l - dma_addr_t dmaphysdest2 = 0;! X# @* {: x% F+ u8 A! ]
@' w/ R$ N- \8 E- char *dmabufsrc1 = NULL;2 t$ a5 o/ T# c! o+ Y+ w
- char *dmabufsrc2 = NULL;3 f/ ]. S, p$ l' X6 @- S
- char *dmabufdest1 = NULL;' C) J/ l- }# S F
- char *dmabufdest2 = NULL;
, T! ^- ]) n% ]5 }% p1 r! R! c - 7 C& O2 c/ l$ a% g. c
- static int acnt = 512;+ j; Y4 w; c0 N( N' J
- static int bcnt = 8;) u) r& Q a0 y. q
- static int ccnt = 8;
& q% h8 G2 X* W. o( E) u3 N
! Q6 I7 D+ ~1 b( k& k. _' a- module_param(acnt, int, S_IRUGO); m! J" G" R# V+ v
- module_param(bcnt, int, S_IRUGO);$ J# t! o7 T8 W+ f/ p9 p
- module_param(ccnt, int, S_IRUGO);
复制代码 $ j' K% o# m% r3 v
, {$ o: ?. n& |0 h" Z" }& L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ F! o4 z9 @. F+ G* c$ y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 E, c( R5 v: x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* ~6 f+ E) w4 }( z
9 \$ @) j! w$ i+ F, A% F1 |* c* [9 i" ?+ T
|
|