]>
Commit | Line | Data |
---|---|---|
c5c77ba1 JK |
1 | /* ////////////////////////////////////////////////////////////////////////// */ |
2 | /* */ | |
3 | /* Copyright (c) Atmel Corporation. All rights reserved. */ | |
4 | /* */ | |
5 | /* Module Name: wilc_wlan_cfg.c */ | |
6 | /* */ | |
7 | /* */ | |
8 | /* ///////////////////////////////////////////////////////////////////////// */ | |
9 | ||
10 | #include "wilc_wlan_if.h" | |
11 | #include "wilc_wlan.h" | |
12 | #include "wilc_wlan_cfg.h" | |
13 | #include "coreconfigurator.h" | |
14 | ||
c5c77ba1 JK |
15 | /******************************************** |
16 | * | |
17 | * Global Data | |
18 | * | |
19 | ********************************************/ | |
20 | ||
21 | typedef struct { | |
22 | wilc_debug_func dPrint; | |
23 | ||
24 | int mac_status; | |
51e825f7 CL |
25 | u8 mac_address[7]; |
26 | u8 ip_address[5]; | |
27 | u8 bssid[7]; | |
28 | u8 ssid[34]; | |
29 | u8 firmware_version[129]; | |
30 | u8 supp_rate[24]; | |
31 | u8 wep_key[28]; | |
32 | u8 i_psk[66]; | |
33 | u8 hardwareProductVersion[33]; | |
34 | u8 phyversion[17]; | |
35 | u8 supp_username[21]; | |
36 | u8 supp_password[64]; | |
37 | u8 assoc_req[256]; | |
38 | u8 assoc_rsp[256]; | |
39 | u8 firmware_info[8]; | |
40 | u8 scan_result[256]; | |
41 | u8 scan_result1[256]; | |
c5c77ba1 JK |
42 | } wilc_mac_cfg_t; |
43 | ||
44 | static wilc_mac_cfg_t g_mac; | |
45 | ||
46 | static wilc_cfg_byte_t g_cfg_byte[] = { | |
47 | {WID_BSS_TYPE, 0}, | |
48 | {WID_CURRENT_TX_RATE, 0}, | |
49 | {WID_CURRENT_CHANNEL, 0}, | |
50 | {WID_PREAMBLE, 0}, | |
51 | {WID_11G_OPERATING_MODE, 0}, | |
52 | {WID_STATUS, 0}, | |
53 | {WID_SCAN_TYPE, 0}, | |
54 | {WID_KEY_ID, 0}, | |
55 | {WID_QOS_ENABLE, 0}, | |
56 | {WID_POWER_MANAGEMENT, 0}, | |
57 | {WID_11I_MODE, 0}, | |
58 | {WID_AUTH_TYPE, 0}, | |
59 | {WID_SITE_SURVEY, 0}, | |
60 | {WID_LISTEN_INTERVAL, 0}, | |
61 | {WID_DTIM_PERIOD, 0}, | |
62 | {WID_ACK_POLICY, 0}, | |
63 | {WID_BCAST_SSID, 0}, | |
64 | {WID_REKEY_POLICY, 0}, | |
65 | {WID_SHORT_SLOT_ALLOWED, 0}, | |
66 | {WID_START_SCAN_REQ, 0}, | |
67 | {WID_RSSI, 0}, | |
68 | {WID_LINKSPEED, 0}, | |
69 | {WID_AUTO_RX_SENSITIVITY, 0}, | |
70 | {WID_DATAFLOW_CONTROL, 0}, | |
71 | {WID_SCAN_FILTER, 0}, | |
72 | {WID_11N_PROT_MECH, 0}, | |
73 | {WID_11N_ERP_PROT_TYPE, 0}, | |
74 | {WID_11N_ENABLE, 0}, | |
75 | {WID_11N_OPERATING_MODE, 0}, | |
76 | {WID_11N_OBSS_NONHT_DETECTION, 0}, | |
77 | {WID_11N_HT_PROT_TYPE, 0}, | |
78 | {WID_11N_RIFS_PROT_ENABLE, 0}, | |
79 | {WID_11N_SMPS_MODE, 0}, | |
80 | {WID_11N_CURRENT_TX_MCS, 0}, | |
81 | {WID_11N_SHORT_GI_ENABLE, 0}, | |
82 | {WID_RIFS_MODE, 0}, | |
83 | {WID_TX_ABORT_CONFIG, 0}, | |
84 | {WID_11N_IMMEDIATE_BA_ENABLED, 0}, | |
85 | {WID_11N_TXOP_PROT_DISABLE, 0}, | |
86 | {WID_NIL, 0} | |
87 | }; | |
88 | ||
89 | static wilc_cfg_hword_t g_cfg_hword[] = { | |
90 | {WID_LINK_LOSS_THRESHOLD, 0}, | |
91 | {WID_RTS_THRESHOLD, 0}, | |
92 | {WID_FRAG_THRESHOLD, 0}, | |
93 | {WID_SHORT_RETRY_LIMIT, 0}, | |
94 | {WID_LONG_RETRY_LIMIT, 0}, | |
95 | {WID_BEACON_INTERVAL, 0}, | |
96 | {WID_RX_SENSE, 0}, | |
97 | {WID_ACTIVE_SCAN_TIME, 0}, | |
98 | {WID_PASSIVE_SCAN_TIME, 0}, | |
99 | {WID_SITE_SURVEY_SCAN_TIME, 0}, | |
100 | {WID_JOIN_START_TIMEOUT, 0}, | |
101 | {WID_AUTH_TIMEOUT, 0}, | |
102 | {WID_ASOC_TIMEOUT, 0}, | |
103 | {WID_11I_PROTOCOL_TIMEOUT, 0}, | |
104 | {WID_EAPOL_RESPONSE_TIMEOUT, 0}, | |
105 | {WID_11N_SIG_QUAL_VAL, 0}, | |
106 | {WID_CCA_THRESHOLD, 0}, | |
107 | {WID_NIL, 0} | |
108 | }; | |
109 | ||
110 | static wilc_cfg_word_t g_cfg_word[] = { | |
111 | {WID_FAILED_COUNT, 0}, | |
112 | {WID_RETRY_COUNT, 0}, | |
113 | {WID_MULTIPLE_RETRY_COUNT, 0}, | |
114 | {WID_FRAME_DUPLICATE_COUNT, 0}, | |
115 | {WID_ACK_FAILURE_COUNT, 0}, | |
116 | {WID_RECEIVED_FRAGMENT_COUNT, 0}, | |
117 | {WID_MCAST_RECEIVED_FRAME_COUNT, 0}, | |
118 | {WID_FCS_ERROR_COUNT, 0}, | |
119 | {WID_SUCCESS_FRAME_COUNT, 0}, | |
120 | {WID_TX_FRAGMENT_COUNT, 0}, | |
121 | {WID_TX_MULTICAST_FRAME_COUNT, 0}, | |
122 | {WID_RTS_SUCCESS_COUNT, 0}, | |
123 | {WID_RTS_FAILURE_COUNT, 0}, | |
124 | {WID_WEP_UNDECRYPTABLE_COUNT, 0}, | |
125 | {WID_REKEY_PERIOD, 0}, | |
126 | {WID_REKEY_PACKET_COUNT, 0}, | |
127 | {WID_HW_RX_COUNT, 0}, | |
128 | {WID_GET_INACTIVE_TIME, 0}, | |
129 | {WID_NIL, 0} | |
130 | ||
131 | }; | |
132 | ||
133 | static wilc_cfg_str_t g_cfg_str[] = { | |
134 | {WID_SSID, g_mac.ssid}, /* 33 + 1 bytes */ | |
135 | {WID_FIRMWARE_VERSION, g_mac.firmware_version}, | |
136 | {WID_OPERATIONAL_RATE_SET, g_mac.supp_rate}, | |
137 | {WID_BSSID, g_mac.bssid}, /* 6 bytes */ | |
138 | {WID_WEP_KEY_VALUE, g_mac.wep_key}, /* 27 bytes */ | |
139 | {WID_11I_PSK, g_mac.i_psk}, /* 65 bytes */ | |
140 | /* {WID_11E_P_ACTION_REQ, g_mac.action_req}, */ | |
141 | {WID_HARDWARE_VERSION, g_mac.hardwareProductVersion}, | |
142 | {WID_MAC_ADDR, g_mac.mac_address}, | |
143 | {WID_PHY_VERSION, g_mac.phyversion}, | |
144 | {WID_SUPP_USERNAME, g_mac.supp_username}, | |
145 | {WID_SUPP_PASSWORD, g_mac.supp_password}, | |
146 | {WID_SITE_SURVEY_RESULTS, g_mac.scan_result}, | |
147 | {WID_SITE_SURVEY_RESULTS, g_mac.scan_result1}, | |
148 | /* {WID_RX_POWER_LEVEL, g_mac.channel_rssi}, */ | |
149 | {WID_ASSOC_REQ_INFO, g_mac.assoc_req}, | |
150 | {WID_ASSOC_RES_INFO, g_mac.assoc_rsp}, | |
151 | /* {WID_11N_P_ACTION_REQ, g_mac.action_req}, */ | |
152 | {WID_FIRMWARE_INFO, g_mac.firmware_version}, | |
153 | {WID_IP_ADDRESS, g_mac.ip_address}, | |
154 | {WID_NIL, NULL} | |
155 | }; | |
156 | ||
157 | /******************************************** | |
158 | * | |
159 | * Configuration Functions | |
160 | * | |
161 | ********************************************/ | |
162 | ||
fbc2fe16 | 163 | static int wilc_wlan_cfg_set_byte(u8 *frame, u32 offset, u16 id, u8 val8) |
c5c77ba1 | 164 | { |
51e825f7 | 165 | u8 *buf; |
c5c77ba1 JK |
166 | |
167 | if ((offset + 4) >= MAX_CFG_FRAME_SIZE) | |
168 | return 0; | |
169 | ||
170 | buf = &frame[offset]; | |
171 | ||
51e825f7 CL |
172 | buf[0] = (u8)id; |
173 | buf[1] = (u8)(id >> 8); | |
c5c77ba1 JK |
174 | buf[2] = 1; |
175 | buf[3] = val8; | |
176 | return 4; | |
177 | } | |
178 | ||
fbc2fe16 | 179 | static int wilc_wlan_cfg_set_hword(u8 *frame, u32 offset, u16 id, u16 val16) |
c5c77ba1 | 180 | { |
51e825f7 | 181 | u8 *buf; |
c5c77ba1 JK |
182 | |
183 | if ((offset + 5) >= MAX_CFG_FRAME_SIZE) | |
184 | return 0; | |
185 | ||
186 | buf = &frame[offset]; | |
187 | ||
51e825f7 CL |
188 | buf[0] = (u8)id; |
189 | buf[1] = (u8)(id >> 8); | |
c5c77ba1 | 190 | buf[2] = 2; |
51e825f7 CL |
191 | buf[3] = (u8)val16; |
192 | buf[4] = (u8)(val16 >> 8); | |
c5c77ba1 JK |
193 | |
194 | return 5; | |
195 | } | |
196 | ||
fbc2fe16 | 197 | static int wilc_wlan_cfg_set_word(u8 *frame, u32 offset, u16 id, u32 val32) |
c5c77ba1 | 198 | { |
51e825f7 | 199 | u8 *buf; |
c5c77ba1 JK |
200 | |
201 | if ((offset + 7) >= MAX_CFG_FRAME_SIZE) | |
202 | return 0; | |
203 | ||
204 | buf = &frame[offset]; | |
205 | ||
51e825f7 CL |
206 | buf[0] = (u8)id; |
207 | buf[1] = (u8)(id >> 8); | |
c5c77ba1 | 208 | buf[2] = 4; |
51e825f7 CL |
209 | buf[3] = (u8)val32; |
210 | buf[4] = (u8)(val32 >> 8); | |
211 | buf[5] = (u8)(val32 >> 16); | |
212 | buf[6] = (u8)(val32 >> 24); | |
c5c77ba1 JK |
213 | |
214 | return 7; | |
215 | } | |
216 | ||
fbc2fe16 | 217 | static int wilc_wlan_cfg_set_str(u8 *frame, u32 offset, u16 id, u8 *str, u32 size) |
c5c77ba1 | 218 | { |
51e825f7 | 219 | u8 *buf; |
c5c77ba1 JK |
220 | |
221 | if ((offset + size + 3) >= MAX_CFG_FRAME_SIZE) | |
222 | return 0; | |
223 | ||
224 | buf = &frame[offset]; | |
225 | ||
51e825f7 CL |
226 | buf[0] = (u8)id; |
227 | buf[1] = (u8)(id >> 8); | |
228 | buf[2] = (u8)size; | |
c5c77ba1 JK |
229 | |
230 | if ((str != NULL) && (size != 0)) | |
231 | memcpy(&buf[3], str, size); | |
232 | ||
233 | return (size + 3); | |
234 | } | |
235 | ||
fbc2fe16 | 236 | static int wilc_wlan_cfg_set_bin(u8 *frame, u32 offset, u16 id, u8 *b, u32 size) |
c5c77ba1 | 237 | { |
51e825f7 | 238 | u8 *buf; |
fbc2fe16 | 239 | u32 i; |
51e825f7 | 240 | u8 checksum = 0; |
c5c77ba1 JK |
241 | |
242 | if ((offset + size + 5) >= MAX_CFG_FRAME_SIZE) | |
243 | return 0; | |
244 | ||
245 | buf = &frame[offset]; | |
51e825f7 CL |
246 | buf[0] = (u8)id; |
247 | buf[1] = (u8)(id >> 8); | |
248 | buf[2] = (u8)size; | |
249 | buf[3] = (u8)(size >> 8); | |
c5c77ba1 JK |
250 | |
251 | if ((b != NULL) && (size != 0)) { | |
252 | memcpy(&buf[4], b, size); | |
253 | for (i = 0; i < size; i++) { | |
254 | checksum += buf[i + 4]; | |
255 | } | |
256 | } | |
257 | ||
258 | buf[size + 4] = checksum; | |
259 | ||
260 | return (size + 5); | |
261 | } | |
262 | ||
263 | /******************************************** | |
264 | * | |
265 | * Configuration Response Functions | |
266 | * | |
267 | ********************************************/ | |
268 | ||
51e825f7 | 269 | static void wilc_wlan_parse_response_frame(u8 *info, int size) |
c5c77ba1 | 270 | { |
fbc2fe16 | 271 | u32 wid, len = 0, i = 0; |
c5c77ba1 JK |
272 | static int seq; |
273 | ||
274 | while (size > 0) { | |
275 | i = 0; | |
276 | wid = info[0] | (info[1] << 8); | |
277 | #ifdef BIG_ENDIAN | |
278 | wid = BYTE_SWAP(wid); | |
279 | #endif | |
280 | PRINT_INFO(GENERIC_DBG, "Processing response for %d seq %d\n", wid, seq++); | |
281 | switch ((wid >> 12) & 0x7) { | |
282 | case WID_CHAR: | |
283 | do { | |
284 | if (g_cfg_byte[i].id == WID_NIL) | |
285 | break; | |
286 | ||
287 | if (g_cfg_byte[i].id == wid) { | |
288 | g_cfg_byte[i].val = info[3]; | |
289 | break; | |
290 | } | |
291 | i++; | |
292 | } while (1); | |
293 | len = 2; | |
294 | break; | |
295 | ||
296 | case WID_SHORT: | |
297 | do { | |
298 | if (g_cfg_hword[i].id == WID_NIL) | |
299 | break; | |
300 | ||
301 | if (g_cfg_hword[i].id == wid) { | |
302 | #ifdef BIG_ENDIAN | |
303 | g_cfg_hword[i].val = (info[3] << 8) | (info[4]); | |
304 | #else | |
305 | g_cfg_hword[i].val = info[3] | (info[4] << 8); | |
306 | #endif | |
307 | break; | |
308 | } | |
309 | i++; | |
310 | } while (1); | |
311 | len = 3; | |
312 | break; | |
313 | ||
314 | case WID_INT: | |
315 | do { | |
316 | if (g_cfg_word[i].id == WID_NIL) | |
317 | break; | |
318 | ||
319 | if (g_cfg_word[i].id == wid) { | |
320 | #ifdef BIG_ENDIAN | |
321 | g_cfg_word[i].val = (info[3] << 24) | (info[4] << 16) | (info[5] << 8) | (info[6]); | |
322 | #else | |
323 | g_cfg_word[i].val = info[3] | (info[4] << 8) | (info[5] << 16) | (info[6] << 24); | |
324 | #endif | |
325 | break; | |
326 | } | |
327 | i++; | |
328 | } while (1); | |
329 | len = 5; | |
330 | break; | |
331 | ||
332 | case WID_STR: | |
333 | do { | |
334 | if (g_cfg_str[i].id == WID_NIL) | |
335 | break; | |
336 | ||
337 | if (g_cfg_str[i].id == wid) { | |
338 | if (wid == WID_SITE_SURVEY_RESULTS) { | |
339 | static int toggle; | |
8dfaafd6 | 340 | |
c5c77ba1 JK |
341 | PRINT_INFO(GENERIC_DBG, "Site survey results received[%d]\n", |
342 | size); | |
343 | ||
344 | PRINT_INFO(GENERIC_DBG, "Site survey results value[%d]toggle[%d]\n", size, toggle); | |
345 | i += toggle; | |
346 | toggle ^= 1; | |
347 | } | |
348 | memcpy(g_cfg_str[i].str, &info[2], (info[2] + 1)); | |
349 | break; | |
350 | } | |
351 | i++; | |
352 | } while (1); | |
353 | len = 1 + info[2]; | |
354 | break; | |
355 | ||
356 | default: | |
357 | break; | |
358 | } | |
359 | size -= (2 + len); | |
360 | info += (2 + len); | |
361 | } | |
c5c77ba1 JK |
362 | } |
363 | ||
51e825f7 | 364 | static int wilc_wlan_parse_info_frame(u8 *info, int size) |
c5c77ba1 JK |
365 | { |
366 | wilc_mac_cfg_t *pd = (wilc_mac_cfg_t *)&g_mac; | |
fbc2fe16 | 367 | u32 wid, len; |
c5c77ba1 JK |
368 | int type = WILC_CFG_RSP_STATUS; |
369 | ||
370 | wid = info[0] | (info[1] << 8); | |
c5c77ba1 JK |
371 | |
372 | len = info[2]; | |
373 | PRINT_INFO(GENERIC_DBG, "Status Len = %d Id= %d\n", len, wid); | |
374 | if ((len == 1) && (wid == WID_STATUS)) { | |
375 | pd->mac_status = info[3]; | |
376 | type = WILC_CFG_RSP_STATUS; | |
377 | } | |
378 | ||
379 | return type; | |
380 | } | |
381 | ||
c5c77ba1 JK |
382 | /******************************************** |
383 | * | |
384 | * Configuration Exported Functions | |
385 | * | |
386 | ********************************************/ | |
387 | ||
fbc2fe16 | 388 | static int wilc_wlan_cfg_set_wid(u8 *frame, u32 offset, u16 id, u8 *buf, int size) |
c5c77ba1 | 389 | { |
51e825f7 | 390 | u8 type = (id >> 12) & 0xf; |
c5c77ba1 JK |
391 | int ret = 0; |
392 | ||
393 | if (type == 0) { /* byte command */ | |
394 | if (size >= 1) | |
395 | ret = wilc_wlan_cfg_set_byte(frame, offset, id, *buf); | |
396 | } else if (type == 1) { /* half word command */ | |
397 | if (size >= 2) | |
ec53adfe | 398 | ret = wilc_wlan_cfg_set_hword(frame, offset, id, *((u16 *)buf)); |
c5c77ba1 JK |
399 | } else if (type == 2) { /* word command */ |
400 | if (size >= 4) | |
fbc2fe16 | 401 | ret = wilc_wlan_cfg_set_word(frame, offset, id, *((u32 *)buf)); |
c5c77ba1 JK |
402 | } else if (type == 3) { /* string command */ |
403 | ret = wilc_wlan_cfg_set_str(frame, offset, id, buf, size); | |
404 | } else if (type == 4) { /* binary command */ | |
405 | ret = wilc_wlan_cfg_set_bin(frame, offset, id, buf, size); | |
406 | } else { | |
407 | g_mac.dPrint(N_ERR, "illegal id\n"); | |
408 | } | |
409 | ||
410 | return ret; | |
411 | } | |
412 | ||
fbc2fe16 | 413 | static int wilc_wlan_cfg_get_wid(u8 *frame, u32 offset, u16 id) |
c5c77ba1 | 414 | { |
51e825f7 | 415 | u8 *buf; |
c5c77ba1 JK |
416 | |
417 | if ((offset + 2) >= MAX_CFG_FRAME_SIZE) | |
418 | return 0; | |
419 | ||
420 | buf = &frame[offset]; | |
421 | ||
51e825f7 CL |
422 | buf[0] = (u8)id; |
423 | buf[1] = (u8)(id >> 8); | |
c5c77ba1 JK |
424 | |
425 | return 2; | |
426 | } | |
427 | ||
fbc2fe16 | 428 | static int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size) |
c5c77ba1 | 429 | { |
fbc2fe16 | 430 | u32 type = (wid >> 12) & 0xf; |
c5c77ba1 JK |
431 | int i, ret = 0; |
432 | ||
433 | if (wid == WID_STATUS) { | |
fbc2fe16 | 434 | *((u32 *)buffer) = g_mac.mac_status; |
c5c77ba1 JK |
435 | return 4; |
436 | } | |
437 | ||
438 | i = 0; | |
439 | if (type == 0) { /* byte command */ | |
440 | do { | |
441 | if (g_cfg_byte[i].id == WID_NIL) | |
442 | break; | |
443 | ||
444 | if (g_cfg_byte[i].id == wid) { | |
445 | memcpy(buffer, &g_cfg_byte[i].val, 1); | |
446 | ret = 1; | |
447 | break; | |
448 | } | |
449 | i++; | |
450 | } while (1); | |
451 | } else if (type == 1) { /* half word command */ | |
452 | do { | |
453 | if (g_cfg_hword[i].id == WID_NIL) | |
454 | break; | |
455 | ||
456 | if (g_cfg_hword[i].id == wid) { | |
457 | memcpy(buffer, &g_cfg_hword[i].val, 2); | |
458 | ret = 2; | |
459 | break; | |
460 | } | |
461 | i++; | |
462 | } while (1); | |
463 | } else if (type == 2) { /* word command */ | |
464 | do { | |
465 | if (g_cfg_word[i].id == WID_NIL) | |
466 | break; | |
467 | ||
468 | if (g_cfg_word[i].id == wid) { | |
469 | memcpy(buffer, &g_cfg_word[i].val, 4); | |
470 | ret = 4; | |
471 | break; | |
472 | } | |
473 | i++; | |
474 | } while (1); | |
475 | } else if (type == 3) { /* string command */ | |
476 | do { | |
477 | if (g_cfg_str[i].id == WID_NIL) | |
478 | break; | |
479 | ||
480 | if (g_cfg_str[i].id == wid) { | |
fbc2fe16 | 481 | u32 size = g_cfg_str[i].str[0]; |
8dfaafd6 | 482 | |
c5c77ba1 JK |
483 | if (buffer_size >= size) { |
484 | if (g_cfg_str[i].id == WID_SITE_SURVEY_RESULTS) { | |
485 | static int toggle; | |
8dfaafd6 | 486 | |
c5c77ba1 JK |
487 | PRINT_INFO(GENERIC_DBG, "Site survey results value[%d]\n", |
488 | size); | |
489 | i += toggle; | |
490 | toggle ^= 1; | |
491 | ||
492 | } | |
493 | memcpy(buffer, &g_cfg_str[i].str[1], size); | |
494 | ret = size; | |
495 | } | |
496 | break; | |
497 | } | |
498 | i++; | |
499 | } while (1); | |
500 | } else { | |
501 | g_mac.dPrint(N_ERR, "[CFG]: illegal type (%08x)\n", wid); | |
502 | } | |
503 | ||
504 | return ret; | |
505 | } | |
506 | ||
51e825f7 | 507 | static int wilc_wlan_cfg_indicate_rx(u8 *frame, int size, wilc_cfg_rsp_t *rsp) |
c5c77ba1 JK |
508 | { |
509 | int ret = 1; | |
51e825f7 CL |
510 | u8 msg_type; |
511 | u8 msg_id; | |
c5c77ba1 JK |
512 | |
513 | msg_type = frame[0]; | |
514 | msg_id = frame[1]; /* seq no */ | |
c5c77ba1 JK |
515 | frame += 4; |
516 | size -= 4; | |
517 | ||
518 | /** | |
519 | * The valid types of response messages are 'R' (Response), 'I' (Information), and 'N' (Network Information) | |
520 | **/ | |
521 | ||
522 | switch (msg_type) { | |
523 | case 'R': | |
524 | wilc_wlan_parse_response_frame(frame, size); | |
525 | rsp->type = WILC_CFG_RSP; | |
526 | rsp->seq_no = msg_id; | |
527 | break; | |
528 | ||
529 | case 'I': | |
530 | rsp->type = wilc_wlan_parse_info_frame(frame, size); | |
531 | rsp->seq_no = msg_id; | |
532 | /*call host interface info parse as well*/ | |
533 | PRINT_INFO(RX_DBG, "Info message received\n"); | |
534 | GnrlAsyncInfoReceived(frame - 4, size + 4); | |
535 | break; | |
536 | ||
c5c77ba1 JK |
537 | case 'N': |
538 | NetworkInfoReceived(frame - 4, size + 4); | |
539 | rsp->type = 0; | |
540 | break; | |
541 | ||
c5c77ba1 | 542 | case 'S': |
17aacd43 | 543 | PRINT_INFO(RX_DBG, "Scan Notification Received\n"); |
c5c77ba1 JK |
544 | host_int_ScanCompleteReceived(frame - 4, size + 4); |
545 | break; | |
546 | ||
c5c77ba1 JK |
547 | default: |
548 | PRINT_INFO(RX_DBG, "Receive unknown message type[%d-%d-%d-%d-%d-%d-%d-%d]\n", | |
549 | frame[0], frame[1], frame[2], frame[3], frame[4], | |
550 | frame[5], frame[6], frame[7]); | |
551 | rsp->type = 0; | |
552 | rsp->seq_no = msg_id; | |
553 | ret = 0; | |
554 | break; | |
555 | } | |
556 | ||
557 | return ret; | |
558 | } | |
559 | ||
560 | static int wilc_wlan_cfg_init(wilc_debug_func func) | |
561 | { | |
562 | memset((void *)&g_mac, 0, sizeof(wilc_mac_cfg_t)); | |
563 | g_mac.dPrint = func; | |
564 | return 1; | |
565 | } | |
566 | ||
567 | wilc_cfg_func_t mac_cfg = { | |
568 | wilc_wlan_cfg_set_wid, | |
569 | wilc_wlan_cfg_get_wid, | |
570 | wilc_wlan_cfg_get_wid_value, | |
571 | wilc_wlan_cfg_indicate_rx, | |
572 | wilc_wlan_cfg_init, | |
573 | }; |