Wi-Fi Transceiver#
Functions#
Start a Wi-Fi Transceiver interface.
Configure channel from the host.
This API shall be used to configure the CWmin, CWmax, and AIFSN per access category and retransmit count.
When new peer is added or deleted from the network, application shall call this API to update peer information to the MAC layer.
This API configures the multicast MAC address to filter Rx multicast packets.
This API shall flush the entire software buffer pool.
Host shall call this API to encapsulate the data with 802.11 MAC header and send it to MAC layer.
Function Documentation#
sl_wifi_transceiver_up#
sl_status_t sl_wifi_transceiver_up (sl_wifi_interface_t interface, sl_wifi_transceiver_configuration_t * config)
Start a Wi-Fi Transceiver interface.
[in] | interface | Wi-Fi interface as identified by sl_wifi_interface_t |
[in] | config | Wi-Fi Transceiver configuration. See sl_wifi_transceiver_configuration_t |
Pre-conditions:
sl_wifi_init shall be called before this API.
Returns
sl_status_t. See Status Codes. Possible Error Codes:
0x11
- SL_STATUS_NOT_INITIALIZED0x21
- SL_STATUS_SI91X_COMMAND_GIVEN_IN_INVALID_STATE0x22
- SL_STATUS_NULL_POINTER0x0B65
- SL_STATUS_TRANSCEIVER_INVALID_CHANNEL0x0B67
- SL_STATUS_TRANSCEIVER_INVALID_CONFIG
Note
This API is only supported in Wi-Fi Transceiver opermode (7).
sl_wifi_transceiver_up
internally calls sl_wifi_set_transceiver_parameters and sl_wifi_transceiver_set_channel. Additionally, DUT MAC address is queried using sl_wifi_get_mac_address and used as Addr2 for TX data packets.
1325
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_transceiver_set_channel#
sl_status_t sl_wifi_transceiver_set_channel (sl_wifi_interface_t interface, sl_wifi_transceiver_set_channel_t channel)
Configure channel from the host.
[in] | interface | Wi-Fi interface as identified by sl_wifi_interface_t | ||||||||||
[in] | channel | Application shall decide the channel at which device operates and transmits frames. See sl_wifi_transceiver_set_channel_t.
|
Pre-conditions:
sl_wifi_init shall be called before this API.
Returns
sl_status_t. See Status Codes. Possible Error Codes:
0x11
- SL_STATUS_NOT_INITIALIZED0x21
- SL_STATUS_SI91X_COMMAND_GIVEN_IN_INVALID_STATE0x0B65
- SL_STATUS_TRANSCEIVER_INVALID_CHANNEL
Note
This API is only supported in Wi-Fi Transceiver opermode (7).
This is a blocking API.
The effective transmit power is subject to regional and device limitations. If the specified transmit power exceeds the maximum supported value for that region, the transmission will occur at the maximum supported transmit power.
Sample command usage:
// Initialize channel
sl_wifi_transceiver_set_channel_t channel = {
.chan_info.channel = 14,
};
// Set channel
sl_wifi_transceiver_set_channel(SL_WIFI_TRANSCEIVER_INTERFACE, channel);
1366
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_set_transceiver_parameters#
sl_status_t sl_wifi_set_transceiver_parameters (sl_wifi_interface_t interface, sl_wifi_transceiver_parameters_t * params)
This API shall be used to configure the CWmin, CWmax, and AIFSN per access category and retransmit count.
[in] | interface | Wi-Fi interface as identified by sl_wifi_interface_t |
[in] | params | Transceiver parameters as identified by sl_wifi_transceiver_parameters_t. Shall be used to set/get the contention parameters per access category and the retransmit count in MAC layer. |
Pre-conditions:
sl_wifi_init shall be called before this API.
Returns
sl_status_t. See Status Codes. Possible Error Codes:
0x11
- SL_STATUS_NOT_INITIALIZED0x21
- SL_STATUS_SI91X_COMMAND_GIVEN_IN_INVALID_STATE0x22
- SL_STATUS_NULL_POINTER0x0B67
- SL_STATUS_TRANSCEIVER_INVALID_CONFIG
Note
This API is only supported in Wi-Fi Transceiver opermode (7).
Set is allowed only once before the first call to sl_wifi_transceiver_set_channel API.
This API is optional. Default configurations are used if API is not called.
This is a blocking API.
Sample command usage:
// Initialize parameters
sl_wifi_transceiver_parameters_t params = {
.set = 1,
.retransmit_count = 15,
.cw_params[0].aifsn = 3,
};
// Set parameters
sl_wifi_set_transceiver_parameters(SL_WIFI_TRANSCEIVER_INTERFACE, ¶ms);
1405
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_update_transceiver_peer_list#
sl_status_t sl_wifi_update_transceiver_peer_list (sl_wifi_interface_t interface, sl_wifi_transceiver_peer_update_t peer)
When new peer is added or deleted from the network, application shall call this API to update peer information to the MAC layer.
[in] | interface | Wi-Fi interface as identified by sl_wifi_interface_t |
[in] | peer | Peer to be added/deleted in MAC layer. See sl_wifi_transceiver_peer_update_t. |
Pre-conditions:
sl_wifi_transceiver_set_channel shall be called before this API.
Returns
sl_status_t. See Status Codes. Possible Error Codes:
0x11
- SL_STATUS_NOT_INITIALIZED0x0B44
- SL_STATUS_WIFI_INTERFACE_NOT_UP0x0B63
- SL_STATUS_TRANSCEIVER_INVALID_MAC_ADDRESS0x0B66
- SL_STATUS_TRANSCEIVER_INVALID_DATA_RATE0x10096
- SL_STATUS_SI91X_TRANSCEIVER_PEER_DS_FEAT_DISABLED0x10097
- SL_STATUS_SI91X_TRANSCEIVER_PEER_ALREADY_EXISTS0x10098
- SL_STATUS_SI91X_TRANSCEIVER_MAX_PEER_LIMIT_REACHED0x10099
- SL_STATUS_SI91X_TRANSCEIVER_PEER_NOT_FOUND
Note
This API is only supported in Wi-Fi Transceiver opermode (7).
This is a blocking API.
MAC layer supports storing up to 100 peers.
To add peers in MAC layer, it is mandatory to enable SL_SI91X_FEAT_TRANSCEIVER_MAC_PEER_DS_SUPPORT/BIT(13) in sl_wifi_device_configuration_t feature_bit_map passed in sl_wifi_init.
Sample command usage:
// Initialize peer
sl_wifi_transceiver_peer_update_t peer;
uint8_t peer_mac[6] = {0x00, 0x23, 0xa7, 0x20, 0x21, 0x24};
memcpy(peer.peer_mac_address, peer_mac, 6);
peer.peer_supported_rate_bitmap = PEER_DS_BITMAP_DATA_RATE_48 | PEER_DS_BITMAP_DATA_RATE_54;
peer.flags |= BIT(0)); // Set bit 0 to add peer
// Add peer
sl_wifi_update_transceiver_peer_list(SL_WIFI_TRANSCEIVER_INTERFACE, peer);
1447
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_set_transceiver_multicast_filter#
sl_status_t sl_wifi_set_transceiver_multicast_filter (sl_wifi_interface_t interface, sl_wifi_transceiver_mcast_filter_t mcast)
This API configures the multicast MAC address to filter Rx multicast packets.
[in] | interface | Wi-Fi interface as identified by sl_wifi_interface_t |
[in] | mcast | Multicast MAC address to be added/deleted from MAC layer for filtering. See sl_wifi_transceiver_mcast_filter_t. |
Pre-conditions:
sl_wifi_transceiver_set_channel shall be called before this API.
Returns
sl_status_t. See Status Codes. Possible Error Codes:
0x11
- SL_STATUS_NOT_INITIALIZED0x21
- SL_STATUS_INVALID_PARAMETER0x0B44
- SL_STATUS_WIFI_INTERFACE_NOT_UP0x0B63
- SL_STATUS_TRANSCEIVER_INVALID_MAC_ADDRESS
Note
This API is only supported in Wi-Fi Transceiver opermode (7).
This API can be called dynamically.
Maximum of two multicast MAC addresses can be configured for filtering.
Sample command usage:
// Initialize multicast filter address structure
sl_wifi_transceiver_mcast_filter_t mcast;
uint8_t filter_mac[6] = { 0x01, 0x00, 0x5e, 0x00, 0x01, 0x01 };
mcast.flags |= BIT(0);
mcast.num_of_mcast_addr = 1;
memcpy(mcast.mac[0], filter_mac, 6);
// Add MAC address to be filtered
sl_wifi_set_transceiver_multicast_filter(SL_WIFI_TRANSCEIVER_INTERFACE, mcast);
1484
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_flush_transceiver_data#
sl_status_t sl_wifi_flush_transceiver_data (sl_wifi_interface_t interface)
This API shall flush the entire software buffer pool.
[in] | interface | Wi-Fi interface as identified by sl_wifi_interface_t |
Pre-conditions:
sl_wifi_transceiver_set_channel shall be called before this API.
Returns
sl_status_t. See Status Codes. Possible Error Codes:
0x11
- SL_STATUS_NOT_INITIALIZED0x0B44
- SL_STATUS_WIFI_INTERFACE_NOT_UP
Note
This API is only supported in Wi-Fi Transceiver opermode (7).
All priority queues shall be flushed.
Sample command usage:
sl_wifi_flush_transceiver_data(SL_WIFI_TRANSCEIVER_INTERFACE);
1509
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_send_transceiver_data#
sl_status_t sl_wifi_send_transceiver_data (sl_wifi_interface_t interface, sl_wifi_transceiver_tx_data_control_t * control, uint8_t * payload, uint16_t payload_len)
Host shall call this API to encapsulate the data with 802.11 MAC header and send it to MAC layer.
[in] | interface | Wi-Fi interface as identified by sl_wifi_interface_t |
[in] | control | API uses metadata for preparing data packet along with MAC header for sending to MAC layer. See sl_wifi_transceiver_tx_data_control_t. |
[in] | payload | Pointer to payload (encrypted by host) to be sent to LMAC. |
[in] | payload_len | Length of the payload. Valid range is 1 - 2020 bytes. |
Pre-conditions:
sl_wifi_transceiver_set_channel shall be called before this API.
Returns
sl_status_t. See Status Codes. Possible Error Codes:
0x11
- SL_STATUS_NOT_INITIALIZED0x0B44
- SL_STATUS_WIFI_INTERFACE_NOT_UP0x0B63
- SL_STATUS_TRANSCEIVER_INVALID_MAC_ADDRESS0x0B64
- SL_STATUS_TRANSCEIVER_INVALID_QOS_PRIORITY0x0B66
- SL_STATUS_TRANSCEIVER_INVALID_DATA_RATE0x21
- SL_STATUS_INVALID_PARAMETER0x22
- SL_STATUS_NULL_POINTER
Format of encapsulated data sent to MAC#
Field name | Frame Control | Duration | Addr1 | Addr2 | Adddr3 | Seq Ctrl | Addr4 | QoS ctrl | Payload (LLC + Data) |
---|---|---|---|---|---|---|---|---|---|
Size(bytes) | 2 | 2 | 6 | 6 | 6 | 2 | 6 (Optionally present) | 2 (Optionally present) | Variable |
Note
This API is only supported in Wi-Fi Transceiver opermode (7).
Once sl_wifi_send_transceiver_data() returns, the calling API is responsible for freeing control and payload. The calling API refers to the function that invoked sl_wifi_send_transceiver_data().
On chip MAC level encryption is not supported in transceiver mode.
This is not a blocking API. Callback SL_WIFI_TRANSCEIVER_TX_DATA_STATUS_CB can be registered to get the status report from firmware.
Only 11b/g rates shall be supported.
It is recommended to use basic rate for multicast/broadcast packets.
Sample command usage:
// Prepare payload <Prepare data payload in "payload" buffer> <Initialize data control block @ref sl_wifi_transceiver_tx_data_control_t > control->ctrl_flags = BIT(0) | BIT(1) | BIT(2) | BIT(5); // Enable 4-addr MAC hdr, QoS frame, Fixed data rate, send status report for data packet control->priority = 2; // Voice priority queue control->rate = SL_WIFI_DATA_RATE_36; control->token = token; <Fill control addr1, addr2, addr3 and addr4(optionally) with 6 byte RA, NWP, DA and SA MAC addresses respectively> // Call API to encapsulate the data with 802.11 MAC header and send it to MAC layer. sl_wifi_send_transceiver_data(SL_WIFI_TRANSCEIVER_INTERFACE, control, payload, payload_len);
1563
of file components/protocol/wifi/inc/sl_wifi.h