int32_t debug_vprint(int32_t lvl, const char *format, va_list arg_list)
{
if (debug_buffer == NULL) {
return -1;
}
if (lvl == ECLOG_EMERG) {
// In emergency mode, global interrupt should be disabled.
int cnt = vsprintf(debug_buffer, format, arg_list);
for (int32_t i = 0; i < cnt; i++) {
while ((DEBUG_UART_HANDLE->SR & (0x1 << 7)) == 0) {
}
DEBUG_UART_HANDLE->DR = debug_buffer[i];
}
return cnt;
}
else if (lvl <= debug_lvl) {
int32_t ret = ec_vfprintf(debug_fd, format, arg_list);
return ret;
}
else {
return 0;
}
}
--
FROM 111.198.57.*