1 /***************************************************************************/ /** 2 * @file 3 * @brief 4 ******************************************************************************* 5 * # License 6 * <b>Copyright 2019 Silicon Laboratories Inc. www.silabs.com</b> 7 ******************************************************************************* 8 * 9 * SPDX-License-Identifier: Zlib 10 * 11 * The licensor of this software is Silicon Laboratories Inc. 12 * 13 * This software is provided 'as-is', without any express or implied 14 * warranty. In no event will the authors be held liable for any damages 15 * arising from the use of this software. 16 * 17 * Permission is granted to anyone to use this software for any purpose, 18 * including commercial applications, and to alter it and redistribute it 19 * freely, subject to the following restrictions: 20 * 21 * 1. The origin of this software must not be misrepresented; you must not 22 * claim that you wrote the original software. If you use this software 23 * in a product, an acknowledgment in the product documentation would be 24 * appreciated but is not required. 25 * 2. Altered source versions must be plainly marked as such, and must not be 26 * misrepresented as being the original software. 27 * 3. This notice may not be removed or altered from any source distribution. 28 * 29 ******************************************************************************/ 30 #pragma once 31 32 #include <stdint.h> 33 #include "sl_ieee802_types.h" 34 #include "sl_ip_types.h" 35 #include "sl_wifi_constants.h" 36 #include "sl_si91x_constants.h" 37 #include "sl_common.h" 38 39 //! @cond Doxygen_Suppress 40 // below defines and structure for CFG_GET: Getting user store configuration. 41 #define IP_ADDRESS_SZ 4 42 #define RSI_SSID_LEN 34 43 #define WISE_PMK_LEN 32 44 #define MAX_HTTP_SERVER_USERNAME 31 45 #define MAX_HTTP_SERVER_PASSWORD 31 46 #define RSI_PSK_LEN 64 47 #define RSI_MAC_ADDR_LEN 6 48 49 // A macro to define the size of array in sl_si91x_socket_info_response_t to hold socket data. 50 #define SL_SI91X_SOCKET_INFO_RESPONSE_SOCKETS_COUNT 10 51 52 // Maximum Access points that can be scanned 53 #define RSI_AP_SCANNED_MAX 11 54 55 // Maximum number of stations associated when running as an AP 56 #define SI91X_MAX_STATIONS 16 57 58 // Quick reference: Bit 3 -> DHCPv6 client, Bit 5 -> DHCPv6 server, Bit 17 -> TCP_IP_FEAT_IPV6 59 // Details: https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/opermode#rsi-tcp-ip-feature-bit-map 60 #define SI91X_IPV6_MODE (1 << 3) | (1 << 5) | (1 << 17) 61 #define RSI_IP_ADDRESS_LEN 4 62 // Maximum payload size 63 #define RSI_MAX_PAYLOAD_SIZE 1500 64 65 #define SL_MAX_FWUP_CHUNK_SIZE 1024 66 #define SL_RPS_HEADER_SIZE 64 67 68 // Firmware upgrade packet types 69 #define SL_FWUP_ABORT 2 70 #define SL_FWUP_RPS_HEADER 1 71 #define SL_FWUP_RPS_CONTENT 0 72 73 // Websocket max url length 74 #define RSI_WEBS_MAX_URL_LENGTH 51 75 76 // Websocket max host length 77 #define RSI_WEBS_MAX_HOST_LENGTH 51 78 79 #if defined(SLI_SI917) || defined(SLI_SI915) 80 #define SI91X_MAX_SIZE_OF_EXTENSION_DATA 256 81 #else 82 #define SI91X_MAX_SIZE_OF_EXTENSION_DATA 64 83 #endif 84 85 #define SI91X_DNS_REQUEST_MAX_URL_LEN 90 86 87 #define SI91X_DNS_RESPONSE_MAX_ENTRIES 10 88 89 #define SI91X_MAX_CERT_SEND_SIZE 1400 90 91 /** NOTE: For power save related info 92 * https://confluence.silabs.com/pages/viewpage.action?spaceKey=RPD&title=Master+++Power+Save+modes 93 * https://confluence.silabs.com/display/RPD/Master+WLAN+APIs#MasterWLANAPIs-rsi_wlan_power_save_profile 94 * https://docs.silabs.com/rs9116/wiseconnect/rs9116w-wifi-at-command-prm/latest/wlan-commands#rsi-pwmode----power-mode 95 * NOTE: Wake up procedure provided in Confluence is outdated, Please refer AT PRM for it. 96 * ****************************** POWER RELATED DEFINES START *******************************/ 97 #define SL_POWER_MODE_DISABLE 0 98 #define SL_CONNECTED_SLEEP_PS 1 99 #define SL_CONNECTED_GPIO_BASED_PS 2 100 #define SL_CONNECTED_MSG_BASED_PS 3 101 102 #ifdef SLI_SI91X_MCU_INTERFACE 103 #define SL_CONNECTED_M4_BASED_PS 4 104 #endif 105 106 #define SL_GPIO_BASED_DEEP_SLEEP 8 107 #define SL_MSG_BASED_DEEP_SLEEP 9 108 109 #ifdef SLI_SI91X_MCU_INTERFACE 110 #define SL_M4_BASED_DEEP_SLEEP 10 111 #endif 112 113 #define DEFAULT_MONITOR_INTERVAL 50 114 #define DEFAULT_DTIM_SKIP 0 115 #define DEFAULT_DTIM_ALIGNMENT 0 116 117 #define SL_LP_MODE 0 118 #define SL_ULP_WITH_RAM_RETENTION 1 119 #define SL_ULP_WITHOUT_RAM_RET_RETENTION 2 120 121 #define SL_MAX_PSP 0 122 #define SL_FAST_PSP 1 123 124 /****************************** POWER RELATED DEFINES END ***********************************/ 125 126 // **************************** Macros for BG scan **************************************/ 127 #define SI91X_BG_SCAN_DISABLE 0 128 #define SI91X_BG_SCAN_ENABLE 1 129 130 //**************************** Macros for BG end *********************************/ 131 #define NUMBER_OF_SOCKETS 20 132 133 //**************************** Macros for WPS Method request START *********************************/ 134 135 #define SI91X_SET_WPS_METHOD_PUSH_BUTTON 0 136 #define SI91X_SET_WPS_METHOD_PIN 1 137 #define Si91X_SET_WPS_VALIDATE_PIN 0 138 #define SI91X_SET_WPS_GENERATE_PIN 1 139 #define SI91X_WPS_PIN_LEN 8 140 141 //**************************** Macros for WPS Method request END ***********************************/ 142 //! @endcond 143 144 /** \addtogroup SI91X_JOIN_FEATURE_BIT_MAP 145 * @{ */ 146 /*=========================================================================*/ 147 // Join feature bit map parameters description !// 148 /*=========================================================================*/ 149 /// To enable b/g only mode in station mode 150 #define SL_SI91X_JOIN_FEAT_STA_BG_ONLY_MODE_ENABLE (1 << 0) 151 152 /// To take listen interval from join command. 153 #define SL_SI91X_JOIN_FEAT_LISTEN_INTERVAL_VALID (1 << 1) 154 155 /// To enable quick join feature 156 #define SL_SI91X_JOIN_FEAT_QUICK_JOIN (1 << 2) 157 158 /// To enable CCXV2 feature 159 #define SL_SI91X_JOIN_FEAT_CCXV2_FEATURE (1 << 3) 160 161 /// To connect to AP based on BSSID together with configured SSID 162 #define SL_SI91X_JOIN_FEAT_BSSID_BASED (1 << 4) 163 164 /// MFP Capable only 165 #define SL_SI91X_JOIN_FEAT_MFP_CAPABLE_ONLY (1 << 5) 166 167 /// MFP Capable required 168 #define SL_SI91X_JOIN_FEAT_MFP_CAPABLE_REQUIRED ((1 << 5) | (1 << 6)) 169 170 /// Listen interval from power save command 171 #define SL_SI91X_JOIN_FEAT_PS_CMD_LISTEN_INTERVAL_VALID (1 << 7) 172 /** @} */ 173 174 //! @cond Doxygen_Suppress 175 //**************************** Macros for FEATURE frame Method request START *********************************/ 176 #define SI91X_FEAT_FRAME_PREAMBLE_DUTY_CYCLE (1 << 0) 177 #define SI91X_FEAT_FRAME_PERMIT_UNDESTINED_PACKETS (1 << 1) 178 #define SI91X_FEAT_FRAME_LP_CHAIN (1 << 4) 179 #define SI91X_FEAT_FRAME_IN_PACKET_DUTY_CYCLE (1 << 5) 180 181 #define PLL_MODE 0 182 #define RF_TYPE 1 // 0 - External RF 1- Internal RF 183 #define WIRELESS_MODE 0 184 #define ENABLE_PPP 0 185 #define AFE_TYPE 1 186 #ifndef FEATURE_ENABLES 187 #define FEATURE_ENABLES \ 188 (SI91X_FEAT_FRAME_PREAMBLE_DUTY_CYCLE | SI91X_FEAT_FRAME_LP_CHAIN | SI91X_FEAT_FRAME_IN_PACKET_DUTY_CYCLE) 189 #endif 190 191 //**************************** Macros for FEATURE frame Method request END *********************************/ 192 193 //**************************** Macros for HTTP Client START *********************************/ 194 195 #define SI91X_HTTP_BUFFER_LEN 2400 196 #define SI91X_MAX_HTTP_URL_SIZE 2048 197 #define SI91X_MAX_HTTP_CHUNK_SIZE 900 198 #define HTTP_GET_FIRST_PKT BIT(0) 199 #define HTTP_GET_MIDDLE_PKT BIT(1) 200 #define HTTP_GET_LAST_PKT BIT(2) 201 202 #define SI91X_HTTP_CLIENT_MAX_WRITE_BUFFER_LENGTH 900 203 #define SI91X_HTTP_CLIENT_PUT_MAX_BUFFER_LENGTH 900 204 #define SI91X_HTTP_CLIENT_POST_MAX_BUFFER_LENGTH 900 205 206 // HTTP client PUT create command 207 #define SI91X_HTTP_CLIENT_PUT_CREATE 1 208 209 // HTTP client PUT START command 210 #define SI91X_HTTP_CLIENT_PUT_START 2 211 212 // HTTP client PUT PKT command 213 #define SI91X_HTTP_CLIENT_PUT_PKT 3 214 215 // HTTP client PUT DELETE command 216 #define SI91X_HTTP_CLIENT_PUT_DELETE 4 217 218 // HTTP client PUT PKT OFFSET command 219 #define SI91X_HTTP_CLIENT_PUT_OFFSET_PKT 5 220 221 //***************************** Macros for HTTP Client End **********************************/ 222 223 #define SI91X_COUNTRY_CODE_LENGTH 3 224 #define SI91X_MAX_POSSIBLE_CHANNEL 24 225 226 #define ATTESTATION 30 227 228 #define NONCE_DATA_SIZE 32 229 230 typedef enum { RSI_NONE, RSI_TKIP, RSI_CCMP } sl_si91x_encryption_mode_t; 231 //! @endcond 232 233 /// Set region command request structure 234 typedef struct { 235 /// Enable or disable set region from user: 1-take from user configuration,0-Take from Beacons 236 uint8_t set_region_code_from_user_cmd; 237 238 /// region code(1-US,2-EU,3-JP,4-World Domain,5-KR) 239 uint8_t region_code; 240 241 /// module type (0- Without on board antenna, 1- With on board antenna) 242 uint16_t module_type; 243 } sl_si91x_set_region_request_t; 244 245 /// Set region in AP mode command request structure 246 typedef struct { 247 /// Enable or disable set region from user: 1-take from user configuration, 0-Take US or EU or JP 248 uint8_t set_region_code_from_user_cmd; 249 250 /// region code(1-US,2-EU,3-JP) 251 uint8_t country_code[SI91X_COUNTRY_CODE_LENGTH]; 252 253 /// No of rules 254 uint32_t no_of_rules; 255 256 /// Channel information 257 struct { 258 uint8_t first_channel; ///< First channel 259 uint8_t no_of_channels; ///< Number of channels 260 uint8_t max_tx_power; ///< Max Tx power 261 } channel_info[SI91X_MAX_POSSIBLE_CHANNEL]; 262 } sl_si91x_set_region_ap_request_t; 263 264 /// Scan command request structure 265 typedef struct { 266 uint8_t channel[4]; ///< RF channel to scan, 0=All, 1-14 for 2.4 GHz channels 1-14 267 uint8_t ssid[RSI_SSID_LEN]; ///< SSID to scan, 0=All 268 uint8_t pscan_bitmap[4]; ///< Pscan bitmap 269 uint8_t _reserved; ///< Reserved 270 uint8_t scan_feature_bitmap; ///< Scan feature bitmap 271 uint8_t channel_bit_map_2_4[2]; ///< Channel bit map for 2.4GHz 272 uint8_t channel_bit_map_5[4]; ///< Channel bit map for 5GHz 273 } sl_si91x_req_scan_t; 274 275 /// bg scan command request structure 276 typedef struct { 277 /// enable or disable BG scan 278 uint16_t bgscan_enable; 279 280 /// Is it instant bgscan or normal bgscan 281 uint16_t enable_instant_bgscan; 282 283 /// bg scan threshold value 284 uint16_t bgscan_threshold; 285 286 /// tolerance threshold 287 uint16_t rssi_tolerance_threshold; 288 289 /// periodicity 290 uint16_t bgscan_periodicity; 291 292 /// active scan duration 293 uint16_t active_scan_duration; 294 295 /// passive scan duration 296 uint16_t passive_scan_duration; 297 298 /// multi probe 299 uint8_t multi_probe; 300 } sl_si91x_req_bg_scan_t; 301 302 /// Scan information response structure 303 typedef struct { 304 uint8_t rf_channel; ///< channel number of the scanned AP 305 uint8_t security_mode; ///< security mode of the scanned AP 306 uint8_t rssi_val; ///< rssi value of the scanned AP 307 uint8_t network_type; ///< network type of the scanned AP 308 uint8_t ssid[RSI_SSID_LEN]; ///< SSID of the scanned AP 309 uint8_t bssid[RSI_MAC_ADDR_LEN]; ///< BSSID of the scanned AP 310 uint8_t reserved[2]; ///< Reserved 311 } sl_si91x_scan_info_t; 312 313 /// Scan command response structure 314 typedef struct { 315 uint8_t scan_count[4]; ///< number of access points scanned 316 uint8_t reserved[4]; ///< Reserved 317 sl_si91x_scan_info_t scan_info[RSI_AP_SCANNED_MAX]; ///< scanned access points information 318 } sl_si91x_rsp_scan_t; 319 320 /// Antenna select command request structure 321 typedef struct { 322 uint8_t antenna_value; ///< Antenna value to set 323 324 uint8_t gain_2g; ///< Antenna 2G gain value 325 326 uint8_t gain_5g; ///< Antenna 5G gain value 327 328 } sl_si91x_antenna_select_t; 329 330 /// PSK command request structure 331 typedef struct { 332 uint8_t type; ///< psk type , 1-psk alone, 2-pmk, 3-generate pmk from psk 333 uint8_t psk_or_pmk[RSI_PSK_LEN]; ///< psk or pmk 334 uint8_t ap_ssid[RSI_SSID_LEN]; ///< access point ssid: used for generation pmk 335 } sl_si91x_req_psk_t; 336 337 /// Enterprise configuration command request structure 338 typedef struct { 339 uint8_t eap_method[32]; ///< EAP method 340 341 uint8_t inner_method[32]; ///< Inner method 342 343 uint8_t user_identity[64]; ///< Username 344 345 uint8_t password[128]; ///< Password 346 347 int8_t okc_enable[4]; ///< Opportunistic key caching enable 348 349 uint8_t private_key_password[82]; ///< Private key password for encrypted private keys 350 351 } sl_si91x_req_eap_config_t; 352 353 /// Set certificate information structure 354 typedef struct { 355 uint16_t total_len; ///< total length of the certificate 356 uint8_t certificate_type; ///< type of certificate 357 uint8_t more_chunks; ///< more chunks flag 358 uint16_t certificate_length; ///< length of the current segment 359 uint8_t certificate_inx; ///< index of certificate 360 uint8_t key_password[127]; ///< reserved 361 } sl_si91x_cert_info_t; 362 363 /// Si91x specific certificate validation 364 typedef struct { 365 uint16_t socket_id; ///< Socket ID 366 volatile uint16_t status; ///< certificate valid status 367 } sl_si91x_req_cert_valid_t; 368 369 /// Set certificate command request structure 370 typedef struct { 371 sl_si91x_cert_info_t cert_info; ///< certificate information structure 372 uint8_t certificate[SI91X_MAX_CERT_SEND_SIZE]; ///< certificate 373 } sl_si91x_req_set_certificate_t; 374 375 /// join command request structure 376 #pragma pack(1) 377 typedef struct { 378 /// reserved bytes:Can be used for security Type 379 uint8_t reserved1; 380 381 /// 0- Open, 1-WPA, 2-WPA2,6-MIXED_MODE, 7-WPA3, 8-WP3_Transition 382 uint8_t security_type; 383 384 /// data rate, 0=auto, 1=1 Mbps, 2=2 Mbps, 3=5.5Mbps, 4=11 Mbps, 12=54 Mbps 385 uint8_t data_rate; 386 387 /// transmit power level, 0=low (6-9 dBm), 1=medium (10-14 dBm, 2=high (15-17 dBm) 388 uint8_t power_level; 389 390 /// pre-shared key, 63-byte string , last character is NULL 391 uint8_t psk[RSI_PSK_LEN]; 392 393 /// ssid of access point to join to, 34-byte string 394 uint8_t ssid[RSI_SSID_LEN]; 395 396 /// feature bitmap for join 397 uint8_t join_feature_bitmap; 398 399 /// reserved bytes 400 uint8_t reserved2[2]; 401 402 /// length of ssid given 403 uint8_t ssid_len; 404 405 /// listen interval 406 uint32_t listen_interval; 407 408 /// vap id, 0 - station mode, 1 - AP mode 409 uint8_t vap_id; 410 411 /// join bssid for mac based join 412 uint8_t join_bssid[6]; 413 } sl_si91x_join_request_t; 414 #pragma pack() 415 416 /// IPV4 ipconfig command request structure 417 typedef struct { 418 /// 0=Manual, 1=Use DHCP 419 uint8_t dhcp_mode; 420 421 /// IP address of this module if in manual mode 422 uint8_t ipaddress[4]; 423 424 /// Netmask used if in manual mode 425 uint8_t netmask[4]; 426 427 /// IP address of default gateway if in manual mode 428 uint8_t gateway[4]; 429 430 /// DHCP client host name 431 uint8_t hostname[31]; 432 433 /// vap id, 0 - station and 1 - AP 434 uint8_t vap_id; 435 436 /// FQDN flag 437 uint8_t fqdn_flag[4]; 438 439 /// minimum interval for DHCP discover retries 440 uint16_t dhcp_discover_rtr_interval_min; 441 442 /// minimum interval for DHCP request retries 443 uint16_t dhcp_request_rtr_interval_min; 444 445 /// maximum interval for DHCP discover retries 446 uint16_t dhcp_discover_rtr_interval_max; 447 448 /// maximum interval for DHCP request retries 449 uint16_t dhcp_request_rtr_interval_max; 450 451 /// maximum number of DHCP discover retries 452 uint8_t dhcp_discover_max_retries; 453 454 /// maximum number of DHCP request retries 455 uint8_t dhcp_request_max_retries; 456 } SL_ATTRIBUTE_PACKED sl_si91x_req_ipv4_params_t; 457 458 /// IPV4 ipconfig command response structure 459 typedef struct { 460 /// MAC address of this module 461 uint8_t macAddr[6]; 462 463 /// Configured IP address 464 uint8_t ipaddr[4]; 465 466 /// Configured netmask 467 uint8_t netmask[4]; 468 469 /// Configured default gateway 470 uint8_t gateway[4]; 471 } sl_si91x_rsp_ipv4_params_t; 472 473 /// IPV6 ipconfig command request structure 474 typedef struct { 475 /// 0=Manual, 1=Use DHCP 476 uint8_t mode[2]; 477 478 /// prefix length 479 uint8_t prefixLength[2]; 480 481 /// IPV6 address of the module 482 uint8_t ipaddr6[16]; 483 484 /// address of gateway 485 uint8_t gateway6[16]; 486 487 /// vap id, 0 - station and 1 - AP 488 uint8_t vap_id; 489 } sl_si91x_req_ipv6_params_t; 490 491 /// IPV6 ipconfig command response structure 492 typedef struct { 493 /// prefix length 494 uint16_t prefixLength; 495 496 /// reserved bytes 497 uint16_t reserved; 498 499 /// Link local address 500 uint32_t link_local_address[4]; 501 502 /// Global address 503 uint32_t global_address[4]; 504 505 /// Gateway address 506 uint32_t gateway_address[4]; 507 508 /// Mac address 509 uint8_t mac_address[6]; 510 511 } SL_ATTRIBUTE_PACKED sl_si91x_rsp_ipv6_params_t; 512 513 /// Structure for firmware upgradation 514 typedef struct { 515 /// Type of the packet 516 uint16_t type; 517 518 /// Length of the packet 519 uint16_t length; 520 521 /// RPS content 522 uint8_t content[SL_MAX_FWUP_CHUNK_SIZE]; 523 } sl_si91x_req_fwup_t; 524 525 /// Si91x specific module RTC time 526 typedef struct { 527 uint32_t tm_sec; ///< Seconds [0-59] 528 uint32_t tm_min; ///< Minutes [0-59] 529 uint32_t tm_hour; ///< Hours since midnight [0-23] 530 uint32_t tm_mday; ///< Day of the month [1-31] 531 uint32_t tm_mon; ///< Months since January [0-11] 532 uint32_t tm_year; ///< Years since 1990 533 uint32_t tm_wday; ///< Weekday from Sunday to Saturday [1-7] 534 } sl_si91x_module_rtc_time_t; 535 536 /** \addtogroup SL_SI91X_TYPES 537 * @{ 538 * */ 539 /// Si91x specific Wireless information 540 typedef struct { 541 542 uint16_t 543 wlan_state; ///< WLAN state: connected or disconnected in station mode; number of stations connected in AP mode. 544 545 uint16_t channel_number; ///< Channel number of connected AP 546 547 uint8_t ssid[RSI_SSID_LEN]; ///< SSID of connected access point 548 549 uint8_t mac_address[6]; ///< MAC address 550 551 uint8_t sec_type; ///< Security type 552 553 uint8_t psk_pmk[64]; ///< PSK for AP mode, PMK for Client mode 554 555 uint8_t ipv4_address[4]; ///< Module IP Address 556 557 uint8_t ipv6_address[16]; ///< Module IPv6 Address 558 559 uint8_t reserved1[2]; ///< Reserved1 560 561 uint8_t reserved2[2]; ///< Reserved2 562 563 } sl_si91x_rsp_wireless_info_t; 564 /** @} */ 565 566 ///< socket create command request structure 567 #pragma pack(1) 568 typedef struct { 569 uint16_t ip_version; ///< ip version4 or 6 570 uint16_t socket_type; ///< 0= TCP Client, 1= UDP Client, 2= TCP Server (Listening TCP) 571 uint16_t local_port; ///< Our local module port number 572 uint16_t remote_port; ///< Port number of what we are connecting to 573 union { 574 uint8_t ipv4_address[4]; ///< remote IPv4 Address 575 uint8_t ipv6_address[16]; ///< remote IPv6 Address 576 } dest_ip_addr; ///< Destination IP address 577 uint16_t max_count; ///< maximum no of LTCP sockets on same port 578 #if defined(SLI_SI917) || defined(SLI_SI915) 579 uint16_t tos; ///< type of service 580 581 #else 582 uint32_t tos; ///< type of service 583 584 #endif 585 586 #if defined(SLI_SI917) || defined(SLI_SI915) 587 uint32_t ssl_bitmap; ///< ssl version select bit map 588 589 #else 590 uint8_t ssl_bitmap; ///< ssl version select bit map 591 uint8_t ssl_ciphers; ///< ssl ciphers bitmap 592 #endif 593 uint8_t webs_resource_name[RSI_WEBS_MAX_URL_LENGTH]; ///< web socket resource name 594 uint8_t webs_host_name[RSI_WEBS_MAX_HOST_LENGTH]; ///< web socket host name 595 uint8_t max_tcp_retries_count; ///< TCP retries 596 uint8_t socket_bitmap; ///< Socket bitmap 597 uint8_t rx_window_size; ///< RX window size 598 uint16_t tcp_keepalive_initial_time; ///< TCP keepalive initial timeout 599 uint8_t vap_id; ///< VAPID 600 uint8_t socket_cert_inx; ///< socket cert inx 601 uint32_t ssl_ciphers_bitmap; ///< ssl ciphers bitmap 602 #if defined(SLI_SI917) || defined(SLI_SI915) 603 uint32_t ssl_ext_ciphers_bitmap; ///< ssl extended ciphers bitmap 604 uint8_t max_retransmission_timeout_value; ///< max retransmission timeout value 605 #endif 606 uint8_t tcp_retry_transmit_timer; ///< tcp retry transmission timer 607 uint16_t tcp_mss; ///< TCP MSS 608 uint16_t no_of_tls_extensions; ///< number of TLS extensions 609 uint16_t total_extension_length; ///< total extension length 610 uint8_t tls_extension_data[SI91X_MAX_SIZE_OF_EXTENSION_DATA]; ///< TLS extension data 611 #if defined(SLI_SI917) || defined(SLI_SI915) 612 uint16_t recv_buff_len; ///< receive buffer length 613 #endif 614 615 } sl_si91x_socket_create_request_t; 616 #pragma pack() 617 618 /// socket create command response structure 619 typedef struct { 620 uint8_t ip_version[2]; ///< ip version 4 or 6 621 uint8_t socket_type[2]; ///< 2 bytes, type of socket created 622 uint8_t socket_id[2]; ///< 2 bytes socket descriptor, like a file handle, usually 0x00 623 uint8_t module_port[2]; ///< 2 bytes, Port number of our local socket 624 uint8_t dst_port[2]; ///< Destination port number 625 union { 626 uint8_t ipv4_addr[4]; ///< 4 bytes, Our (module) IPv4 Address 627 uint8_t ipv6_addr[16]; ///< 4 bytes, Our (module) IPv6 Address 628 } module_ip_addr; ///< Module IP address 629 union { 630 uint8_t ipv4_addr[4]; ///< 4 bytes, Our (module) IPv4 Address 631 uint8_t ipv6_addr[16]; ///< 4 bytes, Our (module) IPv6 Address 632 } dest_ip_addr; ///< Destrination IP address 633 uint8_t mss[2]; ///< 2 bytes, Remote peer MSS size 634 uint8_t window_size[4]; ///< 4 bytes, Remote peer Window size 635 } sl_si91x_socket_create_response_t; 636 #pragma pack() 637 638 #pragma pack(1) 639 /// Socket close command request structure 640 typedef struct { 641 uint16_t socket_id; ///< 2 bytes, socket that was closed 642 uint16_t port_number; ///< 4 bytes, port number 643 } sl_si91x_socket_close_request_t; 644 #pragma pack() 645 646 #pragma pack(1) 647 /// Socket close command response structure 648 649 typedef struct { 650 uint16_t socket_id; ///< 2 bytes, socket that was closed 651 uint32_t sent_bytes_count; ///< 4 bytes, sent bytes count 652 uint16_t port_number; ///< 2 bytes, port number 653 } sl_si91x_socket_close_response_t; 654 #pragma pack() 655 656 #pragma pack(1) 657 /// Si91x specifc send data on socket request structure 658 typedef struct { 659 uint16_t ip_version; ///< ip version 4 or 6 660 uint16_t socket_id; ///< socket descriptor of the already opened socket connection 661 uint32_t length; ///< length of the data to be sent 662 uint16_t data_offset; ///< Data Offset 663 uint16_t dest_port; ///< destination port 664 union { 665 uint8_t ipv4_address[RSI_IP_ADDRESS_LEN]; ///< 4 bytes, IPv4 Address of the remote device 666 uint8_t ipv6_address[RSI_IP_ADDRESS_LEN * 4]; ///< 16 bytes, IPv6 Address of the remote device 667 } dest_ip_addr; ///< IP address of the remote device 668 uint8_t send_buffer[]; ///< data buffer to send 669 } sli_si91x_socket_send_request_t; 670 #pragma pack() 671 672 /// socket accept request structure 673 #pragma pack(1) 674 typedef struct { 675 uint8_t socket_id; ///< Socket ID 676 uint16_t source_port; ///< Local port number 677 } sl_si91x_socket_accept_request_t; 678 #pragma pack() 679 680 /// LTCP socket establish request structure 681 #pragma pack(1) 682 typedef struct { 683 /// IP version 684 uint16_t ip_version; 685 686 /// 2 bytes, socket handle 687 uint16_t socket_id; 688 689 /// 2 bytes, remote port number 690 uint16_t dest_port; 691 692 union { 693 694 /// remote IPv4 Address 695 uint8_t ipv4_address[4]; 696 697 /// remote IPv6 Address 698 uint8_t ipv6_address[16]; 699 } dest_ip_addr; ///< Destination IP address 700 701 /// 2 bytes, remote peer MSS size 702 uint16_t mss; 703 704 /// 4 bytes, remote peer Window size 705 uint32_t window_size; 706 707 /// source port number 708 uint16_t src_port_num; 709 } sl_si91x_rsp_ltcp_est_t; 710 #pragma pack() 711 712 /// disassociate command request structure 713 #pragma pack(1) 714 typedef struct { 715 // FIXME: Enumerate 716 /// 0- Module in Client mode, 1- AP mode 717 uint16_t mode_flag; 718 719 /// client MAC address, Ignored/Reserved in case of client mode 720 sl_mac_address_t client_mac_address; 721 } sl_si91x_disassociation_request_t; 722 #pragma pack() 723 724 /// Access point configuration parameters 725 #pragma pack(1) 726 typedef struct { 727 /// channel number of the access point 728 uint16_t channel; 729 730 /// ssid of the AP to be created 731 uint8_t ssid[RSI_SSID_LEN]; 732 733 /// security type of the Access point 734 uint8_t security_type; 735 736 /// encryption mode 737 uint8_t encryption_mode; 738 739 /// password in case of security mode 740 uint8_t psk[SL_WIFI_MAX_PMK_LENGTH]; 741 742 /// Beacon interval of the access point in milliseconds. Allowed values are integers in the range of 100 to 1000 in multiples of 100. 743 uint16_t beacon_interval; 744 745 /// DTIM period of the access point 746 uint16_t dtim_period; 747 748 /// This is the bitmap to enable AP keep alive functionality and to select the keep alive type. 749 uint8_t ap_keepalive_type; 750 751 /// Keep alive time after which AP will disconnect the station if there are no wireless exchanges from station to AP. 752 uint8_t ap_keepalive_period; 753 754 /// Number of clients supported 755 uint16_t max_sta_support; 756 } sl_si91x_ap_config_request; 757 #pragma pack() 758 759 /// Internal SiWx91x Socket information query 760 /// @note: This is internal structure and should not be used by the applicatiom. This is identical to sl_si91x_sock_info_query_t and, would be cleaned to have single structure in future. 761 typedef struct { 762 uint8_t sock_id[2]; ///< Identifier for the socket 763 764 uint8_t sock_type[2]; ///< Type of the socket (TCP, UDP, and so on.) 765 766 uint8_t source_port[2]; ///< Port number used by the source 767 768 uint8_t dest_port[2]; ///< Port number used by the destination 769 770 union { 771 uint8_t ipv4_address[4]; ///< IPv4 address of the remote host 772 773 uint8_t ipv6_address[16]; ///< IPv6 address of the remote host 774 775 } dest_ip_address; ///< IP address of the destination host 776 } sli_sock_info_query_t; 777 778 /// Network params command response structure 779 #pragma pack(1) 780 typedef struct { 781 /// uint8, 0= NOT Connected, 1= Connected 782 uint8_t wlan_state; 783 784 /// channel number of connected AP 785 uint8_t channel_number; 786 787 /// PSK 788 uint8_t psk[64]; 789 790 /// Mac address 791 uint8_t mac_address[6]; 792 793 /// uint8[32], SSID of connected access point 794 uint8_t ssid[RSI_SSID_LEN]; 795 796 /// 2 bytes, 0= AdHoc, 1= Infrastructure 797 uint8_t connType[2]; 798 799 /// security type 800 uint8_t sec_type; 801 802 /// uint8, 0= Manual IP Configuration,1= DHCP 803 uint8_t dhcpMode; 804 805 /// uint8[4], Module IP Address 806 uint8_t ipv4_address[4]; 807 808 /// uint8[4], Module Subnet Mask 809 uint8_t subnetMask[4]; 810 811 /// uint8[4], Gateway address for the Module 812 uint8_t gateway[4]; 813 814 /// number of sockets opened 815 uint8_t num_open_socks[2]; 816 817 /// prefix length for ipv6 address 818 uint8_t prefix_length[2]; 819 820 /// modules ipv6 address 821 uint8_t ipv6_address[16]; 822 823 /// router ipv6 address 824 uint8_t defaultgw6[16]; 825 826 /// BIT(0) =1 - ipv4, BIT(1)=2 - ipv6, BIT(0) & BIT(1)=3 - BOTH 827 uint8_t tcp_stack_used; 828 829 /// sockets information array 830 sli_sock_info_query_t socket_info[10]; 831 } sl_si91x_network_params_response_t; 832 #pragma pack() 833 834 /// Si91x specific station information 835 typedef struct { 836 uint8_t ip_version[2]; ///< IP version if the connected client 837 uint8_t mac[6]; ///< Mac Address of the connected client 838 union { 839 uint8_t ipv4_address[4]; ///< IPv4 address of the connected client 840 uint8_t ipv6_address[16]; ///< IPv6 address of the connected client 841 842 } ip_address; ///< IP address 843 } sl_si91x_station_info_t; 844 845 /// go paramas response structure 846 #pragma pack(1) 847 typedef struct { 848 /// SSID of the P2p GO 849 uint8_t ssid[RSI_SSID_LEN]; 850 851 /// BSSID of the P2p GO 852 uint8_t mac_address[6]; 853 854 /// Operating channel of the GO 855 uint8_t channel_number[2]; 856 857 /// PSK of the GO 858 uint8_t psk[64]; 859 860 /// IPv4 Address of the GO 861 uint8_t ipv4_address[4]; 862 863 /// IPv6 Address of the GO 864 uint8_t ipv6_address[16]; 865 866 /// Number of stations Connected to GO 867 uint8_t sta_count[2]; 868 869 /// Station information 870 sl_si91x_station_info_t sta_info[SI91X_MAX_STATIONS]; 871 } sl_si91x_client_info_response; 872 #pragma pack() 873 874 /// Wi-Fi statistics report 875 typedef enum { 876 START_STATISTICS_REPORT, ///< Start statistics report 877 STOP_STATISTICS_REPORT, ///< Stop statistics report 878 } sl_wifi_statistics_report_t; 879 880 /// per stats command request structure 881 typedef struct { 882 /// 0 - start , 1 -stop 883 uint8_t start[2]; 884 885 /// channel number 886 uint8_t channel[2]; 887 } sl_si91x_req_rx_stats_t; 888 889 /// wlan per stats structure 890 typedef struct { 891 uint8_t tx_pkts[2]; ///< Number of transmitted packets 892 uint8_t reserved_1[2]; ///< Reserved 893 uint8_t tx_retries[2]; ///< Number of transmitted packets 894 uint16_t crc_pass; ///< Number of packets passed CRC 895 uint16_t crc_fail; ///< Number of packets failed CRC 896 uint8_t cca_stk[2]; ///< CCA stuck count 897 uint8_t cca_not_stk[2]; ///< CCA not stuck count 898 uint8_t pkt_abort[2]; ///< Packet abort count 899 uint8_t fls_rx_start[2]; ///< FLS RX start count 900 uint8_t cca_idle[2]; ///< CCA idle count 901 uint8_t reserved_2[26]; ///< Reserved 902 uint8_t rx_retries[2]; ///< Number of received packets 903 uint8_t reserved_3[2]; ///< Reserved 904 uint16_t cal_rssi; ///< RSSI value 905 uint8_t reserved_4[4]; ///< Reserved 906 uint8_t xretries[2]; ///< Number of retries 907 uint8_t max_cons_pkts_dropped[2]; ///< Maximum consecutive packets dropped 908 uint8_t reserved_5[2]; ///< Reserved 909 uint8_t bss_broadcast_pkts[2]; ///< BSS broadcast packets 910 uint8_t bss_multicast_pkts[2]; ///< BSS multicast packets 911 uint8_t bss_filter_matched_multicast_pkts[2]; ///< BSS filter matched multicast packets 912 } sl_si91x_per_stats_rsp_t; 913 914 /// Si91x specific sockt send data parameters 915 typedef struct { 916 uint8_t sock_fd; ///< Socket identifier 917 uint32_t length; ///< Length of data 918 // Need to discuss and increase data size 919 uint8_t data[50]; ///< Data 920 } sl_si91x_socket_send_data_parameters_t; 921 922 /// Si91x specific sockt receive data parameters 923 typedef struct { 924 uint8_t new_sock_fd; ///< New socket identifier 925 uint32_t length; ///< Length of data 926 uint8_t data[1460]; ///< Data 927 } sl_si91x_socket_receive_data_parameters_t; 928 929 /// Si91x specific socket create parameters 930 typedef struct { 931 uint8_t domain; ///< Domain 932 uint8_t type; ///< Socket protocol types (TCP/UDP/RAW) :: 1(SOCK_STREAM), 2(SOCK_DGRAM), 3(SOCK_RAW) 933 uint8_t protocol; ///< Protocol default : 0(IPPROTO_IP) 934 } sl_si91x_socket_create_parameters_t; 935 936 /// Socket connection parameters 937 typedef struct { 938 uint8_t domain; ///< Domain 939 int8_t sock_fd; ///< Socket identifier 940 uint32_t port; ///< Port number 941 uint32_t remote_ip_addr; ///< Remote IP address 942 } sl_si91x_socket_connect_or_listen_parameters_t; 943 944 /// Si91x specific feature frame request 945 typedef struct { 946 uint8_t 947 pll_mode; ///< PLL Mode. 0 - less than 120 Mhz NWP SoC clock; 1 - greater than 120 Mhz NWP SoC clock (Mode 1 is not currently supported for coex) 948 uint8_t rf_type; ///< RF Type. 949 uint8_t wireless_mode; ///< Wireless Mode. 950 uint8_t enable_ppp; ///< Enable PPP. 951 uint8_t afe_type; ///< AFE Type. 952 uint32_t feature_enables; ///< Feature Enables. 953 } sl_si91x_feature_frame_request; 954 955 /// structure for power save request 956 typedef struct { 957 /// power mode to set 958 uint8_t power_mode; 959 960 /// set LP/ULP/ULP-without RAM retention 961 uint8_t ulp_mode_enable; 962 963 /// set DTIM aligment required 964 // 0 - module wakes up at beacon which is just before or equal to listen_interval 965 // 1 - module wakes up at DTIM beacon which is just before or equal to listen_interval 966 uint8_t dtim_aligned_type; 967 968 /// Set PSP type, 0-Max PSP, 1- FAST PSP, 2-APSD 969 uint8_t psp_type; 970 971 /// Monitor interval for the FAST PSP mode 972 // default is 50 ms, and this parameter is valid for FAST PSP only 973 uint16_t monitor_interval; 974 /// Number of DTIMs to skip 975 uint8_t num_of_dtim_skip; 976 /// Listen interval 977 uint16_t listen_interval; 978 } sl_si91x_power_save_request_t; 979 980 /// DNS query request structure 981 typedef struct { 982 //! Ip version value 983 uint8_t ip_version[2]; 984 985 //! URL name 986 uint8_t url_name[SI91X_DNS_REQUEST_MAX_URL_LEN]; 987 988 //! DNS servers count 989 uint8_t dns_server_number[2]; 990 } sl_si91x_dns_query_request_t; 991 992 /// DNS query response structure 993 typedef struct { 994 //! Ip version of the DNS server 995 uint8_t ip_version[2]; 996 997 //! DNS response count 998 uint8_t ip_count[2]; 999 1000 //! DNS address responses 1001 union { 1002 uint8_t ipv4_address[4]; 1003 uint8_t ipv6_address[16]; 1004 } ip_address[SI91X_DNS_RESPONSE_MAX_ENTRIES]; 1005 } sl_si91x_dns_response_t; 1006 1007 /** 1008 * @brief DNS Server add request structure. 1009 * 1010 * This structure holds the information needed to add DNS servers, supporting both IPv4 and IPv6 addresses. 1011 */ 1012 typedef struct { 1013 uint8_t ip_version[2]; ///< IP version value. The second byte is reserved for future use. 1014 uint8_t dns_mode[2]; ///< DNS mode to use. The second byte is reserved for future use. 1015 1016 union { 1017 uint8_t primary_dns_ipv4[4]; ///< Primary DNS address in IPv4 format. 1018 uint8_t primary_dns_ipv6[16]; ///< Primary DNS address in IPv6 format. 1019 } sli_ip_address1; ///< Primary DNS address. 1020 1021 union { 1022 uint8_t secondary_dns_ipv4[4]; ///< Secondary DNS address in IPv4 format. 1023 uint8_t secondary_dns_ipv6[16]; ///< Secondary DNS address in IPv6 format. 1024 } sli_ip_address2; ///< Secondary DNS address. 1025 } sli_dns_server_add_request_t; 1026 1027 /// Structure for TCP ACK indication 1028 typedef struct { 1029 /// Socket ID 1030 uint8_t socket_id; 1031 1032 /// Length 1033 uint8_t length[2]; 1034 1035 } sl_si91x_rsp_tcp_ack_t; 1036 1037 /// Config command request structure 1038 typedef struct { 1039 /// config type 1040 uint16_t config_type; 1041 1042 /// value to set 1043 uint16_t value; 1044 } sl_si91x_config_request_t; 1045 1046 /// read bytes coming on socket request structure 1047 typedef struct { 1048 /// socket id 1049 uint8_t socket_id; 1050 1051 /// requested bytes 1052 uint8_t requested_bytes[4]; 1053 1054 /// Timeout for read 1055 uint8_t read_timeout[2]; 1056 } sl_si91x_req_socket_read_t; 1057 1058 /// Si91x specific time value 1059 typedef struct { 1060 uint32_t tv_sec; ///< Time in Seconds 1061 uint32_t tv_usec; ///< Time in microseconds 1062 } sl_si91x_time_value; 1063 1064 /// The select socket array manager. */ 1065 typedef struct { 1066 uint32_t fd_array[(NUMBER_OF_SOCKETS + 31) / 32]; ///< Bit map of SOCKET Descriptors. 1067 int32_t fd_count; ///< How many are SET 1068 } sl_si91x_fd_set_t; 1069 1070 /// Si91x specifc socket select request structure 1071 typedef struct { 1072 uint8_t num_fd; ///< Number of file descriptors 1073 uint8_t select_id; ///< Select ID 1074 sl_si91x_fd_set_t read_fds; ///< Read file descriptors 1075 sl_si91x_fd_set_t write_fds; ///< Write file descriptors 1076 sl_si91x_time_value select_timeout; ///< Select timeout 1077 uint8_t no_timeout; ///< No timeout 1078 } sl_si91x_socket_select_req_t; 1079 1080 /// Si91x specific socket select response structure 1081 typedef struct { 1082 uint8_t select_id; ///< Select ID 1083 sl_si91x_fd_set_t read_fds; ///< Read file descriptors 1084 sl_si91x_fd_set_t write_fds; ///< Write file descriptors 1085 uint32_t socket_terminate_bitmap; ///< Socket terminate bitmap 1086 } sl_si91x_socket_select_rsp_t; 1087 1088 /// Structure for OTA firmware upgradation 1089 typedef struct { 1090 /// Type of the packet 1091 uint8_t ip_version; 1092 1093 union { 1094 /// 4 bytes, IPv4 Address of the server 1095 uint8_t ipv4_address[4]; 1096 1097 /// 16 bytes, IPv6 Address of the server 1098 uint8_t ipv6_address[16]; 1099 1100 } server_ip_address; ///< Server IP address 1101 1102 /// server port 1103 uint8_t server_port[4]; 1104 1105 /// Chunk number 1106 uint8_t chunk_number[2]; 1107 1108 /// Timeout 1109 uint8_t timeout[2]; 1110 1111 /// TCP retry count 1112 uint8_t retry_count[2]; 1113 1114 } sl_si91x_ota_firmware_update_request_t; 1115 1116 /// Multicast request structure 1117 typedef struct { 1118 /// IP version 1119 uint8_t ip_version[2]; 1120 1121 /// command type 1122 uint8_t type[2]; 1123 1124 union { 1125 uint8_t ipv4_address[4]; ///< IPv4 address 1126 uint8_t ipv6_address[16]; ///< IPv6 address 1127 } multicast_address; ///< Multicast address 1128 } si91x_req_multicast_t; 1129 1130 /// Si91x specific WPS method request 1131 typedef struct { 1132 /// wps method: 0 - push button, 1 - pin method 1133 uint16_t wps_method; 1134 1135 /// If 0 - validate given pin, 1 - generate new pin 1136 uint16_t generate_pin; 1137 1138 /// wps pin for validation 1139 uint8_t wps_pin[SI91X_WPS_PIN_LEN]; 1140 } sl_si91x_wps_method_request_t; 1141 1142 /// Si91x specific roam parameters request 1143 typedef struct { 1144 uint32_t roam_enable; ///< Enable or disable roaming 1145 uint32_t roam_threshold; ///< roaming threshold 1146 uint32_t roam_hysteresis; ///< roaming hysteresis 1147 } sl_si91x_req_roam_params_t; 1148 1149 /// Ping Request Frame 1150 typedef struct { 1151 /// ip version 1152 uint16_t ip_version; 1153 1154 /// ping size 1155 uint16_t ping_size; 1156 1157 union { 1158 /// ipv4 address 1159 uint8_t ipv4_address[4]; 1160 1161 /// ipv6 address 1162 uint8_t ipv6_address[16]; 1163 1164 } ping_address; ///< Ping address 1165 1166 /// ping request timeout 1167 uint16_t timeout; 1168 } sl_si91x_ping_request_t; 1169 1170 //! HTTP Get/Post request structure 1171 typedef struct { 1172 //! ip version 1173 uint16_t ip_version; 1174 1175 //! https enable 1176 uint16_t https_enable; 1177 1178 //! port number 1179 uint16_t port_number; 1180 1181 //! buffer 1182 uint8_t buffer[SI91X_HTTP_BUFFER_LEN]; 1183 } sl_si91x_http_client_request_t; 1184 1185 //! SNI for embedded sockets structure 1186 #define SI91X_SNI_FOR_HTTPS 1 1187 1188 /// Si91x specific SNI for embedded socket request 1189 typedef struct si91x_sni_for_embedded_socket_request_s { 1190 //! offset from which hostname starts 1191 uint16_t offset; 1192 1193 //! application protocol 1194 uint16_t protocol; 1195 1196 //! sni extension data 1197 uint8_t tls_extension_data[SI91X_MAX_SIZE_OF_EXTENSION_DATA]; 1198 } si91x_sni_for_embedded_socket_request_t; 1199 1200 //! HTTP client PUT START create structure 1201 typedef struct { 1202 //! HTTP server ip version 1203 uint8_t ip_version; 1204 1205 //! HTTPS bit map 1206 uint16_t https_enable; 1207 1208 //! HTTP server port number 1209 uint32_t port_number; 1210 1211 //! HTTP Content Length 1212 uint32_t content_length; 1213 } SL_ATTRIBUTE_PACKED sl_si91x_http_client_put_start_t; 1214 1215 typedef struct { 1216 //! Current chunk length 1217 uint16_t current_length; 1218 } SL_ATTRIBUTE_PACKED sl_si91x_http_client_put_data_request_t; 1219 1220 //! @cond Doxygen_Suppress 1221 //! HTTP client PUT request structure 1222 typedef struct { 1223 //! Command type 1224 uint8_t command_type; 1225 1226 union http_client_put_s { 1227 //! HTTP PUT START command structure 1228 sl_si91x_http_client_put_start_t http_client_put_start; 1229 1230 //! HTTP PUT PACKET command structure 1231 sl_si91x_http_client_put_data_request_t http_client_put_data_req; 1232 1233 } SL_ATTRIBUTE_PACKED http_client_put_struct; 1234 1235 //! HTTP PUT buffer 1236 uint8_t http_put_buffer[SI91X_HTTP_CLIENT_PUT_MAX_BUFFER_LENGTH]; 1237 } SL_ATTRIBUTE_PACKED sl_si91x_http_client_put_request_t; 1238 //! @endcond 1239 1240 //! HTTP Client POST DATA PKT request structure 1241 typedef struct { 1242 //! Current http data chunk length 1243 uint16_t current_length; 1244 1245 //! HTTP POST buffer 1246 uint8_t http_post_data_buffer[SI91X_HTTP_CLIENT_POST_MAX_BUFFER_LENGTH]; 1247 } sl_si91x_http_client_post_data_request_t; 1248 1249 //! HTTP Client PUT PKT response structure 1250 typedef struct { 1251 //! Receive HTTP client PUT command type 1252 uint8_t command_type; 1253 1254 //! End of resource content file 1255 uint8_t end_of_file; 1256 } sl_si91x_http_client_put_pkt_rsp_t; 1257 1258 //! HTTP Client PUT pkt server response structure 1259 typedef struct { 1260 uint32_t command_type; ///< Command type 1261 uint32_t more; ///< More 1262 uint32_t offset; ///< Offset 1263 uint32_t data_len; ///< Data length 1264 } sl_si91x_http_put_pkt_server_rsp_t; 1265 1266 /// Si91x specific WLAN filter broadcast request 1267 typedef struct { 1268 uint8_t beacon_drop_threshold[2]; ///< Beacon drop threshold 1269 uint8_t filter_bcast_in_tim; ///< Filter broadcast in TIM 1270 uint8_t filter_bcast_tim_till_next_cmd; ///< Filter broadcast TIM till next command 1271 } sl_si91x_request_wlan_filter_broadcast_t; 1272 1273 //! user configurable gain table structure 1274 typedef struct { 1275 uint8_t band; ///< band value 1276 uint8_t bandwidth; ///< bandwidth value 1277 uint16_t size; ///< payload size 1278 uint32_t reserved; ///< Reserved 1279 uint8_t gain_table[]; ///< payload 1280 } sl_si91x_gain_table_info_t; 1281 1282 /// Si91x specific 11AX configuration parameters 1283 typedef struct { 1284 uint8_t guard_interval; ///< Period of time inserted between two packets in wireless transmission. Range : 0 - 3 1285 uint8_t nominal_pe; ///< Nominal Packet extension Range: 0 - 2 1286 uint8_t dcm_enable; ///< Enable or disable dual carrier modulation (DCM). 0 - Disable DCM, 1 - Enable DCM 1287 uint8_t ldpc_enable; ///< Enable or disable low-density parity-check (LDPC). 0 - Disable LDPC, 1 - Enable LDPC 1288 uint8_t 1289 ng_cb_enable; ///< Enable or disable non-contiguous channel bonding (NG CB). 0 - Disable NG CB, 1 - Enable NG CB 1290 uint8_t ng_cb_values; ///< Values of non-contiguous channel bonding (NG CB). Range: 0x00 - 0x11 1291 uint8_t 1292 uora_enable; ///< Enable or disable uplink orthogonal frequency division multiple random access (UORA). 0 - Disable uora, 1 - Enable uora. 1293 uint8_t 1294 trigger_rsp_ind; ///< Trigger_Response_Indication. BIT(0) ? Trigger Response For BE, BIT(1) ? Trigger Response For BK, BIT(2) ? Trigger Response For VI, BIT(3) ? Trigger Response For VO 1295 uint8_t ipps_valid_value; ///< IPPS valid value 1296 uint8_t tx_only_on_ap_trig; ///< Reserved for future use 1297 uint8_t twt_support; ///< Enable or Disable TWT. 0 - Disable TWT, 1 - Enable TWT. 1298 uint8_t 1299 config_er_su; ///< Extended Range Single User. 0 - NO ER_SU support, 1 - Use ER_SU rates along with Non_ER_SU rates, 2 - Use ER_SU rates only 1300 uint8_t disable_su_beamformee_support; ///< Flag indicating whether Single User Beamformee support is disabled. 1301 /// * 0: Enabled, 1: Disabled. 1302 } sl_si91x_11ax_config_params_t; 1303 1304 /// Si91x specific ram dump 1305 typedef struct { 1306 uint32_t address; ///< Address 1307 uint32_t length; ///< Length 1308 } sl_si91x_ram_dump_t; 1309 1310 #ifdef SLI_SI91X_MCU_INTERFACE 1311 typedef enum { 1312 SL_SI91X_TAKE_M4_64K = 1, 1313 SL_SI91X_GET_IPMU_PROGRAMMING_VALUES = 2, 1314 SL_SI91X_READ_TA_REGISTER = 3, 1315 SL_SI91X_WRITE_TA_REGISTER = 4, 1316 // This enum varibale added for M4 has to give indication to NWP, for configuring the clock switching between 1.3 to 3.3 V .For more details, check Jira Ticket RSC-3802. 1317 SL_SI91X_ENABLE_XTAL = 5, 1318 SL_SI91X_WRITE_TO_COMMON_FLASH = 6, 1319 #ifdef SL_SI91X_SIDE_BAND_CRYPTO 1320 SL_SI91X_ENABLE_SIDE_BAND = 7, 1321 #endif 1322 SL_SI91X_READ_FROM_COMMON_FLASH = 8, 1323 } sl_si91x_ta_m4_commands_t; 1324 1325 // M4 and NWP secure handshake request structure. 1326 typedef struct { 1327 // sub_cmd form the enum ta_m4_commands_e(Main command type is RSI_COMMON_REQ_TA_M4_COMMANDS) 1328 sl_si91x_ta_m4_commands_t sub_cmd; 1329 // length of input_data 1330 uint8_t input_data_size; 1331 // Input data. In this input data first byte is reserved for enable(1) or Disable(0) sub_cmd of this structure. 1332 uint8_t input_data[]; 1333 } sl_si91x_ta_m4_handshake_parameters_t; 1334 1335 #define MAX_CHUNK_SIZE 1400 1336 #define FLASH_SECTOR_SIZE 4096 1337 // TA2M4 handshake request structure. 1338 typedef struct { 1339 // sub_cmd 1340 uint8_t sub_cmd; 1341 1342 // NWP flash location 1343 uint32_t addr; 1344 1345 // total length of input data 1346 uint16_t input_buffer_length; 1347 1348 // erases multiples of 4kbytes 1349 uint8_t flash_sector_erase_enable; 1350 1351 //data 1352 uint8_t input_data[MAX_CHUNK_SIZE]; 1353 } SL_ATTRIBUTE_PACKED sl_si91x_request_ta2m4_t; 1354 1355 typedef struct { 1356 // sub_cmd 1357 uint8_t sub_cmd; 1358 1359 // nwp flash location 1360 uint32_t nwp_address; 1361 1362 // total length of output data 1363 uint16_t output_buffer_length; 1364 1365 } SL_ATTRIBUTE_PACKED sl_si91x_read_flash_request_t; 1366 1367 #endif // SLI_SI91X_MCU_INTERFACE 1368 1369 /** \addtogroup SL_SI91X_TYPES 1370 * @{ 1371 * */ 1372 /// Si91x specific TWT response 1373 typedef struct { 1374 uint8_t wake_duration; ///< Wake duration 1375 uint8_t wake_duration_unit; ///< Wake duration unit 1376 uint8_t wake_int_exp; ///< Wake interval exponent 1377 uint8_t negotiation_type; ///< Negotiation type 1378 uint16_t wake_int_mantissa; ///< Wake interval mantissa 1379 uint8_t implicit_twt; ///< Impilcit TWT 1380 uint8_t un_announced_twt; ///< Unannounced TWT 1381 uint8_t triggered_twt; ///< Triggered TWT 1382 uint8_t twt_channel; ///< TWT channel 1383 uint8_t twt_protection; ///< TWT Protection 1384 uint8_t twt_flow_id; ///< TWT flow ID 1385 } sl_si91x_twt_response_t; 1386 1387 /// Si91x specific TX test info 1388 typedef struct { 1389 uint16_t enable; ///< Enable/disable TX test mode 1390 uint16_t power; ///< TX power in dBm. Range : 2 - 18 dBm. 1391 ///< 1392 ///< @note 1. User can configure the maximum power level allowed for the given frequncey in the configured region by providing 127 as power level. 1393 ///< @note 2. User should configure a minimum delay (approx. 10 milliseconds) before and after \ref sl_si91x_transmit_test_start API to observe a stable output at requested dBm level. 1394 uint32_t rate; ///< Transmit data rate 1395 ///< ### Data Rates ### 1396 ///< Data rate(Mbps) | Value of rate 1397 ///< :--------------:|:-------------------: 1398 ///< 1 | 0 1399 ///< 2 | 2 1400 ///< 5.5 | 4 1401 ///< 11 | 6 1402 ///< 6 | 139 1403 ///< 9 | 143 1404 ///< 12 | 138 1405 ///< 18 | 142 1406 ///< 24 | 137 1407 ///< 36 | 141 1408 ///< 48 | 136 1409 ///< 54 | 140 1410 ///< MCS0 | 256 1411 ///< MCS1 | 257 1412 ///< MCS2 | 258 1413 ///< MCS3 | 259 1414 ///< MCS4 | 260 1415 ///< MCS5 | 261 1416 ///< MCS6 | 262 1417 ///< MCS7 | 263 1418 uint16_t length; ///< TX packet length. Range: [24 - 1500] bytes in Burst mode and [24 - 260] bytes in Continuous mode 1419 uint16_t mode; ///< TX test mode mode. 1420 ///< 1421 ///< 0 - Burst Mode. 1422 ///< 1423 ///< 1 - Continuous Mode. 1424 ///< 1425 ///< 2 - Continuous wave Mode (non modulation) in DC mode. 1426 ///< 1427 ///< 3 - Continuous wave Mode (non modulation) in single tone mode (center frequency -2.5 MHz). 1428 ///< 1429 ///< 4 - Continuous wave Mode (non modulation) in single tone mode (center frequency +5 MHz). 1430 ///< 1431 ///< `Burst mode`: DUT transmits a burst of packets with the given power, rate, length in the channel configured. 1432 ///< The burst size will be determined by the number of packets and if its zero, then DUT keeps transmitting till a @ref sl_si91x_transmit_test_stop API is called. 1433 ///< 1434 ///< `Continuous Mode`: The DUT transmits a unmodulated waveform continuously 1435 ///< 1436 ///< `Continuous Wave Mode (Non-Modulation) in DC Mode`: The DUT transmits a spectrum only at the center frequency of the channel. 1437 ///< A basic signal with no modulation is that of a sine wave and is usually referred to as a continuous wave (CW) signal. 1438 ///< A basic signal source produces sine waves. Ideally, the sine wave is perfect. In the frequency domain, it is viewed as a single line at some specified frequency. 1439 ///< 1440 ///< `Continuous Wave Mode (Non-Modulation) in single tone Mode (Center frequency -2.5 MHz)`: The DUT transmits a spectrum that is generated at -2.5MHz from the center frequency of the channel selected. 1441 ///< Some amount of carrier leakage will be seen at Center Frequency. For example, for 2412 MHz, the output would be seen at 2409.5 MHz. 1442 ///< 1443 ///< `Continuous Wave Mode (Non-Modulation) in single tone Mode (Center frequency +5 MHz)`: The DUT transmits a spectrum that is generated at 5MHz from the center frequency of the channel selected. 1444 ///< Some amount of carrier leakage will be seen at Center Frequency. For example, for 2412MHz, the output would be seen at 2417 MHz. 1445 uint16_t channel; ///< Channel number in 2.4 GHZ / 5 GHZ. 1446 ///< ###The following table maps the channel number to the actual radio frequency in the 2.4 GHz spectrum. ### 1447 ///< Channel numbers (2.4GHz)| Center frequencies for 20 MHz channel width 1448 ///< :----------------------:|:-----------------------------------------------: 1449 ///< 1 | 2412 1450 ///< 2 | 2417 1451 ///< 3 | 2422 1452 ///< 4 | 2427 1453 ///< 5 | 2432 1454 ///< 6 | 2437 1455 ///< 7 | 2442 1456 ///< 8 | 2447 1457 ///< 9 | 2452 1458 ///< 10 | 2457 1459 ///< 11 | 2462 1460 ///< 12 | 2467 1461 ///< 13 | 2472 1462 ///< @note To start transmit test in 12,13 channels, configure set region parameters in @ref sl_si91x_set_device_region 1463 ///< ### The following table maps the channel number to the actual radio frequency in the 5 GHz spectrum for 20MHz channel bandwidth. The channel numbers in 5 GHz range is from 36 to 165. ### 1464 ///< Channel Numbers(5GHz) | Center frequencies for 20MHz channel width 1465 ///< :--------------------:|:------------------------------------------: 1466 ///< 36 |5180 1467 ///< 40 |5200 1468 ///< 44 |5220 1469 ///< 48 |5240 1470 ///< 52 |5260 1471 ///< 56 |5280 1472 ///< 60 |5300 1473 ///< 64 |5320 1474 ///< 149 |5745 1475 ///< 153 |5765 1476 ///< 157 |5785 1477 ///< 161 |5805 1478 ///< 165 |5825 1479 uint16_t rate_flags; ///< Rate flags 1480 ///< BIT(6) - Immediate Transfer, set this bit to transfer packets immediately ignoring energy/traffic in channel. 1481 uint16_t channel_bw; ///< Channel Bandwidth 1482 uint16_t aggr_enable; ///< tx test mode aggr_enable 1483 uint16_t reserved; ///< Reserved 1484 uint16_t no_of_pkts; ///< Number of packets 1485 uint32_t delay; ///< Delay 1486 #if defined(SLI_SI917) || defined(DOXYGEN) || defined(SLI_SI915) 1487 uint8_t enable_11ax; ///< 11AX_ENABLE 0-disable, 1-enable 1488 uint8_t coding_type; ///< Coding_type 0-BCC 1-LDPC 1489 uint8_t nominal_pe; ///< Indicates Nominal T-PE value. 0-0Us 1-8Us 2-16Us 1490 uint8_t 1491 ul_dl; ///< Indicates whether the PPDU is UL/DL. Set it to 1 if PPDU is to be sent by station to AP; 0 if PPDU is to be sent by AP to station. 1492 uint8_t he_ppdu_type; ///< he_ppdu_type 0-HE SU PPDU, 1-HE ER SU PPDU, 2-HE TB PPDU, 3-HE MU PPDU 1493 uint8_t 1494 beam_change; ///< Indicates the spatial mapping of pre-HE and HE fields. Enter 0 for pre-HE and HE fields are spatially mapped in the same way and 1 for pre-HE and HE fields are spatially mapped differently. 1495 uint8_t bw; ///< Indicates the BW for the PPDU: 0 for 242-tone RU, 1 for upper 106-tone RU. 1496 uint8_t 1497 stbc; ///< Indicates whether STBC is used for PPDU transmission. Set to 0 for no STBC and 1 for STBC (only if DCM field is set to 0). 1498 uint8_t 1499 tx_bf; ///< Indicates whether beamforming matrix is applied to the transmission. 0 - no beamforming matrix, 1 - beamforming matrix. 1500 uint8_t gi_ltf; ///< Indicates the GI and LTF size. GI_LTF shall be in the range 0-3 1501 uint8_t dcm; ///< Indicates whether DCM is applied to Data Symbols. 0 - No DCM, 1 - DCM. 1502 uint8_t nsts_midamble; ///< Indicates the NSTS and Midamble Periodicity. NSTS_MIDAMBLE shall be in the range 0-7 1503 uint8_t 1504 spatial_reuse; ///< spatial_reuse shall be in the range 0-15. 4 indicates that spatial reuse is allowed during the transmission of PPDU. 1505 uint8_t bss_color; ///< Color value of BSS. Must be in the range 0 to 63 1506 uint16_t he_siga2_reserved; ///< HE_SIGA2_RESERVED shall be in the range 0-511 1507 uint8_t ru_allocation; ///< Indicates the RU Allocation Subfield for 20MHz BW. Must be in the range 0-255. 1508 uint8_t n_heltf_tot; ///< Indicates the number of HE-LTF to be transmitted. Can be in the range 0-7. 1509 uint8_t sigb_dcm; ///< Indicates whether DCM is applied to SIG-B Symbols. 0-disable, 1-enable 1510 uint8_t sigb_mcs; ///< Indicates the MCS for SIG-B Symbols. Allowed range is 0-5. 1511 uint16_t user_sta_id; ///< Indicates the Station ID of the intended user. Allowed range is 0-2047. 1512 uint8_t user_idx; ///< USER_IDX shall be in the range 0-8 1513 uint8_t sigb_compression_field; ///< SIGB_COMPRESSION_FIELD shall be 0/1 1514 #endif 1515 } sl_si91x_request_tx_test_info_t; 1516 /** @} */ 1517 1518 /// Si91x specific calibration write 1519 typedef struct { 1520 /* Target 1521 * 0 - BURN_INTO_EFUSE (Burns calibration data to EFuse) 1522 - 1523 * 1 - BURN_INTO_FLASH (Burns calibration data to Flash) 1524 - 1525 **/ 1526 uint8_t target; ///< Target 1527 uint8_t reserved0[3]; ///< Reserved 1528 /* Flags - Validate information 1529 * Bit | MACRO | Description 1530 * :---|:---------------------:|:--------------------------------------------------- 1531 * 0 | RESERVED_0 | Reserved 1532 * 1 | BURN_FREQ_OFFSET | 1 - Update XO Ctune to calibration data 1533 - 0 - Skip XO Ctune update 1534 * 2 | SW_XO_CTUNE_VALID | 1 - Use XO Ctune provided as argument to update calibration data 1535 - 0 - Use XO Ctune value as read from hardware register 1536 * 3 | BURN_XO_FAST_DISABLE | Used to apply patch for cold temperature issue(host interface detection) observed on CC0/CC1 modules. \ref appendix 1537 * 4 | BURN_GAIN_OFFSET_LOW | 1 - Update gain offset for low sub-band (2 GHz) 1538 - 0 - Skip low sub-band gain-offset update 1539 * 5 | BURN_GAIN_OFFSET_MID | 1 - Update gain offset for mid sub-band (2 GHz) 1540 - 0 - Skip mid sub-band gain-offset update 1541 * 6 | BURN_GAIN_OFFSET_HIGH | 1 - Update gain offset for high sub-band (2 GHz) 1542 - 0 - Skip high sub-band gain-offset update 1543 * 8 | ENABLE_DPD_CALIB | 1 - Collect dpd coefficients data 1544 - 0 - Skip dpd coefficients calibration 1545 * 9 | BURN_DPD_COEFFICIENTS | 1 - Burn dpd coefficients data 1546 - 0 - Skip dpd coefficients calibration 1547 * 10 | BURN_GAIN_OFFSET_CHANNEL-14 | 1 - Update gain offset for channel-14 sub-band (2 GHz) 1548 - 0 - Skip channel-14 sub-band gain-offset update 1549 * 31-4 | | Reserved 1550 **/ 1551 uint32_t flags; ///< flags 1552 /* 1553 gain_offset_low - gain_offset as observed in dBm in channel-1 1554 gain_offset_mid - gain_offset as observed in dBm in channel-6 1555 gain_offset_high - gain_offset as observed in dBm in channel-11 1556 */ 1557 int8_t gain_offset[3]; ///< Gain offset 1558 /*xo_ctune - Allow user to directly update xo_ctune value to calibration data bypassing the freq offset loop, 1559 *valid only when BURN_FREQ_OFFSET & SW_XO_CTUNE_VALID of flags is set. The range of xo_ctune is [0, 255], and the typical value is 80 1560 */ 1561 int8_t xo_ctune; ///< XO Ctune 1562 /*gain_offset_channel-14 - gain_offset as observed in dBm in channel-14 */ 1563 int8_t gain_offset_ch14; ///< Gain offset channel 14 1564 } sl_si91x_calibration_write_t; 1565 1566 /// Si91x specific calibration read 1567 typedef struct { 1568 1569 /* target 1570 * 0 - READ_FROM_EFUSE (read calibration data from the EFuse) 1571 * 1 - READ_FROM_FLASH (read calibration data from the Flash) 1572 */ 1573 uint8_t target; ///< target 1574 uint8_t reserved0[3]; ///< Reserved 1575 /* 1576 gain_offset_low - gain_offset in dBm that is applied for transmissions in channel-1. 1577 gain_offset_mid - gain_offset in dBm that is applied for transmissions in channel-6. 1578 gain_offset_high -gain_offset in dBm that is applied for transmissions in channel-11. 1579 */ 1580 int8_t gain_offset[3]; ///< gain offset 1581 1582 int8_t xo_ctune; ///< xo_ctune - xo_ctune value as read from the target memory. 1583 1584 int8_t 1585 gain_offset_ch14; ///< gain_offset_channel-14 - gain_offset in dBm that is applied for transmissions in channel-14. 1586 1587 #if !defined(SLI_SI917) && !defined(SLI_SI915) 1588 /// RSI EVM Data 1589 struct rsi_evm_data_t { 1590 int8_t evm_offset[5]; ///< Evm offset 1591 } rsi_evm_data_t; ///< Evm data 1592 #endif 1593 } sl_si91x_calibration_read_t; 1594 1595 /// Si91x specific frequency offset 1596 typedef struct { 1597 int32_t frequency_offset_in_khz; ///< Frequency offset in KHZ 1598 } sl_si91x_freq_offset_t; 1599 1600 /// Si91x specific get DPD calibration data 1601 typedef struct { 1602 int8_t dpd_power_index; ///< Dpd power index given by the user 1603 } sl_si91x_get_dpd_calib_data_t; 1604 1605 /// Si91x specific EVM offset 1606 typedef struct { 1607 int8_t evm_offset_val; ///<EVM_offset_val - emv_offset value observed. 1608 /* index - index of EVM,range from[0 to 4]. 1609 * index | description 1610 * 0 | Update evm_offset_11B 1611 * 1 | Update evm_offset_11G_6M_24M_11N_MCS0_MCS2 1612 * 2 | Update evm_offset_11G_36M_54M_11N_MCS3_MCS7 1613 * 3 | Update evm_offset_11N_MCS0 1614 * 4 | Update evm_offset_11N_MCS7 1615 * > 4 | Reserved 1616 * */ 1617 uint8_t evm_index; ///< EVM index 1618 } sl_si91x_evm_offset_t; 1619 1620 /// Si91x Specific EVM write 1621 typedef struct { 1622 /* 1623 *Target 1624 * 0 - BURN_INTO_EFUSE (Burns calibration data to EFuse)(Not supported) 1625 * 1 - BURN_INTO_FLASH (Burns calibration data to Flash) 1626 **/ 1627 uint8_t target; ///< Target 1628 /* 1629 * Flags - Validate information 1630 - 1631 * Bit | MACRO | Description 1632 * :---|:---------------------:|:--------------------------------------------------- 1633 * 0 | EVM_OFFSET_CUST_0 | 1 - Update evm_offset_11B rate calibration data 1634 - 0 - Skip evm_offset update 1635 * 1 | EVM_OFFSET_CUST_1 | 1 - Update evm_offset_11G_6M_24M_11N_MCS0_MCS2 rate calibration data 1636 - 0 - Skip evm_offset update 1637 * 2 | EVM_OFFSET_CUST_2 | 1 - Update evm_offset_11G_36M_54M_11N_MCS3_MCS7 rate calibration data 1638 - 0 - Skip evm_offset update 1639 * 3 | EVM_OFFSET_CUST_3 | 1 - Update evm_offset_11N_MCS0 rate calibration data 1640 - 0 - Skip evm_offset update 1641 * 4 | EVM_OFFSET_CUST_4 | 1 - Update evm_offset_11N_MCS7 rate calibration data 1642 - 0 - Skip evm_offset update 1643 * 31-5| Reserved 1644 */ 1645 uint32_t flags; ///< Flags 1646 uint8_t evm_offset_11B; ///< evm_offset for 11B rate 1647 uint8_t evm_offset_11G_6M_24M_11N_MCS0_MCS2; ///< evm_offset for 11G_6M_24M_11N_MCS0_MCS2 rate 1648 uint8_t evm_offset_11G_36M_54M_11N_MCS3_MCS7; ///< evm_offset for 11G_36M_54M_11N_MCS3_MCS7 rate 1649 uint8_t evm_offset_11N_MCS0; ///< evm_offset for 11N_MCS0 rate 1650 uint8_t evm_offset_11N_MCS7; ///< evm_offset for 11N_MCS7 rate 1651 } sl_si91x_evm_write_t; 1652 1653 /// Si91x specific efuse read 1654 typedef struct { 1655 /// Efuse read addr offset 1656 /** 1657 * 1658 * |efuse_read_addr_offset | Component | Parameter | Size in bytes| Description | 1659 * |-----------------------|---------------------|---------------------------------------|--------------|------------------------------------------------------------------------------------------------------------------------------------------------| 1660 * | 144 | Wlan info-Cust | Magic byte |1 |Magic byte for Wlan Customer info | 1661 * | 145 | | Reserved |1 |Reserved | 1662 * | 146 | | Mac address |6 |If this MAC address is set, it overrides the Wlan MAC address set by Silabs. | 1663 * | 152 | BT/BLE info-Cust | Magic byte |1 |Magic byte for BLE Customer info | 1664 * | 153 | | Reserved |1 |Reserved | 1665 * | 154 | | Mac address |6 |If this MAC address is set, it overrides the BLE MAC address set by Silabs. | 1666 * | 160 | XO_offset_cust | Magic byte |1 |0x000B => XO_offset is set by customer. | 1667 * | 161 | | XO_offset |1 |If a valid XO_OFFSET is programmed here, the one in location 259 is ignored, and this one is taken; otherwise, the one in location 259 is taken.| 1668 * | 162 | Gain_offset_cust | cusotmer_gain_offset_1_3p3 |1 |Channel 1,2,3 | 1669 * | 163 | | cusotmer_gain_offset_6_3p3 |1 |Channel 4,5,6,7,8 | 1670 * | 164 | | cusotmer_gain_offset_11_3p3 |1 |Channel 9,10,11,12,13, optional 14 (this is used if 168 magic byte is not set) | 1671 * | 165 | | cusotmer_gain_offset_1_1p8 |1 | | 1672 * | 166 | | cusotmer_gain_offset_6_1p8 |1 | | 1673 * | 167 | | cusotmer_gain_offset_11_1p8 |1 | | 1674 * | 168 | | cusotmer_gain_offset_14_3p3_magic_byte|1 |Magic byte for customer gain offset CH14 0xAB | 1675 * | 169 | | cusotmer_gain_offset_14_3p3 |1 |Customer gain offset for CH14, this is valid only when the Magic byte is valid when 168 Location. | 1676 * | 170 | | AntiRollback space for M4 image |8 |Anti-Rollback bit map. 64 bits represent theversion numbers for Anti-rollback base. | 1677 * | 178 | Customer EVM Offset | Magic byte |1 |0xAB => Magic byte set by customer while loading the offset | 1678 * | 179 | | evm_offset_11B |1 | | 1679 * | 180 | | evm_offset_11G_6M_24M_11N_MCS0_MSC2 |1 | | 1680 * | 181 | | evm_offset_11G_36M_54M_11N_MCS3_MSC7 |1 | | 1681 * | 182 | | evm_offset_11N_MCS0 |1 | | 1682 * | 183 | | evm_offset_11N_MCS7 |1 | | 1683 * | 184 | | Reserved for Customer |71 |Reserved for future use | 1684 * | 255 | | OTP_Lock_1 |1 |Bit 0 : Lock 128-255 1 ->Lock, 0 -> Unlocked Bit 1 : Debug port was opened Bit 2 -7 : Reserved | 1685 * */ 1686 uint32_t efuse_read_addr_offset; 1687 /// Efuse read data length 1688 uint16_t efuse_read_data_len; 1689 } sl_si91x_efuse_read_t; 1690 1691 /// Si91x specific rejoin parameters 1692 typedef struct { 1693 uint32_t max_retry_attempts; ///< Maximum number of retries before indicating join failure. 1694 uint32_t scan_interval; ///< Scan interval between each retry. 1695 uint32_t 1696 beacon_missed_count; ///< Number of missed beacons that will trigger rejoin. Minimum value of beacon_missed_count is 40. 1697 uint32_t first_time_retry_enable; ///< Retry enable or disable for first time joining. 1698 } sl_si91x_rejoin_params_t; 1699 1700 /** \addtogroup SL_SI91X_TYPES 1701 * @{ 1702 * */ 1703 /// Si917 specific Wi-Fi asynchronous statistics 1704 typedef struct { 1705 uint16_t tx_pkts; ///< Number of transmitted packets 1706 uint8_t reserved_1[2]; ///< Reserved fields 1707 uint16_t tx_retries; ///< Number of transmission retries 1708 uint16_t crc_pass; ///< Number of packets that passed CRC check 1709 uint16_t crc_fail; ///< Number of packets that failed CRC check 1710 uint16_t cca_stk; ///< Number of times CCA got stuck 1711 uint16_t cca_not_stk; ///< Number of times CCA didn't get stuck 1712 uint16_t pkt_abort; ///< Number of packet aborts 1713 uint16_t fls_rx_start; ///< Number of false RX starts 1714 uint16_t cca_idle; ///< CCA idle time 1715 uint8_t reserved_2[26]; ///< Reserved fields 1716 uint16_t rx_retries; ///< Number of reception retries 1717 uint8_t reserved_3[2]; ///< Reserved fields 1718 uint16_t cal_rssi; ///< Calibrated RSSI 1719 uint8_t reserved_4[4]; ///< Reserved fields 1720 uint16_t xretries; ///< Number of transmitted packets dropped after maximum retries 1721 uint16_t max_cons_pkts_dropped; ///< Maximum consecutive packets dropped 1722 uint8_t reserved_5[2]; ///< Reserved fields 1723 uint16_t bss_broadcast_pkts; ///< BSSID matched broadcast packets count 1724 uint16_t bss_multicast_pkts; ///< BSSID matched multicast packets count 1725 uint16_t bss_filter_matched_multicast_pkts; ///< BSSID & multicast filter matched packets count 1726 } sl_si91x_async_stats_response_t; 1727 1728 /// Si917 specific Wi-Fi advance statistics 1729 typedef struct { 1730 uint32_t beacon_lost_count; ///< Number of missed beacons 1731 uint32_t beacon_rx_count; ///< Number of received beacons 1732 uint32_t mcast_rx_count; ///< Multicast packets received 1733 uint32_t mcast_tx_count; ///< Multicast packets transmitted 1734 uint32_t ucast_rx_count; ///< Unicast packets received 1735 uint32_t ucast_tx_count; ///< Unicast packets transmitted 1736 uint32_t 1737 overrun_count; ///< Number of packets dropped either at ingress or egress, due to lack of buffer memory to retain all packets. 1738 } sl_si91x_advance_stats_response_t; 1739 /** @} */ 1740 1741 /// Debug log structure 1742 typedef struct { 1743 uint32_t assertion_type; ///< Assertion type. It must be in the range of 0 to 15 (both included). 1744 uint32_t assertion_level; ///< Assertion level. It must be in the range of 0 to 15 (both included). 1745 } sl_si91x_debug_log_t; 1746 1747 //! @cond Doxygen_Suppress 1748 #ifdef SL_SI91X_SIDE_BAND_CRYPTO 1749 typedef struct crypto_key_s { 1750 uint32_t key_slot; ///< For built-in key 1751 uint32_t wrap_iv_mode; ///< IV mode 0-> ECB; 1-> CBC 1752 uint8_t wrap_iv[16]; ///< IV for CBC mode 1753 uint8_t key_buffer[32]; ///< Key data wrapped/ Plain text 1754 } sl_si91x_crypto_key_t; 1755 1756 typedef struct { 1757 uint32_t key_size; 1758 sl_si91x_crypto_key_t key_spec; 1759 } sl_si91x_key_info_t; 1760 1761 typedef struct { 1762 uint32_t key_type; 1763 uint32_t reserved; 1764 sl_si91x_key_info_t key_detail; 1765 } sl_si91x_key_descriptor_t; 1766 1767 typedef struct { 1768 uint8_t algorithm_type; 1769 uint8_t algorithm_sub_type; 1770 uint16_t total_msg_length; 1771 uint16_t encrypt_decryption; 1772 uint16_t output_length; 1773 sl_si91x_key_descriptor_t key_info; 1774 uint8_t *IV; 1775 uint8_t *msg; 1776 uint8_t *output; 1777 } sl_si91x_aes_request_t; 1778 1779 typedef struct { 1780 uint32_t key_type; 1781 uint16_t padding; 1782 uint16_t hmac_sha_mode; 1783 uint32_t key_size; 1784 uint32_t wrap_iv_mode; 1785 uint8_t *wrap_iv; 1786 uint8_t *key_buffer; 1787 } sl_si91x_wrap_key_descriptor_t; 1788 1789 typedef struct { 1790 uint16_t algorithm_type; 1791 uint16_t output_length; 1792 sl_si91x_wrap_key_descriptor_t key_info; 1793 uint8_t *output; 1794 } sl_si91x_wrap_request_t; 1795 1796 typedef struct { 1797 uint16_t algorithm_type; 1798 uint16_t algorithm_sub_type; 1799 uint16_t total_length; 1800 uint16_t output_length; 1801 sl_si91x_key_descriptor_t key_info; 1802 uint8_t *hmac_data; 1803 uint8_t *output; 1804 } sl_si91x_hmac_sha_request_t; 1805 1806 typedef struct { 1807 uint16_t algorithm_type; 1808 uint16_t algorithm_sub_type; 1809 uint16_t total_msg_length; 1810 uint16_t output_length; 1811 uint8_t *msg; 1812 uint8_t *output; 1813 } sl_si91x_sha_request_t; 1814 1815 typedef struct { 1816 uint8_t algorithm_type; 1817 uint8_t nonce_length; 1818 uint16_t encrypt_decryption; 1819 uint16_t total_msg_length; 1820 uint16_t ad_length; 1821 uint16_t tag_length; 1822 uint16_t output_length; 1823 sl_si91x_key_descriptor_t key_info; 1824 uint8_t *nonce; 1825 uint8_t *ad; 1826 uint8_t *tag; // tag size = 16 1827 uint8_t *msg; 1828 uint8_t *output; 1829 } sl_si91x_ccm_request_t; 1830 1831 typedef struct { 1832 uint8_t algorithm_type; 1833 uint8_t dma_use; 1834 uint8_t gcm_mode; 1835 uint8_t encrypt_decryption; 1836 uint16_t total_msg_length; 1837 uint16_t ad_length; 1838 uint32_t output_length; 1839 sl_si91x_key_descriptor_t key_info; 1840 uint8_t *nonce; // iv length = 12 bytes 1841 uint8_t *ad; 1842 uint8_t *msg; 1843 uint8_t *output; 1844 } sl_si91x_gcm_request_t; 1845 1846 typedef struct { 1847 uint8_t algorithm_type; 1848 uint8_t algorithm_sub_type; 1849 uint8_t encrypt_decryption; 1850 uint8_t dma_use; 1851 uint16_t total_msg_length; 1852 uint16_t header_length; 1853 uint32_t output_length; 1854 uint8_t *nonce; 1855 sl_si91x_key_descriptor_t key_info; 1856 uint8_t *header_input; 1857 uint8_t *msg; 1858 uint8_t *output; 1859 } sl_si91x_chachapoly_request_t; 1860 1861 typedef struct { 1862 uint8_t algorithm_type; 1863 uint8_t ecdh_mode; 1864 uint8_t ecdh_sub_mode; 1865 uint8_t *sx; 1866 uint8_t *sy; 1867 uint8_t *sz; 1868 uint8_t *tx; 1869 uint8_t *ty; 1870 uint8_t *tz; 1871 uint8_t *rx; 1872 uint8_t *ry; 1873 uint8_t *rz; 1874 } sl_si91x_ecdh_add_sub_request_t; 1875 1876 typedef struct { 1877 uint8_t algorithm_type; 1878 uint8_t ecdh_mode; 1879 uint8_t ecdh_sub_mode; 1880 uint8_t ecdh_curve_type; 1881 uint32_t affinity; 1882 uint8_t *d; 1883 uint8_t *sx; 1884 uint8_t *sy; 1885 uint8_t *sz; 1886 uint8_t *rx; 1887 uint8_t *ry; 1888 uint8_t *rz; 1889 } sl_si91x_ecdh_mul_request_t; 1890 1891 typedef struct { 1892 uint8_t algorithm_type; 1893 uint8_t ecdh_mode; 1894 uint8_t ecdh_sub_mode; 1895 uint8_t *sx; 1896 uint8_t *sy; 1897 uint8_t *sz; 1898 uint8_t *rx; 1899 uint8_t *ry; 1900 uint8_t *rz; 1901 } sl_si91x_ecdh_double_request_t; 1902 1903 typedef struct { 1904 uint8_t algorithm_type; 1905 uint8_t ecdh_mode; 1906 uint8_t ecdh_sub_mode; 1907 uint8_t ecdh_curve_type; 1908 uint8_t *sx; 1909 uint8_t *sy; 1910 uint8_t *sz; 1911 uint8_t *rx; 1912 uint8_t *ry; 1913 uint8_t *rz; 1914 } sl_si91x_ecdh_affine_request_t; 1915 1916 /// Si91x Specific TRNG request 1917 typedef struct { 1918 uint8_t algorithm_type; ///< Algorithm type 1919 uint8_t algorithm_sub_type; ///< Algorithm sub type 1920 uint16_t total_msg_length; ///< Total message length 1921 uint8_t *trng_key; ///< TRNG key 1922 uint8_t *msg; ///< Message 1923 uint8_t *output; ///< Output 1924 } sl_si91x_trng_request_t; 1925 1926 /// Attestation token Request Frames Structures 1927 typedef struct { 1928 uint16_t algorithm_type; ///< Algorithm type 1929 uint16_t total_msg_length; ///< Total message length 1930 uint32_t *msg; ///< Message 1931 uint8_t *token_buf; ///< Token buffer 1932 } sl_si91x_rsi_token_req_t; 1933 #else 1934 typedef struct crypto_key_s { 1935 uint32_t key_slot; ///< For built-in key 1936 uint32_t wrap_iv_mode; ///< IV mode 0-> ECB; 1-> CBC 1937 uint8_t wrap_iv[16]; ///< IV for CBC mode 1938 uint8_t key_buffer[32]; ///< Key data wrapped/ Plain text 1939 } sl_si91x_crypto_key_t; 1940 1941 typedef struct { 1942 uint32_t key_size; 1943 sl_si91x_crypto_key_t key_spec; 1944 } sl_si91x_key_info_t; 1945 1946 typedef struct { 1947 uint32_t key_type; 1948 uint32_t reserved; 1949 sl_si91x_key_info_t key_detail; 1950 } sl_si91x_key_descriptor_t; 1951 1952 typedef struct { 1953 uint16_t algorithm_type; 1954 uint8_t algorithm_sub_type; 1955 uint8_t aes_flags; 1956 uint16_t total_msg_length; 1957 uint16_t current_chunk_length; 1958 uint32_t encrypt_decryption; 1959 #if defined(SLI_SI917B0) || defined(SLI_SI915) 1960 sl_si91x_key_descriptor_t key_info; 1961 #else 1962 uint32_t key_length; 1963 uint8_t key[32]; 1964 #endif 1965 uint8_t IV[16]; 1966 uint8_t msg[1400]; 1967 } sl_si91x_aes_request_t; 1968 1969 typedef struct { 1970 uint32_t key_type; 1971 uint16_t padding; 1972 uint16_t hmac_sha_mode; 1973 uint32_t key_size; 1974 uint32_t wrap_iv_mode; 1975 uint8_t wrap_iv[16]; 1976 uint8_t key_buffer[1400]; 1977 } sl_si91x_wrap_key_descriptor_t; 1978 1979 typedef struct { 1980 uint8_t algorithm_type; 1981 uint8_t wrap_flags; 1982 uint16_t current_chunk_length; 1983 sl_si91x_wrap_key_descriptor_t key_info; 1984 } sl_si91x_wrap_request_t; 1985 1986 typedef struct { 1987 uint16_t algorithm_type; 1988 uint8_t algorithm_sub_type; 1989 uint8_t hmac_sha_flags; 1990 uint16_t total_length; 1991 uint16_t current_chunk_length; 1992 #if defined(SLI_SI917B0) || defined(SLI_SI915) 1993 sl_si91x_key_descriptor_t key_info; 1994 #else 1995 uint32_t key_length; 1996 #endif 1997 uint8_t hmac_data[1400]; 1998 } sl_si91x_hmac_sha_request_t; 1999 2000 /// Si91x specific SHA request 2001 typedef struct { 2002 uint16_t algorithm_type; ///< Algorithm type 2003 uint8_t algorithm_sub_type; ///< Algorithm sub type 2004 uint8_t sha_flags; ///< SHA flags 2005 uint16_t total_msg_length; ///< Total message length 2006 uint16_t current_chunk_length; ///< Current chunk length 2007 uint8_t msg[1400]; ///< Message 2008 } sl_si91x_sha_request_t; 2009 2010 /// Si91x specific CCM request 2011 typedef struct { 2012 uint16_t algorithm_type; ///< Algorithm type 2013 uint8_t ccm_flags; ///< CCM flags 2014 uint8_t nonce_length; ///< Nonce length 2015 uint16_t encrypt_decryption; ///< Encrypt/Decrypt 2016 uint16_t total_msg_length; ///< Total message length 2017 uint16_t current_chunk_length; ///< Current chunk length 2018 uint16_t ad_length; ///< AD length 2019 uint32_t tag_length; ///< Tag length 2020 #if defined(SLI_SI917B0) || defined(SLI_SI915) 2021 sl_si91x_key_descriptor_t key_info; ///< Key info 2022 #else 2023 uint32_t key_length; ///< Key length 2024 uint8_t key[SL_SI91X_KEY_BUFFER_SIZE]; ///< Key 2025 #endif 2026 uint8_t nonce[SL_SI91X_CCM_IV_BUFF_LEN]; ///< Nonce 2027 uint8_t ad[SL_SI91X_CCM_AD_MAX_SIZE]; ///< AD 2028 uint8_t tag[SL_SI91X_TAG_SIZE]; ///< tag size = 16 2029 uint8_t msg[SL_SI91X_CCM_MSG_MAX_SIZE]; ///< max msg size = 1200 bytes 2030 } sl_si91x_ccm_request_t; 2031 2032 typedef struct { 2033 uint16_t algorithm_type; 2034 uint8_t gcm_flags; 2035 uint8_t encrypt_decryption; 2036 uint16_t total_msg_length; 2037 uint16_t current_chunk_length; 2038 uint16_t ad_length; 2039 uint16_t dma_use; 2040 #if defined(SLI_SI917B0) || defined(SLI_SI915) 2041 uint32_t gcm_mode; 2042 sl_si91x_key_descriptor_t key_info; 2043 #else 2044 uint32_t key_length; 2045 uint8_t key[SL_SI91X_KEY_BUFFER_SIZE]; 2046 #endif 2047 uint8_t nonce[SL_SI91X_GCM_IV_SIZE]; // iv length = 12 bytes 2048 uint8_t ad[SL_SI91X_GCM_AD_MAX_SIZE]; 2049 uint8_t msg[SL_SI91X_GCM_MSG_MAX_SIZE]; 2050 } sl_si91x_gcm_request_t; 2051 2052 typedef struct { 2053 uint16_t algorithm_type; 2054 uint8_t algorithm_sub_type; 2055 uint8_t chachapoly_flags; 2056 uint16_t total_msg_length; 2057 uint16_t header_length; 2058 uint16_t current_chunk_length; 2059 uint16_t encrypt_decryption; 2060 uint32_t dma_use; 2061 uint8_t nonce[SL_SI91X_IV_SIZE]; 2062 #if defined(SLI_SI917B0) || defined(SLI_SI915) 2063 sl_si91x_key_descriptor_t key_info; 2064 #else 2065 uint8_t key_chacha[SL_SI91X_KEY_BUFFER_SIZE]; 2066 uint8_t keyr_in[SL_SI91X_KEYR_SIZE]; 2067 uint8_t keys_in[SL_SI91X_KEYS_SIZE]; 2068 #endif 2069 uint8_t header_input[SL_SI91X_GCM_AD_MAX_SIZE]; 2070 uint8_t msg[SL_SI91X_CHACHAPOLY_MSG_MAX_SIZE]; 2071 } sl_si91x_chachapoly_request_t; 2072 2073 typedef struct { 2074 uint8_t algorithm_type; 2075 uint8_t algorithm_sub_type; 2076 uint8_t ecdsa_flags; 2077 uint8_t curve_id; 2078 uint8_t sha_mode; 2079 uint8_t private_key_length; 2080 uint8_t public_key_length; 2081 uint8_t signature_length; 2082 uint16_t current_chunk_length; 2083 uint16_t msg_len; 2084 #if defined(SLI_SI917B0) || defined(SLI_SI915) 2085 sl_si91x_key_descriptor_t key_info; 2086 #else 2087 uint32_t key_length; 2088 #endif 2089 uint8_t private_key[SL_SI91X_PRIVATE_KEY_MAX_SIZE]; 2090 uint8_t public_key[SL_SI91X_PUBLIC_KEY_MAX_SIZE]; 2091 uint8_t signature[SL_SI91X_SIGNATURE_MAX_SIZE]; 2092 uint8_t msg[SL_SI91X_ECDSA_MSG_MAX_SIZE]; 2093 } sl_si91x_ecdsa_request_t; 2094 2095 typedef struct { 2096 uint8_t algorithm_type; 2097 uint8_t ecdh_mode; 2098 uint8_t ecdh_sub_mode; 2099 uint8_t sx[ECDH_BUFFER_SIZE]; 2100 uint8_t sy[ECDH_BUFFER_SIZE]; 2101 uint8_t sz[ECDH_BUFFER_SIZE]; 2102 uint8_t tx[ECDH_BUFFER_SIZE]; 2103 uint8_t ty[ECDH_BUFFER_SIZE]; 2104 uint8_t tz[ECDH_BUFFER_SIZE]; 2105 } sl_si91x_ecdh_add_sub_request_t; 2106 2107 typedef struct { 2108 uint8_t algorithm_type; 2109 uint8_t ecdh_mode; 2110 uint8_t ecdh_sub_mode; 2111 uint8_t ecdh_curve_type; 2112 uint32_t affinity; 2113 uint8_t d[ECDH_BUFFER_SIZE]; 2114 uint8_t sx[ECDH_BUFFER_SIZE]; 2115 uint8_t sy[ECDH_BUFFER_SIZE]; 2116 uint8_t sz[ECDH_BUFFER_SIZE]; 2117 } sl_si91x_ecdh_mul_request_t; 2118 2119 typedef struct { 2120 uint8_t algorithm_type; 2121 uint8_t ecdh_mode; 2122 uint8_t ecdh_sub_mode; 2123 uint8_t sx[ECDH_BUFFER_SIZE]; 2124 uint8_t sy[ECDH_BUFFER_SIZE]; 2125 uint8_t sz[ECDH_BUFFER_SIZE]; 2126 } sl_si91x_ecdh_double_request_t; 2127 2128 typedef struct { 2129 uint8_t algorithm_type; 2130 uint8_t ecdh_mode; 2131 uint8_t ecdh_sub_mode; 2132 uint8_t ecdh_curve_type; 2133 uint8_t sx[ECDH_BUFFER_SIZE]; 2134 uint8_t sy[ECDH_BUFFER_SIZE]; 2135 uint8_t sz[ECDH_BUFFER_SIZE]; 2136 } sl_si91x_ecdh_affine_request_t; 2137 2138 /// Si91x specific TRNG request 2139 typedef struct { 2140 uint8_t algorithm_type; ///< Algorithm type 2141 uint8_t algorithm_sub_type; ///< Algorithm sub type 2142 uint16_t total_msg_length; ///< Total message length 2143 uint32_t trng_key[TRNG_KEY_SIZE]; ///< TRNG key 2144 uint32_t msg[TRNG_TEST_DATA_SIZE]; ///< Message 2145 } sl_si91x_trng_request_t; 2146 2147 /// Attestation token Request Frames Structures 2148 typedef struct { 2149 uint8_t algorithm_type; ///< Algorithm type 2150 uint16_t total_msg_length; ///< Total message length 2151 uint32_t msg[NONCE_DATA_SIZE]; ///< Message 2152 } sl_si91x_rsi_token_req_t; 2153 2154 #endif 2155 //! @endcond 2156 2157 /// Request timeout Structure 2158 typedef struct { 2159 uint32_t timeout_bitmap; ///< Timeout bitmap 2160 uint16_t timeout_value; ///< Timeout value 2161 } sl_si91x_request_timeout_t; 2162 2163 /// High throughputs enable command 2164 typedef struct { 2165 uint16_t mode_11n_enable; ///< 11n mode enable 2166 uint16_t ht_caps_bitmap; ///< HT caps bitmap 2167 } sl_si91x_request_ap_high_throughput_capability_t; 2168