2 * Driver for KeyStream wireless LAN
5 * $Id: ks_hostif.h 994 2009-09-14 01:51:16Z sekine $
7 * Copyright (c) 2005-2008 KeyStream Corp.
8 * Copyright (C) 2009 Renesas Technology Corp.
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.
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
57 #define HIF_REQ_MAX 0xE010
60 * HOST-MAC I/F data structure
61 * Byte alignmet Little Endian
67 } __attribute__((packed));
69 struct hostif_data_request_t {
70 struct hostif_hdr header;
72 #define TYPE_DATA 0x0000
73 #define TYPE_AUTH 0x0001
76 } __attribute__((packed));
78 struct hostif_data_indication_t {
79 struct hostif_hdr header;
81 /* #define TYPE_DATA 0x0000 */
82 #define TYPE_PMK1 0x0001
83 #define TYPE_GMK1 0x0002
84 #define TYPE_GMK2 0x0003
87 } __attribute__((packed));
89 #define CHANNEL_LIST_MAX_SIZE 14
90 struct channel_list_t {
92 uint8_t body[CHANNEL_LIST_MAX_SIZE];
94 } __attribute__((packed));
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 */
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 */
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) */
134 #define LOCAL_REGION 0xF10A0100 /* Region setting */
137 #define LOCAL_WPS_ENABLE 0xF10B0100 /* WiFi Protected Setup */
138 #define LOCAL_WPS_PROBE_REQ 0xF10C0100 /* WPS Probe Request */
141 #define LOCAL_GAIN 0xF10D0100 /* Carrer sense threshold for demo ato show */
142 #define LOCAL_EEPROM_SUM 0xF10E0100 /* EEPROM checksum information */
144 struct hostif_mib_get_request_t {
145 struct hostif_hdr header;
146 uint32_t mib_attribute;
147 } __attribute__((packed));
150 struct hostif_mib_value_t {
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
159 } __attribute__((packed));
161 struct hostif_mib_get_confirm_t {
162 struct hostif_hdr header;
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));
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));
178 struct hostif_mib_set_confirm_t {
179 struct hostif_hdr header;
181 uint32_t mib_attribute;
182 } __attribute__((packed));
184 struct hostif_power_mngmt_request_t {
185 struct hostif_hdr header;
187 #define POWER_ACTIVE 1
190 #define SLEEP_FALSE 0
191 #define SLEEP_TRUE 1 /* not used */
192 uint32_t receiveDTIMs;
195 } __attribute__((packed));
197 /* power management mode */
199 POWMGT_ACTIVE_MODE=0,
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
210 struct hostif_power_mngmt_confirm_t {
211 struct hostif_hdr header;
212 uint16_t result_code;
213 } __attribute__((packed));
215 struct hostif_start_request_t {
216 struct hostif_hdr header;
218 #define MODE_PSEUDO_ADHOC 0
219 #define MODE_INFRASTRUCTURE 1
220 #define MODE_AP 2 /* not used */
222 } __attribute__((packed));
224 struct hostif_start_confirm_t {
225 struct hostif_hdr header;
226 uint16_t result_code;
227 } __attribute__((packed));
229 #define SSID_MAX_SIZE 32
232 uint8_t body[SSID_MAX_SIZE];
234 } __attribute__((packed));
236 #define RATE_SET_MAX_SIZE 16
241 } __attribute__((packed));
248 } __attribute__((packed));
252 } __attribute__((packed));
257 uint16_t maxDuration;
258 uint16_t durRemaining;
259 } __attribute__((packed));
263 } __attribute__((packed));
268 #define RSN_BODY_SIZE 64
269 uint8_t body[RSN_BODY_SIZE];
270 } __attribute__((packed));
274 } __attribute__((packed));
280 } __attribute__((packed));
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 */
307 } __attribute__((packed));
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
331 uint8_t size; /* +52 */
332 uint8_t body[128]; /* +53 */
333 } __attribute__((packed)) rsn;
334 } __attribute__((packed));
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));
344 struct hostif_stop_request_t {
345 struct hostif_hdr header;
346 } __attribute__((packed));
348 struct hostif_stop_confirm_t {
349 struct hostif_hdr header;
350 uint16_t result_code;
351 } __attribute__((packed));
353 struct hostif_ps_adhoc_set_request_t {
354 struct hostif_hdr header;
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
361 #define CTS_MODE_FALSE 0
362 #define CTS_MODE_TRUE 1
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 */
368 } __attribute__((packed));
370 struct hostif_ps_adhoc_set_confirm_t {
371 struct hostif_hdr header;
372 uint16_t result_code;
373 } __attribute__((packed));
375 struct hostif_infrastructure_set_request_t {
376 struct hostif_hdr header;
379 struct rate_set16_t rate_set;
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;
385 #define AUTH_TYPE_OPEN_SYSTEM 0
386 #define AUTH_TYPE_SHARED_KEY 1
387 struct channel_list_t channel_list;
389 } __attribute__((packed));
391 struct hostif_infrastructure_set2_request_t {
392 struct hostif_hdr header;
395 struct rate_set16_t rate_set;
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;
401 #define AUTH_TYPE_OPEN_SYSTEM 0
402 #define AUTH_TYPE_SHARED_KEY 1
403 struct channel_list_t channel_list;
405 uint8_t bssid[ETH_ALEN];
406 } __attribute__((packed));
409 struct hostif_infrastructure_set_confirm_t {
410 struct hostif_hdr header;
411 uint16_t result_code;
412 } __attribute__((packed));
414 struct hostif_adhoc_set_request_t {
415 struct hostif_hdr header;
419 struct rate_set16_t rate_set;
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 */
424 } __attribute__((packed));
426 struct hostif_adhoc_set2_request_t {
427 struct hostif_hdr header;
431 struct rate_set16_t rate_set;
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 */
436 struct channel_list_t channel_list;
437 uint8_t bssid[ETH_ALEN];
438 } __attribute__((packed));
440 struct hostif_adhoc_set_confirm_t {
441 struct hostif_hdr header;
442 uint16_t result_code;
443 } __attribute__((packed));
446 struct last_associate_t {
449 } __attribute__((packed));
451 struct association_request_t {
453 #define FRAME_TYPE_ASSOC_REQ 0x00
454 #define FRAME_TYPE_REASSOC_REQ 0x20
457 uint16_t listen_interval;
458 uint8_t ap_address[6];
459 uint16_t reqIEs_size;
460 } __attribute__((packed));
462 struct association_response_t {
464 #define FRAME_TYPE_ASSOC_RESP 0x10
465 #define FRAME_TYPE_REASSOC_RESP 0x30
469 uint16_t association_id;
470 uint16_t respIEs_size;
471 } __attribute__((packed));
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));
481 struct hostif_bss_scan_request_t {
482 struct hostif_hdr header;
484 #define ACTIVE_SCAN 0
485 #define PASSIVE_SCAN 1
487 uint32_t ch_time_min;
488 uint32_t ch_time_max;
489 struct channel_list_t channel_list;
491 } __attribute__((packed));
493 struct hostif_bss_scan_confirm_t {
494 struct hostif_hdr header;
495 uint16_t result_code;
497 } __attribute__((packed));
499 struct hostif_phy_information_request_t {
500 struct hostif_hdr header;
502 #define NORMAL_TYPE 0
504 uint16_t time; /* unit 100ms */
505 } __attribute__((packed));
507 struct hostif_phy_information_confirm_t {
508 struct hostif_hdr header;
517 } __attribute__((packed));
522 struct hostif_sleep_request_t {
523 struct hostif_hdr header;
524 } __attribute__((packed));
526 struct hostif_sleep_confirm_t {
527 struct hostif_hdr header;
528 uint16_t result_code;
529 } __attribute__((packed));
531 struct hostif_mic_failure_request_t {
532 struct hostif_hdr header;
533 uint16_t failure_count;
535 } __attribute__((packed));
537 struct hostif_mic_failure_confirm_t {
538 struct hostif_hdr header;
539 uint16_t result_code;
540 } __attribute__((packed));
542 #define BASIC_RATE 0x80
543 #define RATE_MASK 0x7F
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
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
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 */
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)
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))
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))
583 #define IS_11BG_RATE(A) (IS_11B_RATE(A)||IS_OFDM_RATE(A))
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))
600 /* multicast filter */
601 #define MCAST_FILTER_MCAST 0
602 #define MCAST_FILTER_MCASTALL 1
603 #define MCAST_FILTER_PROMISC 2
605 #define NIC_MAX_MCAST_LIST 32
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))
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) )
625 /* function prototype */
626 extern int hostif_data_request( struct ks_wlan_private *priv, struct sk_buff *packet );
627 extern void hostif_receive( struct ks_wlan_private *priv, unsigned char *p, unsigned int size );
628 extern void hostif_sme_enqueue(struct ks_wlan_private *priv, uint16_t event);
629 extern int hostif_init( struct ks_wlan_private *priv );
630 extern void hostif_exit( struct ks_wlan_private *priv );
633 inline int hif_align_size(int size)
639 #ifdef DEVICE_ALIGNMENT
640 return (size%DEVICE_ALIGNMENT) ? size + DEVICE_ALIGNMENT - (size % DEVICE_ALIGNMENT) : size;
646 #endif /* __KERNEL__ */
648 #endif /* _KS_HOSTIF_H_ */