does this osif_IsIsrContext API is get current status in isr or task with freertos?
can i used it in printf/scanf ? static inline bool osif_IsIsrContext(void) { bool is_isr = false; uint32_t ipsr_code = (uint32_t)( (S32_SCB->ICSR & S32_SCB_ICSR_VECTACTIVE_MASK) >> S32_SCB_ICSR_VECTACTIVE_SHIFT ); if (ipsr_code != 0u) { is_isr = true; } return is_isr; } int_t __read_console(__file_handle handle, uchar_t * buffer, size_t * count) { #ifdef rtos_version if(osif_IsIsrContext() == true) taskDISABLE_INTERRUPTS(); else { taskENTER_CRITICAL(); } #endif uint32_t bytesRemain; bool MsgDone=false; uchar_t new_lin[]={"\n"}; int i=0; while (MsgDone==false) { LPUART_DRV_ReceiveData(INST_LPUART1, &buffer[i], 1); while(LPUART_DRV_GetReceiveStatus(INST_LPUART1, &bytesRemain) != STATUS_SUCCESS); LPUART_DRV_SendData(INST_LPUART1, &buffer[i], 1); while(LPUART_DRV_GetTransmitStatus(INST_LPUART1, &bytesRemain) != STATUS_SUCCESS); if(buffer[i++] == '\r') { buffer[i-1]='\n'; MsgDone = true; } } LPUART_DRV_SendData(INST_LPUART1, new_lin, 1); while(LPUART_DRV_GetTransmitStatus(INST_LPUART1, &bytesRemain) != STATUS_SUCCESS); buffer[i]=0; *count = (size_t)i; #ifdef rtos_version if(osif_IsIsrContext() == true) taskENABLE_INTERRUPTS(); else { taskEXIT_CRITICAL(); } #endif return 0; }