diff --git a/examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c b/examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c index 23adb43d8f52c8..c16079ce0f0a3a 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c +++ b/examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c @@ -151,12 +151,16 @@ uint32_t sl_si91x_host_get_wake_indicator(void) sl_status_t sl_si91x_host_init(sl_si91x_host_init_configuration * config) { + uint32_t status = SL_STATUS_OK; #if SL_SPICTRL_MUX - if (SL_STATUS_OK != sl_board_disable_display()) + status = sl_board_disable_display(); + if (SL_STATUS_OK != status) { - return SL_STATUS_FAIL; + SILABS_LOG("sl_board_disable_display failed with error: %x", status); + xSemaphoreGive(spi_sem_sync_hdl); + return status; } -#endif +#endif //SL_SPICTRL_MUX init_config.rx_irq = config->rx_irq; init_config.rx_done = config->rx_done; diff --git a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c index f487207ffad11d..15aaef0898de6c 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c +++ b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c @@ -297,12 +297,16 @@ sl_status_t sl_wfx_host_post_bootloader_spi_transfer(void) #if SL_LCDCTRL_MUX sl_status_t sl_wfx_host_pre_lcd_spi_transfer(void) { + uint32_t status = SL_STATUS_OK; #if SL_SPICTRL_MUX xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY); #endif // SL_SPICTRL_MUX - if (SL_STATUS_OK != sl_board_enable_display()) + status = sl_board_enable_display(); + if (SL_STATUS_OK != status) { - return SL_STATUS_FAIL; + SILABS_LOG("sl_board_enable_display failed with error: %x", status); + xSemaphoreGive(spi_sem_sync_hdl); + return status; } // sl_memlcd_refresh takes care of SPIDRV_Init() if (SL_STATUS_OK != sl_memlcd_refresh(sl_memlcd_get())) @@ -318,12 +322,16 @@ sl_status_t sl_wfx_host_pre_lcd_spi_transfer(void) sl_status_t sl_wfx_host_post_lcd_spi_transfer(void) { + uint32_t status = SL_STATUS_OK; USART_Enable(SL_MEMLCD_SPI_PERIPHERAL, usartDisable); CMU_ClockEnable(SPI_CLOCK(SL_MEMLCD_SPI_PERIPHERAL_NO), false); GPIO->USARTROUTE[SL_MEMLCD_SPI_PERIPHERAL_NO].ROUTEEN = PINOUT_CLEAR; - if (SL_STATUS_OK != sl_board_disable_display()) + status = sl_board_disable_display(); + if (SL_STATUS_OK != status) { - return SL_STATUS_FAIL; + SILABS_LOG("sl_board_disable_display failed with error: %x", status); + xSemaphoreGive(spi_sem_sync_hdl); + return status; } #if SL_SPICTRL_MUX xSemaphoreGive(spi_sem_sync_hdl); diff --git a/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.c b/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.c index 2daef77519d729..ad8ebba0ffbd90 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.c +++ b/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.c @@ -67,7 +67,6 @@ sl_status_t sl_wfx_host_spiflash_cs_deassert(void); #if SL_SPICTRL_MUX StaticSemaphore_t spi_sem_peripheral; SemaphoreHandle_t spi_sem_sync_hdl; - #endif // SL_SPICTRL_MUX #if SL_LCDCTRL_MUX @@ -81,12 +80,16 @@ SemaphoreHandle_t spi_sem_sync_hdl; **********************************************************/ sl_status_t sl_wfx_host_pre_lcd_spi_transfer(void) { + uint32_t status = SL_STATUS_OK; #if SL_SPICTRL_MUX xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY); #endif // SL_SPICTRL_MUX - if (SL_STATUS_OK != sl_board_enable_display()) + status = sl_board_enable_display(); + if (SL_STATUS_OK != status) { - return SL_STATUS_FAIL; + SILABS_LOG("sl_board_enable_display failed with error: %x", status); + xSemaphoreGive(spi_sem_sync_hdl); + return status; } SPIDRV_SetBaudrate(SL_SPIDRV_LCD_BITRATE); @@ -102,12 +105,16 @@ sl_status_t sl_wfx_host_pre_lcd_spi_transfer(void) **********************************************************/ sl_status_t sl_wfx_host_post_lcd_spi_transfer(void) { + uint32_t status = SL_STATUS_OK; #if SL_SPICTRL_MUX xSemaphoreGive(spi_sem_sync_hdl); #endif // SL_SPICTRL_MUX - if (SL_STATUS_OK != sl_board_disable_display()) + status = sl_board_disable_display(); + if (SL_STATUS_OK != status) { - return SL_STATUS_FAIL; + SILABS_LOG("sl_board_disable_display failed with error: %x", status); + xSemaphoreGive(spi_sem_sync_hdl); + return status; } return SL_STATUS_OK; } diff --git a/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.h b/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.h index a487efacf045ae..0f0bcfbc919059 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.h +++ b/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.h @@ -25,7 +25,8 @@ #define SL_SI91X_NCP_UTILITY_H #pragma once - +#include "FreeRTOS.h" +#include "semphr.h" #include "silabs_utils.h" #include "sl_status.h" #include "spi_multiplex.h" @@ -39,6 +40,7 @@ #define USART_INITSYNC_BAUDRATE 12500000 #if SL_SPICTRL_MUX +extern SemaphoreHandle_t spi_sem_sync_hdl; sl_status_t spi_board_init(void); #endif // SL_SPICTRL_MUX