复位操作
/*
---------------------------------------------------------------
作 者:温子祺
联系方式:wenziqi@hotmail.com
说 明:WINCE复位操作
---------------------------------------------------------------
*/
C:\WINCE600\PLATFORM\Mini2440\src\common\ioctl\reboot
源码:
代码
#include <oal.h>
//------------------------------------------------------------------------------
//
// Function: OALIoCtlHalReboot
//
//
BOOL OALIoCtlHalReboot(UINT32 code, VOID *pInpBuffer,
UINT32 inpSize, VOID *pOutBuffer,
UINT32 outSize, UINT32 *pOutSize)
{
//
// If the board design supports software-controllable hardware reset logic, it should be
// used. Because this routine is specific to the S3C2440A CPU, it only uses the watchdog
// timer to assert reset. One downside to this approach is that nRSTOUT isn't asserted
// so any board-level logic isn't reset via this method. This routine can be overidden in
// the specific platform code to control board-level reset logic, should it exist.
//
volatile S3C2440A_WATCHDOG_REG *pWDRegs = (volatile S3C2440A_WATCHDOG_REG *)
OALPAtoVA(S3C2440A_BASE_REG_PA_WATCHDOG, FALSE);
OALMSG(OAL_IOCTL&&OAL_FUNC, (L"+OALIoCtlHalReboot\r\n"));
// Setup the watchdog.
//
pWDRegs->WTDAT = 0;
pWDRegs->WTCNT = 5; // Load count with low value.
pWDRegs->WTCON = 0x8021; // Enable watchdog timer...
// Wait for watchdog reset...
//
while(TRUE);
// Should never get to this point...
//
OALMSG(OAL_IOCTL&&OAL_FUNC, (L"-OALIoCtlHalReboot\r\n"));
return(TRUE);
}
在OALIoCtlHalReboot函数中,复位操作很简单,只需要对看门狗相关的寄存器进行配置,然后等待看门狗计数器溢出,看门狗就会复位ARM。
OALIoCtlHalReboot输入参数如下:
- code
-
[in] Set to IOCTL_HAL_REBOOT to support a warm boot of the target device.
- pInpBuffer
-
[in] Not used; set to NULL.
- inpSize
-
[in] Not used; set to zero.
- pOutBuffer
-
[in] Ignored; set to NULL.
- outSize
-
[in] Not used; set to zero.
- pOutSize
-
[in] Not used; may be set to NULL.
即OALIoCtlHalReboot(IOCTL_HAL_REBOOT,NULL,0,NULL,0,NULL);
转载请注明出处,谢谢!