OpenWrt packages
Sign in or create your account | Project List | Help
OpenWrt packages Git Source Tree
Root/
| 1 | /* |
| 2 | * Driver for KeyStream wireless LAN |
| 3 | * |
| 4 | * ks_hostif.h |
| 5 | * $Id: ks_hostif.h 994 2009-09-14 01:51:16Z sekine $ |
| 6 | * |
| 7 | * Copyright (c) 2005-2008 KeyStream Corp. |
| 8 | * Copyright (C) 2009 Renesas Technology Corp. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it undr the terms of the GNU General Public License version 2 as |
| 12 | * published by the Free Sotware Foundation. |
| 13 | */ |
| 14 | |
| 15 | #ifndef _KS_HOSTIF_H_ |
| 16 | #define _KS_HOSTIF_H_ |
| 17 | /* |
| 18 | * HOST-MAC I/F events |
| 19 | */ |
| 20 | #define HIF_DATA_REQ 0xE001 |
| 21 | #define HIF_DATA_IND 0xE801 |
| 22 | #define HIF_MIB_GET_REQ 0xE002 |
| 23 | #define HIF_MIB_GET_CONF 0xE802 |
| 24 | #define HIF_MIB_SET_REQ 0xE003 |
| 25 | #define HIF_MIB_SET_CONF 0xE803 |
| 26 | #define HIF_POWERMGT_REQ 0xE004 |
| 27 | #define HIF_POWERMGT_CONF 0xE804 |
| 28 | #define HIF_START_REQ 0xE005 |
| 29 | #define HIF_START_CONF 0xE805 |
| 30 | #define HIF_CONNECT_IND 0xE806 |
| 31 | #define HIF_STOP_REQ 0xE006 |
| 32 | #define HIF_STOP_CONF 0xE807 |
| 33 | #define HIF_PS_ADH_SET_REQ 0xE007 |
| 34 | #define HIF_PS_ADH_SET_CONF 0xE808 |
| 35 | #define HIF_INFRA_SET_REQ 0xE008 |
| 36 | #define HIF_INFRA_SET_CONF 0xE809 |
| 37 | #define HIF_ADH_SET_REQ 0xE009 |
| 38 | #define HIF_ADH_SET_CONF 0xE80A |
| 39 | #define HIF_AP_SET_REQ 0xE00A |
| 40 | #define HIF_AP_SET_CONF 0xE80B |
| 41 | #define HIF_ASSOC_INFO_IND 0xE80C |
| 42 | #define HIF_MIC_FAILURE_REQ 0xE00B |
| 43 | #define HIF_MIC_FAILURE_CONF 0xE80D |
| 44 | #define HIF_SCAN_REQ 0xE00C |
| 45 | #define HIF_SCAN_CONF 0xE80E |
| 46 | #define HIF_PHY_INFO_REQ 0xE00D |
| 47 | #define HIF_PHY_INFO_CONF 0xE80F |
| 48 | #define HIF_SLEEP_REQ 0xE00E |
| 49 | #define HIF_SLEEP_CONF 0xE810 |
| 50 | #define HIF_PHY_INFO_IND 0xE811 |
| 51 | #define HIF_SCAN_IND 0xE812 |
| 52 | #define HIF_INFRA_SET2_REQ 0xE00F |
| 53 | #define HIF_INFRA_SET2_CONF 0xE813 |
| 54 | #define HIF_ADH_SET2_REQ 0xE010 |
| 55 | #define HIF_ADH_SET2_CONF 0xE814 |
| 56 | |
| 57 | #define HIF_REQ_MAX 0xE010 |
| 58 | |
| 59 | /* |
| 60 | * HOST-MAC I/F data structure |
| 61 | * Byte alignmet Little Endian |
| 62 | */ |
| 63 | |
| 64 | struct hostif_hdr { |
| 65 | uint16_t size; |
| 66 | uint16_t event; |
| 67 | } __attribute__((packed)); |
| 68 | |
| 69 | struct hostif_data_request_t { |
| 70 | struct hostif_hdr header; |
| 71 | uint16_t auth_type; |
| 72 | #define TYPE_DATA 0x0000 |
| 73 | #define TYPE_AUTH 0x0001 |
| 74 | uint16_t reserved; |
| 75 | uint8_t data[0]; |
| 76 | } __attribute__((packed)); |
| 77 | |
| 78 | struct hostif_data_indication_t { |
| 79 | struct hostif_hdr header; |
| 80 | uint16_t auth_type; |
| 81 | /* #define TYPE_DATA 0x0000 */ |
| 82 | #define TYPE_PMK1 0x0001 |
| 83 | #define TYPE_GMK1 0x0002 |
| 84 | #define TYPE_GMK2 0x0003 |
| 85 | uint16_t reserved; |
| 86 | uint8_t data[0]; |
| 87 | } __attribute__((packed)); |
| 88 | |
| 89 | #define CHANNEL_LIST_MAX_SIZE 14 |
| 90 | struct channel_list_t { |
| 91 | uint8_t size; |
| 92 | uint8_t body[CHANNEL_LIST_MAX_SIZE]; |
| 93 | uint8_t pad; |
| 94 | } __attribute__((packed)); |
| 95 | |
| 96 | /* MIB Attribute */ |
| 97 | #define DOT11_MAC_ADDRESS 0x21010100 /* MAC Address (R) */ |
| 98 | #define DOT11_PRODUCT_VERSION 0x31024100 /* FirmWare Version (R)*/ |
| 99 | #define DOT11_RTS_THRESHOLD 0x21020100 /* RTS Threshold (R/W) */ |
| 100 | #define DOT11_FRAGMENTATION_THRESHOLD 0x21050100 /* Fragment Threshold (R/W) */ |
| 101 | #define DOT11_PRIVACY_INVOKED 0x15010100 /* WEP ON/OFF (W) */ |
| 102 | #define DOT11_WEP_DEFAULT_KEY_ID 0x15020100 /* WEP Index (W) */ |
| 103 | #define DOT11_WEP_DEFAULT_KEY_VALUE1 0x13020101 /* WEP Key#1(TKIP AES: PairwiseTemporalKey) (W) */ |
| 104 | #define DOT11_WEP_DEFAULT_KEY_VALUE2 0x13020102 /* WEP Key#2(TKIP AES: GroupKey1) (W) */ |
| 105 | #define DOT11_WEP_DEFAULT_KEY_VALUE3 0x13020103 /* WEP Key#3(TKIP AES: GroupKey2) (W) */ |
| 106 | #define DOT11_WEP_DEFAULT_KEY_VALUE4 0x13020104 /* WEP Key#4 (W) */ |
| 107 | #define DOT11_WEP_LIST 0x13020100 /* WEP LIST */ |
| 108 | #define DOT11_DESIRED_SSID 0x11090100 /* SSID */ |
| 109 | #define DOT11_CURRENT_CHANNEL 0x45010100 /* channel set */ |
| 110 | #define DOT11_OPERATION_RATE_SET 0x11110100 /* rate set */ |
| 111 | |
| 112 | #define LOCAL_AP_SEARCH_INTEAVAL 0xF1010100 /* AP search interval (R/W) */ |
| 113 | #define LOCAL_CURRENTADDRESS 0xF1050100 /* MAC Adress change (W) */ |
| 114 | #define LOCAL_MULTICAST_ADDRESS 0xF1060100 /* Multicast Adress (W) */ |
| 115 | #define LOCAL_MULTICAST_FILTER 0xF1060200 /* Multicast Adress Filter enable/disable (W) */ |
| 116 | #define LOCAL_SEARCHED_AP_LIST 0xF1030100 /* AP list (R) */ |
| 117 | #define LOCAL_LINK_AP_STATUS 0xF1040100 /* Link AP status (R) */ |
| 118 | #define LOCAL_PACKET_STATISTICS 0xF1020100 /* tx,rx packets statistics */ |
| 119 | #define LOCAL_AP_SCAN_LIST_TYPE_SET 0xF1030200 /* AP_SCAN_LIST_TYPE */ |
| 120 | |
| 121 | #define DOT11_RSN_ENABLED 0x15070100 /* WPA enable/disable (W) */ |
| 122 | #define LOCAL_RSN_MODE 0x56010100 /* RSN mode WPA/WPA2 (W) */ |
| 123 | #define DOT11_RSN_CONFIG_MULTICAST_CIPHER 0x51040100 /* GroupKeyCipherSuite (W) */ |
| 124 | #define DOT11_RSN_CONFIG_UNICAST_CIPHER 0x52020100 /* PairwiseKeyCipherSuite (W) */ |
| 125 | #define DOT11_RSN_CONFIG_AUTH_SUITE 0x53020100 /* AuthenticationKeyManagementSuite (W) */ |
| 126 | #define DOT11_RSN_CONFIG_VERSION 0x51020100 /* RSN version (W) */ |
| 127 | #define LOCAL_RSN_CONFIG_ALL 0x5F010100 /* RSN CONFIG ALL (W) */ |
| 128 | #define DOT11_PMK_TSC 0x55010100 /* PMK_TSC (W) */ |
| 129 | #define DOT11_GMK1_TSC 0x55010101 /* GMK1_TSC (W) */ |
| 130 | #define DOT11_GMK2_TSC 0x55010102 /* GMK2_TSC (W) */ |
| 131 | #define DOT11_GMK3_TSC 0x55010103 /* GMK3_TSC */ |
| 132 | #define LOCAL_PMK 0x58010100 /* Pairwise Master Key cache (W) */ |
| 133 | |
| 134 | #define LOCAL_REGION 0xF10A0100 /* Region setting */ |
| 135 | |
| 136 | #ifdef WPS |
| 137 | #define LOCAL_WPS_ENABLE 0xF10B0100 /* WiFi Protected Setup */ |
| 138 | #define LOCAL_WPS_PROBE_REQ 0xF10C0100 /* WPS Probe Request */ |
| 139 | #endif /* WPS */ |
| 140 | |
| 141 | #define LOCAL_GAIN 0xF10D0100 /* Carrer sense threshold for demo ato show */ |
| 142 | #define LOCAL_EEPROM_SUM 0xF10E0100 /* EEPROM checksum information */ |
| 143 | |
| 144 | struct hostif_mib_get_request_t { |
| 145 | struct hostif_hdr header; |
| 146 | uint32_t mib_attribute; |
| 147 | } __attribute__((packed)); |
| 148 | |
| 149 | |
| 150 | struct hostif_mib_value_t { |
| 151 | uint16_t size; |
| 152 | uint16_t type; |
| 153 | #define MIB_VALUE_TYPE_NULL 0 |
| 154 | #define MIB_VALUE_TYPE_INT 1 |
| 155 | #define MIB_VALUE_TYPE_BOOL 2 |
| 156 | #define MIB_VALUE_TYPE_COUNT32 3 |
| 157 | #define MIB_VALUE_TYPE_OSTRING 4 |
| 158 | uint8_t body[0]; |
| 159 | } __attribute__((packed)); |
| 160 | |
| 161 | struct hostif_mib_get_confirm_t { |
| 162 | struct hostif_hdr header; |
| 163 | uint32_t mib_status; |
| 164 | #define MIB_SUCCESS 0 |
| 165 | #define MIB_INVALID 1 |
| 166 | #define MIB_READ_ONLY 2 |
| 167 | #define MIB_WRITE_ONLY 3 |
| 168 | uint32_t mib_attribute; |
| 169 | struct hostif_mib_value_t mib_value; |
| 170 | } __attribute__((packed)); |
| 171 | |
| 172 | struct hostif_mib_set_request_t { |
| 173 | struct hostif_hdr header; |
| 174 | uint32_t mib_attribute; |
| 175 | struct hostif_mib_value_t mib_value; |
| 176 | } __attribute__((packed)); |
| 177 | |
| 178 | struct hostif_mib_set_confirm_t { |
| 179 | struct hostif_hdr header; |
| 180 | uint32_t mib_status; |
| 181 | uint32_t mib_attribute; |
| 182 | } __attribute__((packed)); |
| 183 | |
| 184 | struct hostif_power_mngmt_request_t { |
| 185 | struct hostif_hdr header; |
| 186 | uint32_t mode; |
| 187 | #define POWER_ACTIVE 1 |
| 188 | #define POWER_SAVE 2 |
| 189 | uint32_t wake_up; |
| 190 | #define SLEEP_FALSE 0 |
| 191 | #define SLEEP_TRUE 1 /* not used */ |
| 192 | uint32_t receiveDTIMs; |
| 193 | #define DTIM_FALSE 0 |
| 194 | #define DTIM_TRUE 1 |
| 195 | } __attribute__((packed)); |
| 196 | |
| 197 | /* power management mode */ |
| 198 | enum { |
| 199 | POWMGT_ACTIVE_MODE=0, |
| 200 | POWMGT_SAVE1_MODE, |
| 201 | POWMGT_SAVE2_MODE |
| 202 | }; |
| 203 | |
| 204 | #define RESULT_SUCCESS 0 |
| 205 | #define RESULT_INVALID_PARAMETERS 1 |
| 206 | #define RESULT_NOT_SUPPORTED 2 |
| 207 | /* #define RESULT_ALREADY_RUNNING 3 */ |
| 208 | #define RESULT_ALREADY_RUNNING 7 |
| 209 | |
| 210 | struct hostif_power_mngmt_confirm_t { |
| 211 | struct hostif_hdr header; |
| 212 | uint16_t result_code; |
| 213 | } __attribute__((packed)); |
| 214 | |
| 215 | struct hostif_start_request_t { |
| 216 | struct hostif_hdr header; |
| 217 | uint16_t mode; |
| 218 | #define MODE_PSEUDO_ADHOC 0 |
| 219 | #define MODE_INFRASTRUCTURE 1 |
| 220 | #define MODE_AP 2 /* not used */ |
| 221 | #define MODE_ADHOC 3 |
| 222 | } __attribute__((packed)); |
| 223 | |
| 224 | struct hostif_start_confirm_t { |
| 225 | struct hostif_hdr header; |
| 226 | uint16_t result_code; |
| 227 | } __attribute__((packed)); |
| 228 | |
| 229 | #define SSID_MAX_SIZE 32 |
| 230 | struct ssid_t { |
| 231 | uint8_t size; |
| 232 | uint8_t body[SSID_MAX_SIZE]; |
| 233 | uint8_t ssid_pad; |
| 234 | } __attribute__((packed)); |
| 235 | |
| 236 | #define RATE_SET_MAX_SIZE 16 |
| 237 | struct rate_set8_t { |
| 238 | uint8_t size; |
| 239 | uint8_t body[8]; |
| 240 | uint8_t rate_pad; |
| 241 | } __attribute__((packed)); |
| 242 | |
| 243 | struct FhParms_t { |
| 244 | uint16_t dwellTime; |
| 245 | uint8_t hopSet; |
| 246 | uint8_t hopPattern; |
| 247 | uint8_t hopIndex; |
| 248 | } __attribute__((packed)); |
| 249 | |
| 250 | struct DsParms_t { |
| 251 | uint8_t channel; |
| 252 | } __attribute__((packed)); |
| 253 | |
| 254 | struct CfParms_t { |
| 255 | uint8_t count; |
| 256 | uint8_t period; |
| 257 | uint16_t maxDuration; |
| 258 | uint16_t durRemaining; |
| 259 | } __attribute__((packed)); |
| 260 | |
| 261 | struct IbssParms_t { |
| 262 | uint16_t atimWindow; |
| 263 | } __attribute__((packed)); |
| 264 | |
| 265 | |
| 266 | struct rsn_t { |
| 267 | uint8_t size; |
| 268 | #define RSN_BODY_SIZE 64 |
| 269 | uint8_t body[RSN_BODY_SIZE]; |
| 270 | } __attribute__((packed)); |
| 271 | |
| 272 | struct ErpParams_t { |
| 273 | uint8_t erp_info; |
| 274 | } __attribute__((packed)); |
| 275 | |
| 276 | struct rate_set16_t{ |
| 277 | uint8_t size; |
| 278 | uint8_t body[16]; |
| 279 | uint8_t rate_pad; |
| 280 | } __attribute__((packed)); |
| 281 | |
| 282 | struct ap_info_t{ |
| 283 | uint8_t bssid[6]; /* +00 */ |
| 284 | uint8_t rssi; /* +06 */ |
| 285 | uint8_t sq; /* +07 */ |
| 286 | uint8_t noise; /* +08 */ |
| 287 | uint8_t pad0; /* +09 */ |
| 288 | uint16_t beacon_period; /* +10 */ |
| 289 | uint16_t capability; /* +12 */ |
| 290 | #define BSS_CAP_ESS (1<<0) |
| 291 | #define BSS_CAP_IBSS (1<<1) |
| 292 | #define BSS_CAP_CF_POLABLE (1<<2) |
| 293 | #define BSS_CAP_CF_POLL_REQ (1<<3) |
| 294 | #define BSS_CAP_PRIVACY (1<<4) |
| 295 | #define BSS_CAP_SHORT_PREAMBLE (1<<5) |
| 296 | #define BSS_CAP_PBCC (1<<6) |
| 297 | #define BSS_CAP_CHANNEL_AGILITY (1<<7) |
| 298 | #define BSS_CAP_SHORT_SLOT_TIME (1<<10) |
| 299 | #define BSS_CAP_DSSS_OFDM (1<<13) |
| 300 | uint8_t frame_type; /* +14 */ |
| 301 | uint8_t ch_info; /* +15 */ |
| 302 | #define FRAME_TYPE_BEACON 0x80 |
| 303 | #define FRAME_TYPE_PROBE_RESP 0x50 |
| 304 | uint16_t body_size; /* +16 */ |
| 305 | uint8_t body[1024]; /* +18 */ |
| 306 | /* +1032 */ |
| 307 | } __attribute__((packed)); |
| 308 | |
| 309 | struct link_ap_info_t{ |
| 310 | uint8_t bssid[6]; /* +00 */ |
| 311 | uint8_t rssi; /* +06 */ |
| 312 | uint8_t sq; /* +07 */ |
| 313 | uint8_t noise; /* +08 */ |
| 314 | uint8_t pad0; /* +09 */ |
| 315 | uint16_t beacon_period; /* +10 */ |
| 316 | uint16_t capability; /* +12 */ |
| 317 | struct rate_set8_t rate_set; /* +14 */ |
| 318 | struct FhParms_t fh_parameter; /* +24 */ |
| 319 | struct DsParms_t ds_parameter; /* +29 */ |
| 320 | struct CfParms_t cf_parameter; /* +30 */ |
| 321 | struct IbssParms_t ibss_parameter; /* +36 */ |
| 322 | struct ErpParams_t erp_parameter; /* +38 */ |
| 323 | uint8_t pad1; /* +39 */ |
| 324 | struct rate_set8_t ext_rate_set; /* +40 */ |
| 325 | uint8_t DTIM_period; /* +50 */ |
| 326 | uint8_t rsn_mode; /* +51 */ |
| 327 | #define RSN_MODE_NONE 0 |
| 328 | #define RSN_MODE_WPA 1 |
| 329 | #define RSN_MODE_WPA2 2 |
| 330 | struct { |
| 331 | uint8_t size; /* +52 */ |
| 332 | uint8_t body[128]; /* +53 */ |
| 333 | } __attribute__((packed)) rsn; |
| 334 | } __attribute__((packed)); |
| 335 | |
| 336 | struct hostif_connect_indication_t { |
| 337 | struct hostif_hdr header; |
| 338 | uint16_t connect_code; |
| 339 | #define RESULT_CONNECT 0 |
| 340 | #define RESULT_DISCONNECT 1 |
| 341 | struct link_ap_info_t link_ap_info; |
| 342 | } __attribute__((packed)); |
| 343 | |
| 344 | struct hostif_stop_request_t { |
| 345 | struct hostif_hdr header; |
| 346 | } __attribute__((packed)); |
| 347 | |
| 348 | struct hostif_stop_confirm_t { |
| 349 | struct hostif_hdr header; |
| 350 | uint16_t result_code; |
| 351 | } __attribute__((packed)); |
| 352 | |
| 353 | struct hostif_ps_adhoc_set_request_t { |
| 354 | struct hostif_hdr header; |
| 355 | uint16_t phy_type; |
| 356 | #define D_11B_ONLY_MODE 0 |
| 357 | #define D_11G_ONLY_MODE 1 |
| 358 | #define D_11BG_COMPATIBLE_MODE 2 |
| 359 | #define D_11A_ONLY_MODE 3 |
| 360 | uint16_t cts_mode; |
| 361 | #define CTS_MODE_FALSE 0 |
| 362 | #define CTS_MODE_TRUE 1 |
| 363 | uint16_t channel; |
| 364 | struct rate_set16_t rate_set; |
| 365 | uint16_t capability; /* bit5:preamble bit6:pbcc pbcc not supported always 0 |
| 366 | * bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ |
| 367 | uint16_t scan_type; |
| 368 | } __attribute__((packed)); |
| 369 | |
| 370 | struct hostif_ps_adhoc_set_confirm_t { |
| 371 | struct hostif_hdr header; |
| 372 | uint16_t result_code; |
| 373 | } __attribute__((packed)); |
| 374 | |
| 375 | struct hostif_infrastructure_set_request_t { |
| 376 | struct hostif_hdr header; |
| 377 | uint16_t phy_type; |
| 378 | uint16_t cts_mode; |
| 379 | struct rate_set16_t rate_set; |
| 380 | struct ssid_t ssid; |
| 381 | uint16_t capability; /* bit5:preamble bit6:pbcc pbcc not supported always 0 |
| 382 | * bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ |
| 383 | uint16_t beacon_lost_count; |
| 384 | uint16_t auth_type; |
| 385 | #define AUTH_TYPE_OPEN_SYSTEM 0 |
| 386 | #define AUTH_TYPE_SHARED_KEY 1 |
| 387 | struct channel_list_t channel_list; |
| 388 | uint16_t scan_type; |
| 389 | } __attribute__((packed)); |
| 390 | |
| 391 | struct hostif_infrastructure_set2_request_t { |
| 392 | struct hostif_hdr header; |
| 393 | uint16_t phy_type; |
| 394 | uint16_t cts_mode; |
| 395 | struct rate_set16_t rate_set; |
| 396 | struct ssid_t ssid; |
| 397 | uint16_t capability; /* bit5:preamble bit6:pbcc pbcc not supported always 0 |
| 398 | * bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ |
| 399 | uint16_t beacon_lost_count; |
| 400 | uint16_t auth_type; |
| 401 | #define AUTH_TYPE_OPEN_SYSTEM 0 |
| 402 | #define AUTH_TYPE_SHARED_KEY 1 |
| 403 | struct channel_list_t channel_list; |
| 404 | uint16_t scan_type; |
| 405 | uint8_t bssid[ETH_ALEN]; |
| 406 | } __attribute__((packed)); |
| 407 | |
| 408 | |
| 409 | struct hostif_infrastructure_set_confirm_t { |
| 410 | struct hostif_hdr header; |
| 411 | uint16_t result_code; |
| 412 | } __attribute__((packed)); |
| 413 | |
| 414 | struct hostif_adhoc_set_request_t { |
| 415 | struct hostif_hdr header; |
| 416 | uint16_t phy_type; |
| 417 | uint16_t cts_mode; |
| 418 | uint16_t channel; |
| 419 | struct rate_set16_t rate_set; |
| 420 | struct ssid_t ssid; |
| 421 | uint16_t capability; /* bit5:preamble bit6:pbcc pbcc not supported always 0 |
| 422 | * bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ |
| 423 | uint16_t scan_type; |
| 424 | } __attribute__((packed)); |
| 425 | |
| 426 | struct hostif_adhoc_set2_request_t { |
| 427 | struct hostif_hdr header; |
| 428 | uint16_t phy_type; |
| 429 | uint16_t cts_mode; |
| 430 | uint16_t reserved; |
| 431 | struct rate_set16_t rate_set; |
| 432 | struct ssid_t ssid; |
| 433 | uint16_t capability; /* bit5:preamble bit6:pbcc pbcc not supported always 0 |
| 434 | * bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ |
| 435 | uint16_t scan_type; |
| 436 | struct channel_list_t channel_list; |
| 437 | uint8_t bssid[ETH_ALEN]; |
| 438 | } __attribute__((packed)); |
| 439 | |
| 440 | struct hostif_adhoc_set_confirm_t { |
| 441 | struct hostif_hdr header; |
| 442 | uint16_t result_code; |
| 443 | } __attribute__((packed)); |
| 444 | |
| 445 | |
| 446 | struct last_associate_t { |
| 447 | uint8_t type; |
| 448 | uint8_t status; |
| 449 | } __attribute__((packed)); |
| 450 | |
| 451 | struct association_request_t { |
| 452 | uint8_t type; |
| 453 | #define FRAME_TYPE_ASSOC_REQ 0x00 |
| 454 | #define FRAME_TYPE_REASSOC_REQ 0x20 |
| 455 | uint8_t pad; |
| 456 | uint16_t capability; |
| 457 | uint16_t listen_interval; |
| 458 | uint8_t ap_address[6]; |
| 459 | uint16_t reqIEs_size; |
| 460 | } __attribute__((packed)); |
| 461 | |
| 462 | struct association_response_t { |
| 463 | uint8_t type; |
| 464 | #define FRAME_TYPE_ASSOC_RESP 0x10 |
| 465 | #define FRAME_TYPE_REASSOC_RESP 0x30 |
| 466 | uint8_t pad; |
| 467 | uint16_t capability; |
| 468 | uint16_t status; |
| 469 | uint16_t association_id; |
| 470 | uint16_t respIEs_size; |
| 471 | } __attribute__((packed)); |
| 472 | |
| 473 | struct hostif_associate_indication_t { |
| 474 | struct hostif_hdr header; |
| 475 | struct association_request_t assoc_req; |
| 476 | struct association_response_t assoc_resp; |
| 477 | /* followed by (reqIEs_size + respIEs_size) octets of data */ |
| 478 | /* reqIEs data *//* respIEs data */ |
| 479 | } __attribute__((packed)); |
| 480 | |
| 481 | struct hostif_bss_scan_request_t { |
| 482 | struct hostif_hdr header; |
| 483 | uint8_t scan_type; |
| 484 | #define ACTIVE_SCAN 0 |
| 485 | #define PASSIVE_SCAN 1 |
| 486 | uint8_t pad[3]; |
| 487 | uint32_t ch_time_min; |
| 488 | uint32_t ch_time_max; |
| 489 | struct channel_list_t channel_list; |
| 490 | struct ssid_t ssid; |
| 491 | } __attribute__((packed)); |
| 492 | |
| 493 | struct hostif_bss_scan_confirm_t { |
| 494 | struct hostif_hdr header; |
| 495 | uint16_t result_code; |
| 496 | uint16_t reserved; |
| 497 | } __attribute__((packed)); |
| 498 | |
| 499 | struct hostif_phy_information_request_t { |
| 500 | struct hostif_hdr header; |
| 501 | uint16_t type; |
| 502 | #define NORMAL_TYPE 0 |
| 503 | #define TIME_TYPE 1 |
| 504 | uint16_t time; /* unit 100ms */ |
| 505 | } __attribute__((packed)); |
| 506 | |
| 507 | struct hostif_phy_information_confirm_t { |
| 508 | struct hostif_hdr header; |
| 509 | uint8_t rssi; |
| 510 | uint8_t sq; |
| 511 | uint8_t noise; |
| 512 | uint8_t link_speed; |
| 513 | uint32_t tx_frame; |
| 514 | uint32_t rx_frame; |
| 515 | uint32_t tx_error; |
| 516 | uint32_t rx_error; |
| 517 | } __attribute__((packed)); |
| 518 | |
| 519 | /* sleep mode */ |
| 520 | #define SLP_ACTIVE 0 |
| 521 | #define SLP_SLEEP 1 |
| 522 | struct hostif_sleep_request_t { |
| 523 | struct hostif_hdr header; |
| 524 | } __attribute__((packed)); |
| 525 | |
| 526 | struct hostif_sleep_confirm_t { |
| 527 | struct hostif_hdr header; |
| 528 | uint16_t result_code; |
| 529 | } __attribute__((packed)); |
| 530 | |
| 531 | struct hostif_mic_failure_request_t { |
| 532 | struct hostif_hdr header; |
| 533 | uint16_t failure_count; |
| 534 | uint16_t timer; |
| 535 | } __attribute__((packed)); |
| 536 | |
| 537 | struct hostif_mic_failure_confirm_t { |
| 538 | struct hostif_hdr header; |
| 539 | uint16_t result_code; |
| 540 | } __attribute__((packed)); |
| 541 | |
| 542 | #define BASIC_RATE 0x80 |
| 543 | #define RATE_MASK 0x7F |
| 544 | |
| 545 | #define TX_RATE_AUTO 0xff |
| 546 | #define TX_RATE_1M_FIXED 0 |
| 547 | #define TX_RATE_2M_FIXED 1 |
| 548 | #define TX_RATE_1_2M_AUTO 2 |
| 549 | #define TX_RATE_5M_FIXED 3 |
| 550 | #define TX_RATE_11M_FIXED 4 |
| 551 | |
| 552 | #define TX_RATE_FULL_AUTO 0 |
| 553 | #define TX_RATE_11_AUTO 1 |
| 554 | #define TX_RATE_11B_AUTO 2 |
| 555 | #define TX_RATE_11BG_AUTO 3 |
| 556 | #define TX_RATE_MANUAL_AUTO 4 |
| 557 | #define TX_RATE_FIXED 5 |
| 558 | |
| 559 | /* 11b rate */ |
| 560 | #define TX_RATE_1M (uint8_t)(10/5) /* 11b 11g basic rate */ |
| 561 | #define TX_RATE_2M (uint8_t)(20/5) /* 11b 11g basic rate */ |
| 562 | #define TX_RATE_5M (uint8_t)(55/5) /* 11g basic rate */ |
| 563 | #define TX_RATE_11M (uint8_t)(110/5) /* 11g basic rate */ |
| 564 | |
| 565 | /* 11g rate */ |
| 566 | #define TX_RATE_6M (uint8_t)(60/5) /* 11g basic rate */ |
| 567 | #define TX_RATE_12M (uint8_t)(120/5) /* 11g basic rate */ |
| 568 | #define TX_RATE_24M (uint8_t)(240/5) /* 11g basic rate */ |
| 569 | #define TX_RATE_9M (uint8_t)(90/5) |
| 570 | #define TX_RATE_18M (uint8_t)(180/5) |
| 571 | #define TX_RATE_36M (uint8_t)(360/5) |
| 572 | #define TX_RATE_48M (uint8_t)(480/5) |
| 573 | #define TX_RATE_54M (uint8_t)(540/5) |
| 574 | |
| 575 | #define IS_11B_RATE(A) (((A&RATE_MASK)==TX_RATE_1M)||((A&RATE_MASK)==TX_RATE_2M)||\ |
| 576 | ((A&RATE_MASK)==TX_RATE_5M)||((A&RATE_MASK)==TX_RATE_11M)) |
| 577 | |
| 578 | #define IS_OFDM_RATE(A) (((A&RATE_MASK)==TX_RATE_6M)||((A&RATE_MASK)==TX_RATE_12M)||\ |
| 579 | ((A&RATE_MASK)==TX_RATE_24M)||((A&RATE_MASK)==TX_RATE_9M)||\ |
| 580 | ((A&RATE_MASK)==TX_RATE_18M)||((A&RATE_MASK)==TX_RATE_36M)||\ |
| 581 | ((A&RATE_MASK)==TX_RATE_48M)||((A&RATE_MASK)==TX_RATE_54M)) |
| 582 | |
| 583 | #define IS_11BG_RATE(A) (IS_11B_RATE(A)||IS_OFDM_RATE(A)) |
| 584 | |
| 585 | #define IS_OFDM_EXT_RATE(A) (((A&RATE_MASK)==TX_RATE_9M)||((A&RATE_MASK)==TX_RATE_18M)||\ |
| 586 | ((A&RATE_MASK)==TX_RATE_36M)||((A&RATE_MASK)==TX_RATE_48M)||\ |
| 587 | ((A&RATE_MASK)==TX_RATE_54M)) |
| 588 | |
| 589 | enum { |
| 590 | CONNECT_STATUS=0, |
| 591 | DISCONNECT_STATUS |
| 592 | }; |
| 593 | |
| 594 | /* preamble type */ |
| 595 | enum { |
| 596 | LONG_PREAMBLE=0, |
| 597 | SHORT_PREAMBLE |
| 598 | }; |
| 599 | |
| 600 | /* multicast filter */ |
| 601 | #define MCAST_FILTER_MCAST 0 |
| 602 | #define MCAST_FILTER_MCASTALL 1 |
| 603 | #define MCAST_FILTER_PROMISC 2 |
| 604 | |
| 605 | #define NIC_MAX_MCAST_LIST 32 |
| 606 | |
| 607 | /* macro function */ |
| 608 | #define HIF_EVENT_MASK 0xE800 |
| 609 | #define IS_HIF_IND(_EVENT) ((_EVENT&HIF_EVENT_MASK)==0xE800 && \ |
| 610 | ((_EVENT&~HIF_EVENT_MASK)==0x0001 || \ |
| 611 | (_EVENT&~HIF_EVENT_MASK)==0x0006 || \ |
| 612 | (_EVENT&~HIF_EVENT_MASK)==0x000C || \ |
| 613 | (_EVENT&~HIF_EVENT_MASK)==0x0011 || \ |
| 614 | (_EVENT&~HIF_EVENT_MASK)==0x0012)) |
| 615 | |
| 616 | #define IS_HIF_CONF(_EVENT) ((_EVENT&HIF_EVENT_MASK)==0xE800 && \ |
| 617 | (_EVENT&~HIF_EVENT_MASK)>0x0000 && \ |
| 618 | (_EVENT&~HIF_EVENT_MASK)<0x0012 && \ |
| 619 | !IS_HIF_IND(_EVENT) ) |
| 620 | |
| 621 | #ifdef __KERNEL__ |
| 622 | |
| 623 | #include "ks_wlan.h" |
| 624 | |
| 625 | /* function prototype */ |
| 626 | extern int hostif_data_request( ks_wlan_private *priv, struct sk_buff *packet ); |
| 627 | extern void hostif_receive( ks_wlan_private *priv, unsigned char *p, unsigned int size ); |
| 628 | extern void hostif_sme_enqueue(ks_wlan_private *priv, uint16_t event); |
| 629 | extern int hostif_init( ks_wlan_private *priv ); |
| 630 | extern void hostif_exit( ks_wlan_private *priv ); |
| 631 | |
| 632 | static |
| 633 | inline int hif_align_size(int size) |
| 634 | { |
| 635 | #ifdef KS_ATOM |
| 636 | if( size < 1024 ) |
| 637 | size = 1024; |
| 638 | #endif |
| 639 | #ifdef DEVICE_ALIGNMENT |
| 640 | return (size%DEVICE_ALIGNMENT) ? size + DEVICE_ALIGNMENT - (size % DEVICE_ALIGNMENT) : size; |
| 641 | #else |
| 642 | return size; |
| 643 | #endif |
| 644 | } |
| 645 | |
| 646 | #endif /* __KERNEL__ */ |
| 647 | |
| 648 | #endif /* _KS_HOSTIF_H_ */ |
| 649 |
