1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef __WIFI_HAL_H__ 18 #define __WIFI_HAL_H__ 19 20 #ifdef __cplusplus 21 extern "C" 22 { 23 #endif 24 #include <stdint.h> 25 26 #define IFNAMSIZ 16 27 28 /* typedefs */ 29 typedef unsigned char byte; 30 typedef unsigned char u8; 31 typedef signed char s8; 32 typedef uint16_t u16; 33 typedef uint32_t u32; 34 typedef int32_t s32; 35 typedef uint64_t u64; 36 typedef int64_t s64; 37 typedef int wifi_request_id; 38 typedef int wifi_channel; // indicates channel frequency in MHz 39 typedef int wifi_rssi; 40 typedef int wifi_radio; 41 typedef byte mac_addr[6]; 42 typedef byte oui[3]; 43 typedef int64_t wifi_timestamp; // In microseconds (us) 44 typedef int64_t wifi_timespan; // In picoseconds (ps) 45 typedef uint64_t feature_set; 46 47 /* forward declarations */ 48 struct wifi_info; 49 struct wifi_interface_info; 50 typedef struct wifi_info *wifi_handle; 51 typedef struct wifi_interface_info *wifi_interface_handle; 52 53 /* WiFi Common definitions */ 54 /* channel operating width */ 55 typedef enum { 56 WIFI_CHAN_WIDTH_20 = 0, 57 WIFI_CHAN_WIDTH_40 = 1, 58 WIFI_CHAN_WIDTH_80 = 2, 59 WIFI_CHAN_WIDTH_160 = 3, 60 WIFI_CHAN_WIDTH_80P80 = 4, 61 WIFI_CHAN_WIDTH_5 = 5, 62 WIFI_CHAN_WIDTH_10 = 6, 63 WIFI_CHAN_WIDTH_320 = 7, 64 WIFI_CHAN_WIDTH_INVALID = -1 65 } wifi_channel_width; 66 67 /* Pre selected Power scenarios to be applied from BDF file */ 68 typedef enum { 69 WIFI_POWER_SCENARIO_INVALID = -2, 70 WIFI_POWER_SCENARIO_DEFAULT = -1, 71 WIFI_POWER_SCENARIO_VOICE_CALL = 0, 72 WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF = 1, 73 WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON = 2, 74 WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF = 3, 75 WIFI_POWER_SCENARIO_ON_BODY_CELL_ON = 4, 76 WIFI_POWER_SCENARIO_ON_BODY_BT = 5, 77 WIFI_POWER_SCENARIO_ON_HEAD_HOTSPOT = 6, 78 WIFI_POWER_SCENARIO_ON_HEAD_HOTSPOT_MMW = 7, 79 WIFI_POWER_SCENARIO_ON_BODY_CELL_ON_BT = 8, 80 WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT = 9, 81 WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_BT = 10, 82 WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_MMW = 11, 83 WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_BT_MMW = 12, 84 WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF_UNFOLDED = 13, 85 WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON_UNFOLDED = 14, 86 WIFI_POWER_SCENARIO_ON_HEAD_HOTSPOT_UNFOLDED = 15, 87 WIFI_POWER_SCENARIO_ON_HEAD_HOTSPOT_MMW_UNFOLDED = 16, 88 WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF_UNFOLDED = 17, 89 WIFI_POWER_SCENARIO_ON_BODY_BT_UNFOLDED = 18, 90 WIFI_POWER_SCENARIO_ON_BODY_CELL_ON_UNFOLDED = 19, 91 WIFI_POWER_SCENARIO_ON_BODY_CELL_ON_BT_UNFOLDED = 20, 92 WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_UNFOLDED = 21, 93 WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_BT_UNFOLDED = 22, 94 WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_MMW_UNFOLDED = 23, 95 WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_BT_MMW_UNFOLDED = 24, 96 } wifi_power_scenario; 97 98 typedef enum { 99 WIFI_LATENCY_MODE_NORMAL = 0, 100 WIFI_LATENCY_MODE_LOW = 1, 101 } wifi_latency_mode; 102 103 /* Wifi Thermal mitigation modes */ 104 typedef enum { 105 WIFI_MITIGATION_NONE = 0, 106 WIFI_MITIGATION_LIGHT = 1, 107 WIFI_MITIGATION_MODERATE = 2, 108 WIFI_MITIGATION_SEVERE = 3, 109 WIFI_MITIGATION_CRITICAL = 4, 110 WIFI_MITIGATION_EMERGENCY = 5, 111 } wifi_thermal_mode; 112 113 /* 114 * Wifi voice over IP mode 115 * may add new modes later, for example, voice + video over IP mode. 116 */ 117 typedef enum { 118 WIFI_VOIP_MODE_OFF = 0, 119 WIFI_VOIP_MODE_ON = 1, 120 } wifi_voip_mode; 121 122 /* List of interface types supported */ 123 typedef enum { 124 WIFI_INTERFACE_TYPE_STA = 0, 125 WIFI_INTERFACE_TYPE_AP = 1, 126 WIFI_INTERFACE_TYPE_P2P = 2, 127 WIFI_INTERFACE_TYPE_NAN = 3, 128 } wifi_interface_type; 129 130 /* 131 * enum wlan_mac_band - Band information corresponding to the WLAN MAC. 132 */ 133 typedef enum { 134 /* WLAN MAC Operates in 2.4 GHz Band */ 135 WLAN_MAC_2_4_BAND = 1 << 0, 136 /* WLAN MAC Operates in 5 GHz Band */ 137 WLAN_MAC_5_0_BAND = 1 << 1, 138 /* WLAN MAC Operates in 6 GHz Band */ 139 WLAN_MAC_6_0_BAND = 1 << 2, 140 /* WLAN MAC Operates in 60 GHz Band */ 141 WLAN_MAC_60_0_BAND = 1 << 3, 142 } wlan_mac_band; 143 144 /* List of chre nan rtt state */ 145 typedef enum { 146 CHRE_PREEMPTED = 0, 147 CHRE_UNAVAILABLE = 1, 148 CHRE_AVAILABLE = 2, 149 } chre_nan_rtt_state; 150 151 typedef struct { 152 wifi_channel_width width; 153 int center_frequency0; 154 int center_frequency1; 155 int primary_frequency; 156 } wifi_channel_spec; 157 158 /* 159 * wifi_usable_channel specifies a channel frequency, bandwidth, and bitmask 160 * of modes allowed on the channel. 161 */ 162 typedef struct { 163 /* Channel frequency in MHz */ 164 wifi_channel freq; 165 /* Channel operating width (20, 40, 80, 160, 320 etc.) */ 166 wifi_channel_width width; 167 /* BIT MASK of BIT(WIFI_INTERFACE_*) represented by |wifi_interface_mode| 168 * Bitmask does not represent concurrency. 169 * Examples: 170 * - If a channel is usable only for STA, then only the WIFI_INTERFACE_STA 171 * bit would be set for that channel. 172 * - If 5GHz SAP is not allowed, then none of the 5GHz channels will have 173 * WIFI_INTERFACE_SOFTAP bit set. 174 * Note: TDLS bit is set only if there is a STA connection. TDLS bit is set 175 * on non-STA channels only if TDLS off channel is supported. 176 */ 177 u32 iface_mode_mask; 178 } wifi_usable_channel; 179 180 /* 181 * wifi_usable_channel_filter 182 */ 183 typedef enum { 184 /* Filter Wifi channels that should be avoided due to cellular coex 185 * restrictions. Some Wifi channels can have extreme interference 186 * from/to cellular due to short frequency separation with neighboring 187 * cellular channels or when there is harmonic and intermodulation 188 * interference. Channels which only have some performance degradation 189 * (e.g. power back off is sufficient to deal with coexistence issue) 190 * can be included and should not be filtered out. 191 */ 192 WIFI_USABLE_CHANNEL_FILTER_CELLULAR_COEXISTENCE = 1 << 0, 193 /* Filter channels due to concurrency state. 194 * Examples: 195 * - 5GHz SAP operation may be supported in standalone mode, but if 196 * there is STA connection on 5GHz DFS channel, none of the 5GHz 197 * channels are usable for SAP if device does not support DFS SAP mode. 198 * - P2P GO may not be supported on indoor channels in EU during 199 * standalone mode but if there is a STA connection on indoor channel, 200 * P2P GO may be supported by some vendors on the same STA channel. 201 */ 202 WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY = 1 << 1, 203 /* This Filter queries Wifi channels and bands that are supported for 204 * NAN3.1 Instant communication mode. This filter should only be applied to NAN interface. 205 * If 5G is supported default discovery channel 149/44 is considered, 206 * If 5G is not supported then channel 6 has to be considered. 207 * Based on regulatory domain if channel 149 and 44 are restricted, channel 6 should 208 * be considered for instant communication channel 209 */ 210 WIFI_USABLE_CHANNEL_FILTER_NAN_INSTANT_MODE = 1 << 2, 211 } wifi_usable_channel_filter; 212 213 typedef enum { 214 WIFI_SUCCESS = 0, 215 WIFI_ERROR_NONE = 0, 216 WIFI_ERROR_UNKNOWN = -1, 217 WIFI_ERROR_UNINITIALIZED = -2, 218 WIFI_ERROR_NOT_SUPPORTED = -3, 219 WIFI_ERROR_NOT_AVAILABLE = -4, // Not available right now, but try later 220 WIFI_ERROR_INVALID_ARGS = -5, 221 WIFI_ERROR_INVALID_REQUEST_ID = -6, 222 WIFI_ERROR_TIMED_OUT = -7, 223 WIFI_ERROR_TOO_MANY_REQUESTS = -8, // Too many instances of this request 224 WIFI_ERROR_OUT_OF_MEMORY = -9, 225 WIFI_ERROR_BUSY = -10, 226 } wifi_error; 227 228 typedef enum { 229 WIFI_ACCESS_CATEGORY_BEST_EFFORT = 0, 230 WIFI_ACCESS_CATEGORY_BACKGROUND = 1, 231 WIFI_ACCESS_CATEGORY_VIDEO = 2, 232 WIFI_ACCESS_CATEGORY_VOICE = 3 233 } wifi_access_category; 234 235 /* Antenna configuration */ 236 typedef enum { 237 WIFI_ANTENNA_UNSPECIFIED = 0, 238 WIFI_ANTENNA_1X1 = 1, 239 WIFI_ANTENNA_2X2 = 2, 240 WIFI_ANTENNA_3X3 = 3, 241 WIFI_ANTENNA_4X4 = 4, 242 } wifi_antenna_configuration; 243 244 /* Wifi Radio configuration */ 245 typedef struct { 246 /* Operating band */ 247 wlan_mac_band band; 248 /* Antenna configuration */ 249 wifi_antenna_configuration antenna_cfg; 250 } wifi_radio_configuration; 251 252 /* WiFi Radio Combination */ 253 typedef struct { 254 u32 num_radio_configurations; 255 wifi_radio_configuration radio_configurations[]; 256 } wifi_radio_combination; 257 258 /* WiFi Radio combinations matrix */ 259 /* For Example in case of a chip which has two radios, where one radio is 260 * capable of 2.4GHz 2X2 only and another radio which is capable of either 261 * 5GHz or 6GHz 2X2, number of possible radio combinations in this case 262 * are 5 and possible combinations are 263 * {{{2G 2X2}}, //Standalone 2G 264 * {{5G 2X2}}, //Standalone 5G 265 * {{6G 2X2}}, //Standalone 6G 266 * {{2G 2X2}, {5G 2X2}}, //2G+5G DBS 267 * {{2G 2X2}, {6G 2X2}}} //2G+6G DBS 268 * Note: Since this chip doesn’t support 5G+6G simultaneous operation 269 * as there is only one radio which can support both, So it can only 270 * do MCC 5G+6G. This table should not get populated with possible MCC 271 * configurations. This is only for simultaneous radio configurations 272 * (such as Standalone, multi band simultaneous or single band simultaneous). 273 */ 274 typedef struct { 275 u32 num_radio_combinations; 276 /* Each row represents possible radio combinations */ 277 wifi_radio_combination radio_combinations[]; 278 } wifi_radio_combination_matrix; 279 280 /* Initialize/Cleanup */ 281 282 wifi_error wifi_initialize(wifi_handle *handle); 283 284 /** 285 * wifi_wait_for_driver 286 * Function should block until the driver is ready to proceed. 287 * Any errors from this function is considered fatal & will fail the HAL startup sequence. 288 * 289 * on success returns WIFI_SUCCESS 290 * on failure returns WIFI_ERROR_TIMED_OUT 291 */ 292 wifi_error wifi_wait_for_driver_ready(void); 293 294 typedef void (*wifi_cleaned_up_handler) (wifi_handle handle); 295 void wifi_cleanup(wifi_handle handle, wifi_cleaned_up_handler handler); 296 void wifi_event_loop(wifi_handle handle); 297 298 /* Error handling */ 299 void wifi_get_error_info(wifi_error err, const char **msg); // return a pointer to a static string 300 301 /* Feature enums */ 302 #define WIFI_FEATURE_INFRA (uint64_t)0x1 // Basic infrastructure mode 303 #define WIFI_FEATURE_INFRA_5G (uint64_t)0x2 // Support for 5 GHz Band 304 #define WIFI_FEATURE_HOTSPOT (uint64_t)0x4 // Support for GAS/ANQP 305 #define WIFI_FEATURE_P2P (uint64_t)0x8 // Wifi-Direct 306 #define WIFI_FEATURE_SOFT_AP (uint64_t)0x10 // Soft AP 307 #define WIFI_FEATURE_GSCAN (uint64_t)0x20 // Google-Scan APIs 308 #define WIFI_FEATURE_NAN (uint64_t)0x40 // Neighbor Awareness Networking 309 #define WIFI_FEATURE_D2D_RTT (uint64_t)0x80 // Device-to-device RTT 310 #define WIFI_FEATURE_D2AP_RTT (uint64_t)0x100 // Device-to-AP RTT 311 #define WIFI_FEATURE_BATCH_SCAN (uint64_t)0x200 // Batched Scan (legacy) 312 #define WIFI_FEATURE_PNO (uint64_t)0x400 // Preferred network offload 313 #define WIFI_FEATURE_ADDITIONAL_STA (uint64_t)0x800 // Support for two STAs 314 #define WIFI_FEATURE_TDLS (uint64_t)0x1000 // Tunnel directed link setup 315 #define WIFI_FEATURE_TDLS_OFFCHANNEL (uint64_t)0x2000 // Support for TDLS off channel 316 #define WIFI_FEATURE_EPR (uint64_t)0x4000 // Enhanced power reporting 317 #define WIFI_FEATURE_AP_STA (uint64_t)0x8000 // Support for AP STA Concurrency 318 #define WIFI_FEATURE_LINK_LAYER_STATS (uint64_t)0x10000 // Link layer stats collection 319 #define WIFI_FEATURE_LOGGER (uint64_t)0x20000 // WiFi Logger 320 #define WIFI_FEATURE_HAL_EPNO (uint64_t)0x40000 // WiFi PNO enhanced 321 #define WIFI_FEATURE_RSSI_MONITOR (uint64_t)0x80000 // RSSI Monitor 322 #define WIFI_FEATURE_MKEEP_ALIVE (uint64_t)0x100000 // WiFi mkeep_alive 323 #define WIFI_FEATURE_CONFIG_NDO (uint64_t)0x200000 // ND offload configure 324 #define WIFI_FEATURE_TX_TRANSMIT_POWER (uint64_t)0x400000 // Capture Tx transmit power levels 325 #define WIFI_FEATURE_CONTROL_ROAMING (uint64_t)0x800000 // Enable/Disable firmware roaming 326 #define WIFI_FEATURE_IE_WHITELIST (uint64_t)0x1000000 // Support Probe IE white listing 327 #define WIFI_FEATURE_SCAN_RAND (uint64_t)0x2000000 // Support MAC & Probe Sequence Number randomization 328 #define WIFI_FEATURE_SET_TX_POWER_LIMIT (uint64_t)0x4000000 // Support Tx Power Limit setting 329 #define WIFI_FEATURE_USE_BODY_HEAD_SAR (uint64_t)0x8000000 // Support Using Body/Head Proximity for SAR 330 #define WIFI_FEATURE_DYNAMIC_SET_MAC (uint64_t)0x10000000 // Support changing MAC address without iface reset(down and up) 331 #define WIFI_FEATURE_SET_LATENCY_MODE (uint64_t)0x40000000 // Support Latency mode setting 332 #define WIFI_FEATURE_P2P_RAND_MAC (uint64_t)0x80000000 // Support P2P MAC randomization 333 #define WIFI_FEATURE_INFRA_60G (uint64_t)0x100000000 // Support for 60GHz Band 334 // Add more features here 335 336 #define IS_MASK_SET(mask, flags) (((flags) & (mask)) == (mask)) 337 338 #define IS_SUPPORTED_FEATURE(feature, featureSet) IS_MASK_SET(feature, featureSet) 339 340 /* Feature set */ 341 wifi_error wifi_get_supported_feature_set(wifi_interface_handle handle, feature_set *set); 342 343 /* 344 * Each row represents a valid feature combination; 345 * all other combinations are invalid! 346 */ 347 wifi_error wifi_get_concurrency_matrix(wifi_interface_handle handle, int set_size_max, 348 feature_set set[], int *set_size); 349 350 /* multiple interface support */ 351 352 wifi_error wifi_get_ifaces(wifi_handle handle, int *num_ifaces, wifi_interface_handle **ifaces); 353 wifi_error wifi_get_iface_name(wifi_interface_handle iface, char *name, size_t size); 354 wifi_interface_handle wifi_get_iface_handle(wifi_handle handle, char *name); 355 356 /* STA + STA support - Supported if WIFI_FEATURE_ADDITIONAL_STA is set */ 357 358 /** 359 * Invoked to indicate that the provided iface is the primary STA iface when there are more 360 * than 1 STA iface concurrently active. 361 * 362 * Note: If the wifi firmware/chip cannot support multiple instances of any offload 363 * (like roaming, APF, rssi threshold, etc), the firmware should ensure that these 364 * offloads are at least enabled for the primary interface. If the new primary interface is 365 * already connected to a network, the firmware must switch all the offloads on 366 * this new interface without disconnecting. 367 */ 368 wifi_error wifi_multi_sta_set_primary_connection(wifi_handle handle, wifi_interface_handle iface); 369 370 /** 371 * When there are 2 or more simultaneous STA connections, this use case hint indicates what 372 * use-case is being enabled by the framework. This use case hint can be used by the firmware 373 * to modify various firmware configurations like: 374 * - Allowed BSSIDs the firmware can choose for the initial connection/roaming attempts. 375 * - Duty cycle to choose for the 2 STA connections if the radio is in MCC mode. 376 * - Whether roaming, APF and other offloads needs to be enabled or not. 377 * 378 * Note: 379 * - This will be invoked before an active wifi connection is established on the second interface. 380 * - This use-case hint is implicitly void when the second STA interface is brought down. 381 */ 382 typedef enum { 383 /** 384 * Usage: 385 * - This will be sent down for make before break use-case. 386 * - Platform is trying to speculatively connect to a second network and evaluate it without 387 * disrupting the primary connection. 388 * 389 * Requirements for Firmware: 390 * - Do not reduce the number of tx/rx chains of primary connection. 391 * - If using MCC, should set the MCC duty cycle of the primary connection to be higher than 392 * the secondary connection (maybe 70/30 split). 393 * - Should pick the best BSSID for the secondary STA (disregard the chip mode) independent of 394 * the primary STA: 395 * - Don’t optimize for DBS vs MCC/SCC 396 * - Should not impact the primary connection’s bssid selection: 397 * - Don’t downgrade chains of the existing primary connection. 398 * - Don’t optimize for DBS vs MCC/SCC. 399 */ 400 WIFI_DUAL_STA_TRANSIENT_PREFER_PRIMARY = 0, 401 /** 402 * Usage: 403 * - This will be sent down for any app requested peer to peer connections. 404 * - In this case, both the connections needs to be allocated equal resources. 405 * - For the peer to peer use case, BSSID for the secondary connection will be chosen by the 406 * framework. 407 * 408 * Requirements for Firmware: 409 * - Can choose MCC or DBS mode depending on the MCC efficiency and HW capability. 410 * - If using MCC, set the MCC duty cycle of the primary connection to be equal to the secondary 411 * connection. 412 * - Prefer BSSID candidates which will help provide the best "overall" performance for both the 413 * connections. 414 */ 415 WIFI_DUAL_STA_NON_TRANSIENT_UNBIASED = 1 416 } wifi_multi_sta_use_case; 417 418 wifi_error wifi_multi_sta_set_use_case(wifi_handle handle, wifi_multi_sta_use_case use_case); 419 420 /* Configuration events */ 421 422 typedef struct { 423 void (*on_country_code_changed)(char code[2]); // We can get this from supplicant too 424 425 // More event handlers 426 } wifi_event_handler; 427 428 typedef struct { 429 char iface_name[IFNAMSIZ + 1]; 430 wifi_channel channel; 431 } wifi_iface_info; 432 433 typedef struct { 434 u32 wlan_mac_id; 435 /* BIT MASK of BIT(WLAN_MAC*) as represented by wlan_mac_band */ 436 u32 mac_band; 437 /* Represents the connected Wi-Fi interfaces associated with each MAC */ 438 int num_iface; 439 wifi_iface_info *iface_info; 440 } wifi_mac_info; 441 442 typedef struct { 443 void (*on_radio_mode_change)(wifi_request_id id, unsigned num_mac, 444 wifi_mac_info *mac_info); 445 } wifi_radio_mode_change_handler; 446 447 typedef struct { 448 void (*on_rssi_threshold_breached)(wifi_request_id id, u8 *cur_bssid, s8 cur_rssi); 449 } wifi_rssi_event_handler; 450 451 typedef struct { 452 void (*on_subsystem_restart)(const char* error); 453 } wifi_subsystem_restart_handler; 454 455 typedef struct { 456 void (*on_chre_nan_rtt_change)(chre_nan_rtt_state state); 457 } wifi_chre_handler; 458 459 wifi_error wifi_set_iface_event_handler(wifi_request_id id, wifi_interface_handle iface, wifi_event_handler eh); 460 wifi_error wifi_reset_iface_event_handler(wifi_request_id id, wifi_interface_handle iface); 461 462 wifi_error wifi_set_nodfs_flag(wifi_interface_handle handle, u32 nodfs); 463 wifi_error wifi_select_tx_power_scenario(wifi_interface_handle handle, wifi_power_scenario scenario); 464 wifi_error wifi_reset_tx_power_scenario(wifi_interface_handle handle); 465 wifi_error wifi_set_latency_mode(wifi_interface_handle handle, wifi_latency_mode mode); 466 wifi_error wifi_map_dscp_access_category(wifi_handle handle, 467 uint32_t start, uint32_t end, 468 uint32_t access_category); 469 wifi_error wifi_reset_dscp_mapping(wifi_handle handle); 470 471 wifi_error wifi_set_subsystem_restart_handler(wifi_handle handle, 472 wifi_subsystem_restart_handler handler); 473 474 /** 475 * Wifi HAL Thermal Mitigation API 476 * 477 * wifi_handle : wifi global handle (note: this is not a interface specific 478 * command). Mitigation is expected to be applied across all active interfaces 479 * The implementation and the mitigation action mapping to each mode is chip 480 * specific. Mitigation will be active until Wifi is turned off or 481 * WIFI_MITIGATION_NONE mode is sent 482 * 483 * mode: Thermal mitigation mode 484 * WIFI_MITIGATION_NONE : Clear all Wifi thermal mitigation actions 485 * WIFI_MITIGATION_LIGHT : Light Throttling where UX is not impacted 486 * WIFI_MITIGATION_MODERATE : Moderate throttling where UX not largely impacted 487 * WIFI_MITIGATION_SEVERE : Severe throttling where UX is largely impacted 488 * WIFI_MITIGATION_CRITICAL : Platform has done everything to reduce power 489 * WIFI_MITIGATION_EMERGENCY: Key components in platform are shutting down 490 * 491 * completion_window 492 * Deadline (in milliseconds) to complete this request, value 0 implies apply 493 * immediately. Deadline is basically a relaxed limit and allows vendors to 494 * apply the mitigation within the window (if it cannot apply immediately) 495 * 496 * Return 497 * WIFI_ERROR_NOT_SUPPORTED : Chip does not support thermal mitigation 498 * WIFI_ERROR_BUSY : Mitigation is supported, but retry later 499 * WIFI_ERROR_NONE : Mitigation request has been accepted 500 */ 501 wifi_error wifi_set_thermal_mitigation_mode(wifi_handle handle, 502 wifi_thermal_mode mode, 503 u32 completion_window); 504 505 506 typedef struct rx_data_cnt_details_t { 507 int rx_unicast_cnt; /*Total rx unicast packet which woke up host */ 508 int rx_multicast_cnt; /*Total rx multicast packet which woke up host */ 509 int rx_broadcast_cnt; /*Total rx broadcast packet which woke up host */ 510 } RX_DATA_WAKE_CNT_DETAILS; 511 512 typedef struct rx_wake_pkt_type_classification_t { 513 int icmp_pkt; /*wake icmp packet count */ 514 int icmp6_pkt; /*wake icmp6 packet count */ 515 int icmp6_ra; /*wake icmp6 RA packet count */ 516 int icmp6_na; /*wake icmp6 NA packet count */ 517 int icmp6_ns; /*wake icmp6 NS packet count */ 518 //ToDo: Any more interesting classification to add? 519 } RX_WAKE_PKT_TYPE_CLASSFICATION; 520 521 typedef struct rx_multicast_cnt_t{ 522 int ipv4_rx_multicast_addr_cnt; /*Rx wake packet was ipv4 multicast */ 523 int ipv6_rx_multicast_addr_cnt; /*Rx wake packet was ipv6 multicast */ 524 int other_rx_multicast_addr_cnt;/*Rx wake packet was non-ipv4 and non-ipv6*/ 525 } RX_MULTICAST_WAKE_DATA_CNT; 526 527 /* 528 * Structure holding all the driver/firmware wake count reasons. 529 * 530 * Buffers for the array fields (cmd_event_wake_cnt/driver_fw_local_wake_cnt) 531 * are allocated and freed by the framework. The size of each allocated 532 * array is indicated by the corresponding |_cnt| field. HAL needs to fill in 533 * the corresponding |_used| field to indicate the number of elements used in 534 * the array. 535 */ 536 typedef struct wlan_driver_wake_reason_cnt_t { 537 int total_cmd_event_wake; /* Total count of cmd event wakes */ 538 int *cmd_event_wake_cnt; /* Individual wake count array, each index a reason */ 539 int cmd_event_wake_cnt_sz; /* Max number of cmd event wake reasons */ 540 int cmd_event_wake_cnt_used; /* Number of cmd event wake reasons specific to the driver */ 541 542 int total_driver_fw_local_wake; /* Total count of drive/fw wakes, for local reasons */ 543 int *driver_fw_local_wake_cnt; /* Individual wake count array, each index a reason */ 544 int driver_fw_local_wake_cnt_sz; /* Max number of local driver/fw wake reasons */ 545 int driver_fw_local_wake_cnt_used; /* Number of local driver/fw wake reasons specific to the driver */ 546 547 int total_rx_data_wake; /* total data rx packets, that woke up host */ 548 RX_DATA_WAKE_CNT_DETAILS rx_wake_details; 549 RX_WAKE_PKT_TYPE_CLASSFICATION rx_wake_pkt_classification_info; 550 RX_MULTICAST_WAKE_DATA_CNT rx_multicast_wake_pkt_info; 551 } WLAN_DRIVER_WAKE_REASON_CNT; 552 553 /* Wi-Fi coex channel avoidance support */ 554 555 #define WIFI_COEX_NO_POWER_CAP (int32_t)0x7FFFFFF 556 557 typedef enum { 558 WIFI_AWARE = 1 << 0, 559 SOFTAP = 1 << 1, 560 WIFI_DIRECT = 1 << 2 561 } wifi_coex_restriction; 562 563 /** 564 * Representation of a Wi-Fi channel to be avoided for Wi-Fi coex channel avoidance. 565 * 566 * band is represented as an WLAN_MAC* enum value defined in wlan_mac_band. 567 * If power_cap_dbm is WIFI_COEX_NO_POWER_CAP, then no power cap should be applied if the specified 568 * channel is used. 569 */ 570 typedef struct { 571 wlan_mac_band band; 572 u32 channel; 573 s32 power_cap_dbm; 574 } wifi_coex_unsafe_channel; 575 576 577 /* include various feature headers */ 578 579 #include "gscan.h" 580 #include "link_layer_stats.h" 581 #include "rtt.h" 582 #include "tdls.h" 583 #include "wifi_logger.h" 584 #include "wifi_config.h" 585 #include "wifi_nan.h" 586 #include "wifi_offload.h" 587 #include "roam.h" 588 #include "wifi_twt.h" 589 590 //wifi HAL function pointer table 591 typedef struct { 592 wifi_error (* wifi_initialize) (wifi_handle *); 593 wifi_error (* wifi_wait_for_driver_ready) (void); 594 void (* wifi_cleanup) (wifi_handle, wifi_cleaned_up_handler); 595 void (*wifi_event_loop)(wifi_handle); 596 void (* wifi_get_error_info) (wifi_error , const char **); 597 wifi_error (* wifi_get_supported_feature_set) (wifi_interface_handle, feature_set *); 598 wifi_error (* wifi_get_concurrency_matrix) (wifi_interface_handle, int, feature_set *, int *); 599 wifi_error (* wifi_set_scanning_mac_oui) (wifi_interface_handle, unsigned char *); 600 wifi_error (* wifi_get_supported_channels)(wifi_handle, int *, wifi_channel *); 601 wifi_error (* wifi_is_epr_supported)(wifi_handle); 602 wifi_error (* wifi_get_ifaces) (wifi_handle , int *, wifi_interface_handle **); 603 wifi_error (* wifi_get_iface_name) (wifi_interface_handle, char *name, size_t); 604 wifi_error (* wifi_set_iface_event_handler) (wifi_request_id,wifi_interface_handle , 605 wifi_event_handler); 606 wifi_error (* wifi_reset_iface_event_handler) (wifi_request_id, wifi_interface_handle); 607 wifi_error (* wifi_start_gscan) (wifi_request_id, wifi_interface_handle, wifi_scan_cmd_params, 608 wifi_scan_result_handler); 609 wifi_error (* wifi_stop_gscan)(wifi_request_id, wifi_interface_handle); 610 wifi_error (* wifi_get_cached_gscan_results)(wifi_interface_handle, byte, int, 611 wifi_cached_scan_results *, int *); 612 wifi_error (* wifi_set_bssid_hotlist)(wifi_request_id, wifi_interface_handle, 613 wifi_bssid_hotlist_params, wifi_hotlist_ap_found_handler); 614 wifi_error (* wifi_reset_bssid_hotlist)(wifi_request_id, wifi_interface_handle); 615 wifi_error (* wifi_set_significant_change_handler)(wifi_request_id, wifi_interface_handle, 616 wifi_significant_change_params, wifi_significant_change_handler); 617 wifi_error (* wifi_reset_significant_change_handler)(wifi_request_id, wifi_interface_handle); 618 wifi_error (* wifi_get_gscan_capabilities)(wifi_interface_handle, wifi_gscan_capabilities *); 619 wifi_error (* wifi_set_link_stats) (wifi_interface_handle, wifi_link_layer_params); 620 wifi_error (* wifi_get_link_stats) (wifi_request_id,wifi_interface_handle, 621 wifi_stats_result_handler); 622 wifi_error (* wifi_clear_link_stats)(wifi_interface_handle,u32, u32 *, u8, u8 *); 623 wifi_error (* wifi_get_valid_channels)(wifi_interface_handle,int, int, wifi_channel *, int *); 624 wifi_error (* wifi_rtt_range_request)(wifi_request_id, wifi_interface_handle, unsigned, 625 wifi_rtt_config[], wifi_rtt_event_handler); 626 wifi_error (* wifi_rtt_range_cancel)(wifi_request_id, wifi_interface_handle, unsigned, 627 mac_addr[]); 628 wifi_error (* wifi_get_rtt_capabilities)(wifi_interface_handle, wifi_rtt_capabilities *); 629 wifi_error (* wifi_rtt_get_responder_info)(wifi_interface_handle iface, 630 wifi_rtt_responder *responder_info); 631 wifi_error (* wifi_enable_responder)(wifi_request_id id, wifi_interface_handle iface, 632 wifi_channel_info channel_hint, unsigned max_duration_seconds, 633 wifi_rtt_responder *responder_info); 634 wifi_error (* wifi_disable_responder)(wifi_request_id id, wifi_interface_handle iface); 635 wifi_error (* wifi_set_nodfs_flag)(wifi_interface_handle, u32); 636 wifi_error (* wifi_start_logging)(wifi_interface_handle, u32, u32, u32, u32, char *); 637 wifi_error (* wifi_set_epno_list)(wifi_request_id, wifi_interface_handle, 638 const wifi_epno_params *, wifi_epno_handler); 639 wifi_error (* wifi_reset_epno_list)(wifi_request_id, wifi_interface_handle); 640 wifi_error (* wifi_set_country_code)(wifi_interface_handle, const char *); 641 wifi_error (* wifi_get_firmware_memory_dump)( wifi_interface_handle iface, 642 wifi_firmware_memory_dump_handler handler); 643 wifi_error (* wifi_set_log_handler)(wifi_request_id id, wifi_interface_handle iface, 644 wifi_ring_buffer_data_handler handler); 645 wifi_error (* wifi_reset_log_handler)(wifi_request_id id, wifi_interface_handle iface); 646 wifi_error (* wifi_set_alert_handler)(wifi_request_id id, wifi_interface_handle iface, 647 wifi_alert_handler handler); 648 wifi_error (* wifi_reset_alert_handler)(wifi_request_id id, wifi_interface_handle iface); 649 wifi_error (* wifi_get_firmware_version)(wifi_interface_handle iface, char *buffer, 650 int buffer_size); 651 wifi_error (* wifi_get_ring_buffers_status)(wifi_interface_handle iface, 652 u32 *num_rings, wifi_ring_buffer_status *status); 653 wifi_error (* wifi_get_logger_supported_feature_set)(wifi_interface_handle iface, 654 unsigned int *support); 655 wifi_error (* wifi_get_ring_data)(wifi_interface_handle iface, char *ring_name); 656 wifi_error (* wifi_enable_tdls)(wifi_interface_handle, mac_addr, wifi_tdls_params *, 657 wifi_tdls_handler); 658 wifi_error (* wifi_disable_tdls)(wifi_interface_handle, mac_addr); 659 wifi_error (*wifi_get_tdls_status) (wifi_interface_handle, mac_addr, wifi_tdls_status *); 660 wifi_error (*wifi_get_tdls_capabilities)(wifi_interface_handle iface, 661 wifi_tdls_capabilities *capabilities); 662 wifi_error (* wifi_get_driver_version)(wifi_interface_handle iface, char *buffer, 663 int buffer_size); 664 wifi_error (* wifi_set_passpoint_list)(wifi_request_id id, wifi_interface_handle iface, 665 int num, wifi_passpoint_network *networks, wifi_passpoint_event_handler handler); 666 wifi_error (* wifi_reset_passpoint_list)(wifi_request_id id, wifi_interface_handle iface); 667 wifi_error (*wifi_set_lci) (wifi_request_id id, wifi_interface_handle iface, 668 wifi_lci_information *lci); 669 wifi_error (*wifi_set_lcr) (wifi_request_id id, wifi_interface_handle iface, 670 wifi_lcr_information *lcr); 671 wifi_error (*wifi_start_sending_offloaded_packet)(wifi_request_id id, 672 wifi_interface_handle iface, u16 ether_type, u8 *ip_packet, 673 u16 ip_packet_len, u8 *src_mac_addr, u8 *dst_mac_addr, 674 u32 period_msec); 675 wifi_error (*wifi_stop_sending_offloaded_packet)(wifi_request_id id, 676 wifi_interface_handle iface); 677 wifi_error (*wifi_start_rssi_monitoring)(wifi_request_id id, wifi_interface_handle 678 iface, s8 max_rssi, s8 min_rssi, wifi_rssi_event_handler eh); 679 wifi_error (*wifi_stop_rssi_monitoring)(wifi_request_id id, wifi_interface_handle iface); 680 wifi_error (*wifi_get_wake_reason_stats)(wifi_interface_handle iface, 681 WLAN_DRIVER_WAKE_REASON_CNT *wifi_wake_reason_cnt); 682 wifi_error (*wifi_configure_nd_offload)(wifi_interface_handle iface, u8 enable); 683 wifi_error (*wifi_get_driver_memory_dump)(wifi_interface_handle iface, 684 wifi_driver_memory_dump_callbacks callbacks); 685 wifi_error (*wifi_start_pkt_fate_monitoring)(wifi_interface_handle iface); 686 wifi_error (*wifi_get_tx_pkt_fates)(wifi_interface_handle handle, 687 wifi_tx_report *tx_report_bufs, 688 size_t n_requested_fates, 689 size_t *n_provided_fates); 690 wifi_error (*wifi_get_rx_pkt_fates)(wifi_interface_handle handle, 691 wifi_rx_report *rx_report_bufs, 692 size_t n_requested_fates, 693 size_t *n_provided_fates); 694 695 /* NAN functions */ 696 wifi_error (*wifi_nan_enable_request)(transaction_id id, 697 wifi_interface_handle iface, 698 NanEnableRequest* msg); 699 wifi_error (*wifi_nan_disable_request)(transaction_id id, 700 wifi_interface_handle iface); 701 wifi_error (*wifi_nan_publish_request)(transaction_id id, 702 wifi_interface_handle iface, 703 NanPublishRequest* msg); 704 wifi_error (*wifi_nan_publish_cancel_request)(transaction_id id, 705 wifi_interface_handle iface, 706 NanPublishCancelRequest* msg); 707 wifi_error (*wifi_nan_subscribe_request)(transaction_id id, 708 wifi_interface_handle iface, 709 NanSubscribeRequest* msg); 710 wifi_error (*wifi_nan_subscribe_cancel_request)(transaction_id id, 711 wifi_interface_handle iface, 712 NanSubscribeCancelRequest* msg); 713 wifi_error (*wifi_nan_transmit_followup_request)(transaction_id id, 714 wifi_interface_handle iface, 715 NanTransmitFollowupRequest* msg); 716 wifi_error (*wifi_nan_stats_request)(transaction_id id, 717 wifi_interface_handle iface, 718 NanStatsRequest* msg); 719 wifi_error (*wifi_nan_config_request)(transaction_id id, 720 wifi_interface_handle iface, 721 NanConfigRequest* msg); 722 wifi_error (*wifi_nan_tca_request)(transaction_id id, 723 wifi_interface_handle iface, 724 NanTCARequest* msg); 725 wifi_error (*wifi_nan_beacon_sdf_payload_request)(transaction_id id, 726 wifi_interface_handle iface, 727 NanBeaconSdfPayloadRequest* msg); 728 wifi_error (*wifi_nan_register_handler)(wifi_interface_handle iface, 729 NanCallbackHandler handlers); 730 wifi_error (*wifi_nan_get_version)(wifi_handle handle, 731 NanVersion* version); 732 wifi_error (*wifi_nan_get_capabilities)(transaction_id id, 733 wifi_interface_handle iface); 734 wifi_error (*wifi_nan_data_interface_create)(transaction_id id, 735 wifi_interface_handle iface, 736 char *iface_name); 737 wifi_error (*wifi_nan_data_interface_delete)(transaction_id id, 738 wifi_interface_handle iface, 739 char *iface_name); 740 wifi_error (*wifi_nan_data_request_initiator)( 741 transaction_id id, wifi_interface_handle iface, 742 NanDataPathInitiatorRequest *msg); 743 wifi_error (*wifi_nan_data_indication_response)( 744 transaction_id id, wifi_interface_handle iface, 745 NanDataPathIndicationResponse *msg); 746 wifi_error (*wifi_nan_data_end)(transaction_id id, 747 wifi_interface_handle iface, 748 NanDataPathEndRequest *msg); 749 wifi_error (*wifi_select_tx_power_scenario)(wifi_interface_handle iface, 750 wifi_power_scenario scenario); 751 wifi_error (*wifi_reset_tx_power_scenario)(wifi_interface_handle iface); 752 753 /** 754 * Returns the chipset's hardware filtering capabilities: 755 * @param version pointer to version of the packet filter interpreter 756 * supported, filled in upon return. 0 indicates no support. 757 * @param max_len pointer to maximum size of the filter bytecode, filled in 758 * upon return. 759 */ 760 wifi_error (*wifi_get_packet_filter_capabilities)(wifi_interface_handle handle, 761 u32 *version, u32 *max_len); 762 /** 763 * Programs the packet filter. 764 * @param program pointer to the program byte-code. 765 * @param len length of the program byte-code. 766 */ 767 wifi_error (*wifi_set_packet_filter)(wifi_interface_handle handle, 768 const u8 *program, u32 len); 769 wifi_error (*wifi_read_packet_filter)(wifi_interface_handle handle, 770 u32 src_offset, u8 *host_dst, 771 u32 length); 772 wifi_error (*wifi_get_roaming_capabilities)(wifi_interface_handle handle, 773 wifi_roaming_capabilities *caps); 774 wifi_error (*wifi_enable_firmware_roaming)(wifi_interface_handle handle, 775 fw_roaming_state_t state); 776 wifi_error (*wifi_configure_roaming)(wifi_interface_handle handle, 777 wifi_roaming_config *roaming_config); 778 wifi_error (*wifi_set_radio_mode_change_handler)(wifi_request_id id, wifi_interface_handle 779 iface, wifi_radio_mode_change_handler eh); 780 wifi_error (*wifi_set_latency_mode)(wifi_interface_handle iface, 781 wifi_latency_mode mode); 782 wifi_error (*wifi_set_thermal_mitigation_mode)(wifi_handle handle, 783 wifi_thermal_mode mode, 784 u32 completion_window); 785 wifi_error (*wifi_map_dscp_access_category)(wifi_handle handle, 786 u32 start, u32 end, 787 u32 access_category); 788 wifi_error (*wifi_reset_dscp_mapping)(wifi_handle handle); 789 790 wifi_error (*wifi_virtual_interface_create)(wifi_handle handle, const char* ifname, 791 wifi_interface_type iface_type); 792 wifi_error (*wifi_virtual_interface_delete)(wifi_handle handle, const char* ifname); 793 794 wifi_error (*wifi_set_subsystem_restart_handler)(wifi_handle handle, 795 wifi_subsystem_restart_handler handler); 796 797 /** 798 * Allow vendor HAL to choose interface name when creating 799 * an interface. This can be implemented by chips with their 800 * own interface naming policy. 801 * If not implemented, the default naming will be used. 802 */ 803 wifi_error (*wifi_get_supported_iface_name)(wifi_handle handle, u32 iface_type, 804 char *name, size_t len); 805 806 /** 807 * Perform early initialization steps that are needed when WIFI 808 * is disabled. 809 * If the function returns failure, it means the vendor HAL is unusable 810 * (for example, if chip hardware is not installed) and no further 811 * functions should be called. 812 */ 813 wifi_error (*wifi_early_initialize)(void); 814 815 /** 816 * Get supported feature set which are chip-global, that is 817 * not dependent on any created interface. 818 */ 819 wifi_error (*wifi_get_chip_feature_set)(wifi_handle handle, feature_set *set); 820 821 /** 822 * Invoked to indicate that the provided iface is the primary STA iface when there are more 823 * than 1 STA iface concurrently active. 824 */ 825 wifi_error (*wifi_multi_sta_set_primary_connection)(wifi_handle handle, 826 wifi_interface_handle iface); 827 828 829 /** 830 * When there are 2 simultaneous STA connections, this use case hint 831 * indicates what STA + STA use-case is being enabled by the framework. 832 */ 833 wifi_error (*wifi_multi_sta_set_use_case)(wifi_handle handle, 834 wifi_multi_sta_use_case use_case); 835 836 /** 837 * Invoked to indicate that the following list of wifi_coex_unsafe_channel should be avoided 838 * with the specified restrictions. 839 * @param unsafeChannels list of current |wifi_coex_unsafe_channel| to avoid. 840 * @param restrictions bitmask of |wifi_coex_restriction| indicating wifi interfaces to 841 * restrict from the current unsafe channels. 842 */ 843 wifi_error (*wifi_set_coex_unsafe_channels)(wifi_handle handle, u32 num_channels, 844 wifi_coex_unsafe_channel *unsafeChannels, 845 u32 restrictions); 846 847 /** 848 * Invoked to set voip optimization mode for the provided STA iface 849 */ 850 wifi_error (*wifi_set_voip_mode)(wifi_interface_handle iface, wifi_voip_mode mode); 851 852 /**@brief twt_register_handler 853 * Request to register TWT callback before sending any TWT request 854 * @param wifi_interface_handle: 855 * @param TwtCallbackHandler: callback function pointers 856 * @return Synchronous wifi_error 857 */ 858 wifi_error (*wifi_twt_register_handler)(wifi_interface_handle iface, 859 TwtCallbackHandler handler); 860 861 /**@brief twt_get_capability 862 * Request TWT capability 863 * @param wifi_interface_handle: 864 * @return Synchronous wifi_error and TwtCapabilitySet 865 */ 866 wifi_error (*wifi_twt_get_capability)(wifi_interface_handle iface, 867 TwtCapabilitySet* twt_cap_set); 868 869 /**@brief twt_setup_request 870 * Request to send TWT setup frame 871 * @param wifi_interface_handle: 872 * @param TwtSetupRequest: detailed parameters of setup request 873 * @return Synchronous wifi_error 874 * @return Asynchronous EventTwtSetupResponse CB return TwtSetupResponse 875 */ 876 wifi_error (*wifi_twt_setup_request)(wifi_interface_handle iface, 877 TwtSetupRequest* msg); 878 879 /**@brief twt_teardown_request 880 * Request to send TWT teardown frame 881 * @param wifi_interface_handle: 882 * @param TwtTeardownRequest: detailed parameters of teardown request 883 * @return Synchronous wifi_error 884 * @return Asynchronous EventTwtTeardownCompletion CB return TwtTeardownCompletion 885 * TwtTeardownCompletion may also be received due to other events 886 * like CSA, BTCX, TWT scheduler, MultiConnection, peer-initiated teardown, etc. 887 */ 888 wifi_error (*wifi_twt_teardown_request)(wifi_interface_handle iface, 889 TwtTeardownRequest* msg); 890 891 /**@brief twt_info_frame_request 892 * Request to send TWT info frame 893 * @param wifi_interface_handle: 894 * @param TwtInfoFrameRequest: detailed parameters in info frame 895 * @return Synchronous wifi_error 896 * @return Asynchronous EventTwtInfoFrameReceived CB return TwtInfoFrameReceived 897 * Driver may also receive Peer-initiated TwtInfoFrame 898 */ 899 wifi_error (*wifi_twt_info_frame_request)(wifi_interface_handle iface, 900 TwtInfoFrameRequest* msg); 901 902 /**@brief twt_get_stats 903 * Request to get TWT stats 904 * @param wifi_interface_handle: 905 * @param config_id: configuration ID of TWT request 906 * @return Synchronous wifi_error and TwtStats 907 */ 908 wifi_error (*wifi_twt_get_stats)(wifi_interface_handle iface, u8 config_id, 909 TwtStats* stats); 910 911 /**@brief twt_clear_stats 912 * Request to clear TWT stats 913 * @param wifi_interface_handle: 914 * @param config_id: configuration ID of TWT request 915 * @return Synchronous wifi_error 916 */ 917 wifi_error (*wifi_twt_clear_stats)(wifi_interface_handle iface, u8 config_id); 918 919 /** 920 * Invoked to set DTIM configuration when the host is in the suspend mode 921 * @param wifi_interface_handle: 922 * @param multiplier: when STA in the power saving mode, the wake up interval will be set to 923 * 1) multiplier * DTIM period if multiplier > 0. 924 * 2) the device default value if multiplier <=0 925 * Some implementations may apply an additional cap to wake up interval in the case of 1). 926 */ 927 wifi_error (*wifi_set_dtim_config)(wifi_interface_handle handle, u32 multiplier); 928 929 /**@brief wifi_get_usable_channels 930 * Request list of usable channels for the requested bands and modes. Usable 931 * implies channel is allowed as per regulatory for the current country code 932 * and not restricted due to other hard limitations (e.g. DFS, Coex) In 933 * certain modes (e.g. STA+SAP) there could be other hard restrictions 934 * since MCC operation many not be supported by SAP. This API also allows 935 * driver to return list of usable channels for each mode uniquely to 936 * distinguish cases where only a limited set of modes are allowed on 937 * a given channel e.g. srd channels may be supported for P2P but not 938 * for SAP or P2P-Client may be allowed on an indoor channel but P2P-GO 939 * may not be allowed. This API is not interface specific and will be 940 * used to query capabilities of driver in terms of what modes (STA, SAP, 941 * P2P_CLI, P2P_GO, NAN, TDLS) can be supported on each of the channels. 942 * @param handle global wifi_handle 943 * @param band_mask BIT MASK of WLAN_MAC* as represented by |wlan_mac_band| 944 * @param iface_mode_mask BIT MASK of BIT(WIFI_INTERFACE_*) represented by 945 * |wifi_interface_mode|. Bitmask respresents all the modes that the 946 * caller is interested in (e.g. STA, SAP, WFD-CLI, WFD-GO, TDLS, NAN). 947 * Note: Bitmask does not represent concurrency matrix. If the caller 948 * is interested in CLI, GO modes, the iface_mode_mask would be set 949 * to WIFI_INTERFACE_P2P_CLIENT|WIFI_INTERFACE_P2P_GO. 950 * @param filter_mask BIT MASK of WIFI_USABLE_CHANNEL_FILTER_* represented by 951 * |wifi_usable_channel_filter|. Indicates if the channel list should 952 * be filtered based on additional criteria. If filter_mask is not 953 * specified, driver should return list of usable channels purely 954 * based on regulatory constraints. 955 * @param max_size maximum number of |wifi_usable_channel| 956 * @param size actual number of |wifi_usable_channel| entries returned by driver 957 * @param channels list of usable channels represented by |wifi_usable_channel| 958 */ 959 wifi_error (*wifi_get_usable_channels)(wifi_handle handle, u32 band_mask, u32 iface_mode_mask, 960 u32 filter_mask, u32 max_size, u32* size, 961 wifi_usable_channel* channels); 962 963 /** 964 * Trigger wifi subsystem restart to reload firmware 965 */ 966 wifi_error (*wifi_trigger_subsystem_restart)(wifi_handle handle); 967 968 /** 969 * Invoked to set that the device is operating in an indoor environment. 970 * @param handle global wifi_handle 971 * @param isIndoor: true if the device is operating in an indoor 972 * environment, false otherwise. 973 * @return Synchronous wifi_error 974 */ 975 wifi_error (*wifi_set_indoor_state)(wifi_handle handle, bool isIndoor); 976 977 /**@brief wifi_get_supported_radio_combinations_matrix 978 * Request all the possible radio combinations this device can offer. 979 * @param handle global wifi_handle 980 * @param max_size maximum size allocated for filling the wifi_radio_combination_matrix 981 * @param wifi_radio_combination_matrix to return all the possible radio 982 * combinations. 983 * @param size actual size of wifi_radio_combination_matrix returned from 984 * lower layer 985 * 986 */ 987 wifi_error (*wifi_get_supported_radio_combinations_matrix)( 988 wifi_handle handle, u32 max_size, u32 *size, 989 wifi_radio_combination_matrix *radio_combination_matrix); 990 991 /**@brief wifi_nan_rtt_chre_enable_request 992 * Request to enable CHRE NAN RTT 993 * @param transaction_id: NAN transaction id 994 * @param wifi_interface_handle 995 * @param NanEnableRequest request message 996 * @return Synchronous wifi_error 997 */ 998 wifi_error (*wifi_nan_rtt_chre_enable_request)(transaction_id id, 999 wifi_interface_handle iface, 1000 NanEnableRequest* msg); 1001 1002 /**@brief wifi_nan_rtt_chre_disable_request 1003 * Request to disable CHRE NAN RTT 1004 * @param transaction_id: NAN transaction id 1005 * @param wifi_interface_handle 1006 * @return Synchronous wifi_error 1007 */ 1008 wifi_error (*wifi_nan_rtt_chre_disable_request)(transaction_id id, wifi_interface_handle iface); 1009 1010 /**@brief wifi_chre_register_handler 1011 * register a handler to get the state of CHR 1012 * @param wifi_interface_handle 1013 * @param wifi_chre_handler: callback function pointer 1014 * @return Synchronous wifi_error 1015 */ 1016 wifi_error (*wifi_chre_register_handler)(wifi_interface_handle iface, 1017 wifi_chre_handler handler); 1018 1019 /**@brief wifi_enable_tx_power_limits 1020 * Enable WiFi Tx power limis 1021 * @param wifi_interface_handle 1022 * @param isEnable : If enable TX limit or not 1023 * @return Synchronous wifi_error 1024 */ 1025 wifi_error (*wifi_enable_tx_power_limits) (wifi_interface_handle iface, 1026 bool isEnable); 1027 1028 1029 /* 1030 * when adding new functions make sure to add stubs in 1031 * hal_tool.cpp::init_wifi_stub_hal_func_table 1032 */ 1033 } wifi_hal_fn; 1034 1035 wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn *fn); 1036 typedef wifi_error (*init_wifi_vendor_hal_func_table_t)(wifi_hal_fn *fn); 1037 1038 #ifdef __cplusplus 1039 } 1040 #endif 1041 1042 #endif 1043