summaryrefslogtreecommitdiff
path: root/include/hardware_legacy/wifi_hal.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/hardware_legacy/wifi_hal.h')
-rw-r--r--include/hardware_legacy/wifi_hal.h395
1 files changed, 27 insertions, 368 deletions
diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h
index 81948d6..5dabeb6 100644
--- a/include/hardware_legacy/wifi_hal.h
+++ b/include/hardware_legacy/wifi_hal.h
@@ -25,31 +25,6 @@ extern "C"
#define IFNAMSIZ 16
-/* typedefs */
-typedef unsigned char byte;
-typedef unsigned char u8;
-typedef signed char s8;
-typedef uint16_t u16;
-typedef uint32_t u32;
-typedef int32_t s32;
-typedef uint64_t u64;
-typedef int64_t s64;
-typedef int wifi_request_id;
-typedef int wifi_channel; // indicates channel frequency in MHz
-typedef int wifi_rssi;
-typedef int wifi_radio;
-typedef byte mac_addr[6];
-typedef byte oui[3];
-typedef int64_t wifi_timestamp; // In microseconds (us)
-typedef int64_t wifi_timespan; // In picoseconds (ps)
-typedef uint64_t feature_set;
-
-/* forward declarations */
-struct wifi_info;
-struct wifi_interface_info;
-typedef struct wifi_info *wifi_handle;
-typedef struct wifi_interface_info *wifi_interface_handle;
-
/* WiFi Common definitions */
/* channel operating width */
typedef enum {
@@ -73,13 +48,6 @@ typedef enum {
WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF = 3,
WIFI_POWER_SCENARIO_ON_BODY_CELL_ON = 4,
WIFI_POWER_SCENARIO_ON_BODY_BT = 5,
- WIFI_POWER_SCENARIO_ON_HEAD_HOTSPOT = 6,
- WIFI_POWER_SCENARIO_ON_HEAD_HOTSPOT_MMW = 7,
- WIFI_POWER_SCENARIO_ON_BODY_CELL_ON_BT = 8,
- WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT = 9,
- WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_BT = 10,
- WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_MMW = 11,
- WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_BT_MMW = 12,
} wifi_power_scenario;
typedef enum {
@@ -97,15 +65,6 @@ typedef enum {
WIFI_MITIGATION_EMERGENCY = 5,
} wifi_thermal_mode;
-/*
- * Wifi voice over IP mode
- * may add new modes later, for example, voice + video over IP mode.
- */
-typedef enum {
- WIFI_VOIP_MODE_OFF = 0,
- WIFI_VOIP_MODE_ON = 1,
-} wifi_voip_mode;
-
/* List of interface types supported */
typedef enum {
WIFI_INTERFACE_TYPE_STA = 0,
@@ -123,11 +82,12 @@ typedef enum {
/* WLAN MAC Operates in 5 GHz Band */
WLAN_MAC_5_0_BAND = 1 << 1,
/* WLAN MAC Operates in 6 GHz Band */
- WLAN_MAC_6_0_BAND = 1 << 2,
-/* WLAN MAC Operates in 60 GHz Band */
- WLAN_MAC_60_0_BAND = 1 << 3,
+ WLAN_MAC_6_0_BAND = 1 << 2
} wlan_mac_band;
+typedef int wifi_radio;
+typedef int wifi_channel;
+
typedef struct {
wifi_channel_width width;
int center_frequency0;
@@ -135,53 +95,6 @@ typedef struct {
int primary_frequency;
} wifi_channel_spec;
-/*
- * wifi_usable_channel specifies a channel frequency, bandwidth, and bitmask
- * of modes allowed on the channel.
- */
-typedef struct {
- /* Channel frequency in MHz */
- wifi_channel freq;
- /* Channel operating width (20, 40, 80, 160 etc.) */
- wifi_channel_width width;
- /* BIT MASK of BIT(WIFI_INTERFACE_*) represented by |wifi_interface_mode|
- * Bitmask does not represent concurrency.
- * Examples:
- * - If a channel is usable only for STA, then only the WIFI_INTERFACE_STA
- * bit would be set for that channel.
- * - If 5GHz SAP is not allowed, then none of the 5GHz channels will have
- * WIFI_INTERFACE_SOFTAP bit set.
- * Note: TDLS bit is set only if there is a STA connection. TDLS bit is set
- * on non-STA channels only if TDLS off channel is supported.
- */
- u32 iface_mode_mask;
-} wifi_usable_channel;
-
-/*
- * wifi_usable_channel_filter
- */
-typedef enum {
- /* Filter Wifi channels that should be avoided due to cellular coex
- * restrictions. Some Wifi channels can have extreme interference
- * from/to cellular due to short frequency separation with neighboring
- * cellular channels or when there is harmonic and intermodulation
- * interference. Channels which only have some performance degradation
- * (e.g. power back off is sufficient to deal with coexistence issue)
- * can be included and should not be filtered out.
- */
- WIFI_USABLE_CHANNEL_FILTER_CELLULAR_COEXISTENCE = 1 << 0,
- /* Filter channels due to concurrency state.
- * Examples:
- * - 5GHz SAP operation may be supported in standalone mode, but if
- * there is STA connection on 5GHz DFS channel, none of the 5GHz
- * channels are usable for SAP if device does not support DFS SAP mode.
- * - P2P GO may not be supported on indoor channels in EU during
- * standalone mode but if there is a STA connection on indoor channel,
- * P2P GO may be supported by some vendors on the same STA channel.
- */
- WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY = 1 << 1,
-} wifi_usable_channel_filter;
-
typedef enum {
WIFI_SUCCESS = 0,
WIFI_ERROR_NONE = 0,
@@ -204,6 +117,26 @@ typedef enum {
WIFI_ACCESS_CATEGORY_VOICE = 3
} wifi_access_category;
+typedef unsigned char byte;
+typedef unsigned char u8;
+typedef signed char s8;
+typedef uint16_t u16;
+typedef uint32_t u32;
+typedef int32_t s32;
+typedef uint64_t u64;
+typedef int64_t s64;
+typedef int wifi_request_id;
+typedef int wifi_channel; // indicates channel frequency in MHz
+typedef int wifi_rssi;
+typedef byte mac_addr[6];
+typedef byte oui[3];
+typedef int64_t wifi_timestamp; // In microseconds (us)
+typedef int64_t wifi_timespan; // In picoseconds (ps)
+
+struct wifi_info;
+struct wifi_interface_info;
+typedef struct wifi_info *wifi_handle;
+typedef struct wifi_interface_info *wifi_interface_handle;
/* Initialize/Cleanup */
@@ -257,9 +190,11 @@ void wifi_get_error_info(wifi_error err, const char **msg); // return a pointer
#define WIFI_FEATURE_USE_BODY_HEAD_SAR (uint64_t)0x8000000 // Support Using Body/Head Proximity for SAR
#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
// Add more features here
+
+typedef uint64_t feature_set;
+
#define IS_MASK_SET(mask, flags) (((flags) & (mask)) == (mask))
#define IS_SUPPORTED_FEATURE(feature, featureSet) IS_MASK_SET(feature, featureSet)
@@ -280,70 +215,6 @@ wifi_error wifi_get_ifaces(wifi_handle handle, int *num_ifaces, wifi_interface_h
wifi_error wifi_get_iface_name(wifi_interface_handle iface, char *name, size_t size);
wifi_interface_handle wifi_get_iface_handle(wifi_handle handle, char *name);
-/* STA + STA support - Supported if WIFI_FEATURE_ADDITIONAL_STA is set */
-
-/**
- * Invoked to indicate that the provided iface is the primary STA iface when there are more
- * than 1 STA iface concurrently active.
- *
- * Note: If the wifi firmware/chip cannot support multiple instances of any offload
- * (like roaming, APF, rssi threshold, etc), the firmware should ensure that these
- * offloads are at least enabled for the primary interface. If the new primary interface is
- * already connected to a network, the firmware must switch all the offloads on
- * this new interface without disconnecting.
- */
-wifi_error wifi_multi_sta_set_primary_connection(wifi_handle handle, wifi_interface_handle iface);
-
-/**
- * When there are 2 or more simultaneous STA connections, this use case hint indicates what
- * use-case is being enabled by the framework. This use case hint can be used by the firmware
- * to modify various firmware configurations like:
- * - Allowed BSSIDs the firmware can choose for the initial connection/roaming attempts.
- * - Duty cycle to choose for the 2 STA connections if the radio is in MCC mode.
- * - Whether roaming, APF and other offloads needs to be enabled or not.
- *
- * Note:
- * - This will be invoked before an active wifi connection is established on the second interface.
- * - This use-case hint is implicitly void when the second STA interface is brought down.
- */
-typedef enum {
- /**
- * Usage:
- * - This will be sent down for make before break use-case.
- * - Platform is trying to speculatively connect to a second network and evaluate it without
- * disrupting the primary connection.
- *
- * Requirements for Firmware:
- * - Do not reduce the number of tx/rx chains of primary connection.
- * - If using MCC, should set the MCC duty cycle of the primary connection to be higher than
- * the secondary connection (maybe 70/30 split).
- * - Should pick the best BSSID for the secondary STA (disregard the chip mode) independent of
- * the primary STA:
- * - Don’t optimize for DBS vs MCC/SCC
- * - Should not impact the primary connection’s bssid selection:
- * - Don’t downgrade chains of the existing primary connection.
- * - Don’t optimize for DBS vs MCC/SCC.
- */
- WIFI_DUAL_STA_TRANSIENT_PREFER_PRIMARY = 0,
- /**
- * Usage:
- * - This will be sent down for any app requested peer to peer connections.
- * - In this case, both the connections needs to be allocated equal resources.
- * - For the peer to peer use case, BSSID for the secondary connection will be chosen by the
- * framework.
- *
- * Requirements for Firmware:
- * - Can choose MCC or DBS mode depending on the MCC efficiency and HW capability.
- * - If using MCC, set the MCC duty cycle of the primary connection to be equal to the secondary
- * connection.
- * - Prefer BSSID candidates which will help provide the best "overall" performance for both the
- * connections.
- */
- WIFI_DUAL_STA_NON_TRANSIENT_UNBIASED = 1
-} wifi_multi_sta_use_case;
-
-wifi_error wifi_multi_sta_set_use_case(wifi_handle handle, wifi_multi_sta_use_case use_case);
-
/* Configuration events */
typedef struct {
@@ -375,10 +246,6 @@ typedef struct {
void (*on_rssi_threshold_breached)(wifi_request_id id, u8 *cur_bssid, s8 cur_rssi);
} wifi_rssi_event_handler;
-typedef struct {
- void (*on_subsystem_restart)(const char* error);
-} wifi_subsystem_restart_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);
@@ -391,9 +258,6 @@ wifi_error wifi_map_dscp_access_category(wifi_handle handle,
uint32_t access_category);
wifi_error wifi_reset_dscp_mapping(wifi_handle handle);
-wifi_error wifi_set_subsystem_restart_handler(wifi_handle handle,
- wifi_subsystem_restart_handler handler);
-
/**
* Wifi HAL Thermal Mitigation API
*
@@ -473,30 +337,6 @@ typedef struct wlan_driver_wake_reason_cnt_t {
RX_MULTICAST_WAKE_DATA_CNT rx_multicast_wake_pkt_info;
} WLAN_DRIVER_WAKE_REASON_CNT;
-/* Wi-Fi coex channel avoidance support */
-
-#define WIFI_COEX_NO_POWER_CAP (int32_t)0x7FFFFFF
-
-typedef enum {
- WIFI_AWARE = 1 << 0,
- SOFTAP = 1 << 1,
- WIFI_DIRECT = 1 << 2
-} wifi_coex_restriction;
-
-/**
- * Representation of a Wi-Fi channel to be avoided for Wi-Fi coex channel avoidance.
- *
- * band is represented as an WLAN_MAC* enum value defined in wlan_mac_band.
- * If power_cap_dbm is WIFI_COEX_NO_POWER_CAP, then no power cap should be applied if the specified
- * channel is used.
- */
-typedef struct {
- wlan_mac_band band;
- u32 channel;
- s32 power_cap_dbm;
-} wifi_coex_unsafe_channel;
-
-
/* include various feature headers */
#include "gscan.h"
@@ -508,7 +348,6 @@ typedef struct {
#include "wifi_nan.h"
#include "wifi_offload.h"
#include "roam.h"
-#include "wifi_twt.h"
//wifi HAL function pointer table
typedef struct {
@@ -714,188 +553,8 @@ typedef struct {
wifi_interface_type iface_type);
wifi_error (*wifi_virtual_interface_delete)(wifi_handle handle, const char* ifname);
- wifi_error (*wifi_set_subsystem_restart_handler)(wifi_handle handle,
- wifi_subsystem_restart_handler handler);
-
- /**
- * Allow vendor HAL to choose interface name when creating
- * an interface. This can be implemented by chips with their
- * own interface naming policy.
- * If not implemented, the default naming will be used.
- */
- wifi_error (*wifi_get_supported_iface_name)(wifi_handle handle, u32 iface_type,
- char *name, size_t len);
-
- /**
- * Perform early initialization steps that are needed when WIFI
- * is disabled.
- * If the function returns failure, it means the vendor HAL is unusable
- * (for example, if chip hardware is not installed) and no further
- * functions should be called.
- */
- wifi_error (*wifi_early_initialize)(void);
-
- /**
- * Get supported feature set which are chip-global, that is
- * not dependent on any created interface.
- */
- wifi_error (*wifi_get_chip_feature_set)(wifi_handle handle, feature_set *set);
-
- /**
- * Invoked to indicate that the provided iface is the primary STA iface when there are more
- * than 1 STA iface concurrently active.
- */
- wifi_error (*wifi_multi_sta_set_primary_connection)(wifi_handle handle,
- wifi_interface_handle iface);
-
-
- /**
- * When there are 2 simultaneous STA connections, this use case hint
- * indicates what STA + STA use-case is being enabled by the framework.
- */
- wifi_error (*wifi_multi_sta_set_use_case)(wifi_handle handle,
- wifi_multi_sta_use_case use_case);
-
- /**
- * Invoked to indicate that the following list of wifi_coex_unsafe_channel should be avoided
- * with the specified restrictions.
- * @param unsafeChannels list of current |wifi_coex_unsafe_channel| to avoid.
- * @param restrictions bitmask of |wifi_coex_restriction| indicating wifi interfaces to
- * restrict from the current unsafe channels.
- */
- wifi_error (*wifi_set_coex_unsafe_channels)(wifi_handle handle, u32 num_channels,
- wifi_coex_unsafe_channel *unsafeChannels,
- u32 restrictions);
-
- /**
- * Invoked to set voip optimization mode for the provided STA iface
- */
- wifi_error (*wifi_set_voip_mode)(wifi_interface_handle iface, wifi_voip_mode mode);
-
- /**@brief twt_register_handler
- * Request to register TWT callback before sending any TWT request
- * @param wifi_interface_handle:
- * @param TwtCallbackHandler: callback function pointers
- * @return Synchronous wifi_error
- */
- wifi_error (*wifi_twt_register_handler)(wifi_interface_handle iface,
- TwtCallbackHandler handler);
-
- /**@brief twt_get_capability
- * Request TWT capability
- * @param wifi_interface_handle:
- * @return Synchronous wifi_error and TwtCapabilitySet
- */
- wifi_error (*wifi_twt_get_capability)(wifi_interface_handle iface,
- TwtCapabilitySet* twt_cap_set);
-
- /**@brief twt_setup_request
- * Request to send TWT setup frame
- * @param wifi_interface_handle:
- * @param TwtSetupRequest: detailed parameters of setup request
- * @return Synchronous wifi_error
- * @return Asynchronous EventTwtSetupResponse CB return TwtSetupResponse
- */
- wifi_error (*wifi_twt_setup_request)(wifi_interface_handle iface,
- TwtSetupRequest* msg);
-
- /**@brief twt_teardown_request
- * Request to send TWT teardown frame
- * @param wifi_interface_handle:
- * @param TwtTeardownRequest: detailed parameters of teardown request
- * @return Synchronous wifi_error
- * @return Asynchronous EventTwtTeardownCompletion CB return TwtTeardownCompletion
- * TwtTeardownCompletion may also be received due to other events
- * like CSA, BTCX, TWT scheduler, MultiConnection, peer-initiated teardown, etc.
- */
- wifi_error (*wifi_twt_teardown_request)(wifi_interface_handle iface,
- TwtTeardownRequest* msg);
-
- /**@brief twt_info_frame_request
- * Request to send TWT info frame
- * @param wifi_interface_handle:
- * @param TwtInfoFrameRequest: detailed parameters in info frame
- * @return Synchronous wifi_error
- * @return Asynchronous EventTwtInfoFrameReceived CB return TwtInfoFrameReceived
- * Driver may also receive Peer-initiated TwtInfoFrame
- */
- wifi_error (*wifi_twt_info_frame_request)(wifi_interface_handle iface,
- TwtInfoFrameRequest* msg);
-
- /**@brief twt_get_stats
- * Request to get TWT stats
- * @param wifi_interface_handle:
- * @param config_id: configuration ID of TWT request
- * @return Synchronous wifi_error and TwtStats
- */
- wifi_error (*wifi_twt_get_stats)(wifi_interface_handle iface, u8 config_id,
- TwtStats* stats);
-
- /**@brief twt_clear_stats
- * Request to clear TWT stats
- * @param wifi_interface_handle:
- * @param config_id: configuration ID of TWT request
- * @return Synchronous wifi_error
- */
- wifi_error (*wifi_twt_clear_stats)(wifi_interface_handle iface, u8 config_id);
-
- /**
- * Invoked to set DTIM configuration when the host is in the suspend mode
- * @param wifi_interface_handle:
- * @param multiplier: when STA in the power saving mode, the wake up interval will be set to
- * 1) multiplier * DTIM period if multiplier > 0.
- * 2) the device default value if multiplier <=0
- * Some implementations may apply an additional cap to wake up interval in the case of 1).
- */
- wifi_error (*wifi_set_dtim_config)(wifi_interface_handle handle, u32 multiplier);
-
- /**@brief wifi_get_usable_channels
- * Request list of usable channels for the requested bands and modes. Usable
- * implies channel is allowed as per regulatory for the current country code
- * and not restricted due to other hard limitations (e.g. DFS, Coex) In
- * certain modes (e.g. STA+SAP) there could be other hard restrictions
- * since MCC operation many not be supported by SAP. This API also allows
- * driver to return list of usable channels for each mode uniquely to
- * distinguish cases where only a limited set of modes are allowed on
- * a given channel e.g. srd channels may be supported for P2P but not
- * for SAP or P2P-Client may be allowed on an indoor channel but P2P-GO
- * may not be allowed. This API is not interface specific and will be
- * used to query capabilities of driver in terms of what modes (STA, SAP,
- * P2P_CLI, P2P_GO, NAN, TDLS) can be supported on each of the channels.
- * @param handle global wifi_handle
- * @param band_mask BIT MASK of WLAN_MAC* as represented by |wlan_mac_band|
- * @param iface_mode_mask BIT MASK of BIT(WIFI_INTERFACE_*) represented by
- * |wifi_interface_mode|. Bitmask respresents all the modes that the
- * caller is interested in (e.g. STA, SAP, WFD-CLI, WFD-GO, TDLS, NAN).
- * Note: Bitmask does not represent concurrency matrix. If the caller
- * is interested in CLI, GO modes, the iface_mode_mask would be set
- * to WIFI_INTERFACE_P2P_CLIENT|WIFI_INTERFACE_P2P_GO.
- * @param filter_mask BIT MASK of WIFI_USABLE_CHANNEL_FILTER_* represented by
- * |wifi_usable_channel_filter|. Indicates if the channel list should
- * be filtered based on additional criteria. If filter_mask is not
- * specified, driver should return list of usable channels purely
- * based on regulatory constraints.
- * @param max_size maximum number of |wifi_usable_channel|
- * @param size actual number of |wifi_usable_channel| entries returned by driver
- * @param channels list of usable channels represented by |wifi_usable_channel|
- */
- wifi_error (*wifi_get_usable_channels)(wifi_handle handle, u32 band_mask, u32 iface_mode_mask,
- u32 filter_mask, u32 max_size, u32* size,
- wifi_usable_channel* channels);
-
- /**
- * Trigger wifi subsystem restart to reload firmware
- */
- wifi_error (*wifi_trigger_subsystem_restart)(wifi_handle handle);
- /*
- * when adding new functions make sure to add stubs in
- * hal_tool.cpp::init_wifi_stub_hal_func_table
- */
} wifi_hal_fn;
-
wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn *fn);
-typedef wifi_error (*init_wifi_vendor_hal_func_table_t)(wifi_hal_fn *fn);
-
#ifdef __cplusplus
}
#endif