4 * Copyright(C) 2002 Winbond Electronics Corp.
7 * ---------------------------------------------------------------------------
8 * 1.00.001, 2003-04-21, Kevin created
9 * 1.00.002, 2003-05-14, PD43 & PE20 modified
16 #include <linux/types.h>
18 #include "localpara.h"
20 /****************** CONSTANT AND MACRO SECTION ******************************/
21 #define _INLINE __inline
23 #define MEDIA_STATE_DISCONNECTED 0
24 #define MEDIA_STATE_CONNECTED 1
27 #define MAX_POWER_TO_DB 32
29 /****************** TYPE DEFINITION SECTION *********************************/
31 /****************** EXPORTED FUNCTION DECLARATION SECTION *******************/
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);
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);
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);
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);
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);
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);
60 s8 sme_get_atim_window(void *pcore_data, u16 *patim_window);
61 s8 sme_set_atim_window(void *pcore_data, u16 atim_window);
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);
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);
71 s8 sme_get_connected_bss(void *pcore_data, void **ppbss_now);
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);
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);
83 // ???????????????????????????????????????
86 // OID_802_3_PERMANENT_ADDRESS
87 s8 sme_get_permanent_mac_addr(void *pcore_data, u8 *pmac_addr);
89 // OID_802_3_CURRENT_ADDRESS
90 s8 sme_get_current_mac_addr(void *pcore_data, u8 *pmac_addr);
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);
96 // OID_802_11_SUPPORTED_RATES
97 s8 sme_get_supported_rate(void *pcore_data, u8 *prates);
101 s8 sme_set_add_wep(void *pcore_data, u32 key_index, u32 key_len,
102 u8 *Address, u8 *key);
104 // OID_802_11_REMOVE_WEP
105 s8 sme_set_remove_wep(void *pcre_data, u32 key_index);
107 // OID_802_11_DISASSOCIATE
108 s8 sme_set_disassociate(void *pcore_data);
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);
114 // OID_802_11_BSSID_LIST_SCAN
115 s8 sme_set_bssid_list_scan(void *pcore_data, void *pscan_para);
117 // OID_802_11_RELOAD_DEFAULTS
118 s8 sme_set_reload_defaults(void *pcore_data, u8 reload_type);
121 // The following SME API functions are used for WPA
123 // Mandatory OIDs for WPA
126 // OID_802_11_ADD_KEY
127 //s8 sme_set_add_key(void *pcore_data, NDIS_802_11_KEY *pkey);
129 // OID_802_11_REMOVE_KEY
130 //s8 sme_set_remove_key(void *pcore_data, NDIS_802_11_REMOVE_KEY *pkey);
132 // OID_802_11_ASSOCIATION_INFORMATION
133 //s8 sme_set_association_information(void *pcore_data,
134 // NDIS_802_11_ASSOCIATION_INFORMATION *pinfo);
137 //s8 sme_set_test(void *pcore_data, NDIS_802_11_TEST *ptest_data);
139 //--------------------------------------------------------------------------//
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
155 /*------------------------- none-standard ----------------------------------*/
156 s8 sme_get_connect_status(void *pcore_data, u8 *pstatus);
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);
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);
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,
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);
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);
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);
209 s8 sme_set_IE_append(void *pcore_data, u8 *buffer, u16 buf_len);
214 //================== Local functions ======================
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.
221 static const u32 PowerDbToMw[] =
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
261 #endif /* __SME_API_H__ */