restart.c
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:1k
- #include "stsys.h"
- #include "sttbx.h"
- #include <stdio.h>
- #include <stdarg.h>
- #include <string.h>
- #include <stdlib.h>
- #include "Gendef.h"
- #include "appltype.h"
- #define SYS_SERVICES_BASE_ADDRESS 0x20F00000
- ST_ErrorCode_t KB_Restart(void)
- {
- U32 CodeReceived;
- STTBX_Print(("ENTERING SingapplRestart ...... n"));
-
- printf("ENTERING SingapplRestart ...... n");
-
- STSYS_WriteRegDev32LE(SYS_SERVICES_BASE_ADDRESS + 0x300, 0x00F0);
- STSYS_WriteRegDev32LE(SYS_SERVICES_BASE_ADDRESS + 0x300, 0x000F);
-
- CodeReceived = STSYS_ReadRegDev32LE(SYS_SERVICES_BASE_ADDRESS + 0x300);
- STTBX_Print(("***LOCK STATUS = %08Xn", CodeReceived));
- STSYS_WriteRegDev32LE(SYS_SERVICES_BASE_ADDRESS + 0x110, 0x02);
- CodeReceived = STSYS_ReadRegDev32LE(SYS_SERVICES_BASE_ADDRESS + 0x140) | 0x0180;
- STTBX_Print(("***RESET STATUS = %08X ---changed to = ", CodeReceived));
- STSYS_WriteRegDev32LE(SYS_SERVICES_BASE_ADDRESS + 0x140, 0x0180);
- CodeReceived = STSYS_ReadRegDev32LE(SYS_SERVICES_BASE_ADDRESS + 0x140);
- STTBX_Print(("%08Xn", CodeReceived));
-
- STTBX_Print(("Enabling WATCHDOG...n"));
- STSYS_WriteRegDev32LE(SYS_SERVICES_BASE_ADDRESS + 0x130, 0x01);
- STSYS_WriteRegDev32LE(SYS_SERVICES_BASE_ADDRESS + 0x134, 0x10);
- return ST_NO_ERROR;
- }
- /* EOF */