mirror of
https://gitee.com/Vancouver2017/luban-lite-t3e-pro.git
synced 2025-12-14 18:38:55 +00:00
43 lines
959 B
C
43 lines
959 B
C
|
|
/*
|
||
|
|
* Copyright (c) 2022, ArtInChip Technology Co., Ltd
|
||
|
|
*
|
||
|
|
* SPDX-License-Identifier: Apache-2.0
|
||
|
|
*/
|
||
|
|
|
||
|
|
#include <rtconfig.h>
|
||
|
|
#ifdef RT_USING_FINSH
|
||
|
|
#include <string.h>
|
||
|
|
#include <stdlib.h>
|
||
|
|
#include <finsh.h>
|
||
|
|
#include "aic_reboot_reason.h"
|
||
|
|
#include <drivers/watchdog.h>
|
||
|
|
#include "aic_core.h"
|
||
|
|
#include "aic_drv_wdt.h"
|
||
|
|
|
||
|
|
#define TIMEOUT 0
|
||
|
|
|
||
|
|
|
||
|
|
void cmd_reboot(int argc, char **argv)
|
||
|
|
{
|
||
|
|
u32 timeout = TIMEOUT;
|
||
|
|
rt_device_t wdt_dev = RT_NULL;
|
||
|
|
|
||
|
|
wdt_dev = rt_device_find("wdt");
|
||
|
|
rt_device_init(wdt_dev);
|
||
|
|
|
||
|
|
LOG_I("Restarting system ...\n");
|
||
|
|
aicos_msleep(100);
|
||
|
|
#ifdef AIC_WRI_DRV
|
||
|
|
aic_set_reboot_reason(REBOOT_REASON_CMD_REBOOT);
|
||
|
|
#endif
|
||
|
|
rt_device_control(wdt_dev, RT_DEVICE_CTRL_WDT_SET_TIMEOUT, &timeout);
|
||
|
|
rt_device_control(wdt_dev, RT_DEVICE_CTRL_WDT_START, RT_NULL);
|
||
|
|
|
||
|
|
aicos_msleep(1000);
|
||
|
|
LOG_W("Watchdog doesn't work!");
|
||
|
|
}
|
||
|
|
MSH_CMD_EXPORT_ALIAS(cmd_reboot, reboot, Reboot the system);
|
||
|
|
|
||
|
|
|
||
|
|
#endif /* RT_USING_FINSH */
|