Line No. | Rev | Author | Line |
---|---|---|---|
1 | 32 | kaklik | /****************************************************************************** |
2 | |||
3 | MRF24WB0M Driver Management messages |
||
4 | Module for Microchip TCP/IP Stack |
||
5 | -Provides access to MRF24WB0M WiFi controller |
||
6 | -Reference: MRF24WB0M Data sheet, IEEE 802.11 Standard |
||
7 | |||
8 | ******************************************************************************* |
||
9 | FileName: WFMgmtMsg.h |
||
10 | Dependencies: TCP/IP Stack header files |
||
11 | Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F, PIC32 |
||
12 | Compiler: Microchip C32 v1.10b or higher |
||
13 | Microchip C30 v3.22 or higher |
||
14 | Microchip C18 v3.34 or higher |
||
15 | Company: Microchip Technology, Inc. |
||
16 | |||
17 | Software License Agreement |
||
18 | |||
19 | Copyright (C) 2002-2010 Microchip Technology Inc. All rights reserved. |
||
20 | |||
21 | Microchip licenses to you the right to use, modify, copy, and distribute: |
||
22 | (i) the Software when embedded on a Microchip microcontroller or digital |
||
23 | signal controller product ("Device") which is integrated into |
||
24 | Licensee's product; or |
||
25 | (ii) ONLY the Software driver source files ENC28J60.c, ENC28J60.h, |
||
26 | ENCX24J600.c and ENCX24J600.h ported to a non-Microchip device used in |
||
27 | conjunction with a Microchip ethernet controller for the sole purpose |
||
28 | of interfacing with the ethernet controller. |
||
29 | |||
30 | You should refer to the license agreement accompanying this Software for |
||
31 | additional information regarding your rights and obligations. |
||
32 | |||
33 | THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY |
||
34 | KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY |
||
35 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND |
||
36 | NON-INFRINGEMENT. IN NO EVENT SHALL MICROCHIP BE LIABLE FOR ANY INCIDENTAL, |
||
37 | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST |
||
38 | OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS BY |
||
39 | THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), ANY CLAIMS |
||
40 | FOR INDEMNITY OR CONTRIBUTION, OR OTHER SIMILAR COSTS, WHETHER ASSERTED ON |
||
41 | THE BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR |
||
42 | OTHERWISE. |
||
43 | |||
44 | |||
45 | Author Date Comment |
||
46 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
||
47 | KH 27 Jan 2010 Updated for MRF24WB0M |
||
48 | ******************************************************************************/ |
||
49 | |||
50 | #ifndef __WF_MGMT_MSG_H |
||
51 | #define __WF_MGMT_MSG_H |
||
52 | |||
53 | /*----------------------------------------------*/ |
||
54 | /* Management Message Request/Response Subtypes */ |
||
55 | /*----------------------------------------------*/ |
||
56 | typedef enum |
||
57 | { |
||
58 | /* Misc subtypes */ |
||
59 | WF_SCAN_SUBTYPE = 1, |
||
60 | WF_JOIN_SUBTYPE = 2, |
||
61 | WF_AUTH_SUBTYPE = 3, |
||
62 | WF_ASSOC_SUBTYPE = 4, |
||
63 | WF_DISCONNECT_SUBTYPE = 5, |
||
64 | WF_DISASOCC_SUBTYPE = 6, |
||
65 | WF_SET_POWER_MODE_SUBTYPE = 7, |
||
66 | WF_SET_PM_KEY_SUBTYPE = 8, |
||
67 | WF_SET_WEP_MAP_SUBTYPE = 9, |
||
68 | WF_SET_WEP_KEY_SUBTYPE = 10, |
||
69 | WF_SET_TEMP_KEY_SUBTYPE = 11, |
||
70 | WF_CALC_PSK_KEY_SUBTYPE = 12, |
||
71 | WF_SET_WEP_KEY_ID_SUBTYPE = 13, |
||
72 | WF_CONFIG_KEY_SPACE_SUBTYPE = 14, |
||
73 | WF_SET_PARAM_SUBTYPE = 15, |
||
74 | WF_GET_PARAM_SUBTYPE = 16, |
||
75 | WF_ADHOC_CONNECT_SUBTYPE = 17, |
||
76 | WF_ADHOC_START_SUBTYPE = 18, |
||
77 | |||
78 | /* Connection Profile Message Subtypes */ |
||
79 | WF_CP_CREATE_PROFILE_SUBTYPE = 21, |
||
80 | WF_CP_DELETE_PROFILE_SUBTYPE = 22, |
||
81 | WF_CP_GET_ID_LIST_SUBTYPE = 23, |
||
82 | WF_CP_SET_ELEMENT_SUBTYPE = 24, |
||
83 | WF_CP_GET_ELEMENT_SUBTYPE = 25, |
||
84 | |||
85 | /* Connection Algorithm Message Subtypes */ |
||
86 | WF_CA_SET_ELEMENT_SUBTYPE = 26, |
||
87 | WF_CA_GET_ELEMENT_SUBTYPE = 27, |
||
88 | |||
89 | /* Connnection Manager Message Subtypes */ |
||
90 | WF_CM_CONNECT_SUBYTPE = 28, |
||
91 | WF_CM_DISCONNECT_SUBYTPE = 29, |
||
92 | WF_CM_GET_CONNECTION_STATUS_SUBYTPE = 30, |
||
93 | |||
94 | WF_SCAN_START_SUBTYPE = 31, |
||
95 | WF_SCAN_GET_RESULTS_SUBTYPE = 32, |
||
96 | |||
97 | WF_CM_INFO_SUBTYPE = 33, |
||
98 | |||
99 | WF_SCAN_FOR_IE_SUBTYPE = 34, /* not yet supported */ |
||
100 | WF_SCAN_IE_GET_RESULTS_SUBTYPE = 35, /* not yet supported */ |
||
101 | |||
102 | WF_CM_GET_CONNECTION_STATISTICS_SUBYTPE = 36, /* not yet supported so moved here for now */ |
||
103 | WF_NUM_REQUEST_SUBTYPES |
||
104 | |||
105 | } tMgmtMsgSubtypes; |
||
106 | |||
107 | |||
108 | /*-------------------------------------------------------------*/ |
||
109 | /* Connection Profile Element IDs */ |
||
110 | /* Used in conjunction with the WF_CP_SET_ELEMENT_SUBTYPE and */ |
||
111 | /* WF_CP_GET_ELEMENT_SUBTYPE message subtypes */ |
||
112 | /*-------------------------------------------------------------*/ |
||
113 | typedef enum |
||
114 | { |
||
115 | WF_CP_ELEMENT_ALL = 0, /* sends all elements in CP struct */ |
||
116 | WF_CP_ELEMENT_SSID = 1, |
||
117 | WF_CP_ELEMENT_BSSID = 2, |
||
118 | WF_CP_ELEMENT_SECURITY = 3, |
||
119 | WF_CP_ELEMENT_NETWORK_TYPE = 4, |
||
120 | WF_CP_ELEMENT_ADHOC_BEHAVIOR = 5, |
||
121 | WF_CP_ELEMENT_WEP_KEY_INDEX = 6 |
||
122 | } tCPElementIds; |
||
123 | |||
124 | /*-------------------------------------------------------------*/ |
||
125 | /* Connection Algorithm Element IDs */ |
||
126 | /* Used in conjunction with the WF_CA_SET_ELEMENT_SUBTYPE and */ |
||
127 | /* WF_CA_GET_ELEMENT_SUBTYPE message subtypes */ |
||
128 | /*-------------------------------------------------------------*/ |
||
129 | typedef enum |
||
130 | { |
||
131 | WF_CA_ELEMENT_ALL = 0, |
||
132 | WF_CA_ELEMENT_SCANTYPE = 1, |
||
133 | WF_CA_ELEMENT_RSSI = 2, |
||
134 | WF_CA_ELEMENT_CP_LIST = 3, |
||
135 | WF_CA_ELEMENT_LIST_RETRY_COUNT = 4, |
||
136 | WF_CA_ELEMENT_EVENT_NOTIFICATION_ACTION = 5, |
||
137 | WF_CA_ELEMENT_BEACON_TIMEOUT_ACTION = 6, |
||
138 | WF_CA_ELEMENT_DEAUTH_ACTION = 7, |
||
139 | WF_CA_ELEMENT_CHANNEL_LIST = 8, |
||
140 | WF_CA_ELEMENT_LISTEN_INTERVAL = 9, |
||
141 | WF_CA_ELEMENT_BEACON_TIMEOUT = 10, |
||
142 | WF_CA_ELEMENT_SCAN_COUNT = 11, |
||
143 | WF_CA_ELEMENT_MIN_CHANNEL_TIME = 12, |
||
144 | WF_CA_ELEMENT_MAX_CHANNEL_TIME = 13, |
||
145 | WF_CA_ELEMENT_PROBE_DELAY = 14 |
||
146 | } tCAElementIds; |
||
147 | |||
148 | #if defined(WF_CM_DEBUG) |
||
149 | /*-------------------------------------------------------------*/ |
||
150 | /* CM INFO IDs */ |
||
151 | /* Used in conjunction with the WF_CM_INFO_SUBTYPE */ |
||
152 | /*-------------------------------------------------------------*/ |
||
153 | typedef enum |
||
154 | { |
||
155 | WF_CM_INFO_GET_FSM_STATS = 0, |
||
156 | WF_CM_INFO_CLEAR_FSM_STATS = 1 |
||
157 | } tCMInfoID; |
||
158 | #endif |
||
159 | |||
160 | /* tWFParam - Names (ID's) of WF MAC configurable parameters. */ |
||
161 | typedef enum |
||
162 | { |
||
163 | |||
164 | PARAM_MAC_ADDRESS = 1, /* the device MAC address (6 bytes) */ |
||
165 | PARAM_REGIONAL_DOMAIN = 2, /* the device Regional Domain (1 byte) */ |
||
166 | PARAM_RTS_THRESHOLD = 3, /* the RTS byte threshold 256 - 2347 (2 bytes) */ |
||
167 | PARAM_LONG_FRAME_RETRY_LIMIT = 4, /* the long Frame Retry limit (1 byte) */ |
||
168 | PARAM_SHORT_FRAME_RETRY_LIMIT = 5, /* the short Frame Retry limit (1 byte) */ |
||
169 | PARAM_TX_LIFETIME_TU = 6, /* the Tx Request lifetime in TU's 0 - 4194303 (4 bytes) */ |
||
170 | PARAM_RX_LIFETIME_TU = 7, /* the Rx Frame lifetime in TU's 0 - 4194303 (4 bytes) */ |
||
171 | PARAM_SUPPLICANT_ON_OFF = 8, /* boolean 1 = on 0 = off (1 byte) */ |
||
172 | PARAM_CONFIRM_DATA_TX_REQ = 9, /* boolean 1 = on 0 = off (1 byte) */ |
||
173 | PARAM_MASTER_STATE = 10, /* master state of the MAC using enumerated values (1 byte) */ |
||
174 | PARAM_HOST_ALERT_BITS = 11, /* a bit field which enables/disables various asynchronous */ |
||
175 | /* indications from the MAC to the host (2 bytes) */ |
||
176 | PARAM_NUM_MISSED_BEACONS = 12, /* number of consecutive beacons MAC can miss before it */ |
||
177 | /* considers the network lost (1 byte) */ |
||
178 | PARAM_DIFS_AND_EIFS = 13, /* delay intervals in usec DIFS and EIFS ( 2 * 2 bytes) */ |
||
179 | PARAM_TX_POWER = 14, /* max and min boundaries for Tx power (2 * 2 bytes) */ |
||
180 | PARAM_DEFAULT_DEST_MAC_ADDR = 15, /* stores a persistant destination MAC address for small */ |
||
181 | /* Tx Requests (6 bytes) */ |
||
182 | PARAM_WPA_INFO_ELEMENT = 16, /* stores a WPA info element (IE) in 802.11 IE format. Used */ |
||
183 | /* in Assoc Request and Supplicant exchange (3 - 258 bytes) */ |
||
184 | PARAM_RSN_INFO_ELEMENT = 17, /* stores a RSN info element (IE) in 802.11 IE format. Used */ |
||
185 | /* in Assoc Request and Supplicant exchange (3 - 258 bytes) */ |
||
186 | PARAM_ON_OFF_RADIO = 18, /* bool to force a radio state change 1 = on 0 = off (1 byte) */ |
||
187 | PARAM_COMPARE_ADDRESS = 19, /* A MAC address used to filter received frames */ |
||
188 | /* (sizeof(tAddressFilterInput) = 8 bytes) */ |
||
189 | PARAM_SUBTYPE_FILTER = 20, /* Bitfield used to filter received frames based on type and */ |
||
190 | /* sub-type (sizeof(tAddressFilterInput) = 4 bytes) */ |
||
191 | PARAM_ACK_CONTROL = 21, /* Bitfield used to control the type of frames that cause ACK */ |
||
192 | /* responses (sizeof(tAckControlInput) = 4 bytes) */ |
||
193 | PARAM_STAT_COUNTERS = 22, /* Complete set of statistics counters that are maintained by */ |
||
194 | /* the MAC */ |
||
195 | PARAM_TX_THROTTLE_TABLE = 23, /* Custom Tx Rate throttle table to be used to control tx Rate */ |
||
196 | PARAM_TX_THROTTLE_TABLE_ON_OFF = 24, /* A boolean to enable/disable use of the throttle Table and a */ |
||
197 | /* tx rate to use if the throttle table is disabled */ |
||
198 | PARAM_TX_CONTENTION_ARRAY = 25, /* Custom Retry contention ladder used for backoff calculation */ |
||
199 | /* prior to a Tx attempt */ |
||
200 | PARAM_SYSTEM_VERSION = 26, /* 2 byte representation of a version number for the ROM and */ |
||
201 | /* Patch */ |
||
202 | PARAM_STATUE_INFO = 27, /* MAC State information */ |
||
203 | PARAM_SECURITY_CONTROL = 28, /* 2 byte data structure to enable/disable encryption */ |
||
204 | PARAM_FACTORY_SET_TX_MAX_POWER = 29, /* gets the factory-set tx max power level */ |
||
205 | PARAM_MRF24WB0M = 30 /* a set enables MRF24WB0M Mode, a get gets the version */ |
||
206 | |||
207 | } tWFParam; |
||
208 | |||
209 | |||
210 | /* used in byte 2 of WF_CONNECTION_LOST_EVENT_SUBTYPE */ |
||
211 | #define WF_CONNECTION_TEMPORARILY_LOST ((UINT8)0) |
||
212 | #define WF_CONNECTION_PERMANENTLY_LOST ((UINT8)1) |
||
213 | |||
214 | |||
215 | |||
216 | #define WF_FLASH_UPDATE_NOT_SUCCESSFUL ((UINT8)0) |
||
217 | #define WF_FLASH_UPDATE_SUCCESSFUL ((UINT8)1) |
||
218 | |||
219 | |||
220 | #define WF_MAX_TX_MGMT_MSG_SIZE (128) |
||
221 | |||
222 | #define DO_NOT_FREE_MGMT_BUFFER (0) |
||
223 | #define FREE_MGMT_BUFFER (1) |
||
224 | |||
225 | #define MGMT_RESP_1ST_DATA_BYTE_INDEX (4) /* first data byte of Mgmt response starts at index 4 */ |
||
226 | |||
227 | |||
228 | #if 0 |
||
229 | /*---------------------------------------------------------------------*/ |
||
230 | /* Values that can appear in the result field of a management response */ |
||
231 | /*---------------------------------------------------------------------*/ |
||
232 | kZGMACResultSuccess = 1, // 1 |
||
233 | kZGMACResultInvalidSubType, // 2 |
||
234 | kZGMACResultCancelled, // 3 |
||
235 | kZGMACResultFrameEol, // 4 |
||
236 | kZGMACResultFrameRetryLimit, // 5 |
||
237 | kZGMACResultFrameNoBss, // 6 |
||
238 | kZGMACResultFrameTooBig, // 7 |
||
239 | kZGMACResultFrameEncryptFailure, // 8 |
||
240 | |||
241 | kZGMACResultInvalidParams, // 9 |
||
242 | kZGMACResultAlreadyAuth, // 10 |
||
243 | kZGMACResultAlreadyAssoc, // 11 |
||
244 | kZGMACResultInsufficientRsrcs, // 12 |
||
245 | kZGMACResultTimeout, // 13 |
||
246 | kZGMACResultBadExchange, // 14 /* frame exchange problem with peer */ |
||
247 | kZGMACResultAuthRefused, // 15 /* authenticating node refused our request */ |
||
248 | kZGMACResultAsocRefused, // 16 /* associating node refused our request */ |
||
249 | kZGMACResultReqInProgress, // 17 /* only one mlme request at a time allowed */ |
||
250 | |||
251 | /* several requests first require that the Device successfully 'join' a network */ |
||
252 | kZGMACResultNotJoined, // 18 /* operation requires that device be joined with target */ |
||
253 | kZGMACResultNotAssoc, // 19 /* operation requires that device be associated with target */ |
||
254 | kZGMACResultNotAuth, // 20 /* operation requires that device be authenticated with target */ |
||
255 | kZGMACResultSupplicantFailed, // 21 |
||
256 | kZGMACResultUnsupportedFeature, // 22 |
||
257 | kZGMACResultRequestOutOfSync, // 23 /* Returned when a request is recognized but invalid given the current State of the MAC */ |
||
258 | |||
259 | /* Connection Manager error codes */ |
||
260 | kZGMACResultInvalidElementType, // 24 |
||
261 | kZGMACResultInvalidProfileID, // 25 |
||
262 | kZGMACResultInvalidDataLen, // 26 |
||
263 | kZGMACResultInvalidSSIDLen, // 27 |
||
264 | kZGMACResultInvalidSecType, // 28 |
||
265 | kZGMACResultInvalidSecKeyLen, // 29 |
||
266 | kZGMACResultInvalidWEPKeyID, // 30 |
||
267 | kZGMACResultInvalidNetworkType, // 31 |
||
268 | kZGMACResultInvalidAdhocMode, // 32 |
||
269 | kZGMACResultInvalidScanType, // 33 |
||
270 | kZGMACResultInvalidCPList, // 34 |
||
271 | kZGMACResultInvalidChannelListLen, // 35 |
||
272 | kZGMACResultNotConnected, // 36 |
||
273 | kZGMACResultAlreadyConnecting, // 37 |
||
274 | kZGMACResultDisconnectFailed, // 38 |
||
275 | kZGMACResultNoStoredBssDesc // 39 |
||
276 | #endif |
||
277 | |||
278 | |||
279 | |||
280 | #ifdef WF_DEBUG |
||
281 | /* this block of defines is used to check illegal reentry when in WF API functions */ |
||
282 | #define WF_ENTERING_FUNCTION (1) |
||
283 | #define WF_LEAVING_FUNCTION (0) |
||
284 | |||
285 | /* bit masks for functions that need to be tracked when they are called */ |
||
286 | #define WF_PROCESS_EVENT_FUNC ((UINT8)0x01) |
||
287 | |||
288 | |||
289 | #endif /* WF_DEBUG */ |
||
290 | |||
291 | |||
292 | /*==========================================================================*/ |
||
293 | /* TYPEDEFS */ |
||
294 | /*==========================================================================*/ |
||
295 | |||
296 | /* This structure describes the format of the first four bytes of all */ |
||
297 | /* mgmt response messages received from the MRF24WB0M */ |
||
298 | typedef struct mgmtRxHdrStruct |
||
299 | { |
||
300 | UINT8 type; /* always 0x02 */ |
||
301 | UINT8 subtype; /* mgmt msg subtype */ |
||
302 | UINT8 result; /* 1 if success, else failure */ |
||
303 | UINT8 macState; /* not used */ |
||
304 | |||
305 | } tMgmtMsgRxHdr; |
||
306 | |||
307 | |||
308 | typedef struct mgmtIndicateHdrStruct |
||
309 | { |
||
310 | UINT8 type; /* always WF_MGMT_INDICATE_MSG_TYPE (2) */ |
||
311 | UINT8 subType; /* event type */ |
||
312 | } tMgmtIndicateHdr; |
||
313 | |||
314 | |||
315 | |||
316 | /*==========================================================================*/ |
||
317 | /* FUNCTION PROTOTYPES */ |
||
318 | /*==========================================================================*/ |
||
319 | |||
320 | void WaitForMgmtResponseAndReadData(UINT8 expectedSubtype, |
||
321 | UINT8 numDataBytes, |
||
322 | UINT8 startIndex, |
||
323 | UINT8 *p_data); |
||
324 | |||
325 | void SendMgmtMsg(UINT8 *p_header, |
||
326 | UINT8 headerLength, |
||
327 | UINT8 *p_data, |
||
328 | UINT8 dataLength); |
||
329 | |||
330 | void WaitForMgmtResponse(UINT8 expectedSubtype, UINT8 freeAction); |
||
331 | |||
332 | void SendGetParamMsg(UINT8 paramType, UINT8 *p_paramData, UINT8 paramDataLength); |
||
333 | |||
334 | void SendSetParamMsg(UINT8 paramType, UINT8 *p_paramData, UINT8 paramDataLength); |
||
335 | |||
336 | void WFProcessMgmtIndicateMsg(void); |
||
337 | |||
338 | void SignalMgmtConfirmReceivedEvent(void); |
||
339 | |||
340 | void WFSetConnectionState(UINT8 connectionState); |
||
341 | |||
342 | UINT8 WFGetConnectionState(void); |
||
343 | |||
344 | void WF_SetTxDataConfirm(UINT8 state); /* WF_ENABLED or WF_DISABLED */ |
||
345 | void WF_GetTxDataConfirm(UINT8 *p_state); /* WF_ENABLED or WF_DISABLED */ |
||
346 | BOOL WFisTxMgmtReady(void); |
||
347 | |||
348 | |||
349 | void WFFreeMgmtTx(void); |
||
350 | |||
351 | BOOL SendRAWManagementFrame(UINT16 bufLen); |
||
352 | |||
353 | void WFEnableMRF24WB0MMode(void); |
||
354 | void WFGetMRF24WB0MVersion(UINT8 *p_version); |
||
355 | |||
356 | |||
357 | /* When asserts are enabled, call this function. When asserts are not enabled compile it out */ |
||
358 | #ifdef WF_DEBUG |
||
359 | /* if asserts enabled this function will be called */ |
||
360 | void WFSetFuncState(UINT8 func, UINT8 state); |
||
361 | #else |
||
362 | /* if asserts disabled the function is no-op'ed */ |
||
363 | #define WFSetFuncState(x,y) |
||
364 | #endif |
||
365 | |||
366 | #endif /* __WF_MGMT_MSG_H */ |
Powered by WebSVN v2.8.3