MCUXpresso: Change the MXRT deep sleep implementation

The code checks if any of the UART's is still transmitting.
If so then prevent from entering deepsleep

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
pull/11476/head
Mahesh Mahadevan 2019-09-04 11:14:38 -05:00 committed by adbridge
parent 0206f48e04
commit 71710318f7
1 changed files with 6 additions and 5 deletions

View File

@ -19,8 +19,7 @@
extern void vPortPRE_SLEEP_PROCESSING(clock_mode_t powermode); extern void vPortPRE_SLEEP_PROCESSING(clock_mode_t powermode);
extern void vPortPOST_SLEEP_PROCESSING(clock_mode_t powermode); extern void vPortPOST_SLEEP_PROCESSING(clock_mode_t powermode);
extern void serial_wait_tx_complete(uint32_t uart_index); extern bool serial_check_tx_ongoing();
void hal_sleep(void) void hal_sleep(void)
{ {
@ -35,10 +34,12 @@ void hal_sleep(void)
void hal_deepsleep(void) void hal_deepsleep(void)
{ {
vPortPRE_SLEEP_PROCESSING(kCLOCK_ModeStop); /* Check if any of the UART's is transmitting data */
if (serial_check_tx_ongoing()) {
return;
}
/* Wait till debug UART is done transmitting */ vPortPRE_SLEEP_PROCESSING(kCLOCK_ModeStop);
serial_wait_tx_complete(STDIO_UART);
__DSB(); __DSB();
__WFI(); __WFI();