GNU Linux-libre 4.19.245-gnu1
[releases.git] / drivers / staging / wilc1000 / coreconfigurator.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
4  * All rights reserved.
5  */
6
7 #ifndef CORECONFIGURATOR_H
8 #define CORECONFIGURATOR_H
9
10 #include "wilc_wlan_if.h"
11
12 #define NUM_RSSI                5
13
14 #define MAC_HDR_LEN             24
15 #define FCS_LEN                 4
16 #define TIME_STAMP_LEN          8
17 #define BEACON_INTERVAL_LEN     2
18 #define CAP_INFO_LEN            2
19 #define STATUS_CODE_LEN         2
20 #define AID_LEN                 2
21 #define IE_HDR_LEN              2
22
23 #define SET_CFG              0
24 #define GET_CFG              1
25
26 #define MAX_STRING_LEN               256
27 #define MAX_ASSOC_RESP_FRAME_SIZE    MAX_STRING_LEN
28
29 #define MAKE_WORD16(lsb, msb) ((((u16)(msb) << 8) & 0xFF00) | (lsb))
30 #define MAKE_WORD32(lsw, msw) ((((u32)(msw) << 16) & 0xFFFF0000) | (lsw))
31
32 struct rssi_history_buffer {
33         bool full;
34         u8 index;
35         s8 samples[NUM_RSSI];
36 };
37
38 struct network_info {
39         s8 rssi;
40         u16 cap_info;
41         u8 ssid[MAX_SSID_LEN];
42         u8 ssid_len;
43         u8 bssid[6];
44         u16 beacon_period;
45         u8 dtim_period;
46         u8 ch;
47         unsigned long time_scan_cached;
48         unsigned long time_scan;
49         bool new_network;
50         u8 found;
51         u32 tsf_lo;
52         u8 *ies;
53         u16 ies_len;
54         void *join_params;
55         struct rssi_history_buffer rssi_history;
56         u64 tsf_hi;
57 };
58
59 struct connect_info {
60         u8 bssid[6];
61         u8 *req_ies;
62         size_t req_ies_len;
63         u8 *resp_ies;
64         u16 resp_ies_len;
65         u16 status;
66 };
67
68 struct disconnect_info {
69         u16 reason;
70         u8 *ie;
71         size_t ie_len;
72 };
73
74 s32 wilc_parse_network_info(u8 *msg_buffer,
75                             struct network_info **ret_network_info);
76 s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
77                                struct connect_info *ret_conn_info);
78 void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length);
79 void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length);
80 void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length);
81 #endif