Skip to content

Commit

Permalink
Merge branch 'master' into implement_android_checkin_delegate
Browse files Browse the repository at this point in the history
  • Loading branch information
joonhaengHeo authored Mar 14, 2024
2 parents 8a1eac3 + eecc2a6 commit a8451c8
Show file tree
Hide file tree
Showing 30 changed files with 1,655 additions and 604 deletions.
11 changes: 11 additions & 0 deletions config/openiotsdk/chip-gn/.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/pigweed.gni")

# The location of the build configuration file.
buildconfig = "//build/config/BUILDCONFIG.gn"
Expand All @@ -26,4 +27,14 @@ default_args = {
target_os = "cmsis-rtos"

import("${chip_root}/config/openiotsdk/chip-gn/args.gni")

pw_sys_io_BACKEND = dir_pw_sys_io_stdio

pw_assert_BACKEND = dir_pw_assert_log
pw_log_BACKEND = dir_pw_log_basic

pw_build_LINK_DEPS = [
"$dir_pw_assert:impl",
"$dir_pw_log:impl",
]
}
5 changes: 4 additions & 1 deletion config/openiotsdk/chip-gn/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ group("openiotsdk") {
deps = [ "${chip_root}/src/lib" ]

if (chip_build_tests) {
deps += [ "${chip_root}/src:tests" ]
deps += [
"${chip_root}/src:tests",
"${chip_root}/src/lib/support:pw_tests_wrapper",
]
}
}

Expand Down
1 change: 1 addition & 0 deletions examples/platform/silabs/MatterConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ CHIP_ERROR SilabsMatterConfig::InitWiFi(void)
sl_status_t status;
if ((status = wfx_wifi_rsi_init()) != SL_STATUS_OK)
{
SILABS_LOG("wfx_wifi_rsi_init failed with status: %x", status);
ReturnErrorOnFailure((CHIP_ERROR) status);
}
#endif // SLI_SI91X_MCU_INTERFACE
Expand Down
34 changes: 20 additions & 14 deletions examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ bool btn0_pressed = false;
#define TRNGKEY_SIZE 4
#endif // SLI_SI91X_MCU_INTERFACE

struct wfx_rsi wfx_rsi;
WfxRsi_t wfx_rsi;

/* Declare a variable to hold the data associated with the created event group. */
StaticEventGroup_t rsiDriverEventGroup;
Expand Down Expand Up @@ -98,6 +98,9 @@ static wfx_wifi_scan_ext_t temp_reset;

volatile sl_status_t callback_status = SL_STATUS_OK;

// Scan semaphore
static osSemaphoreId_t sScanSemaphore;

/******************************************************************
* @fn int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t *ap)
* @brief
Expand Down Expand Up @@ -305,8 +308,16 @@ int32_t wfx_wifi_rsi_init(void)
status = sl_wifi_init(&config, NULL, sl_wifi_default_event_handler);
if (status != SL_STATUS_OK)
{
SILABS_LOG("wfx_wifi_rsi_init failed %x", status);
return status;
}

// Create Sempaphore for scan
sScanSemaphore = osSemaphoreNew(1, 0, NULL);
if (sScanSemaphore == NULL)
{
return SL_STATUS_ALLOCATION_FAILED;
}

return status;
}

Expand Down Expand Up @@ -421,6 +432,8 @@ sl_status_t scan_callback_handler(sl_wifi_event_t event, sl_wifi_scan_result_t *
#else
wfx_rsi.sec.security = WFX_SEC_WPA2;
#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */

osSemaphoreRelease(sScanSemaphore);
return SL_STATUS_FAIL;
}
wfx_rsi.sec.security = WFX_SEC_UNSPECIFIED;
Expand Down Expand Up @@ -457,6 +470,8 @@ sl_status_t scan_callback_handler(sl_wifi_event_t event, sl_wifi_scan_result_t *
}
wfx_rsi.dev_state &= ~WFX_RSI_ST_SCANSTARTED;
scan_results_complete = true;

osSemaphoreRelease(sScanSemaphore);
return SL_STATUS_OK;
}
sl_status_t show_scan_results(sl_wifi_scan_result_t * scan_result)
Expand Down Expand Up @@ -501,6 +516,7 @@ sl_status_t bg_scan_callback_handler(sl_wifi_event_t event, sl_wifi_scan_result_
{
callback_status = show_scan_results(result);
bg_scan_results_complete = true;
osSemaphoreRelease(sScanSemaphore);
return SL_STATUS_OK;
}
/***************************************************************************************
Expand Down Expand Up @@ -529,12 +545,7 @@ static void wfx_rsi_save_ap_info() // translation
#endif
if (SL_STATUS_IN_PROGRESS == status)
{
const uint32_t start = osKernelGetTickCount();
while (!scan_results_complete && (osKernelGetTickCount() - start) <= WIFI_SCAN_TIMEOUT_TICK)
{
osThreadYield();
}
status = scan_results_complete ? callback_status : SL_STATUS_TIMEOUT;
osSemaphoreAcquire(sScanSemaphore, WIFI_SCAN_TIMEOUT_TICK);
}
}

Expand Down Expand Up @@ -817,12 +828,7 @@ void wfx_rsi_task(void * arg)
status = sl_wifi_start_scan(SL_WIFI_CLIENT_2_4GHZ_INTERFACE, NULL, &wifi_scan_configuration);
if (SL_STATUS_IN_PROGRESS == status)
{
const uint32_t start = osKernelGetTickCount();
while (!bg_scan_results_complete && (osKernelGetTickCount() - start) <= WIFI_SCAN_TIMEOUT_TICK)
{
osThreadYield();
}
status = bg_scan_results_complete ? callback_status : SL_STATUS_TIMEOUT;
osSemaphoreAcquire(sScanSemaphore, WIFI_SCAN_TIMEOUT_TICK);
}
}
}
Expand Down
53 changes: 30 additions & 23 deletions examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,37 @@
* Various events fielded by the wfx_rsi task
* Make sure that we only use 8 bits (otherwise freeRTOS - may need some changes)
*/
#define WFX_EVT_STA_CONN (0x01)
#define WFX_EVT_STA_DISCONN (0x02)
#define WFX_EVT_AP_START (0x04)
#define WFX_EVT_AP_STOP (0x08)
#define WFX_EVT_SCAN (0x10) /* This is used as scan result and start */
#define WFX_EVT_STA_START_JOIN (0x20)
#define WFX_EVT_STA_DO_DHCP (0x40)
#define WFX_EVT_STA_DHCP_DONE (0x80)
typedef enum
{
WFX_EVT_STA_CONN = (1 << 0),
WFX_EVT_STA_DISCONN = (1 << 1),
WFX_EVT_AP_START = (1 << 2),
WFX_EVT_AP_STOP = (1 << 3),
WFX_EVT_SCAN = (1 << 4), /* This is used as scan result and start */
WFX_EVT_STA_START_JOIN = (1 << 5),
WFX_EVT_STA_DO_DHCP = (1 << 6),
WFX_EVT_STA_DHCP_DONE = (1 << 7)
} WfxEventType_e;

#define WFX_RSI_ST_DEV_READY (0x01)
#define WFX_RSI_ST_AP_READY (0x02)
#define WFX_RSI_ST_STA_PROVISIONED (0x04)
#define WFX_RSI_ST_STA_CONNECTING (0x08)
#define WFX_RSI_ST_STA_CONNECTED (0x10)
#define WFX_RSI_ST_STA_DHCP_DONE (0x40) /* Requested to do DHCP after conn */
#define WFX_RSI_ST_STA_MODE (0x80) /* Enable Station Mode */
#define WFX_RSI_ST_AP_MODE (0x100) /* Enable AP Mode */
#define WFX_RSI_ST_STA_READY (WFX_RSI_ST_STA_CONNECTED | WFX_RSI_ST_STA_DHCP_DONE)
#define WFX_RSI_ST_STARTED (0x200) /* RSI task started */
#define WFX_RSI_ST_SCANSTARTED (0x400) /* Scan Started */
#define WFX_RSI_ST_SLEEP_READY (0x800) /* Notify the M4 to go to sleep*/
typedef enum
{
WFX_RSI_ST_DEV_READY = (1 << 0),
WFX_RSI_ST_AP_READY = (1 << 1),
WFX_RSI_ST_STA_PROVISIONED = (1 << 2),
WFX_RSI_ST_STA_CONNECTING = (1 << 3),
WFX_RSI_ST_STA_CONNECTED = (1 << 4),
WFX_RSI_ST_STA_DHCP_DONE = (1 << 6), /* Requested to do DHCP after conn */
WFX_RSI_ST_STA_MODE = (1 << 7), /* Enable Station Mode */
WFX_RSI_ST_AP_MODE = (1 << 8), /* Enable AP Mode */
WFX_RSI_ST_STA_READY = (WFX_RSI_ST_STA_CONNECTED | WFX_RSI_ST_STA_DHCP_DONE),
WFX_RSI_ST_STARTED = (1 << 9), /* RSI task started */
WFX_RSI_ST_SCANSTARTED = (1 << 10), /* Scan Started */
WFX_RSI_ST_SLEEP_READY = (1 << 11) /* Notify the M4 to go to sleep*/
} WfxStateType_e;

struct wfx_rsi
typedef struct wfx_rsi_s
{
// TODO: Change tp WfxEventType_e once the event queue is implemented
EventGroupHandle_t events;
TaskHandle_t drv_task;
TaskHandle_t wlan_task;
Expand All @@ -77,9 +84,9 @@ struct wfx_rsi
sl_wfx_mac_address_t ap_bssid; /* To which our STA is connected */
uint16_t join_retries;
uint8_t ip4_addr[4]; /* Not sure if this is enough */
};
} WfxRsi_t;

extern struct wfx_rsi wfx_rsi;
extern WfxRsi_t wfx_rsi;
#ifdef __cplusplus
extern "C" {
#endif
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/efr32/rs911x/rsi_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,4 +866,4 @@ int32_t wfx_rsi_send_data(void * p, uint16_t len)
return status;
}

struct wfx_rsi wfx_rsi;
WfxRsi_t wfx_rsi;
6 changes: 3 additions & 3 deletions examples/platform/silabs/efr32/rs911x/wfx_rsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#define WFX_RSI_ST_SCANSTARTED (0x400) /* Scan Started */
#define WFX_RSI_ST_SLEEP_READY (0x800) /* Notify the M4 to go to sleep*/

struct wfx_rsi
typedef struct wfx_rsi_s
{
EventGroupHandle_t events;
TaskHandle_t drv_task;
Expand All @@ -76,9 +76,9 @@ struct wfx_rsi
sl_wfx_mac_address_t ap_bssid; /* To which our STA is connected */
uint16_t join_retries;
uint8_t ip4_addr[4]; /* Not sure if this is enough */
};
} WfxRsi_t;

extern struct wfx_rsi wfx_rsi;
extern WfxRsi_t wfx_rsi;
#ifdef __cplusplus
extern "C" {
#endif
Expand Down
2 changes: 2 additions & 0 deletions scripts/examples/openiotsdk_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ readarray -t SUPPORTED_APP_NAMES <"$CHIP_ROOT"/examples/platform/openiotsdk/supp
SUPPORTED_APP_NAMES+=("unit-tests")

readarray -t TEST_NAMES <"$CHIP_ROOT"/src/test_driver/openiotsdk/unit-tests/test_components.txt
readarray -t TEST_NAMES_NL <"$CHIP_ROOT"/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt
TEST_NAMES+=("${TEST_NAMES_NL[@]}")

function show_usage() {
cat <<EOF
Expand Down
3 changes: 2 additions & 1 deletion src/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ if (chip_build_tests) {
# TODO [PW_MIGRATION] Remove this if after migartion to PW_TEST is completed for all platforms
# TODO [PW_MIGRATION] There will be a list of already migrated platforms
if (chip_device_platform == "esp32" ||
chip_device_platform == "nrfconnect") {
chip_device_platform == "nrfconnect" ||
chip_device_platform == "openiotsdk") {
deps += [ "${chip_root}/src/lib/support:pw_tests_wrapper" ]
}
build_monolithic_library = true
Expand Down
Loading

0 comments on commit a8451c8

Please sign in to comment.