Pavel Machek | 66101de | 2008-10-01 14:36:56 +0200 | [diff] [blame] | 1 | /* |
| 2 | * sme_api.h |
| 3 | * |
| 4 | * Copyright(C) 2002 Winbond Electronics Corp. |
| 5 | * |
| 6 | * modification history |
| 7 | * --------------------------------------------------------------------------- |
| 8 | * 1.00.001, 2003-04-21, Kevin created |
| 9 | * 1.00.002, 2003-05-14, PD43 & PE20 modified |
| 10 | * |
| 11 | */ |
| 12 | |
| 13 | #ifndef __SME_API_H__ |
| 14 | #define __SME_API_H__ |
| 15 | |
Pekka Enberg | 80aba53 | 2008-10-30 13:04:29 +0200 | [diff] [blame] | 16 | #include <linux/types.h> |
| 17 | |
| 18 | #include "localpara.h" |
| 19 | |
Pavel Machek | 66101de | 2008-10-01 14:36:56 +0200 | [diff] [blame] | 20 | /****************** CONSTANT AND MACRO SECTION ******************************/ |
| 21 | #define _INLINE __inline |
| 22 | |
| 23 | #define MEDIA_STATE_DISCONNECTED 0 |
| 24 | #define MEDIA_STATE_CONNECTED 1 |
| 25 | |
| 26 | //ARRAY CHECK |
| 27 | #define MAX_POWER_TO_DB 32 |
| 28 | |
| 29 | /****************** TYPE DEFINITION SECTION *********************************/ |
| 30 | |
| 31 | /****************** EXPORTED FUNCTION DECLARATION SECTION *******************/ |
| 32 | |
| 33 | // OID_802_11_BSSID |
| 34 | s8 sme_get_bssid(void *pcore_data, u8 *pbssid); |
| 35 | s8 sme_get_desired_bssid(void *pcore_data, u8 *pbssid);//Not use |
| 36 | s8 sme_set_desired_bssid(void *pcore_data, u8 *pbssid); |
| 37 | |
| 38 | // OID_802_11_SSID |
| 39 | s8 sme_get_ssid(void *pcore_data, u8 *pssid, u8 *pssid_len); |
| 40 | s8 sme_get_desired_ssid(void *pcore_data, u8 *pssid, u8 *pssid_len);// Not use |
| 41 | s8 sme_set_desired_ssid(void *pcore_data, u8 *pssid, u8 ssid_len); |
| 42 | |
| 43 | // OID_802_11_INFRASTRUCTURE_MODE |
| 44 | s8 sme_get_bss_type(void *pcore_data, u8 *pbss_type); |
| 45 | s8 sme_get_desired_bss_type(void *pcore_data, u8 *pbss_type);//Not use |
| 46 | s8 sme_set_desired_bss_type(void *pcore_data, u8 bss_type); |
| 47 | |
| 48 | // OID_802_11_FRAGMENTATION_THRESHOLD |
| 49 | s8 sme_get_fragment_threshold(void *pcore_data, u32 *pthreshold); |
| 50 | s8 sme_set_fragment_threshold(void *pcore_data, u32 threshold); |
| 51 | |
| 52 | // OID_802_11_RTS_THRESHOLD |
| 53 | s8 sme_get_rts_threshold(void *pcore_data, u32 *pthreshold); |
| 54 | s8 sme_set_rts_threshold(void *pcore_data, u32 threshold); |
| 55 | |
Pavel Machek | 66101de | 2008-10-01 14:36:56 +0200 | [diff] [blame] | 56 | // OID_802_11_CONFIGURATION |
| 57 | s8 sme_get_beacon_period(void *pcore_data, u16 *pbeacon_period); |
| 58 | s8 sme_set_beacon_period(void *pcore_data, u16 beacon_period); |
| 59 | |
| 60 | s8 sme_get_atim_window(void *pcore_data, u16 *patim_window); |
| 61 | s8 sme_set_atim_window(void *pcore_data, u16 atim_window); |
| 62 | |
| 63 | s8 sme_get_current_channel(void *pcore_data, u8 *pcurrent_channel); |
| 64 | s8 sme_get_current_band(void *pcore_data, u8 *pcurrent_band); |
| 65 | s8 sme_set_current_channel(void *pcore_data, u8 current_channel); |
| 66 | |
| 67 | // OID_802_11_BSSID_LIST |
| 68 | s8 sme_get_scan_bss_count(void *pcore_data, u8 *pcount); |
| 69 | s8 sme_get_scan_bss(void *pcore_data, u8 index, void **ppbss); |
| 70 | |
| 71 | s8 sme_get_connected_bss(void *pcore_data, void **ppbss_now); |
| 72 | |
| 73 | // OID_802_11_AUTHENTICATION_MODE |
| 74 | s8 sme_get_auth_mode(void *pcore_data, u8 *pauth_mode); |
| 75 | s8 sme_set_auth_mode(void *pcore_data, u8 auth_mode); |
| 76 | |
| 77 | // OID_802_11_WEP_STATUS / OID_802_11_ENCRYPTION_STATUS |
| 78 | s8 sme_get_wep_mode(void *pcore_data, u8 *pwep_mode); |
| 79 | s8 sme_set_wep_mode(void *pcore_data, u8 wep_mode); |
| 80 | //s8 sme_get_encryption_status(void *pcore_data, u8 *pstatus); |
| 81 | //s8 sme_set_encryption_status(void *pcore_data, u8 status); |
| 82 | |
| 83 | // ??????????????????????????????????????? |
| 84 | |
| 85 | // OID_GEN_VENDOR_ID |
| 86 | // OID_802_3_PERMANENT_ADDRESS |
| 87 | s8 sme_get_permanent_mac_addr(void *pcore_data, u8 *pmac_addr); |
| 88 | |
| 89 | // OID_802_3_CURRENT_ADDRESS |
| 90 | s8 sme_get_current_mac_addr(void *pcore_data, u8 *pmac_addr); |
| 91 | |
| 92 | // OID_802_11_NETWORK_TYPE_IN_USE |
| 93 | s8 sme_get_network_type_in_use(void *pcore_data, u8 *ptype); |
| 94 | s8 sme_set_network_type_in_use(void *pcore_data, u8 type); |
| 95 | |
| 96 | // OID_802_11_SUPPORTED_RATES |
| 97 | s8 sme_get_supported_rate(void *pcore_data, u8 *prates); |
| 98 | |
| 99 | // OID_802_11_ADD_WEP |
| 100 | //12/29/03' wkchen |
| 101 | s8 sme_set_add_wep(void *pcore_data, u32 key_index, u32 key_len, |
| 102 | u8 *Address, u8 *key); |
| 103 | |
| 104 | // OID_802_11_REMOVE_WEP |
| 105 | s8 sme_set_remove_wep(void *pcre_data, u32 key_index); |
| 106 | |
| 107 | // OID_802_11_DISASSOCIATE |
| 108 | s8 sme_set_disassociate(void *pcore_data); |
| 109 | |
| 110 | // OID_802_11_POWER_MODE |
| 111 | s8 sme_get_power_mode(void *pcore_data, u8 *pmode); |
| 112 | s8 sme_set_power_mode(void *pcore_data, u8 mode); |
| 113 | |
| 114 | // OID_802_11_BSSID_LIST_SCAN |
| 115 | s8 sme_set_bssid_list_scan(void *pcore_data, void *pscan_para); |
| 116 | |
| 117 | // OID_802_11_RELOAD_DEFAULTS |
| 118 | s8 sme_set_reload_defaults(void *pcore_data, u8 reload_type); |
| 119 | |
| 120 | |
| 121 | // The following SME API functions are used for WPA |
| 122 | // |
| 123 | // Mandatory OIDs for WPA |
| 124 | // |
| 125 | |
| 126 | // OID_802_11_ADD_KEY |
| 127 | //s8 sme_set_add_key(void *pcore_data, NDIS_802_11_KEY *pkey); |
| 128 | |
| 129 | // OID_802_11_REMOVE_KEY |
| 130 | //s8 sme_set_remove_key(void *pcore_data, NDIS_802_11_REMOVE_KEY *pkey); |
| 131 | |
| 132 | // OID_802_11_ASSOCIATION_INFORMATION |
| 133 | //s8 sme_set_association_information(void *pcore_data, |
| 134 | // NDIS_802_11_ASSOCIATION_INFORMATION *pinfo); |
| 135 | |
| 136 | // OID_802_11_TEST |
| 137 | //s8 sme_set_test(void *pcore_data, NDIS_802_11_TEST *ptest_data); |
| 138 | |
| 139 | //--------------------------------------------------------------------------// |
| 140 | /* |
| 141 | // The left OIDs |
| 142 | |
| 143 | // OID_802_11_NETWORK_TYPES_SUPPORTED |
| 144 | // OID_802_11_TX_POWER_LEVEL |
| 145 | // OID_802_11_RSSI_TRIGGER |
| 146 | // OID_802_11_NUMBER_OF_ANTENNAS |
| 147 | // OID_802_11_RX_ANTENNA_SELECTED |
| 148 | // OID_802_11_TX_ANTENNA_SELECTED |
| 149 | // OID_802_11_STATISTICS |
| 150 | // OID_802_11_DESIRED_RATES |
| 151 | // OID_802_11_PRIVACY_FILTER |
| 152 | |
| 153 | */ |
| 154 | |
| 155 | /*------------------------- none-standard ----------------------------------*/ |
| 156 | s8 sme_get_connect_status(void *pcore_data, u8 *pstatus); |
| 157 | |
| 158 | /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 159 | //s8 sme_get_scan_type(void *pcore_data, u8 *pscan_type); |
| 160 | //s8 sme_set_scan_type(void *pcore_data, u8 scan_type); |
| 161 | |
| 162 | //s8 sme_get_scan_channel_list(void *pcore_data, u8 *pscan_type); |
| 163 | //s8 sme_set_scan_channel_list(void *pcore_data, u8 scan_type); |
| 164 | |
| 165 | |
| 166 | void sme_get_encryption_status(void *pcore_data, u8 *EncryptStatus); |
| 167 | void sme_set_encryption_status(void *pcore_data, u8 EncryptStatus); |
| 168 | s8 sme_add_key(void *pcore_data, |
| 169 | u32 key_index, |
| 170 | u8 key_len, |
| 171 | u8 key_type, |
| 172 | u8 *key_bssid, |
| 173 | //u8 *key_rsc, |
| 174 | u8 *ptx_tsc, |
| 175 | u8 *prx_tsc, |
| 176 | u8 *key_material); |
| 177 | void sme_remove_default_key(void *pcore_data, int index); |
| 178 | void sme_remove_mapping_key(void *pcore_data, u8 *pmac_addr); |
| 179 | void sme_clear_all_mapping_key(void *pcore_data); |
| 180 | void sme_clear_all_default_key(void *pcore_data); |
| 181 | |
| 182 | |
| 183 | |
| 184 | s8 sme_set_preamble_mode(void *pcore_data, u8 mode); |
| 185 | s8 sme_get_preamble_mode(void *pcore_data, u8 *mode); |
| 186 | s8 sme_get_preamble_type(void *pcore_data, u8 *type); |
| 187 | s8 sme_set_slottime_mode(void *pcore_data, u8 mode); |
| 188 | s8 sme_get_slottime_mode(void *pcore_data, u8 *mode); |
| 189 | s8 sme_get_slottime_type(void *pcore_data, u8 *type); |
| 190 | s8 sme_set_txrate_policy(void *pcore_data, u8 policy); |
| 191 | s8 sme_get_txrate_policy(void *pcore_data, u8 *policy); |
| 192 | s8 sme_get_cwmin_value(void *pcore_data, u8 *cwmin); |
| 193 | s8 sme_get_cwmax_value(void *pcore_data, u16 *cwmax); |
| 194 | s8 sme_get_ms_radio_mode(void *pcore_data, u8 * pMsRadioOff); |
| 195 | s8 sme_set_ms_radio_mode(void *pcore_data, u8 boMsRadioOff); |
| 196 | s8 sme_get_radio_mode(void *pcore_data, psRadioOff pRadioOffData); |
| 197 | s8 sme_set_radio_mode(void *pcore_data, RadioOff RadioOffData); |
| 198 | |
| 199 | void sme_get_tx_power_level(void *pcore_data, u32 *TxPower); |
| 200 | u8 sme_set_tx_power_level(void *pcore_data, u32 TxPower); |
| 201 | void sme_get_antenna_count(void *pcore_data, u32 *AntennaCount); |
| 202 | void sme_get_rx_antenna(void *pcore_data, u32 *RxAntenna); |
| 203 | u8 sme_set_rx_antenna(void *pcore_data, u32 RxAntenna); |
| 204 | void sme_get_tx_antenna(void *pcore_data, u32 *TxAntenna); |
| 205 | s8 sme_set_tx_antenna(void *pcore_data, u32 TxAntenna); |
| 206 | s8 sme_set_IBSS_chan(void *pcore_data, ChanInfo chan); |
| 207 | |
| 208 | //20061108 WPS |
Pekka Enberg | 8b384e0 | 2008-10-21 00:03:41 +0300 | [diff] [blame] | 209 | s8 sme_set_IE_append(void *pcore_data, u8 *buffer, u16 buf_len); |
Pavel Machek | 66101de | 2008-10-01 14:36:56 +0200 | [diff] [blame] | 210 | |
| 211 | |
| 212 | |
| 213 | |
| 214 | //================== Local functions ====================== |
| 215 | //#ifdef _HSINCHU |
| 216 | //void drv_translate_rssi(); // HW RSSI bit -> NDIS RSSI representation |
| 217 | //void drv_translate_bss_description(); // Local bss desc -> NDIS bss desc |
| 218 | //void drv_translate_channel(u8 NetworkType, u8 ChannelNumber, u32 *freq); // channel number -> channel /freq. |
| 219 | //#endif _HSINCHU |
| 220 | // |
| 221 | static const u32 PowerDbToMw[] = |
| 222 | { |
| 223 | 56, //mW, MAX - 0, 17.5 dbm |
| 224 | 40, //mW, MAX - 1, 16.0 dbm |
| 225 | 30, //mW, MAX - 2, 14.8 dbm |
| 226 | 20, //mW, MAX - 3, 13.0 dbm |
| 227 | 15, //mW, MAX - 4, 11.8 dbm |
| 228 | 12, //mW, MAX - 5, 10.6 dbm |
| 229 | 9, //mW, MAX - 6, 9.4 dbm |
| 230 | 7, //mW, MAX - 7, 8.3 dbm |
| 231 | 5, //mW, MAX - 8, 6.4 dbm |
| 232 | 4, //mW, MAX - 9, 5.3 dbm |
| 233 | 3, //mW, MAX - 10, 4.0 dbm |
| 234 | 2, //mW, MAX - 11, ? dbm |
| 235 | 2, //mW, MAX - 12, ? dbm |
| 236 | 2, //mW, MAX - 13, ? dbm |
| 237 | 2, //mW, MAX - 14, ? dbm |
| 238 | 2, //mW, MAX - 15, ? dbm |
| 239 | 2, //mW, MAX - 16, ? dbm |
| 240 | 2, //mW, MAX - 17, ? dbm |
| 241 | 2, //mW, MAX - 18, ? dbm |
| 242 | 1, //mW, MAX - 19, ? dbm |
| 243 | 1, //mW, MAX - 20, ? dbm |
| 244 | 1, //mW, MAX - 21, ? dbm |
| 245 | 1, //mW, MAX - 22, ? dbm |
| 246 | 1, //mW, MAX - 23, ? dbm |
| 247 | 1, //mW, MAX - 24, ? dbm |
| 248 | 1, //mW, MAX - 25, ? dbm |
| 249 | 1, //mW, MAX - 26, ? dbm |
| 250 | 1, //mW, MAX - 27, ? dbm |
| 251 | 1, //mW, MAX - 28, ? dbm |
| 252 | 1, //mW, MAX - 29, ? dbm |
| 253 | 1, //mW, MAX - 30, ? dbm |
| 254 | 1 //mW, MAX - 31, ? dbm |
| 255 | }; |
| 256 | |
| 257 | |
| 258 | |
| 259 | |
| 260 | |
| 261 | #endif /* __SME_API_H__ */ |
| 262 | |
| 263 | |