From 1a45c1dc9f675b9ae20cdaa927d47830dfcd1e64 Mon Sep 17 00:00:00 2001 From: Rohan S <3526930+brosahay@users.noreply.github.com> Date: Thu, 5 Oct 2023 03:17:45 +0000 Subject: [PATCH] Adds refactored includes and define macros --- .../silabs/efr32/rs911x/hal/efx_spi.c | 32 ++++++++++++------- .../platform/silabs/efr32/spi_multiplex.h | 15 +-------- .../platform/silabs/efr32/wf200/efr_spi.c | 9 ++++++ 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c index 43cec5f0a4f5ba..ac4d48b0c28ac1 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c +++ b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c @@ -24,6 +24,7 @@ #include "FreeRTOS.h" #include "event_groups.h" +#include "semphr.h" #include "task.h" #include "btl_interface.h" @@ -48,6 +49,10 @@ #include "wfx_host_events.h" #include "wfx_rsi.h" +#if defined(SL_CATALOG_POWER_MANAGER_PRESENT) +#include "sl_power_manager.h" +#endif + #ifdef CHIP_9117 #include "cmsis_os2.h" #include "sl_board_configuration.h" @@ -57,10 +62,21 @@ #include "sl_wifi_callback_framework.h" #include "sl_wifi_constants.h" #include "sl_wifi_types.h" + +// macro to drive semaphore block minimum timer in milli seconds +// ported from rsi_hal.h (rs911x) +#define RSI_SEM_BLOCK_MIN_TIMER_VALUE_MS (50) #else #include "rsi_board_configuration.h" #include "rsi_driver.h" -#endif +#endif // CHIP_9117 + +#if SL_LCDCTRL_MUX +#include "sl_memlcd.h" +#endif // SL_LCDCTRL_MUX +#if SL_MX25CTRL_MUX +#include "sl_mx25_flash_shutdown_usart_config.h" +#endif // SL_MX25CTRL_MUX #if defined(EFR32MG12) #include "em_usart.h" @@ -78,16 +94,6 @@ #endif // EFR32MG12 || EFR32MG24 -#if SL_LCDCTRL_MUX -#include "sl_memlcd.h" -#endif // SL_LCDCTRL_MUX - -// Macro to drive semaphore block minimum timer in milli seconds -#define RSI_SEM_BLOCK_MIN_TIMER_VALUE_MS (50) -#if defined(SL_CATALOG_POWER_MANAGER_PRESENT) -#include "sl_power_manager.h" -#endif - #define CONCAT(A, B) (A##B) #define SPI_CLOCK(N) CONCAT(cmuClock_USART, N) @@ -470,6 +476,7 @@ int16_t rsi_spi_transfer(uint8_t * tx_buf, uint8_t * rx_buf, uint16_t xlen, uint return rsiError; } +#ifdef CHIP_9117 /********************************************************************* * @fn int16_t sl_si91x_host_spi_transfer(uint8_t *tx_buf, uint8_t *rx_buf, uint16_t xlen) * @param[in] uint8_t *tx_buff, pointer to the buffer with the data to be transferred @@ -483,4 +490,5 @@ int16_t rsi_spi_transfer(uint8_t * tx_buf, uint8_t * rx_buf, uint16_t xlen, uint sl_status_t sl_si91x_host_spi_transfer(const void * tx_buf, void * rx_buf, uint16_t xlen) { return (rsi_spi_transfer((uint8_t *) tx_buf, rx_buf, xlen, RSI_MODE_8BIT)); -} \ No newline at end of file +} +#endif // CHIP_9117 diff --git a/examples/platform/silabs/efr32/spi_multiplex.h b/examples/platform/silabs/efr32/spi_multiplex.h index 953becdacbff31..14d825379e2bd7 100644 --- a/examples/platform/silabs/efr32/spi_multiplex.h +++ b/examples/platform/silabs/efr32/spi_multiplex.h @@ -48,19 +48,6 @@ #ifdef __cplusplus extern "C" { #endif -#include "FreeRTOS.h" -#include "semphr.h" -#if SL_LCDCTRL_MUX -#include "sl_memlcd_display.h" -#endif // SL_LCDCTRL_MUX -#if SL_MX25CTRL_MUX -#include "sl_mx25_flash_shutdown_usart_config.h" -#endif // SL_MX25CTRL_MUX - -#include "spidrv.h" - -#define SL_SPIDRV_LCD_BITRATE SL_MEMLCD_SCLK_FREQ -#define SL_SPIDRV_MX25_FLASH_BITRATE 16000000 #if SL_SPICTRL_MUX /**************************************************************************** @@ -176,4 +163,4 @@ sl_status_t sl_wfx_host_post_uart_transfer(void); #ifdef __cplusplus } #endif -#endif // SL_SPICTRL_MUX \ No newline at end of file +#endif // SL_SPICTRL_MUX diff --git a/examples/platform/silabs/efr32/wf200/efr_spi.c b/examples/platform/silabs/efr32/wf200/efr_spi.c index f18d40c77ab6bc..dfa6109496d436 100644 --- a/examples/platform/silabs/efr32/wf200/efr_spi.c +++ b/examples/platform/silabs/efr32/wf200/efr_spi.c @@ -46,6 +46,15 @@ #include "sl_power_manager.h" #endif +#if SL_LCDCTRL_MUX +#include "sl_memlcd_display.h" +#define SL_SPIDRV_LCD_BITRATE SL_MEMLCD_SCLK_FREQ +#endif // SL_LCDCTRL_MUX +#if SL_MX25CTRL_MUX +#include "sl_mx25_flash_shutdown_usart_config.h" +#define SL_SPIDRV_MX25_FLASH_BITRATE 16000000 +#endif // SL_MX25CTRL_MUX + // TODO: (MATTER-1906) Investigate why using SL_SPIDRV_EXP_BITRATE is causing WF200 init failure // REF: sl_spidrv_exp_config.h #define SL_SPIDRV_EXP_BITRATE_MULTIPLEXED 10000000