Skip to content

Commit

Permalink
[Silabs] Typing Event, state and wfx_rsi (project-chip#32546)
Browse files Browse the repository at this point in the history
* Added event enum for events and states, added a typedef for the wfi_rsi struct and changed name so the variable is not named like the type

* Converted new type to PascalCase
  • Loading branch information
lpbeliveau-silabs authored Mar 13, 2024
1 parent dd9e5c8 commit c9dc927
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 28 deletions.
2 changes: 1 addition & 1 deletion 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
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

0 comments on commit c9dc927

Please sign in to comment.