Staging: asus_oled: do not use assignment in if condition
[linux-2.6] / drivers / staging / winbond / sme_s.h
1 #ifndef __WINBOND_SME_S_H
2 #define __WINBOND_SME_S_H
3
4 #include <linux/types.h>
5
6 #include "mac_structures.h"
7 #include "localpara.h"
8
9 //
10 // SME_S.H -
11 // SME task global CONSTANTS, STRUCTURES, variables
12 //
13
14 //////////////////////////////////////////////////////////////////////////
15 //define the msg type of SME module
16 // 0x00~0x1F : MSG from GUI dispatch
17 // 0x20~0x3F : MSG from MLME
18 // 0x40~0x5F : MSG from SCAN
19 // 0x60~0x6F : MSG from TX/RX
20 // 0x70~0x7F : MSG from ROAMING
21 // 0x80~0x8F : MSG from ISR
22 // 0x90          : MSG TimeOut
23
24 // from GUI
25 #define SMEMSG_SCAN_REQ                                 0x01
26 //#define SMEMSG_PASSIVE_SCAN_REQ                       0x02
27 #define SMEMSG_JOIN_REQ                                 0x03
28 #define SMEMSG_START_IBSS                               0x04
29 #define SMEMSG_DISCONNECT_REQ                   0x05
30 #define SMEMSG_AUTHEN_REQ                               0x06
31 #define SMEMSG_DEAUTHEN_REQ                             0x07
32 #define SMEMSG_ASSOC_REQ                                0x08
33 #define SMEMSG_REASSOC_REQ                              0x09
34 #define SMEMSG_DISASSOC_REQ                             0x0a
35 #define SMEMSG_POWERSAVE_REQ                    0x0b
36
37
38 // from MLME
39 #define SMEMSG_AUTHEN_CFM                               0x21
40 #define SMEMSG_AUTHEN_IND                               0x22
41 #define SMEMSG_ASSOC_CFM                                0x23
42 #define SMEMSG_DEAUTHEN_IND                             0x24
43 #define SMEMSG_DISASSOC_IND                             0x25
44 // from SCAN
45 #define SMEMSG_SCAN_CFM                                 0x41
46 #define SMEMSG_START_IBSS_CFM                   0x42
47 // from MTO, function call to set SME parameters
48
49 // 0x60~0x6F : MSG from TX/RX
50 //#define SMEMSG_IBSS_JOIN_UPDATE_BSSID 0x61
51 #define SMEMSG_COUNTERMEASURE_MICFAIL_TIMEOUT           0x62
52 #define SMEMSG_COUNTERMEASURE_BLOCK_TIMEOUT     0x63
53 // from ROAMING
54 #define SMEMSG_HANDOVER_JOIN_REQ                0x71
55 #define SMEMSG_END_ROAMING                              0x72
56 #define SMEMSG_SCAN_JOIN_REQ                    0x73
57 // from ISR
58 #define SMEMSG_TSF_SYNC_IND                             0x81
59 // from TimeOut
60 #define SMEMSG_TIMEOUT                                  0x91
61
62
63
64 #define MAX_PMKID_Accunt                16
65 //@added by ws 04/22/05
66 #define Cipher_Disabled                 0
67 #define Cipher_Wep                      1
68 #define Cipher_Tkip                     2
69 #define Cipher_Ccmp                     4
70
71
72 ///////////////////////////////////////////////////////////////////////////
73 //Constants
74
75 ///////////////////////////////////////////////////////////////////////////
76 //Global data structures
77
78 #define NUMOFWEPENTRIES     64
79
80 typedef enum _WEPKeyMode
81 {
82     WEPKEY_DISABLED = 0,
83     WEPKEY_64       = 1,
84     WEPKEY_128      = 2
85
86 } WEPKEYMODE, *pWEPKEYMODE;
87
88 #ifdef _WPA2_
89
90 typedef struct _BSSInfo
91 {
92   u8        PreAuthBssID[6];
93   PMKID        pmkid_value;
94 }BSSID_Info;
95
96 typedef struct _PMKID_Table //added by ws 05/05/04
97 {
98    u32  Length;
99    u32  BSSIDInfoCount;
100    BSSID_Info BSSIDInfo[16];
101
102 } PMKID_Table;
103
104 #endif //end def _WPA2_
105
106 #define MAX_BASIC_RATE_SET          15
107 #define MAX_OPT_RATE_SET            MAX_BASIC_RATE_SET
108
109
110 typedef struct _SME_PARAMETERS
111 {
112     u16                         wState;
113         u8                              boDUTmode;
114         u8                              bDesiredPowerSave;
115
116         // SME timer and timeout value
117         struct timer_list timer;
118
119         u8                              boInTimerHandler;
120         u8                              boAuthRetryActive;
121         u8                              reserved_0[2];
122
123         u32                             AuthenRetryTimerVal;    // NOTE: Assoc don't fail timeout
124         u32                             JoinFailTimerVal;               // 10*Beacon-Interval
125
126         //Rates
127         u8                              BSSBasicRateSet[(MAX_BASIC_RATE_SET + 3) & ~0x03 ];    // BSS basic rate set
128         u8                              OperationalRateSet[(MAX_OPT_RATE_SET + 3) & ~0x03 ]; // Operational rate set
129
130         u8                              NumOfBSSBasicRate;
131         u8                              NumOfOperationalRate;
132         u8                              reserved_1[2];
133
134         u32                             BasicRateBitmap;
135         u32                             OpRateBitmap;
136
137         // System parameters Set by GUI
138         //-------------------- start IBSS parameter ---------------------------//
139         u32                             boStartIBSS;                    //Start IBSS toggle
140
141         u16                             wBeaconPeriod;
142         u16                             wATIM_Window;
143
144         ChanInfo                        IbssChan; // 2B //channel setting when start IBSS
145         u8                              reserved_2[2];
146
147     // Join related
148         u16                             wDesiredJoinBSS;                // BSS index which desire to join
149         u8                              boJoinReq;                              //Join request toggle
150         u8                              bDesiredBSSType;                //for Join request
151
152     u16                         wCapabilityInfo;        // Used when invoking the MLME_Associate_request().
153         u16                             wNonERPcapabilityInfo;
154
155     struct SSID_Element sDesiredSSID; // 34 B
156         u8                              reserved_3[2];
157
158         u8                      abDesiredBSSID[MAC_ADDR_LENGTH + 2];
159
160         u8                              bJoinScanCount;                 // the time of scan-join action need to do
161         u8                              bDesiredAuthMode;       // AUTH_OPEN_SYSTEM or AUTH_SHARED_KEY
162         u8                              reserved_4[2];
163
164     // Encryption parameters
165         u8                      _dot11PrivacyInvoked;
166     u8                  _dot11PrivacyOptionImplemented;
167         u8                              reserved_5[2];
168
169     //@ ws added
170     u8                          DesiredEncrypt;
171         u8                              encrypt_status; //ENCRYPT_DISABLE, ENCRYPT_WEP, ENCRYPT_WEP_NOKEY, ENCRYPT_TKIP, ...
172         u8                              key_length;
173         u8                              pairwise_key_ok;
174
175         u8                              group_key_ok;
176     u8                          wpa_ok;             // indicate the control port of 802.1x is open or close
177         u8                              pairwise_key_type;
178         u8                              group_key_type;
179
180     u32               _dot11WEPDefaultKeyID;
181
182         u8                      tx_mic_key[8];      // TODO: 0627 kevin-TKIP
183         u8                      rx_mic_key[8];      // TODO: 0627 kevin-TKIP
184         u8                              group_tx_mic_key[8];
185         u8                              group_rx_mic_key[8];
186
187 //      #ifdef _WPA_
188         u8                              AssocReqVarIE[200];
189         u8                              AssocRespVarIE[200];
190
191         u16                             AssocReqVarLen;
192         u16                             AssocRespVarLen;
193         u8                              boReassoc;                              //use assoc. or reassoc.
194         u8                              reserved_6[3];
195         u16                             AssocRespCapability;
196         u16                             AssocRespStatus;
197 //      #endif
198
199         #ifdef _WPA2_
200     u8               PmkIdTable[256];
201     u32               PmkidTableIndex;
202         #endif //end def _WPA2_
203
204 } SME_PARAMETERS, *PSME_PARAMETERS;
205
206 #define psSME                   (&(adapter->sSmePara))
207
208 #define wSMEGetCurrentSTAState(adapter)         ((u16)(adapter)->sSmePara.wState)
209
210
211
212 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
213 //      SmeModule.h
214 //              Define the related definitions of SME module
215 //      history -- 01/14/03' created
216 //
217 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
218
219 //Define the state of SME module
220 #define DISABLED                                                0
221 #define INIT_SCAN                                               1
222 #define SCAN_READY                                              2
223 #define START_IBSS                                              3
224 #define JOIN_PENDING                                    4
225 #define JOIN_CFM                                                5
226 #define AUTHENTICATE_PENDING                    6
227 #define AUTHENTICATED                                   7
228 #define CONNECTED                                               8
229 //#define EAP_STARTING                                  9
230 //#define EAPOL_AUTHEN_PENDING                  10
231 //#define SECURE_CONNECTED                              11
232
233
234 // Static function
235
236 #endif