1 /* Copyright (c) 2014, The Linux Foundation. All rights reserved. 2 * 3 * Redistribution and use in source and binary forms, with or without 4 * modification, are permitted provided that the following conditions 5 * are met: 6 * * Redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer. 8 * * Redistributions in binary form must reproduce the above 9 * copyright notice, this list of conditions and the following 10 * disclaimer in the documentation and/or other materials provided 11 * with the distribution. 12 * * Neither the name of The Linux Foundation nor the names of its 13 * contributors may be used to endorse or promote products derived 14 * from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 #ifndef __WIFI_HAL_LOWI_INTERNAL_H__ 30 #define __WIFI_HAL_LOWI_INTERNAL_H__ 31 32 /* 33 * The file defines the interface by which wifihal can call LOWI for the 34 * purposes of initialization, rtt and gscan. 35 */ 36 37 #include "wifi_hal.h" 38 39 #define WIFIHAL_LOWI_MAJOR_VERSION 2 40 #define WIFIHAL_LOWI_MINOR_VERSION 1 41 #define WIFIHAL_LOWI_MICRO_VERSION 1 42 43 /* LOWI supported capabilities bit masks */ 44 #define ONE_SIDED_RANGING_SUPPORTED 0x00000001 45 #define DUAL_SIDED_RANGING_SUPPORED 0x00000002 46 #define GSCAN_SUPPORTED 0x00000004 47 48 /* 49 * This structure is a table of function pointers to the functions 50 * used by the wifihal to interface with LOWI 51 */ 52 typedef struct 53 { 54 /* lowi-client interface functions */ 55 int (*init)(); 56 int (*destroy)(); 57 /* rtt functions */ 58 int (*get_rtt_capabilities)(wifi_interface_handle iface, 59 wifi_rtt_capabilities *capabilities); 60 int (*rtt_range_request)(u32 request_id, 61 wifi_interface_handle iface, 62 u32 num_rtt_config, 63 wifi_rtt_config rtt_config[], 64 wifi_rtt_event_handler handler); 65 int (*rtt_range_cancel)(u32 request_id, 66 u32 num_devices, 67 mac_addr addr[]); 68 /* Additional lowi-client interface functions */ 69 int (*get_lowi_version) (u16* major_version, 70 u16* minor_version, 71 u16* micro_version); 72 int (*get_lowi_capabilities)(u32* capabilities); 73 /* gscan functions */ 74 wifi_error (*get_valid_channels)(wifi_interface_handle iface, 75 u32 band, 76 u32 max_channels, 77 wifi_channel *channels, 78 int *num_channels); 79 80 wifi_error (*get_gscan_capabilities)(wifi_interface_handle handle, 81 wifi_gscan_capabilities *capabilities); 82 83 wifi_error (*start_gscan)(wifi_request_id request_id, 84 wifi_interface_handle iface, 85 wifi_scan_cmd_params params, 86 wifi_scan_result_handler handler); 87 88 wifi_error (*stop_gscan)(wifi_request_id request_id, 89 wifi_interface_handle iface); 90 91 wifi_error (*get_cached_gscan_results)(wifi_interface_handle iface, 92 byte flush, 93 u32 max, 94 wifi_cached_scan_results *results, 95 int *num); 96 97 wifi_error (*set_bssid_hotlist)(wifi_request_id request_id, 98 wifi_interface_handle iface, 99 wifi_bssid_hotlist_params params, 100 wifi_hotlist_ap_found_handler handler); 101 102 wifi_error (*reset_bssid_hotlist)(wifi_request_id request_id, 103 wifi_interface_handle iface); 104 105 wifi_error (*set_significant_change_handler)(wifi_request_id id, 106 wifi_interface_handle iface, 107 wifi_significant_change_params params, 108 wifi_significant_change_handler handler); 109 110 wifi_error (*reset_significant_change_handler)(wifi_request_id id, 111 wifi_interface_handle iface); 112 113 wifi_error (*set_ssid_hotlist)(wifi_request_id id, 114 wifi_interface_handle iface, 115 wifi_ssid_hotlist_params params, 116 wifi_hotlist_ssid_handler handler); 117 118 wifi_error (*reset_ssid_hotlist)(wifi_request_id id, 119 wifi_interface_handle iface); 120 121 // API to configure the LCI. Used in RTT Responder mode only 122 wifi_error (*rtt_set_lci)(wifi_request_id id, 123 wifi_interface_handle iface, 124 wifi_lci_information *lci); 125 126 // API to configure the LCR. Used in RTT Responder mode only. 127 wifi_error (*rtt_set_lcr)(wifi_request_id id, 128 wifi_interface_handle iface, 129 wifi_lcr_information *lcr); 130 131 /** 132 * Get RTT responder information e.g. WiFi channel to enable responder on. 133 */ 134 wifi_error (*rtt_get_responder_info)(wifi_interface_handle iface, 135 wifi_rtt_responder *responder_info); 136 137 /** 138 * Enable RTT responder mode. 139 * channel_hint - hint of the channel information where RTT responder should 140 * be enabled on. 141 * max_duration_seconds - timeout of responder mode. 142 * responder_info - responder information e.g. channel used for RTT responder, 143 * NULL if responder is not enabled. 144 */ 145 wifi_error (*enable_responder)(wifi_request_id id, 146 wifi_interface_handle iface, 147 wifi_channel_info channel_hint, 148 unsigned max_duration_seconds, 149 wifi_rtt_responder *responder_info); 150 151 /** 152 * Disable RTT responder mode. 153 */ 154 wifi_error (*disable_responder)(wifi_request_id id, 155 wifi_interface_handle iface); 156 157 } lowi_cb_table_t; 158 159 /* 160 * This is a function pointer to a function that gets the table 161 * of callback functions populated by LOWI and to be used by wifihal 162 */ 163 typedef lowi_cb_table_t* (getCbTable_t)(); 164 165 #endif 166