5256f40524bf0ff21be2d60eccf1139bb797cfdf
[sfrench/cifs-2.6.git] / drivers / staging / wilc1000 / coreconfigurator.h
1
2 /*!
3  *  @file       coreconfigurator.h
4  *  @brief
5  *  @author
6  *  @sa         coreconfigurator.c
7  *  @date       1 Mar 2012
8  *  @version    1.0
9  */
10
11 #ifndef CORECONFIGURATOR_H
12 #define CORECONFIGURATOR_H
13
14 #include "wilc_wlan_if.h"
15
16 #define NUM_BASIC_SWITCHES      45
17 #define NUM_FHSS_SWITCHES       0
18
19 #define NUM_RSSI                5
20
21 #ifdef MAC_802_11N
22 #define NUM_11N_BASIC_SWITCHES  25
23 #define NUM_11N_HUT_SWITCHES    47
24 #else
25 #define NUM_11N_BASIC_SWITCHES  0
26 #define NUM_11N_HUT_SWITCHES    0
27 #endif
28
29 #define MAC_HDR_LEN             24
30 #define MAX_SSID_LEN            33
31 #define FCS_LEN                 4
32 #define TIME_STAMP_LEN          8
33 #define BEACON_INTERVAL_LEN     2
34 #define CAP_INFO_LEN            2
35 #define STATUS_CODE_LEN         2
36 #define AID_LEN                 2
37 #define IE_HDR_LEN              2
38
39 #define SET_CFG              0
40 #define GET_CFG              1
41
42 #define MAX_STRING_LEN               256
43 #define MAX_SURVEY_RESULT_FRAG_SIZE  MAX_STRING_LEN
44 #define SURVEY_RESULT_LENGTH         44
45 #define MAX_ASSOC_RESP_FRAME_SIZE    MAX_STRING_LEN
46
47 #define MAC_CONNECTED                1
48 #define MAC_DISCONNECTED             0
49
50 #define MAKE_WORD16(lsb, msb) ((((u16)(msb) << 8) & 0xFF00) | (lsb))
51 #define MAKE_WORD32(lsw, msw) ((((u32)(msw) << 16) & 0xFFFF0000) | (lsw))
52
53 enum connect_status {
54         SUCCESSFUL_STATUSCODE    = 0,
55         UNSPEC_FAIL              = 1,
56         UNSUP_CAP                = 10,
57         REASOC_NO_ASOC           = 11,
58         FAIL_OTHER               = 12,
59         UNSUPT_ALG               = 13,
60         AUTH_SEQ_FAIL            = 14,
61         CHLNG_FAIL               = 15,
62         AUTH_TIMEOUT             = 16,
63         AP_FULL                  = 17,
64         UNSUP_RATE               = 18,
65         SHORT_PREAMBLE_UNSUP     = 19,
66         PBCC_UNSUP               = 20,
67         CHANNEL_AGIL_UNSUP       = 21,
68         SHORT_SLOT_UNSUP         = 25,
69         OFDM_DSSS_UNSUP          = 26,
70         CONNECT_STS_FORCE_16_BIT = 0xFFFF
71 };
72
73 struct rssi_history_buffer {
74         bool full;
75         u8 index;
76         s8 samples[NUM_RSSI];
77 };
78
79 struct network_info {
80         s8 rssi;
81         u16 cap_info;
82         u8 ssid[MAX_SSID_LEN];
83         u8 ssid_len;
84         u8 bssid[6];
85         u16 beacon_period;
86         u8 dtim_period;
87         u8 ch;
88         unsigned long time_scan_cached;
89         unsigned long time_scan;
90         bool new_network;
91         u8 found;
92         u32 tsf_lo;
93         u8 *ies;
94         u16 ies_len;
95         void *join_params;
96         struct rssi_history_buffer rssi_history;
97         u64 tsf_hi;
98 };
99
100 struct connect_resp_info {
101         u16 capability;
102         u16 status;
103         u16 assoc_id;
104         u8 *ies;
105         u16 ies_len;
106 };
107
108 struct connect_info {
109         u8 bssid[6];
110         u8 *req_ies;
111         size_t req_ies_len;
112         u8 *resp_ies;
113         u16 resp_ies_len;
114         u16 status;
115 };
116
117 struct disconnect_info {
118         u16 reason;
119         u8 *ie;
120         size_t ie_len;
121 };
122
123 s32 wilc_parse_network_info(u8 *msg_buffer,
124                             struct network_info **ret_network_info);
125 s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
126                                struct connect_resp_info **ret_connect_resp_info);
127 void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length);
128 void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length);
129 void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length);
130 #endif