📄 waitutils.c
字号:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
#include <bsp.h>
UINT32 WdogInit(UINT32 TimeoutMSec);
// Timer already initialized to ~1 kHz (1 ms tick) in PMCPlatformInit
extern PCSP_EPIT_REG g_pEPIT;
void msWait(unsigned nMilliseconds)
{
UINT32 startCount, maxCount;
if (g_pEPIT == NULL)
{
OALMSG(OAL_ERROR, (TEXT("msWait: ERROR - Timer not initialized\r\n")));
return;
}
startCount = EPIT_CNT_COUNT_MAX - INREG32(&g_pEPIT->CNT);
maxCount = startCount + nMilliseconds;
// wait for nMilliseconds number of ticks
while( (EPIT_CNT_COUNT_MAX - INREG32(&g_pEPIT->CNT)) < maxCount);
}
void ResetSystem(void)
{
// Get uncached virtual addresses for Watchdog
WdogInit(500);
while(1);
// Should never get to this point...
//
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -