Skip to content

Commit

Permalink
Updates to example projects.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajisilabs committed Jul 7, 2023
1 parent f486d4b commit 0bf1b5b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 264 deletions.
3 changes: 3 additions & 0 deletions examples/featured/powersave_standby_associated/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ void M4_sleep_wakeup(void)
RSI_WAKEUP_WITH_RETENTION_WO_ULPSS_RAM);

#else
/* Configure RAM Usage and Retention Size */
sl_si91x_configure_ram_retention(WISEMCU_192KB_RAM_IN_USE, WISEMCU_RETAIN_DEFAULT_RAM_DURING_SLEEP);

/* Trigger M4 Sleep*/
sl_si91x_trigger_sleep(SLEEP_WITH_RETENTION,
DISABLE_LF_MODE,
Expand Down
8 changes: 0 additions & 8 deletions examples/snippets/ble/ble_multiconnection_gatt_test/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,6 @@ void rsi_common_app_task(void)
int8_t status = RSI_SUCCESS;
powersave_cmd_given = false;

#if 0
#ifdef RSI_M4_INTERFACE
RSI_WISEMCU_HardwareSetup();
LOG_PRINT("\r\n RSI_WISEMCU_HardwareSetup success \n");

#endif
#endif

status = sl_wifi_init(&config, default_wifi_event_handler);
if (status != SL_STATUS_OK) {
LOG_PRINT("\r\n Wi-Fi Initialization Failed, Error Code : 0x%X\r\n", status);
Expand Down
116 changes: 0 additions & 116 deletions examples/snippets/ble/ble_multiconnection_gatt_test/ble_subtasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,122 +158,6 @@ int32_t rsi_ble_get_event_based_on_conn(uint8_t conn_id)
return (-1);
}

#if 0
#ifdef RSI_M4_INTERFACE
/**
* @fn rsi_ble_only_Trigger_M4_Sleep
* @brief Keeps the M4 In the Sleep
* @param[in] none
* @return none.
* @section description
* This function is used to trigger sleep in the M4 and in the case of the retention submitting the buffer valid
* to the TA for the rx packets.
*/
void rsi_ble_only_Trigger_M4_Sleep(void)
{
/* Configure Wakeup-Source */
RSI_PS_SetWkpSources(WIRELESS_BASED_WAKEUP);

NVIC_EnableIRQ(WIRELESS_WAKEUP_IRQHandler);

#ifndef FLASH_BASED_EXECUTION_ENABLE
/* LDOSOC Default Mode needs to be disabled */
RSI_PS_LdoSocDefaultModeDisable();

/* bypass_ldorf_ctrl needs to be enabled */
RSI_PS_BypassLdoRfEnable();

RSI_PS_FlashLdoDisable();

/* Configure RAM Usage and Retention Size */
RSI_WISEMCU_ConfigRamRetention(WISEMCU_48KB_RAM_IN_USE, WISEMCU_RETAIN_DEFAULT_RAM_DURING_SLEEP);

/* Trigger M4 Sleep */
RSI_WISEMCU_TriggerSleep(SLEEP_WITH_RETENTION,
DISABLE_LF_MODE,
0,
(uint32_t)RSI_PS_RestoreCpuContext,
0,
RSI_WAKEUP_WITH_RETENTION_WO_ULPSS_RAM);

#else

#ifdef COMMON_FLASH_EN
M4SS_P2P_INTR_SET_REG &= ~BIT(3);
#endif
/* Configure RAM Usage and Retention Size */
// RSI_WISEMCU_ConfigRamRetention(WISEMCU_192KB_RAM_IN_USE, WISEMCU_RETAIN_DEFAULT_RAM_DURING_SLEEP);
RSI_PS_SetRamRetention(M4ULP_RAM16K_RETENTION_MODE_EN | ULPSS_RAM_RETENTION_MODE_EN | M4ULP_RAM_RETENTION_MODE_EN
| M4SS_RAM_RETENTION_MODE_EN);

RSI_WISEMCU_TriggerSleep(SLEEP_WITH_RETENTION,
DISABLE_LF_MODE,
WKP_RAM_USAGE_LOCATION,
(uint32_t)RSI_PS_RestoreCpuContext,
IVT_OFFSET_ADDR,
RSI_WAKEUP_FROM_FLASH_MODE);

#endif
#ifdef DEBUG_UART
fpuInit();
DEBUGINIT();
#endif
}
#endif

#ifdef RSI_M4_INTERFACE
void M4_sleep_wakeup()
{
/* Configure Wakeup-Source */
RSI_PS_SetWkpSources(WIRELESS_BASED_WAKEUP);

/* Enable NVIC */
NVIC_EnableIRQ(WIRELESS_WAKEUP_IRQHandler);

#ifndef FLASH_BASED_EXECUTION_ENABLE
/* LDOSOC Default Mode needs to be disabled */
RSI_PS_LdoSocDefaultModeDisable();

/* bypass_ldorf_ctrl needs to be enabled */
RSI_PS_BypassLdoRfEnable();

/* Disable FlashLDO */
RSI_PS_FlashLdoDisable();

/* Configure RAM Usage and Retention Size */
RSI_WISEMCU_ConfigRamRetention(WISEMCU_128KB_RAM_IN_USE, WISEMCU_RETAIN_DEFAULT_RAM_DURING_SLEEP);

/* Trigger M4 Sleep */
RSI_WISEMCU_TriggerSleep(SLEEP_WITH_RETENTION,
DISABLE_LF_MODE,
0,
(uint32_t)RSI_PS_RestoreCpuContext,
0,
RSI_WAKEUP_WITH_RETENTION_WO_ULPSS_RAM);
#else

/* Configure RAM Usage and Retention Size */
//RSI_WISEMCU_ConfigRamRetention(WISEMCU_192KB_RAM_IN_USE, WISEMCU_RETAIN_DEFAULT_RAM_DURING_SLEEP);

RSI_PS_SetRamRetention(M4ULP_RAM16K_RETENTION_MODE_EN | ULPSS_RAM_RETENTION_MODE_EN | M4ULP_RAM_RETENTION_MODE_EN
| M4SS_RAM_RETENTION_MODE_EN);
#ifdef COMMON_FLASH_EN
M4SS_P2P_INTR_SET_REG &= ~BIT(3);
#endif

/* Trigger M4 Sleep*/
RSI_WISEMCU_TriggerSleep(SLEEP_WITH_RETENTION,
DISABLE_LF_MODE,
WKP_RAM_USAGE_LOCATION,
(uint32_t)RSI_PS_RestoreCpuContext,
IVT_OFFSET_ADDR,
RSI_WAKEUP_FROM_FLASH_MODE);

#endif
}
#endif
#endif // #if 0

/*==============================================*/
/**
* @fn rsi_ble_task_on_conn
Expand Down
133 changes: 0 additions & 133 deletions examples/snippets/ble/ble_power_save/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,120 +209,6 @@ const osThreadAttr_t thread_attributes = {
// ! PROCEDURES
/*=======================================================================*/
/*==============================================*/
#if 0
#ifdef RSI_M4_INTERFACE
/**
* @fn rsi_ble_only_Trigger_M4_Sleep
* @brief Keeps the M4 In the Sleep
* @param[in] none
* @return none.
* @section description
* This function is used to trigger sleep in the M4 and in the case of the retention submitting the buffer valid
* to the TA for the rx packets.
*/
void rsi_ble_only_Trigger_M4_Sleep(void)
{
/* Configure Wakeup-Source */
RSI_PS_SetWkpSources(WIRELESS_BASED_WAKEUP);

NVIC_EnableIRQ(WIRELESS_WAKEUP_IRQHandler);

#ifndef FLASH_BASED_EXECUTION_ENABLE
/* LDOSOC Default Mode needs to be disabled */
sl_si91x_disable_default_ldo_mode();

/* bypass_ldorf_ctrl needs to be enabled */
sl_si91x_enable_bypass_ldo_rf();

sl_si91x_disable_flash_ldo();

/* Configure RAM Usage and Retention Size */
sl_si91x_configure_ram_retention(WISEMCU_48KB_RAM_IN_USE, WISEMCU_RETAIN_DEFAULT_RAM_DURING_SLEEP);

/* Trigger M4 Sleep */
sl_si91x_trigger_sleep(SLEEP_WITH_RETENTION,
DISABLE_LF_MODE,
0,
(uint32_t)RSI_PS_RestoreCpuContext,
0,
RSI_WAKEUP_WITH_RETENTION_WO_ULPSS_RAM);

#else

#ifdef COMMON_FLASH_EN
M4SS_P2P_INTR_SET_REG &= ~BIT(3);
#endif
/* Configure RAM Usage and Retention Size */
// sl_si91x_configure_ram_retention(WISEMCU_192KB_RAM_IN_USE, WISEMCU_RETAIN_DEFAULT_RAM_DURING_SLEEP);
RSI_PS_SetRamRetention(M4ULP_RAM16K_RETENTION_MODE_EN | ULPSS_RAM_RETENTION_MODE_EN | M4ULP_RAM_RETENTION_MODE_EN
| M4SS_RAM_RETENTION_MODE_EN);

sl_si91x_trigger_sleep(SLEEP_WITH_RETENTION,
DISABLE_LF_MODE,
WKP_RAM_USAGE_LOCATION,
(uint32_t)RSI_PS_RestoreCpuContext,
IVT_OFFSET_ADDR,
RSI_WAKEUP_FROM_FLASH_MODE);

#endif
#ifdef DEBUG_UART
fpuInit();
DEBUGINIT();
#endif
}
#endif
#ifdef RSI_M4_INTERFACE
void M4_sleep_wakeup()
{
/* Configure Wakeup-Source */
RSI_PS_SetWkpSources(WIRELESS_BASED_WAKEUP);

/* Enable NVIC */
NVIC_EnableIRQ(WIRELESS_WAKEUP_IRQHandler);

#ifndef FLASH_BASED_EXECUTION_ENABLE
/* LDOSOC Default Mode needs to be disabled */
sl_si91x_disable_default_ldo_mode();

/* bypass_ldorf_ctrl needs to be enabled */
sl_si91x_enable_bypass_ldo_rf();

/* Disable FlashLDO */
sl_si91x_disable_flash_ldo();

/* Configure RAM Usage and Retention Size */
sl_si91x_configure_ram_retention(WISEMCU_128KB_RAM_IN_USE, WISEMCU_RETAIN_DEFAULT_RAM_DURING_SLEEP);

/* Trigger M4 Sleep */
sl_si91x_trigger_sleep(SLEEP_WITH_RETENTION,
DISABLE_LF_MODE,
0,
(uint32_t)RSI_PS_RestoreCpuContext,
0,
RSI_WAKEUP_WITH_RETENTION_WO_ULPSS_RAM);
#else

/* Configure RAM Usage and Retention Size */
//sl_si91x_configure_ram_retention(WISEMCU_192KB_RAM_IN_USE, WISEMCU_RETAIN_DEFAULT_RAM_DURING_SLEEP);

RSI_PS_SetRamRetention(M4ULP_RAM16K_RETENTION_MODE_EN | ULPSS_RAM_RETENTION_MODE_EN | M4ULP_RAM_RETENTION_MODE_EN
| M4SS_RAM_RETENTION_MODE_EN);
#ifdef COMMON_FLASH_EN
M4SS_P2P_INTR_SET_REG &= ~BIT(3);
#endif

/* Trigger M4 Sleep*/
sl_si91x_trigger_sleep(SLEEP_WITH_RETENTION,
DISABLE_LF_MODE,
WKP_RAM_USAGE_LOCATION,
(uint32_t)RSI_PS_RestoreCpuContext,
IVT_OFFSET_ADDR,
RSI_WAKEUP_FROM_FLASH_MODE);

#endif
}
#endif
#endif

/**
* @fn rsi_ble_app_init_events
Expand Down Expand Up @@ -579,16 +465,6 @@ void ble_app_task(void *argument)
LOG_PRINT("\r\n Wi-Fi Initialization Success\n");
}

#if 0
#ifdef RSI_M4_INTERFACE

RSI_PS_FlashLdoEnable();
/* MCU Hardware Configuration for Low-Power Applications */
RSI_WISEMCU_HardwareSetup();

#endif
#endif

#ifdef FW_LOGGING_ENABLE
//! Set log levels for firmware components
sl_set_fw_component_log_levels(&fw_component_log_level);
Expand Down Expand Up @@ -712,15 +588,6 @@ void ble_app_task(void *argument)
if (ble_main_task_sem) {
osSemaphoreAcquire(ble_main_task_sem, 0);
}
#if 0
#ifdef RSI_M4_INTERFACE
//! if events are not received loop will be continued.
if ((!(P2P_STATUS_REG & TA_wakeup_M4)) && (!rsi_driver_cb->scheduler_cb.event_map)) {
P2P_STATUS_REG &= ~M4_wakeup_TA;
rsi_ble_only_Trigger_M4_Sleep();
}
#endif
#endif
continue;
}

Expand Down
9 changes: 4 additions & 5 deletions examples/snippets/wlan/http_otaf/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
#define HTTPV6 BIT(0)

//! Set HTTPS_SUPPORT to use HTTPS feature
#define HTTPS_SUPPORT BIT(1)
#define HTTPS_SUPPORT BIT(0)

//! Set HTTP_POST_DATA to use HTTP POST LARGE DATA feature
#define HTTP_POST_DATA BIT(5)
Expand All @@ -77,7 +77,6 @@
#define DNS_TIMEOUT 20000
#define MAX_DNS_RETRY_COUNT 5
#define OTAF_TIMEOUT 600000
char *hostname;
#ifdef AWS_ENABLE
//! for example select required flag bits, Eg:(HTTPS_SUPPORT | HTTPV6 | HTTP_USER_DEFINED_CONTENT_TYPE)
#define FLAGS HTTPS_SUPPORT
Expand Down Expand Up @@ -120,6 +119,7 @@ char *hostname = "rs9116updates.blob.core.windows.net";
#define HTTP_URL "SiWG917-A.2.9.0.0.2.rps"
//! set HTTP hostname
#define HTTP_HOSTNAME "192.168.0.158"
char *hostname = HTTP_HOSTNAME;
//! set HTTP extended header
//! if NULL , driver fills default extended header
#define HTTP_EXTENDED_HEADER NULL
Expand Down Expand Up @@ -153,7 +153,7 @@ static const sl_wifi_device_configuration_t station_init_configuration = {
.coex_mode = SL_SI91X_WLAN_ONLY_MODE,
.feature_bit_map = (SL_SI91X_FEAT_SECURITY_PSK | SL_SI91X_FEAT_AGGREGATION),
.tcp_ip_feature_bit_map = (SL_SI91X_TCP_IP_FEAT_DHCPV4_CLIENT | SL_SI91X_TCP_IP_FEAT_HTTP_CLIENT
| SL_SI91X_TCP_IP_FEAT_EXTENSION_VALID | SL_SI91X_TCP_IP_FEAT_OTAF
| SL_SI91X_TCP_IP_FEAT_EXTENSION_VALID | SL_SI91X_TCP_IP_FEAT_SSL
| SL_SI91X_TCP_IP_FEAT_DNS_CLIENT),
.custom_feature_bit_map = SL_SI91X_FEAT_CUSTOM_FEAT_EXTENTION_VALID,
.ext_custom_feature_bit_map =
Expand Down Expand Up @@ -311,7 +311,6 @@ sl_status_t http_otaf_app()

#else
strcpy(server_ip, HTTP_SERVER_IP_ADDRESS);
strcpy(hostname, HTTP_HOSTNAME);
printf("\r\nLocal Apache Server IP Address: %s\r\n", HTTP_HOSTNAME);
printf("\r\nFirmware download in progress from Local Apache Server.\r\n");
#endif
Expand Down Expand Up @@ -388,4 +387,4 @@ static sl_status_t http_fw_update_response_handler(sl_wifi_event_t event,
}
response = true;
return SL_STATUS_OK;
}
}
12 changes: 10 additions & 2 deletions examples/snippets/wlan_ble/wifi_station_ble_provisioning/ble_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ static uint16_t rsi_ble_att3_val_hndl;
uint8_t coex_ssid[50];
uint8_t pwd[RSI_BLE_MAX_DATA_LEN];
uint8_t sec_type;

sl_wifi_scan_result_t *scanresult = NULL;

extern uint8_t connected, disassosiated;
Expand Down Expand Up @@ -543,7 +542,7 @@ static void rsi_ble_on_gatt_write_event(uint16_t event_id, rsi_ble_event_write_t
} break;

// Sending SSID
case '2': //else if(rsi_ble_write->att_value[0] == '2') //The length of the ssid and pasword is not more than 17 character
case '2': //else if(rsi_ble_write->att_value[0] == '2')
{
memset(coex_ssid, 0, sizeof(coex_ssid));
strcpy((char *)coex_ssid, (const char *)&rsi_ble_write->att_value[3]);
Expand Down Expand Up @@ -615,6 +614,7 @@ static void rsi_ble_on_gatt_write_event(uint16_t event_id, rsi_ble_event_write_t
void rsi_ble_configurator_init(void)
{
uint8_t adv[31] = { 2, 1, 6 };
uint32_t status = 0;

// initializing the application events map
rsi_ble_app_init_events();
Expand Down Expand Up @@ -726,6 +726,14 @@ void rsi_ble_configurator_task(void *argument)

// clear the served event
rsi_ble_app_clear_event(RSI_BLE_ENH_CONN_EVENT);

//MTU exchange
status = rsi_ble_mtu_exchange_event(conn_event_to_app.dev_addr, BLE_MTU_SIZE);
if (status != RSI_SUCCESS) {
LOG_PRINT("\n rsi_ble_mtu_exchange_event command failed : %x", status);
} else {
LOG_PRINT("\n rsi_ble_mtu_exchange_event command success \n");
}
} break;

case RSI_BLE_DISCONN_EVENT: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
/* Number of BLE GATT RECORD SIZE IN (n*16 BYTES), eg:(0x40*16)=1024 bytes */
#define RSI_BLE_NUM_REC_BYTES 0x40

#define BLE_MTU_SIZE 232

/*=======================================================================*/
// Advertising command parameters
/*=======================================================================*/
Expand Down

0 comments on commit 0bf1b5b

Please sign in to comment.