1 /* 2 * sme_api.h 3 * 4 * Copyright(C) 2002 Winbond Electronics Corp. 5 */ 6 7 #ifndef __SME_API_H__ 8 #define __SME_API_H__ 9 10 #include <linux/types.h> 11 12 #include "localpara.h" 13 14 /****************** CONSTANT AND MACRO SECTION ******************************/ 15 #define _INLINE __inline 16 17 #define MEDIA_STATE_DISCONNECTED 0 18 #define MEDIA_STATE_CONNECTED 1 19 20 /* ARRAY CHECK */ 21 #define MAX_POWER_TO_DB 32 22 23 /****************** TYPE DEFINITION SECTION *********************************/ 24 25 /****************** EXPORTED FUNCTION DECLARATION SECTION *******************/ 26 27 /* OID_802_11_BSSID */ 28 s8 sme_get_bssid(void *pcore_data, u8 *pbssid); 29 s8 sme_get_desired_bssid(void *pcore_data, u8 *pbssid); /* Not use */ 30 s8 sme_set_desired_bssid(void *pcore_data, u8 *pbssid); 31 32 /* OID_802_11_SSID */ 33 s8 sme_get_ssid(void *pcore_data, u8 *pssid, u8 *pssid_len); 34 s8 sme_get_desired_ssid(void *pcore_data, u8 *pssid, u8 *pssid_len);/* Not use */ 35 s8 sme_set_desired_ssid(void *pcore_data, u8 *pssid, u8 ssid_len); 36 37 /* OID_802_11_INFRASTRUCTURE_MODE */ 38 s8 sme_get_bss_type(void *pcore_data, u8 *pbss_type); 39 s8 sme_get_desired_bss_type(void *pcore_data, u8 *pbss_type); /* Not use */ 40 s8 sme_set_desired_bss_type(void *pcore_data, u8 bss_type); 41 42 /* OID_802_11_FRAGMENTATION_THRESHOLD */ 43 s8 sme_get_fragment_threshold(void *pcore_data, u32 *pthreshold); 44 s8 sme_set_fragment_threshold(void *pcore_data, u32 threshold); 45 46 /* OID_802_11_RTS_THRESHOLD */ 47 s8 sme_get_rts_threshold(void *pcore_data, u32 *pthreshold); 48 s8 sme_set_rts_threshold(void *pcore_data, u32 threshold); 49 50 /* OID_802_11_CONFIGURATION */ 51 s8 sme_get_beacon_period(void *pcore_data, u16 *pbeacon_period); 52 s8 sme_set_beacon_period(void *pcore_data, u16 beacon_period); 53 54 s8 sme_get_atim_window(void *pcore_data, u16 *patim_window); 55 s8 sme_set_atim_window(void *pcore_data, u16 atim_window); 56 57 s8 sme_get_current_channel(void *pcore_data, u8 *pcurrent_channel); 58 s8 sme_get_current_band(void *pcore_data, u8 *pcurrent_band); 59 s8 sme_set_current_channel(void *pcore_data, u8 current_channel); 60 61 /* OID_802_11_BSSID_LIST */ 62 s8 sme_get_scan_bss_count(void *pcore_data, u8 *pcount); 63 s8 sme_get_scan_bss(void *pcore_data, u8 index, void **ppbss); 64 65 s8 sme_get_connected_bss(void *pcore_data, void **ppbss_now); 66 67 /* OID_802_11_AUTHENTICATION_MODE */ 68 s8 sme_get_auth_mode(void *pcore_data, u8 *pauth_mode); 69 s8 sme_set_auth_mode(void *pcore_data, u8 auth_mode); 70 71 /* OID_802_11_WEP_STATUS / OID_802_11_ENCRYPTION_STATUS */ 72 s8 sme_get_wep_mode(void *pcore_data, u8 *pwep_mode); 73 s8 sme_set_wep_mode(void *pcore_data, u8 wep_mode); 74 75 /* OID_GEN_VENDOR_ID */ 76 /* OID_802_3_PERMANENT_ADDRESS */ 77 s8 sme_get_permanent_mac_addr(void *pcore_data, u8 *pmac_addr); 78 79 /* OID_802_3_CURRENT_ADDRESS */ 80 s8 sme_get_current_mac_addr(void *pcore_data, u8 *pmac_addr); 81 82 /* OID_802_11_NETWORK_TYPE_IN_USE */ 83 s8 sme_get_network_type_in_use(void *pcore_data, u8 *ptype); 84 s8 sme_set_network_type_in_use(void *pcore_data, u8 type); 85 86 /* OID_802_11_SUPPORTED_RATES */ 87 s8 sme_get_supported_rate(void *pcore_data, u8 *prates); 88 89 /* OID_802_11_ADD_WEP */ 90 s8 sme_set_add_wep(void *pcore_data, u32 key_index, u32 key_len, 91 u8 *Address, u8 *key); 92 93 /* OID_802_11_REMOVE_WEP */ 94 s8 sme_set_remove_wep(void *pcre_data, u32 key_index); 95 96 /* OID_802_11_DISASSOCIATE */ 97 s8 sme_set_disassociate(void *pcore_data); 98 99 /* OID_802_11_POWER_MODE */ 100 s8 sme_get_power_mode(void *pcore_data, u8 *pmode); 101 s8 sme_set_power_mode(void *pcore_data, u8 mode); 102 103 /* OID_802_11_BSSID_LIST_SCAN */ 104 s8 sme_set_bssid_list_scan(void *pcore_data, void *pscan_para); 105 106 /* OID_802_11_RELOAD_DEFAULTS */ 107 s8 sme_set_reload_defaults(void *pcore_data, u8 reload_type); 108 109 110 /*------------------------- none-standard ----------------------------------*/ 111 s8 sme_get_connect_status(void *pcore_data, u8 *pstatus); 112 /*--------------------------------------------------------------------------*/ 113 114 void sme_get_encryption_status(void *pcore_data, u8 *EncryptStatus); 115 void sme_set_encryption_status(void *pcore_data, u8 EncryptStatus); 116 s8 sme_add_key(void *pcore_data, 117 u32 key_index, 118 u8 key_len, 119 u8 key_type, 120 u8 *key_bssid, 121 u8 *ptx_tsc, 122 u8 *prx_tsc, 123 u8 *key_material); 124 void sme_remove_default_key(void *pcore_data, int index); 125 void sme_remove_mapping_key(void *pcore_data, u8 *pmac_addr); 126 void sme_clear_all_mapping_key(void *pcore_data); 127 void sme_clear_all_default_key(void *pcore_data); 128 129 130 131 s8 sme_set_preamble_mode(void *pcore_data, u8 mode); 132 s8 sme_get_preamble_mode(void *pcore_data, u8 *mode); 133 s8 sme_get_preamble_type(void *pcore_data, u8 *type); 134 s8 sme_set_slottime_mode(void *pcore_data, u8 mode); 135 s8 sme_get_slottime_mode(void *pcore_data, u8 *mode); 136 s8 sme_get_slottime_type(void *pcore_data, u8 *type); 137 s8 sme_set_txrate_policy(void *pcore_data, u8 policy); 138 s8 sme_get_txrate_policy(void *pcore_data, u8 *policy); 139 s8 sme_get_cwmin_value(void *pcore_data, u8 *cwmin); 140 s8 sme_get_cwmax_value(void *pcore_data, u16 *cwmax); 141 s8 sme_get_ms_radio_mode(void *pcore_data, u8 * pMsRadioOff); 142 s8 sme_set_ms_radio_mode(void *pcore_data, u8 boMsRadioOff); 143 144 void sme_get_tx_power_level(void *pcore_data, u32 *TxPower); 145 u8 sme_set_tx_power_level(void *pcore_data, u32 TxPower); 146 void sme_get_antenna_count(void *pcore_data, u32 *AntennaCount); 147 void sme_get_rx_antenna(void *pcore_data, u32 *RxAntenna); 148 u8 sme_set_rx_antenna(void *pcore_data, u32 RxAntenna); 149 void sme_get_tx_antenna(void *pcore_data, u32 *TxAntenna); 150 s8 sme_set_tx_antenna(void *pcore_data, u32 TxAntenna); 151 s8 sme_set_IBSS_chan(void *pcore_data, struct chan_info chan); 152 s8 sme_set_IE_append(void *pcore_data, u8 *buffer, u16 buf_len); 153 154 /* ================== Local functions ====================== */ 155 static const u32 PowerDbToMw[] = { 156 56, /* mW, MAX - 0, 17.5 dbm */ 157 40, /* mW, MAX - 1, 16.0 dbm */ 158 30, /* mW, MAX - 2, 14.8 dbm */ 159 20, /* mW, MAX - 3, 13.0 dbm */ 160 15, /* mW, MAX - 4, 11.8 dbm */ 161 12, /* mW, MAX - 5, 10.6 dbm */ 162 9, /* mW, MAX - 6, 9.4 dbm */ 163 7, /* mW, MAX - 7, 8.3 dbm */ 164 5, /* mW, MAX - 8, 6.4 dbm */ 165 4, /* mW, MAX - 9, 5.3 dbm */ 166 3, /* mW, MAX - 10, 4.0 dbm */ 167 2, /* mW, MAX - 11, ? dbm */ 168 2, /* mW, MAX - 12, ? dbm */ 169 2, /* mW, MAX - 13, ? dbm */ 170 2, /* mW, MAX - 14, ? dbm */ 171 2, /* mW, MAX - 15, ? dbm */ 172 2, /* mW, MAX - 16, ? dbm */ 173 2, /* mW, MAX - 17, ? dbm */ 174 2, /* mW, MAX - 18, ? dbm */ 175 1, /* mW, MAX - 19, ? dbm */ 176 1, /* mW, MAX - 20, ? dbm */ 177 1, /* mW, MAX - 21, ? dbm */ 178 1, /* mW, MAX - 22, ? dbm */ 179 1, /* mW, MAX - 23, ? dbm */ 180 1, /* mW, MAX - 24, ? dbm */ 181 1, /* mW, MAX - 25, ? dbm */ 182 1, /* mW, MAX - 26, ? dbm */ 183 1, /* mW, MAX - 27, ? dbm */ 184 1, /* mW, MAX - 28, ? dbm */ 185 1, /* mW, MAX - 29, ? dbm */ 186 1, /* mW, MAX - 30, ? dbm */ 187 1 /* mW, MAX - 31, ? dbm */ 188 }; 189 190 #endif /* __SME_API_H__ */ 191 192 193