diff --git a/Android.bp b/Android.bp index 74b9060..7be18c7 100644 --- a/Android.bp +++ b/Android.bp @@ -45,6 +45,11 @@ cc_library { vndk: { enabled: true, }, + apex_available: [ + "//apex_available:platform", + "com.android.uwb", + ], + min_sdk_version: "Tiramisu", } cc_test { diff --git a/include/hardware_legacy/link_layer_stats.h b/include/hardware_legacy/link_layer_stats.h index 9b67f6d..bac84e1 100644 --- a/include/hardware_legacy/link_layer_stats.h +++ b/include/hardware_legacy/link_layer_stats.h @@ -61,7 +61,7 @@ typedef struct { /* channel information */ typedef struct { - wifi_channel_width width; // channel width (20, 40, 80, 80+80, 160) + wifi_channel_width width; // channel width (20, 40, 80, 80+80, 160, 320) wifi_channel center_freq; // primary 20 MHz channel wifi_channel center_freq0; // center frequency (MHz) first segment wifi_channel center_freq1; // center frequency (MHz) second segment @@ -69,11 +69,11 @@ typedef struct { /* wifi rate */ typedef struct { - u32 preamble :3; // 0: OFDM, 1:CCK, 2:HT 3:VHT 4:HE 5..7 reserved + u32 preamble :3; // 0: OFDM, 1:CCK, 2:HT 3:VHT 4:HE 5:EHT 6..7 reserved u32 nss :2; // 0:1x1, 1:2x2, 3:3x3, 4:4x4 - u32 bw :3; // 0:20MHz, 1:40Mhz, 2:80Mhz, 3:160Mhz + u32 bw :3; // 0:20MHz, 1:40Mhz, 2:80Mhz, 3:160Mhz 4:320Mhz u32 rateMcsIdx :8; // OFDM/CCK rate code would be as per ieee std in the units of 0.5mbps - // HT/VHT/HE it would be mcs index + // HT/VHT/HE/EHT it would be mcs index u32 reserved :16; // reserved u32 bitrate; // units of 100 Kbps } wifi_rate; diff --git a/include/hardware_legacy/rtt.h b/include/hardware_legacy/rtt.h index 5084bec..4ef7770 100644 --- a/include/hardware_legacy/rtt.h +++ b/include/hardware_legacy/rtt.h @@ -43,7 +43,8 @@ typedef enum { WIFI_RTT_BW_20 = 0x04, WIFI_RTT_BW_40 = 0x08, WIFI_RTT_BW_80 = 0x10, - WIFI_RTT_BW_160 = 0x20 + WIFI_RTT_BW_160 = 0x20, + WIFI_RTT_BW_320 = 0x40 } wifi_rtt_bw; /* RTT Measurement Preamble */ @@ -51,7 +52,8 @@ typedef enum { WIFI_RTT_PREAMBLE_LEGACY = 0x1, WIFI_RTT_PREAMBLE_HT = 0x2, WIFI_RTT_PREAMBLE_VHT = 0x4, - WIFI_RTT_PREAMBLE_HE = 0x8 + WIFI_RTT_PREAMBLE_HE = 0x8, + WIFI_RTT_PREAMBLE_EHT = 0x10, } wifi_rtt_preamble; /* RTT Type */ @@ -186,6 +188,7 @@ wifi_error wifi_rtt_channel_map_clear(wifi_request_id id, wifi_interface_handle #define PREAMBLE_HT 0x2 #define PREAMBLE_VHT 0x4 #define PREAMBLE_HE 0x8 +#define PREAMBLE_EHT 0x10 // BW definition for bit mask used in wifi_rtt_capabilities #define BW_5_SUPPORT 0x1 @@ -194,6 +197,7 @@ wifi_error wifi_rtt_channel_map_clear(wifi_request_id id, wifi_interface_handle #define BW_40_SUPPORT 0x8 #define BW_80_SUPPORT 0x10 #define BW_160_SUPPORT 0x20 +#define BW_320_SUPPORT 0x40 /* RTT Capabilities */ typedef struct { diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index 6adefdb..952e894 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -60,6 +60,7 @@ typedef enum { WIFI_CHAN_WIDTH_80P80 = 4, WIFI_CHAN_WIDTH_5 = 5, WIFI_CHAN_WIDTH_10 = 6, + WIFI_CHAN_WIDTH_320 = 7, WIFI_CHAN_WIDTH_INVALID = -1 } wifi_channel_width; @@ -140,6 +141,13 @@ typedef enum { WLAN_MAC_60_0_BAND = 1 << 3, } wlan_mac_band; +/* List of chre nan rtt state */ +typedef enum { + CHRE_PREEMPTED = 0, + CHRE_UNAVAILABLE = 1, + CHRE_AVAILABLE = 2, +} chre_nan_rtt_state; + typedef struct { wifi_channel_width width; int center_frequency0; @@ -154,7 +162,7 @@ typedef struct { typedef struct { /* Channel frequency in MHz */ wifi_channel freq; - /* Channel operating width (20, 40, 80, 160 etc.) */ + /* Channel operating width (20, 40, 80, 160, 320 etc.) */ wifi_channel_width width; /* BIT MASK of BIT(WIFI_INTERFACE_*) represented by |wifi_interface_mode| * Bitmask does not represent concurrency. @@ -192,6 +200,14 @@ typedef enum { * P2P GO may be supported by some vendors on the same STA channel. */ WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY = 1 << 1, + /* This Filter queries Wifi channels and bands that are supported for + * NAN3.1 Instant communication mode. This filter should only be applied to NAN interface. + * If 5G is supported default discovery channel 149/44 is considered, + * If 5G is not supported then channel 6 has to be considered. + * Based on regulatory domain if channel 149 and 44 are restricted, channel 6 should + * be considered for instant communication channel + */ + WIFI_USABLE_CHANNEL_FILTER_NAN_INSTANT_MODE = 1 << 2, } wifi_usable_channel_filter; typedef enum { @@ -216,6 +232,50 @@ typedef enum { WIFI_ACCESS_CATEGORY_VOICE = 3 } wifi_access_category; +/* Antenna configuration */ +typedef enum { + WIFI_ANTENNA_UNSPECIFIED = 0, + WIFI_ANTENNA_1X1 = 1, + WIFI_ANTENNA_2X2 = 2, + WIFI_ANTENNA_3X3 = 3, + WIFI_ANTENNA_4X4 = 4, +} wifi_antenna_configuration; + +/* Wifi Radio configuration */ +typedef struct { + /* Operating band */ + wlan_mac_band band; + /* Antenna configuration */ + wifi_antenna_configuration antenna_cfg; +} wifi_radio_configuration; + +/* WiFi Radio Combination */ +typedef struct { + u32 num_radio_configurations; + wifi_radio_configuration radio_configurations[]; +} wifi_radio_combination; + +/* WiFi Radio combinations matrix */ +/* For Example in case of a chip which has two radios, where one radio is + * capable of 2.4GHz 2X2 only and another radio which is capable of either + * 5GHz or 6GHz 2X2, number of possible radio combinations in this case + * are 5 and possible combinations are + * {{{2G 2X2}}, //Standalone 2G + * {{5G 2X2}}, //Standalone 5G + * {{6G 2X2}}, //Standalone 6G + * {{2G 2X2}, {5G 2X2}}, //2G+5G DBS + * {{2G 2X2}, {6G 2X2}}} //2G+6G DBS + * Note: Since this chip doesn’t support 5G+6G simultaneous operation + * as there is only one radio which can support both, So it can only + * do MCC 5G+6G. This table should not get populated with possible MCC + * configurations. This is only for simultaneous radio configurations + * (such as Standalone, multi band simultaneous or single band simultaneous). + */ +typedef struct { + u32 num_radio_combinations; + /* Each row represents possible radio combinations */ + wifi_radio_combination radio_combinations[]; +} wifi_radio_combination_matrix; /* Initialize/Cleanup */ @@ -267,6 +327,7 @@ void wifi_get_error_info(wifi_error err, const char **msg); // return a pointer #define WIFI_FEATURE_SCAN_RAND (uint64_t)0x2000000 // Support MAC & Probe Sequence Number randomization #define WIFI_FEATURE_SET_TX_POWER_LIMIT (uint64_t)0x4000000 // Support Tx Power Limit setting #define WIFI_FEATURE_USE_BODY_HEAD_SAR (uint64_t)0x8000000 // Support Using Body/Head Proximity for SAR +#define WIFI_FEATURE_DYNAMIC_SET_MAC (uint64_t)0x10000000 // Support changing MAC address without iface reset(down and up) #define WIFI_FEATURE_SET_LATENCY_MODE (uint64_t)0x40000000 // Support Latency mode setting #define WIFI_FEATURE_P2P_RAND_MAC (uint64_t)0x80000000 // Support P2P MAC randomization #define WIFI_FEATURE_INFRA_60G (uint64_t)0x100000000 // Support for 60GHz Band @@ -391,6 +452,10 @@ typedef struct { void (*on_subsystem_restart)(const char* error); } wifi_subsystem_restart_handler; +typedef struct { + void (*on_chre_nan_rtt_change)(chre_nan_rtt_state state); +} wifi_chre_handler; + wifi_error wifi_set_iface_event_handler(wifi_request_id id, wifi_interface_handle iface, wifi_event_handler eh); wifi_error wifi_reset_iface_event_handler(wifi_request_id id, wifi_interface_handle iface); @@ -899,6 +964,68 @@ typedef struct { * Trigger wifi subsystem restart to reload firmware */ wifi_error (*wifi_trigger_subsystem_restart)(wifi_handle handle); + + /** + * Invoked to set that the device is operating in an indoor environment. + * @param handle global wifi_handle + * @param isIndoor: true if the device is operating in an indoor + * environment, false otherwise. + * @return Synchronous wifi_error + */ + wifi_error (*wifi_set_indoor_state)(wifi_handle handle, bool isIndoor); + + /**@brief wifi_get_supported_radio_combinations_matrix + * Request all the possible radio combinations this device can offer. + * @param handle global wifi_handle + * @param max_size maximum size allocated for filling the wifi_radio_combination_matrix + * @param wifi_radio_combination_matrix to return all the possible radio + * combinations. + * @param size actual size of wifi_radio_combination_matrix returned from + * lower layer + * + */ + wifi_error (*wifi_get_supported_radio_combinations_matrix)( + wifi_handle handle, u32 max_size, u32 *size, + wifi_radio_combination_matrix *radio_combination_matrix); + + /**@brief wifi_nan_rtt_chre_enable_request + * Request to enable CHRE NAN RTT + * @param transaction_id: NAN transaction id + * @param wifi_interface_handle + * @param NanEnableRequest request message + * @return Synchronous wifi_error + */ + wifi_error (*wifi_nan_rtt_chre_enable_request)(transaction_id id, + wifi_interface_handle iface, + NanEnableRequest* msg); + + /**@brief wifi_nan_rtt_chre_disable_request + * Request to disable CHRE NAN RTT + * @param transaction_id: NAN transaction id + * @param wifi_interface_handle + * @return Synchronous wifi_error + */ + wifi_error (*wifi_nan_rtt_chre_disable_request)(transaction_id id, wifi_interface_handle iface); + + /**@brief wifi_chre_register_handler + * register a handler to get the state of CHR + * @param wifi_interface_handle + * @param wifi_chre_handler: callback function pointer + * @return Synchronous wifi_error + */ + wifi_error (*wifi_chre_register_handler)(wifi_interface_handle iface, + wifi_chre_handler handler); + + /**@brief wifi_enable_tx_power_limits + * Enable WiFi Tx power limis + * @param wifi_interface_handle + * @param isEnable : If enable TX limit or not + * @return Synchronous wifi_error + */ + wifi_error (*wifi_enable_tx_power_limits) (wifi_interface_handle iface, + bool isEnable); + + /* * when adding new functions make sure to add stubs in * hal_tool.cpp::init_wifi_stub_hal_func_table diff --git a/include/hardware_legacy/wifi_nan.h b/include/hardware_legacy/wifi_nan.h index 1fb7138..8437a1d 100644 --- a/include/hardware_legacy/wifi_nan.h +++ b/include/hardware_legacy/wifi_nan.h @@ -305,10 +305,12 @@ typedef struct { } body; } NanSecurityKeyInfo; -/* NAN Shared Key Security Cipher Suites Mask */ -#define NAN_CIPHER_SUITE_SHARED_KEY_NONE 0x00 -#define NAN_CIPHER_SUITE_SHARED_KEY_128_MASK 0x01 -#define NAN_CIPHER_SUITE_SHARED_KEY_256_MASK 0x02 +/* NAN Security Cipher Suites Mask */ +#define NAN_CIPHER_SUITE_SHARED_KEY_NONE 0x00 +#define NAN_CIPHER_SUITE_SHARED_KEY_128_MASK 0x01 +#define NAN_CIPHER_SUITE_SHARED_KEY_256_MASK 0x02 +#define NAN_CIPHER_SUITE_PUBLIC_KEY_2WDH_128_MASK 0x04 +#define NAN_CIPHER_SUITE_PUBLIC_KEY_2WDH_256_MASK 0x08 /* NAN ranging indication condition MASKS */ #define NAN_RANGING_INDICATE_CONTINUOUS_MASK 0x01 @@ -1041,6 +1043,17 @@ typedef struct { */ u8 config_enable_instant_mode; u32 enable_instant_mode; + /* + Config NAN v3.1 instant communication channel frequency selected over NFC/OOB method. + If dual band is supported default channel is 149 or 44 as per regulatory domain, + else channel 6 (send frequency in MHz). + Sometimes depending on country code retrictions, even 149/44 may be restricted + in those cases instant channel will be operational only in 2.4GHz. + Use wifi_get_usable_channels() API to get supported bands/channels before + Instant mode NFC handshake is triggered + */ + u8 config_instant_mode_channel; + wifi_channel instant_mode_channel; } NanEnableRequest; /* @@ -1533,6 +1546,17 @@ typedef struct { */ u8 config_enable_instant_mode; u32 enable_instant_mode; + /* + Config NAN v3.1 instant communication channel selected over NFC/OOB method. + If dual band is supported default channel is 149 or 44 as per regulatory domain, + else channel 6 (send frequency in MHz). + Sometimes depending on country code retrictions, even 149/44 may be restricted + in those cases instant channel will be operational only in 2.4GHz. + Use wifi_get_usable_channels() API to get supported bands/channels before + Instant mode NFC handshake is triggered + */ + u8 config_instant_mode_channel; + wifi_channel instant_mode_channel; } NanConfigRequest; /* @@ -2223,6 +2247,18 @@ typedef struct { is not associated with the NDP (out-of-band discovery). */ u8 service_name[NAN_MAX_SERVICE_NAME_LEN]; + + /* Security Context Identifiers length */ + u32 scid_len; + /* + Security Context Identifier attribute contains PMKID + shall be included in NDP setup and response messages. + Security Context Identifier, Identifies the Security + Context. For NAN Shared Key Cipher Suite, this field + contains the 16 octet PMKID identifying the PMK used + for setting up the Secure Data Path. + */ + u8 scid[NAN_MAX_SCID_BUF_LEN]; } NanDataPathInitiatorRequest; /* @@ -2263,6 +2299,18 @@ typedef struct { is not associated with the NDP (out-of-band discovery). */ u8 service_name[NAN_MAX_SERVICE_NAME_LEN]; + + /* Security Context Identifiers length */ + u32 scid_len; + /* + Security Context Identifier attribute contains PMKID + shall be included in NDP setup and response messages. + Security Context Identifier, Identifies the Security + Context. For NAN Shared Key Cipher Suite, this field + contains the 16 octet PMKID identifying the PMK used + for setting up the Secure Data Path. + */ + u8 scid[NAN_MAX_SCID_BUF_LEN]; } NanDataPathIndicationResponse; /* NDP termination info */ @@ -2298,6 +2346,18 @@ typedef struct { NanDataPathCfg ndp_cfg; /* App/Service information of the initiator */ NanDataPathAppInfo app_info; + + /* Security Context Identifiers length */ + u32 scid_len; + /* + Security Context Identifier attribute contains PMKID + shall be included in NDP setup and response messages. + Security Context Identifier, Identifies the Security + Context. For NAN Shared Key Cipher Suite, this field + contains the 16 octet PMKID identifying the PMK used + for setting up the Secure Data Path. + */ + u8 scid[NAN_MAX_SCID_BUF_LEN]; } NanDataPathRequestInd; /*