|
|
@ -126,6 +126,32 @@ SysMgr* SysMgr::ins() { |
|
|
|
size_t SysMgr::osGetSysRunTime() { return HAL_GetTick(); } |
|
|
|
UBaseType_t uxTaskGetSystemState(TaskStatus_t* const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t* const pulTotalRunTime); |
|
|
|
|
|
|
|
void SysMgr::checkRst(void) { |
|
|
|
if (__HAL_RCC_GET_FLAG(RCC_FLAG_PINRST) != RESET) { // NRST 引脚复位
|
|
|
|
printf("RESET_REASON: PIN reset \n"); |
|
|
|
m_reset_reason = kreset_reason_pinrst; |
|
|
|
} else if (__HAL_RCC_GET_FLAG(RCC_FLAG_PORRST) != RESET) { // 上电掉电复位
|
|
|
|
printf("RESET_REASON: POR/PDR reset \n"); |
|
|
|
m_reset_reason = kreset_reason_porrst; |
|
|
|
} else if (__HAL_RCC_GET_FLAG(RCC_FLAG_SFTRST) != RESET) { // 软件复位
|
|
|
|
printf("RESET_REASON: Software reset \n"); |
|
|
|
m_reset_reason = kreset_reason_sftrst; |
|
|
|
} else if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST) != RESET) { // 独立看门狗复位
|
|
|
|
printf("RESET_REASON: Independent watchdog reset \n"); |
|
|
|
m_reset_reason = kreset_reason_iwdgrst; |
|
|
|
} else if (__HAL_RCC_GET_FLAG(RCC_FLAG_WWDGRST) != RESET) { // 窗口看门狗复位
|
|
|
|
printf("RESET_REASON: Window watchdog reset \n"); |
|
|
|
m_reset_reason = kreset_reason_wwdgrst; |
|
|
|
} else if (__HAL_RCC_GET_FLAG(RCC_FLAG_LPWRRST) != RESET) { // 低功耗复位
|
|
|
|
printf("RESET_REASON: (Low-power reset \n"); |
|
|
|
m_reset_reason = kreset_reason_lpwrrst; |
|
|
|
} else { |
|
|
|
printf("RESET_REASON: Unkown reset \n"); |
|
|
|
m_reset_reason = kreset_reason_unkown; |
|
|
|
} |
|
|
|
__HAL_RCC_CLEAR_RESET_FLAGS(); // 清除复位标志
|
|
|
|
} |
|
|
|
|
|
|
|
void SysMgr::initedFinished() { //
|
|
|
|
static TaskStatus_t pxTaskStatusArray[SDK_MAX_TASK + 1]; |
|
|
|
UBaseType_t uxArraySize = SDK_MAX_TASK + 1; |
|
|
@ -137,6 +163,7 @@ void SysMgr::initedFinished() { // |
|
|
|
ZASSERT_INFO(m_ntask < SDK_MAX_TASK, "task num is too large, please increase SDK_MAX_TASK"); |
|
|
|
|
|
|
|
PVD_Init(); |
|
|
|
checkRst(); |
|
|
|
} |
|
|
|
|
|
|
|
size_t SysMgr::osGetMinimumEverFreeHeapSize() { return ::xPortGetMinimumEverFreeHeapSize(); } |
|
|
|