wait.c

来自「Windows CE 6.0 BSP for VOIP sample phone」· C语言 代码 · 共 73 行

C
73
字号
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
//
/* Copyright 2000-2001 Intel Corp.  */
/*
 *++
 *  FACILITY:
 *
 *
 *  AUTHORS:
 *
 *      Glen Schaff
 *
 *  MODIFICATIONS:
        gds  10-31-98
 *--
*/
#include <windows.h>
#include <nkintr.h>
#include "timer.h"
#include "bulverde.h"


extern PVOID VirtualAllocCopyPhysical(unsigned size,char *str,PVOID pPhysicalAddress);
static volatile BULVERDE_OST_REG *ost;

void usWait(unsigned usVal)
{
    unsigned Start;
    static unsigned firstCall=1;

    if (firstCall)
    {
        ost = (volatile BULVERDE_OST_REG*)VirtualAllocCopyPhysical(0x80,"Wait OST",(PVOID)(BULVERDE_BASE_REG_PA_OST));
        if (!ost)
        {
            RETAILMSG(TRUE, (TEXT("usWait: Map OST register failed\r\n")));
            return;
        }
        firstCall=0;
    }

    if (usVal != 0)
    {
        Start = ost->oscr0;
        while ((ost->oscr0 - Start) < usVal * TIMERTICK)
        {
            // do nothing
        }
    }
}

void msWait(unsigned msVal)
{
    usWait(msVal*1000);
}

void sWait(unsigned sVal)
{
    msWait(sVal*1000);
}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?