|
27 | 27 | *
|
28 | 28 | ******************************************************************************/
|
29 | 29 |
|
30 |
| -#include "FreeRTOSConfig.h" |
31 | 30 | #include "rsi_wisemcu_hardware_setup.h"
|
32 | 31 | #include "rsi_m4.h"
|
33 | 32 | #include "rsi_rom_egpio.h"
|
@@ -215,157 +214,6 @@ void sli_si91x_configure_wireless_frontend_controls(uint32_t switch_sel)
|
215 | 214 | #endif
|
216 | 215 | }
|
217 | 216 |
|
218 |
| -/** |
219 |
| - * @brief Configure the default hardware configuration required for 'WiSeMCU' mode. |
220 |
| - * @param[in] sleepType - Select the retention or non-retention mode of processor; refer to 'SLEEP_TYPE_T'. |
221 |
| - * \n SLEEP_WITH_RETENTION : When used, user must configure the RAMs to be retained during sleep by using the 'RSI_PS_SetRamRetention()' function. |
222 |
| - * @param[in] lf_clk_mode - This parameter is used to switch the processor clock from high frequency clock to low-frequency clock. This is used in some critical power save cases. |
223 |
| - * \n '0' : ' \ref DISABLE_LF_MODE' Normal mode of operation , recommended in most applications. |
224 |
| - * \n '1' : ' \ref LF_32_KHZ_RC' Processor clock is configured to low-frequency RC clock. |
225 |
| - * \n '2' : ' \ref LF_32_KHZ_XTAL' Processor clock is configured to low-frequency XTAL clock. |
226 |
| - * @param[in] stack_address - Stack pointer address to be used by bootloader. |
227 |
| - * @param[in] jump_cb_address - Control block memory address or function address to be branched up on Wake-up |
228 |
| - * @param[in] vector_offset - IVT offset to be programmed by boot-loader up on Wake-up. |
229 |
| - * @param[in] mode - Possible parameters as follows: |
230 |
| - * \n \ref RSI_WAKEUP_FROM_FLASH_MODE : Wakes from flash with retention. Upon wake up, control jumps to wake up handler in flash. |
231 |
| - * In this mode, ULPSS RAMs are used to store the stack pointer and Wake-up handler address. |
232 |
| - * \n \ref RSI_WAKEUP_WITH_OUT_RETENTION : Without retention sleep common for both FLASH/RAM based execution. |
233 |
| - * In this mode, ULPSS RAMs are used to store the stack pointer and control block address. |
234 |
| - * if stack_addr and jump_cb_addr are not valid, then 0x2404_0C00 and 0x2404_0000 are used |
235 |
| - * for stack and control block address respectively. |
236 |
| - * \n \ref RSI_WAKEUP_WITH_RETENTION : With retention branches to wake up handler in RAM. |
237 |
| - * In this mode, ULPSS RAMs are used to store the wake up handler address. |
238 |
| - * \n \ref RSI_WAKEUP_WITH_RETENTION_WO_ULPSS_RAM : In this mode, ULPSS RAMs are not used by boot-loader, instead it uses the NPSS battery flip flops. |
239 |
| - * \n \ref RSI_WAKEUP_WO_RETENTION_WO_ULPSS_RAM : In this mode, ULPSS RAMs are not used by boot-loader, instead it uses the NPSS battery flip flops to store |
240 |
| - * the stack and derives the control block address by adding 0XC00 |
241 |
| - * to the stack address stored in battery flops. |
242 |
| - * @return Void |
243 |
| - */ |
244 |
| - |
245 |
| -void sl_si91x_trigger_sleep(SLEEP_TYPE_T sleepType, |
246 |
| - uint8_t lf_clk_mode, |
247 |
| - uint32_t stack_address, |
248 |
| - uint32_t jump_cb_address, |
249 |
| - uint32_t vector_offset, |
250 |
| - uint32_t mode) |
251 |
| -{ |
252 |
| - // Turn on the ULPSS RAM domains and retain ULPSS RAMs |
253 |
| - if ((mode != RSI_WAKEUP_WITH_RETENTION_WO_ULPSS_RAM) || (mode != RSI_WAKEUP_WO_RETENTION_WO_ULPSS_RAM)) { |
254 |
| - /* Turn on ULPSS SRAM domains*/ |
255 |
| - RSI_PS_UlpssRamBanksPowerUp(ULPSS_2K_BANK_0 | ULPSS_2K_BANK_1 | ULPSS_2K_BANK_2 | ULPSS_2K_BANK_3); |
256 |
| - |
257 |
| - /* Turn on ULPSS SRAM Core/Periphery domains*/ |
258 |
| - RSI_PS_UlpssRamBanksPeriPowerUp(ULPSS_2K_BANK_0 | ULPSS_2K_BANK_1 | ULPSS_2K_BANK_2 | ULPSS_2K_BANK_3); |
259 |
| - |
260 |
| - if ((mode == RSI_WAKEUP_FROM_FLASH_MODE) || (mode == RSI_WAKEUP_WITH_RETENTION) |
261 |
| -#if defined(SLI_SI917B0) || defined(SLI_SI915) |
262 |
| - || (mode == SL_SI91X_MCU_WAKEUP_PSRAM_MODE) |
263 |
| -#endif // SLI_SI917B0 |
264 |
| - ) { |
265 |
| - /* Retain ULPSS RAM*/ |
266 |
| - RSI_PS_SetRamRetention(ULPSS_RAM_RETENTION_MODE_EN); |
267 |
| - } |
268 |
| - } |
269 |
| - |
270 |
| - // Peripherals needed on Wake-up (without RAM retention) needs to be powered up before going to sleep |
271 |
| - if ((mode == RSI_WAKEUP_WITH_OUT_RETENTION) || (mode == RSI_WAKEUP_WO_RETENTION_WO_ULPSS_RAM)) { |
272 |
| - |
273 |
| - RSI_PS_M4ssPeriPowerUp(M4SS_PWRGATE_ULP_M4_DEBUG_FPU); |
274 |
| - } |
275 |
| - |
276 |
| -#if (SL_SI91X_TICKLESS_MODE == 0) |
277 |
| - |
278 |
| - if ((osEventFlagsGet(si91x_events) | osEventFlagsGet(si91x_async_events)) |
279 |
| -#ifdef SL_SI91X_SIDE_BAND_CRYPTO |
280 |
| - || (osMutexGetOwner(side_band_crypto_mutex) != NULL) |
281 |
| -#endif |
282 |
| - || (sli_si91x_host_queue_status(&cmd_queues[SI91X_COMMON_CMD].tx_queue) |
283 |
| - | sli_si91x_host_queue_status(&cmd_queues[SLI_SI91X_WLAN_CMD].tx_queue) |
284 |
| - | sli_si91x_host_queue_status(&cmd_queues[SLI_SI91X_NETWORK_CMD].tx_queue) |
285 |
| - | sli_si91x_host_queue_status(&cmd_queues[SLI_SI91X_SOCKET_CMD].tx_queue) |
286 |
| - | sli_si91x_host_queue_status(&cmd_queues[SLI_SI91X_BT_CMD].tx_queue))) { |
287 |
| - return; |
288 |
| - } |
289 |
| - // Disabling the interrupts & clearing m4_is_active as m4 is going to sleep |
290 |
| - __disable_irq(); |
291 |
| - |
292 |
| - // Indicate M4 is Inactive |
293 |
| - P2P_STATUS_REG &= ~M4_is_active; |
294 |
| - P2P_STATUS_REG; |
295 |
| - // Adding delay to sync m4 with NWP |
296 |
| - for (volatile uint8_t delay = 0; delay < 10; delay++) { |
297 |
| - __ASM("NOP"); |
298 |
| - } |
299 |
| - |
300 |
| - // Checking if already NWP have triggered the packet to M4 |
301 |
| - // RX_BUFFER_VALID will be cleared by NWP if any packet is triggered |
302 |
| - if ((P2P_STATUS_REG & TA_wakeup_M4) || (P2P_STATUS_REG & M4_wakeup_TA) |
303 |
| - || (!(M4SS_P2P_INTR_SET_REG & RX_BUFFER_VALID))) { |
304 |
| - P2P_STATUS_REG |= M4_is_active; |
305 |
| - __enable_irq(); |
306 |
| - return; |
307 |
| - } |
308 |
| - |
309 |
| - //Disbling systick & clearing interrupt as systick is non-maskable interrupt |
310 |
| - SysTick->CTRL = DISABLE; |
311 |
| - NVIC_ClearPendingIRQ(SysTick_IRQn); |
312 |
| - |
313 |
| - //!Clear RX_BUFFER_VALID |
314 |
| - M4SS_P2P_INTR_CLR_REG = RX_BUFFER_VALID; |
315 |
| - M4SS_P2P_INTR_CLR_REG; |
316 |
| -#endif // SL_SI91X_TICKLESS_MODE == 0 |
317 |
| - |
318 |
| -#ifndef ENABLE_DEBUG_MODULE |
319 |
| - RSI_PS_M4ssPeriPowerDown(M4SS_PWRGATE_ULP_M4_DEBUG_FPU); |
320 |
| -#endif // ENABLE_DEBUG_MODULE |
321 |
| - |
322 |
| - /* Define 'SLI_SI91X_MCU_ENABLE_FLASH_BASED_EXECUTION' macro if FLASH execution is needed*/ |
323 |
| -#ifndef SLI_SI91X_MCU_ENABLE_FLASH_BASED_EXECUTION |
324 |
| - RSI_PS_M4ssPeriPowerDown(M4SS_PWRGATE_ULP_QSPI_ICACHE); |
325 |
| - // Remove this if MCU is executing from Flash |
326 |
| -#endif //SLI_SI91X_MCU_ENABLE_FLASH_BASED_EXECUTION |
327 |
| - |
328 |
| - // Move M4 SOC clock to ULP reference clock before going to PowerSave |
329 |
| - if (RSI_CLK_M4SocClkConfig(M4CLK, M4_ULPREFCLK, 0) != RSI_OK) { |
330 |
| - printf("RSI_CLK_M4SocClkConfig failed\n"); |
331 |
| - } |
332 |
| - |
333 |
| - /* Check whether M4 is using XTAL */ |
334 |
| - if (sli_si91x_is_xtal_in_use_by_m4() == true) { |
335 |
| - /* If M4 is using XTAL then request NWP to turn OFF XTAL as M4 is going to sleep */ |
336 |
| - sli_si91x_raise_xtal_interrupt_to_ta(TURN_OFF_XTAL_REQUEST); |
337 |
| - } |
338 |
| - |
339 |
| - // Configure sleep parameters required by bootloader upon Wake-up |
340 |
| - RSI_PS_RetentionSleepConfig(stack_address, jump_cb_address, vector_offset, mode); |
341 |
| - |
342 |
| - // Trigger M4 to sleep |
343 |
| - RSI_PS_EnterDeepSleep(sleepType, lf_clk_mode); |
344 |
| - |
345 |
| - /* Check whether M4 is using XTAL */ |
346 |
| - if (sli_si91x_is_xtal_in_use_by_m4() == true) { |
347 |
| - /* If M4 is using XTAL then request NWP to turn ON XTAL as M4 is going to sleep */ |
348 |
| - sli_si91x_raise_xtal_interrupt_to_ta(TURN_ON_XTAL_REQUEST); |
349 |
| - } |
350 |
| - |
351 |
| -#if defined(SLI_SI917) || defined(SLI_SI915) |
352 |
| - // Upon wake up program wireless GPIO frontend switch controls |
353 |
| - if (frontend_switch_control != 0) { |
354 |
| - sli_si91x_configure_wireless_frontend_controls(frontend_switch_control); |
355 |
| - } |
356 |
| -#endif |
357 |
| - |
358 |
| -#if (SL_SI91X_TICKLESS_MODE == 0) |
359 |
| - //!Indicate M4 is active and rx buffer valid |
360 |
| - P2P_STATUS_REG |= M4_is_active; |
361 |
| - M4SS_P2P_INTR_SET_REG = RX_BUFFER_VALID; |
362 |
| - __enable_irq(); |
363 |
| - |
364 |
| - // Systick configuration upon Wake-up |
365 |
| - SysTick_Config(SystemCoreClock / configTICK_RATE_HZ); |
366 |
| -#endif // SL_SI91X_TICKLESS_MODE == 0 |
367 |
| -} |
368 |
| - |
369 | 217 | /**
|
370 | 218 | * @brief Configure the default hardware configuration required for 'WiSeMCU' mode.
|
371 | 219 | * @param[in] rams_in_use - RAMs to be powered functionally (the rest of the RAM banks will be power gates)
|
|
0 commit comments