Skip to content

Commit

Permalink
WiSeConnect 3 SDK release: v3.0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
wifi-ci-agent committed Aug 18, 2023
1 parent 7178f82 commit 0f0cdcd
Show file tree
Hide file tree
Showing 663 changed files with 4,984 additions and 9,433 deletions.
2 changes: 2 additions & 0 deletions components/console/variables/console_variables.c
Expand Up @@ -13,6 +13,7 @@

#define member_size(type, member) sizeof(((type *)0)->member)
#define MIN(a, b) ((a < b) ? a : b)
#define UNUSED_PARAMETER(x) (void)(x)

/******************************************************
* Constants
Expand Down Expand Up @@ -291,6 +292,7 @@ sl_status_t console_variable_set(console_args_t *arguments)

sl_status_t console_variable_list(console_args_t *arguments)
{
UNUSED_PARAMETER(arguments);
static const char spaces[] = " ";
#define MAX_LEVEL_DEPTH ((sizeof(spaces) - 1) / 2)

Expand Down
2 changes: 1 addition & 1 deletion components/service/network_manager/src/sl_net_for_lwip.c
Expand Up @@ -172,7 +172,7 @@ sl_status_t sl_net_wifi_client_down(sl_net_interface_t interface)
netif_set_down(&wifi_client_context->netif);
netif_remove(&wifi_client_context->netif);

return sl_wifi_disconnect((sl_wifi_interface_t)interface);
return sl_wifi_disconnect(SL_WIFI_CLIENT_INTERFACE);
}

sl_status_t sl_si91x_host_process_data_frame(sl_wifi_interface_t interface, sl_wifi_buffer_t *buffer)
Expand Down
46 changes: 2 additions & 44 deletions components/si91x/bsd_socket/sl_si91x_bsd_socket.c
Expand Up @@ -689,49 +689,7 @@ int getsockopt(int socket_id, int option_level, int option_name, void *option_va
int close(int socket_id)
{
errno = 0;

sl_status_t status = SL_STATUS_OK;
sl_si91x_socket_close_request_t socket_close_request = { 0 };
sl_si91x_socket_close_response_t *socket_close_response = NULL;
sl_si91x_wait_period_t wait_period = SL_SI91X_WAIT_FOR_RESPONSE(35000);
sl_wifi_buffer_t *buffer;

si91x_socket_t *si91x_socket = get_si91x_socket(socket_id);

SET_ERRNO_AND_RETURN_IF_TRUE(si91x_socket == NULL, EBADF);
if (si91x_socket->state == BOUND || si91x_socket->state == INITIALIZED
|| (si91x_socket->state == DISCONNECTED && is_tcp_auto_close_enabled())) {
reset_socket_state(socket_id);

return SI91X_NO_ERROR;
}

// Socket descriptor based close
socket_close_request.socket_id = si91x_socket->id;
// Setting request.port with zero to indicate firmware to close socket based on socket ID not using port.
socket_close_request.port_number = 0;

status = sl_si91x_socket_driver_send_command(RSI_WLAN_REQ_SOCKET_CLOSE,
&socket_close_request,
sizeof(socket_close_request),
SI91X_SOCKET_CMD_QUEUE,
SI91X_SOCKET_RESPONSE_QUEUE,
&buffer,
(void *)&socket_close_response,
NULL,
&wait_period);

SOCKET_VERIFY_STATUS_AND_RETURN(status, SL_STATUS_OK, SI91X_UNDEFINED_ERROR);

if (socket_close_request.socket_id != socket_close_response->socket_id) {
sl_si91x_host_free_buffer(buffer, SL_WIFI_RX_FRAME_BUFFER);
SET_ERROR_AND_RETURN(SI91X_UNDEFINED_ERROR);
}

sl_si91x_host_free_buffer(buffer, SL_WIFI_RX_FRAME_BUFFER);
reset_socket_state(socket_id);

return SI91X_NO_ERROR;
return sli_si91x_shutdown(socket_id, SHUTDOWN_BY_ID);
}

struct hostent *gethostbyname(const char *name)
Expand Down Expand Up @@ -880,7 +838,7 @@ int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struc
packet = sl_si91x_host_get_buffer_data(buffer, 0, NULL);
response = (sl_si91x_socket_select_rsp_t *)packet->data;

total_fd_set_count = handle_select_response(response, nfds, readfds, writefds, exceptfds);
total_fd_set_count = handle_select_response(response, readfds, writefds, exceptfds);

sl_si91x_host_free_buffer(buffer, SL_WIFI_RX_FRAME_BUFFER);
return total_fd_set_count;
Expand Down
18 changes: 18 additions & 0 deletions components/si91x/inc/sl_si91x_driver.h
Expand Up @@ -103,6 +103,24 @@ sl_status_t sl_si91x_driver_send_command(uint32_t command,
void *sdk_context,
sl_wifi_buffer_t **data_buffer);

/***************************************************************************/ /**
* @brief
* Send commands to the TA; whose response needs to be handled asynchronously.
* Note: This function doesn't acquire "command_in_flight" boolean
* @param[in] command
* Command type to be sent to TA firmware.
* @param[in] queue_type
* Queue type to be used to send the command on.
* @param[in] data
* Command packet to be sent to the TA firmware.
* @param[in] data_length
* Length of the command packet.
* sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
******************************************************************************/
sl_status_t sl_si91x_driver_send_asycn_command(uint32_t command,
sl_si91x_queue_type_t queue_type,
void *data,
uint32_t data_length);
/***************************************************************************/ /**
* @brief
* Wait for a command response.
Expand Down
4 changes: 4 additions & 0 deletions components/si91x/inc/sl_si91x_host_interface.h
Expand Up @@ -141,6 +141,10 @@ void sl_si91x_host_clear_sleep_indicator(void);
uint32_t sl_si91x_host_get_wake_indicator(void);
void sl_si91x_ulp_wakeup_init(void);

sl_status_t sl_si91x_semaphore_wait(sl_si91x_semaphore_handle_t *semaphore, uint32_t timeout_ms);
sl_status_t sl_si91x_semaphore_post(sl_si91x_semaphore_handle_t *semaphore);
sl_status_t sl_si91x_semaphore_create(sl_si91x_semaphore_handle_t *semaphore, uint32_t count);

// Unimplemented functions
bool sl_si91x_host_is_in_interrupt_context(void);
void sl_si91x_host_init_queue(sl_si91x_queue_type_t queue);
Expand Down
2 changes: 1 addition & 1 deletion components/si91x/inc/sl_si91x_protocol_types.h
Expand Up @@ -162,7 +162,7 @@

// To take listen interval from join command.
#define SI91X_JOIN_FEAT_BIT_MAP SI91X_JOIN_FEAT_LISTEN_INTERVAL_VALID
#define SI91X_LISTEN_INTERVAL 480
#define SI91X_LISTEN_INTERVAL 1000

//**************************** Macros for JOIN Method request END ***********************************/

Expand Down
6 changes: 4 additions & 2 deletions components/si91x/inc/sl_si91x_types.h
Expand Up @@ -47,8 +47,8 @@
/// Flag to indicate that all the packet tx has to be suspended until the corresponding command response is received
#define SI91X_PACKET_GLOBAL_QUEUE_BLOCK (1 << 3)

/// Flag to indicate that firmware has no response to this command
#define SI91X_PACKET_WITH_NO_RESPONSE (1 << 4)
/// Flag to indicate that host would receive the response from firmware in asynchronous manner.
#define SI91X_PACKET_WITH_ASYNC_RESPONSE (1 << 4)
/** @} */

/** \ingroup SL_SI91X_CONSTANTS
Expand Down Expand Up @@ -95,6 +95,8 @@ typedef enum {
SI91X_QUEUE_MAX ///< SI91X Maximum queue type
} sl_si91x_queue_type_t;

typedef uint32_t sl_si91x_semaphore_handle_t;

/// Si91x band mode
typedef enum {
SL_SI91X_WIFI_BAND_2_4GHZ = 0, ///< 2.4GHz WiFi band
Expand Down
52 changes: 52 additions & 0 deletions components/si91x/platforms/efx32/efx32_ncp_host.c
Expand Up @@ -12,6 +12,8 @@
#include "sl_constants.h"
#include <stdbool.h>
#include <string.h>
#include "FreeRTOS.h"
#include <semphr.h>

#define VERIFY_STATUS(s) \
do { \
Expand Down Expand Up @@ -258,6 +260,56 @@ sl_status_t sl_si91x_host_add_to_queue_with_atomic_action(sl_si91x_queue_type_t
return SL_STATUS_OK;
}

sl_status_t sl_si91x_semaphore_create(sl_si91x_semaphore_handle_t *semaphore, uint32_t count)
{
UNUSED_PARAMETER(count); //This statement is added only to resolve compilation warning, value is unchanged
SemaphoreHandle_t *p_semaphore = NULL;
p_semaphore = (SemaphoreHandle_t *)semaphore;

if (semaphore == NULL) {
return RSI_ERROR_IN_OS_OPERATION;
}
*p_semaphore = xSemaphoreCreateBinary();

if (*p_semaphore == NULL) {
return RSI_ERROR_IN_OS_OPERATION;
}
return RSI_ERROR_NONE;
}

sl_status_t sl_si91x_semaphore_wait(sl_si91x_semaphore_handle_t *semaphore, uint32_t timeout_ms)
{
SemaphoreHandle_t *p_semaphore = NULL;
p_semaphore = (SemaphoreHandle_t *)semaphore;

if (semaphore == NULL || *p_semaphore == NULL) //Note : FreeRTOS porting
{
return RSI_ERROR_INVALID_PARAM;
}
if (!timeout_ms) {
timeout_ms = 0xffffffff;
}
if (xSemaphoreTake(*p_semaphore, timeout_ms) == 0) {
return RSI_ERROR_NONE;
}
return RSI_ERROR_IN_OS_OPERATION;
}

sl_status_t sl_si91x_semaphore_post(sl_si91x_semaphore_handle_t *semaphore)
{
SemaphoreHandle_t *p_semaphore = NULL;
p_semaphore = (SemaphoreHandle_t *)semaphore;

if (semaphore == NULL || *p_semaphore == NULL) //Note : FreeRTOS porting
{
return RSI_ERROR_INVALID_PARAM;
}
if (xSemaphoreGive(*p_semaphore) == 0) {
return RSI_ERROR_NONE;
}
return RSI_ERROR_IN_OS_OPERATION;
}

/*Note: This function is only used to dequeue the responses from Async response queues*/
sl_status_t sl_si91x_host_remove_from_queue(sl_si91x_queue_type_t queue, sl_wifi_buffer_t **buffer)
{
Expand Down
1 change: 1 addition & 0 deletions components/si91x/sl_net/src/sl_net_si91x.c
Expand Up @@ -30,6 +30,7 @@
#include "sl_status.h"
#include "sl_wifi_types.h"
#include "sl_net.h"
#include "stddef.h"

sl_status_t sl_net_inet_addr(const char *addr, uint32_t *value)
{
Expand Down
2 changes: 1 addition & 1 deletion components/si91x/sl_net/src/sl_si91x_net_internal_stack.c
Expand Up @@ -146,7 +146,7 @@ sl_status_t sl_net_wifi_client_up(sl_net_interface_t interface, sl_net_profile_i
sl_status_t sl_net_wifi_client_down(sl_net_interface_t interface)
{
UNUSED_PARAMETER(interface);
return sl_wifi_disconnect(SL_WIFI_CLIENT_2_4GHZ_INTERFACE);
return sl_wifi_disconnect(SL_WIFI_CLIENT_INTERFACE);
}

// wifi_softap APIs
Expand Down
4 changes: 4 additions & 0 deletions components/si91x/socket/inc/sl_si91x_socket.h
Expand Up @@ -47,6 +47,10 @@ int sl_si91x_recvfrom(int socket,
struct sockaddr *fromAddr,
socklen_t *fromAddrLen);

/**
*
* @note: In case of socket being a server socket, the "how" parameter would be ignored and socket shall always be closed based on port number.
*/
int sl_si91x_shutdown(int socket, int how);

int sl_si91x_select(int nfds,
Expand Down

0 comments on commit 0f0cdcd

Please sign in to comment.