1 /** @file wifi_nxp_internal.h
2  *
3  * @brief This file provides Core Wi-Fi definition for wpa supplicant RTOS driver.
4  *
5  * Copyright 2008-2024 NXP
6  *
7  *  SPDX-License-Identifier: BSD-3-Clause
8  *
9  */
10 
11 #ifndef __WIFI_NXP_INTERNAL_H__
12 #define __WIFI_NXP_INTERNAL_H__
13 
14 #include <stdio.h>
15 
16 #include <wifi_config_default.h>
17 
18 #if CONFIG_WPA_SUPP
19 #define WIFI_NXP_HT_MCS_MASK_LEN 10
20 #define WIFI_NXP_HT_MCS_RES_LEN 3
21 
22 /**
23  * @brief MCS information.
24  *
25  */
26 struct wifi_nxp_event_mcs_info {
27     /** Highest supported RX rate */
28     unsigned short wifi_nxp_rx_highest;
29     /** RX mask */
30     unsigned char wifi_nxp_rx_mask[WIFI_NXP_HT_MCS_MASK_LEN];
31     /** TX parameters */
32     unsigned char wifi_nxp_tx_params;
33     /** reserved */
34     unsigned char wifi_nxp_reserved[WIFI_NXP_HT_MCS_RES_LEN];
35 };
36 
37 /**
38  * @brief This structure represents HT capability parameters.
39  *
40  */
41 struct wifi_nxp_event_sta_ht_cap {
42     /** 1 indicates HT Supported */
43     signed int wifi_nxp_ht_supported;
44     /** HT capabilities, as in the HT information IE */
45     unsigned short wifi_nxp_cap;
46     /** MCS information. @ref wifi_nxp_event_mcs_info */
47     struct wifi_nxp_event_mcs_info mcs;
48     /** A-MPDU factor, as in 11n */
49     unsigned char wifi_nxp_ampdu_factor;
50     /** A-MPDU density, as in 11n */
51     unsigned char wifi_nxp_ampdu_density;
52 };
53 
54 #define WIFI_NXP_CHAN_FLAG_FREQUENCY_ATTR_NO_IR (1 << 0)
55 #define WIFI_NXP_CHAN_FLAG_FREQUENCY_ATTR_NO_IBSS (1 << 1)
56 #define WIFI_NXP_CHAN_FLAG_FREQUENCY_ATTR_RADAR (1 << 2)
57 #define WIFI_NXP_CHAN_FLAG_FREQUENCY_ATTR_NO_HT40_MINUS (1 << 3)
58 #define WIFI_NXP_CHAN_FLAG_FREQUENCY_ATTR_NO_HT40_PLUS (1 << 4)
59 #define WIFI_NXP_CHAN_FLAG_FREQUENCY_ATTR_NO_80MHZ (1 << 5)
60 #define WIFI_NXP_CHAN_FLAG_FREQUENCY_ATTR_NO_160MHZ (1 << 6)
61 #define WIFI_NXP_CHAN_FLAG_FREQUENCY_ATTR_INDOOR_ONLY (1 << 7)
62 #define WIFI_NXP_CHAN_FLAG_FREQUENCY_ATTR_GO_CONCURRENT (1 << 8)
63 #define WIFI_NXP_CHAN_FLAG_FREQUENCY_ATTR_NO_20MHZ (1 << 9)
64 #define WIFI_NXP_CHAN_FLAG_FREQUENCY_ATTR_NO_10MHZ (1 << 10)
65 #define WIFI_NXP_CHAN_FLAG_FREQUENCY_DISABLED (1 << 11)
66 
67 #define WIFI_NXP_CHAN_DFS_VALID (1 << 12)
68 #define WIFI_NXP_CHAN_DFS_CAC_TIME_VALID (1 << 13)
69 
70 /**
71  * @brief This structure represents channel parameters.
72  */
73 struct wifi_nxp_event_channel {
74     /** channel flags WIFI_NXP_CHAN_FLAG_FREQUENCY_ATTR_NO_IBSS */
75     unsigned short wifi_nxp_flags;
76     /** maximum transmission power (in dBm) */
77     signed int wifi_nxp_max_power;
78     /** DFS state time */
79     unsigned int wifi_nxp_time;
80     /** DFS CAC time in ms */
81     unsigned int dfs_cac_msec;
82     /** Channel parameters are valid or not 1=valid */
83     signed char ch_valid;
84     /** Channel center frequency */
85     unsigned short center_frequency;
86     /** Current dfs state */
87     signed char dfs_state;
88 };
89 
90 #define WIFI_NXP_EVENT_GET_WIPHY_FLAG_RATE_SHORT_PREAMBLE (1 << 0)
91 /**
92  * @brief This structure represents rate information.
93  */
94 struct wifi_nxp_event_rate {
95     /** WIFI_NXP_EVENT_GET_WIPHY_FLAG_RATE_SHORT_PREAMBLE */
96     unsigned short wifi_nxp_flags;
97     /** Bitrate in units of 100 kbps */
98     unsigned short wifi_nxp_bitrate;
99 };
100 
101 /**
102  * @brief VHT MCS information.
103  *
104  */
105 struct wifi_nxp_event_vht_mcs_info {
106     /** RX MCS map 2 bits for each stream, total 8 streams */
107     unsigned short rx_mcs_map;
108     /** Indicates highest long GI VHT PPDU data rate
109      *  STA can receive. Rate expressed in units of 1 Mbps.
110      *  If this field is 0 this value should not be used to
111      *  consider the highest RX data rate supported.
112      */
113     unsigned short rx_highest;
114     /** TX MCS map 2 bits for each stream, total 8 streams */
115     unsigned short tx_mcs_map;
116     /** Indicates highest long GI VHT PPDU data rate
117      *  STA can transmit. Rate expressed in units of 1 Mbps.
118      *  If this field is 0 this value should not be used to
119      *  consider the highest TX data rate supported.
120      */
121     unsigned short tx_highest;
122 };
123 
124 /**
125  * @brief This structure represents VHT capability parameters.
126  *
127  */
128 struct wifi_nxp_event_sta_vht_cap {
129     /** 1 indicates VHT Supported */
130     signed char wifi_nxp_vht_supported;
131     /** VHT capability info */
132     unsigned int wifi_nxp_cap;
133     /** Refer @ref wifi_nxp_event_vht_mcs_info */
134     struct wifi_nxp_event_vht_mcs_info vht_mcs;
135 };
136 
137 #define WIFI_NXP_HE_MAX_MAC_CAPAB_SIZE  6
138 #define WIFI_NXP_HE_MAX_PHY_CAPAB_SIZE  11
139 #define WIFI_NXP_HE_MAX_MCS_CAPAB_SIZE  12
140 #define WIFI_NXP_HE_MAX_PPET_CAPAB_SIZE 25
141 
142 /**
143  * @brief This structure represents HE capability parameters.
144  *
145  */
146 struct wifi_nxp_event_sta_he_cap {
147     unsigned char wifi_nxp_he_supported;
148     unsigned char phy_cap[WIFI_NXP_HE_MAX_PHY_CAPAB_SIZE];
149     unsigned char mac_cap[WIFI_NXP_HE_MAX_MAC_CAPAB_SIZE];
150     unsigned char mcs[WIFI_NXP_HE_MAX_MCS_CAPAB_SIZE];
151     unsigned char ppet[WIFI_NXP_HE_MAX_PPET_CAPAB_SIZE];
152     unsigned short he_6ghz_capa;
153 };
154 
155 /**
156  * @brief Frequency band information.
157  *
158  */
159 struct wifi_nxp_event_supported_band {
160 	/** No.of channels */
161 	unsigned short wifi_nxp_n_channels;
162 	/** No.of bitrates */
163 	unsigned short wifi_nxp_n_bitrates;
164 	/** Array of channels the hardware can operate in this band */
165 	struct wifi_nxp_event_channel channels[29];
166 	/** Array of bitrates the hardware can operate with in this band */
167 	struct wifi_nxp_event_rate bitrates[13];
168 	/** HT capabilities in this band */
169 	struct wifi_nxp_event_sta_ht_cap ht_cap;
170 	/** VHT capabilities in this band */
171 	struct wifi_nxp_event_sta_vht_cap vht_cap;
172 	/** HE capabilities in this band */
173 	struct wifi_nxp_event_sta_he_cap he_cap;
174 	/** the band this structure represents */
175 	signed char band;
176 };
177 
178 struct wifi_nxp_event_get_wiphy
179 {
180     /** Supported bands info. @ref wifi_nxp_event_supported_band */
181     struct wifi_nxp_event_supported_band sband[WIFI_NXP_EVENT_GET_WIPHY_NUM_BANDS];
182 };
183 
184 #define WIFI_HE_MAX_MAC_CAPAB_SIZE  6
185 #define WIFI_HE_MAX_PHY_CAPAB_SIZE  11
186 #define WIFI_HE_MAX_MCS_CAPAB_SIZE  12
187 #define WIFI_HE_MAX_PPET_CAPAB_SIZE 25
188 
189 /**
190  * struct he_capabilities - IEEE 802.11ax HE capabilities
191  */
192 typedef MLAN_PACK_START struct _nxp_wifi_he_capabilities
193 {
194     unsigned char he_supported;
195     unsigned char phy_cap[WIFI_HE_MAX_PHY_CAPAB_SIZE];
196     unsigned char mac_cap[WIFI_HE_MAX_MAC_CAPAB_SIZE];
197     unsigned char mcs[WIFI_HE_MAX_MCS_CAPAB_SIZE];
198     unsigned char ppet[WIFI_HE_MAX_PPET_CAPAB_SIZE];
199     unsigned short he_6ghz_capa;
200 } MLAN_PACK_END nxp_wifi_he_capabilities;
201 
202 #define WIFI_MAX_IE_LEN 500U
203 
204 typedef MLAN_PACK_START struct _nxp_wifi_ie
205 {
206     unsigned short ie_len;
207     char ie[WIFI_MAX_IE_LEN];
208 } MLAN_PACK_END nxp_wifi_ie_t;
209 
210 typedef MLAN_PACK_START struct _nxp_wifi_ie2
211 {
212     unsigned short ie_len;
213     unsigned char *ie;
214 } MLAN_PACK_END nxp_wifi_ie2_t;
215 
216 #define WIFI_MAX_SSID_LEN 32U
217 #define WIFI_ETH_ADDR_LEN 6U
218 
219 typedef MLAN_PACK_START struct _nxp_wifi_ssid
220 {
221     unsigned char ssid_len;
222     unsigned char ssid[WIFI_MAX_SSID_LEN];
223 } MLAN_PACK_END nxp_wifi_ssid_t;
224 
225 #define WIFI_SCAN_MAX_NUM_SSIDS 2U
226 #define WIFI_SCAN_MAX_NUM_CHAN  41U
227 #define MAX_NUM_CHANNELS        39U
228 
229 typedef MLAN_PACK_START struct _nxp_wifi_trigger_scan
230 {
231     bool hostapd;
232     unsigned char num_ssids;
233     nxp_wifi_ssid_t scan_ssids[WIFI_SCAN_MAX_NUM_SSIDS];
234     unsigned char num_chans;
235     unsigned char chan_list[WIFI_SCAN_MAX_NUM_CHAN];
236     nxp_wifi_ie_t extra_ies;
237     int filter_rssi;
238     unsigned char bssid[WIFI_ETH_ADDR_LEN];
239     unsigned int only_new_results : 1;
240 } MLAN_PACK_END nxp_wifi_trigger_scan_t;
241 
242 typedef MLAN_PACK_START struct _nxp_wifi_trigger_sched_scan
243 {
244     unsigned int chan_per_scan;
245     unsigned char num_ssids;
246     nxp_wifi_ssid_t scan_ssids[WIFI_SCAN_MAX_NUM_SSIDS];
247     unsigned char num_chans;
248     unsigned char chan_list[WIFI_SCAN_MAX_NUM_CHAN];
249     nxp_wifi_ie_t extra_ies;
250     unsigned int scan_interval;
251     unsigned int report_condition;
252     unsigned short repeat_count;
253     int filter_rssi;
254 } MLAN_PACK_END nxp_wifi_trigger_sched_scan_t;
255 
256 typedef MLAN_PACK_START struct _nxp_wifi_event_new_scan_result
257 {
258     unsigned int frequency;
259     unsigned int chan_width;
260     unsigned int seen_ms_ago;
261     int status;
262     unsigned long long ies_tsf;
263     unsigned long long beacon_ies_tsf;
264     unsigned short beacon_interval;
265     unsigned short capability;
266     nxp_wifi_ie2_t ies;
267     unsigned char rssi;
268     unsigned short noise;
269     unsigned char mac_addr[WIFI_ETH_ADDR_LEN];
270     bool more_res;
271 } MLAN_PACK_END nxp_wifi_event_new_scan_result_t;
272 
273 typedef MLAN_PACK_START struct _nxp_wifi_trigger_op
274 {
275     bool hostapd;
276 } MLAN_PACK_END nxp_wifi_trigger_op_t;
277 
278 typedef MLAN_PACK_START struct _nxp_wifi_event_new_survey_result
279 {
280     unsigned int freq;
281     char nf;
282     unsigned long long channel_time;
283     unsigned long long channel_time_busy;
284     unsigned long long channel_time_rx;
285     unsigned long long channel_time_tx;
286     bool more_res;
287 } MLAN_PACK_END nxp_wifi_event_new_survey_result_t;
288 
289 typedef MLAN_PACK_START struct _nxp_wifi_acs_params
290 {
291     unsigned int pri_freq;
292     unsigned int sec_freq;
293     unsigned short ch_width;
294     unsigned int hw_mode;
295 } MLAN_PACK_END nxp_wifi_acs_params;
296 
297 #define WIFI_MAX_FRAME_LEN 1500U
298 
299 typedef MLAN_PACK_START struct _nxp_wifi_frame
300 {
301     int frame_len;
302     int freq;
303     unsigned char frame[WIFI_MAX_FRAME_LEN];
304 } MLAN_PACK_END nxp_wifi_frame_t;
305 
306 typedef MLAN_PACK_START struct _nxp_wifi_event_mlme
307 {
308     nxp_wifi_frame_t frame;
309     unsigned char mac_addr[WIFI_ETH_ADDR_LEN];
310 } MLAN_PACK_END nxp_wifi_event_mlme_t;
311 
312 #define WIFI_EAPOL_MAX_FRAME_LEN 1500U
313 
314 typedef MLAN_PACK_START struct _nxp_wifi_eapol_frame
315 {
316     int frame_len;
317     unsigned char frame[WIFI_EAPOL_MAX_FRAME_LEN];
318 } MLAN_PACK_END nxp_wifi_eapol_frame_t;
319 
320 typedef MLAN_PACK_START struct _nxp_wifi_event_eapol_mlme
321 {
322     nxp_wifi_eapol_frame_t frame;
323     unsigned char mac_addr[WIFI_ETH_ADDR_LEN];
324 } MLAN_PACK_END nxp_wifi_event_eapol_mlme_t;
325 
326 typedef MLAN_PACK_START struct _nxp_wifi_assoc_event_mlme
327 {
328     nxp_wifi_frame_t frame;
329     unsigned char mac_addr[WIFI_ETH_ADDR_LEN];
330     unsigned int req_ie_len;
331     unsigned char req_ie[WIFI_MAX_FRAME_LEN];
332 } MLAN_PACK_END nxp_wifi_assoc_event_mlme_t;
333 
334 typedef MLAN_PACK_START struct _nxp_wifi_gsta_info
335 {
336     unsigned char mac_addr[WIFI_ETH_ADDR_LEN];
337 } MLAN_PACK_END nxp_wifi_gsta_info_t;
338 
339 typedef MLAN_PACK_START struct _nxp_wifi_event_new_station
340 {
341     // struct wpa_signal_info for supplicant
342     unsigned char wme;
343     unsigned char is_sta_legacy;
344     unsigned char mac_addr[WIFI_ETH_ADDR_LEN];
345     unsigned int generation;
346     nxp_wifi_gsta_info_t sta_info;
347     nxp_wifi_ie_t assoc_req_ies;
348 } MLAN_PACK_END nxp_wifi_event_new_station_t;
349 
350 typedef MLAN_PACK_START struct _nxp_wifi_chan_definition
351 {
352     int width;
353     unsigned int center_frequency1;
354     unsigned int center_frequency2;
355 } MLAN_PACK_END nxp_wifi_chan_definition_t;
356 
357 #define IFACENAMSIZ 10U
358 
359 typedef MLAN_PACK_START struct _nxp_wifi_interface_info
360 {
361     // struct wpa_signal_info for supplicant
362     int nrf_wifi_iftype;
363     char ifacename[IFACENAMSIZ];
364     unsigned char nxp_wifi_eth_addr[WIFI_ETH_ADDR_LEN];
365     nxp_wifi_chan_definition_t chan_def;
366     nxp_wifi_ssid_t ssid;
367 } MLAN_PACK_END nxp_wifi_interface_info_t;
368 
369 typedef MLAN_PACK_START struct _nxp_wifi_auth_info
370 {
371     unsigned char auth_alg;
372     unsigned char auth_trans_num;
373     unsigned char status_code;
374     unsigned char bssid[WIFI_ETH_ADDR_LEN];
375     int channel;
376     nxp_wifi_ie_t auth_ie;
377 } MLAN_PACK_END nxp_wifi_auth_info_t;
378 
379 typedef MLAN_PACK_START struct _nxp_wifi_deauth_info
380 {
381     unsigned char bssid[WIFI_ETH_ADDR_LEN];
382     unsigned short reason_code;
383 } MLAN_PACK_END nxp_wifi_deauth_info_t;
384 
385 typedef MLAN_PACK_START struct _nxp_wifi_assoc_info
386 {
387     unsigned int center_frequency;
388     nxp_wifi_ssid_t ssid;
389     unsigned char bssid[WIFI_ETH_ADDR_LEN];
390     unsigned char prev_bssid[WIFI_ETH_ADDR_LEN];
391     int channel;
392     nxp_wifi_ie_t wpa_ie;
393     unsigned char use_mfp;
394     char control_port;
395     bool is_ft;
396 } MLAN_PACK_END nxp_wifi_assoc_info_t;
397 
398 #define WIFI_MAX_KEY_LEN 256U
399 
400 typedef MLAN_PACK_START struct _nxp_wifi_key_info
401 {
402     bool is_pairwise;
403     int key_idx;
404     unsigned char key[WIFI_MAX_KEY_LEN];
405     size_t key_len;
406     unsigned char bssid[WIFI_ETH_ADDR_LEN];
407 } MLAN_PACK_END nxp_wifi_key_info_t;
408 
409 typedef MLAN_PACK_START struct _nxp_wifi_port_info
410 {
411     int authorized;
412     unsigned char bssid[WIFI_ETH_ADDR_LEN];
413 } MLAN_PACK_END nxp_wifi_port_info_t;
414 
415 typedef MLAN_PACK_START struct _nxp_wifi_signal_info
416 {
417     int current_signal;
418     int avg_signal;
419     int avg_beacon_signal;
420     int current_noise;
421     int current_txrate;
422 } MLAN_PACK_END nxp_wifi_signal_info_t;
423 
424 #define WIFI_MAX_DATA_LEN 400U
425 
426 typedef MLAN_PACK_START struct _nxp_wifi_mgmt_tx_info
427 {
428     int channel;
429     unsigned int wait_time;
430     size_t data_len;
431     unsigned char data[WIFI_MAX_DATA_LEN];
432 } MLAN_PACK_END nxp_wifi_mgmt_tx_info_t;
433 
434 enum wifi_mode
435 {
436     MODE_IEEE80211B,
437     MODE_IEEE80211G,
438     MODE_IEEE80211A,
439     MODE_IEEE80211AD,
440     MODE_IEEE80211ANY,
441     NUM_MODES
442 };
443 
444 typedef MLAN_PACK_START struct _nxp_wifi_chan_info
445 {
446     enum wifi_mode mode;
447     int freq;
448     int channel;
449     int sec_channel_offset;
450     int bandwidth;
451     int ht_enabled;
452     int vht_enabled;
453     int he_enabled;
454     int center_freq1;
455     int center_freq2;
456 } MLAN_PACK_END nxp_wifi_chan_info_t;
457 
458 typedef MLAN_PACK_START struct _nxp_wifi_ap_info
459 {
460     int beacon_set;
461     unsigned char bssid[WIFI_ETH_ADDR_LEN];
462     nxp_wifi_ie_t head_ie;
463     nxp_wifi_ie_t tail_ie;
464     int dtim_period;
465     int beacon_int;
466     nxp_wifi_chan_info_t chan;
467     nxp_wifi_ie_t proberesp;
468     nxp_wifi_ssid_t ssid;
469     int hide_ssid;
470     unsigned int pairwise_ciphers;
471     unsigned int group_cipher;
472     unsigned int key_mgmt_suites;
473     unsigned int auth_algs;
474     unsigned int wpa_version;
475     int privacy;
476     nxp_wifi_ie_t beacon_ies;
477     nxp_wifi_ie_t proberesp_ies;
478     nxp_wifi_ie_t assocresp_ies;
479     int ht_opmode;
480     int ap_max_inactivity;
481     int reenable;
482     int twt_responder;
483     int sae_pwe;
484 } MLAN_PACK_END nxp_wifi_ap_info_t;
485 
486 /* HT Capabilities element */
487 typedef MLAN_PACK_START struct _ieee80211_ht_capab
488 {
489     unsigned short ht_capabilities_info;
490     unsigned char a_mpdu_params;
491     unsigned char supported_mcs_set[16];
492     unsigned short ht_extended_capabilities;
493     unsigned int tx_bf_capability_info;
494     unsigned char asel_capabilities;
495 } MLAN_PACK_END ieee80211_ht_capab_t;
496 
497 typedef MLAN_PACK_START struct _ieee80211_vht_capab
498 {
499     unsigned int vht_capabilities_info;
500     struct
501     {
502         unsigned short rx_map;
503         unsigned short rx_highest;
504         unsigned short tx_map;
505         unsigned short tx_highest;
506     } vht_supported_mcs_set;
507 } MLAN_PACK_END ieee80211_vht_capab_t;
508 
509 typedef MLAN_PACK_START struct _ieee80211_he_capab
510 {
511     unsigned char he_mac_capab_info[6];
512     unsigned char he_phy_capab_info[11];
513     unsigned char optional[37];
514 } MLAN_PACK_END ieee80211_he_capab_t;
515 
516 typedef MLAN_PACK_START struct _nxp_wifi_sta_info
517 {
518     unsigned char addr[WIFI_ETH_ADDR_LEN];
519     unsigned short aid;
520     unsigned short capability;
521     unsigned char supp_rates[30];
522     size_t supp_rates_len;
523     unsigned short listen_interval;
524     ieee80211_ht_capab_t ht_capab;
525     size_t ht_capab_len;
526     ieee80211_vht_capab_t vht_capab;
527     size_t vht_capab_len;
528     int vht_opmode_enabled;
529     unsigned char vht_opmode;
530     ieee80211_he_capab_t he_capab;
531     size_t he_capab_len;
532     unsigned int flags; /* bitmask of WPA_STA_* flags */
533     int set;            /* Set STA parameters instead of add */
534     unsigned char qosinfo;
535     unsigned char ext_capab[10];
536     size_t ext_capab_len;
537 } MLAN_PACK_END nxp_wifi_sta_info_t;
538 
539 enum chanWidth
540 {
541     CHAN_BAND_WIDTH_20_NOHT,
542     CHAN_BAND_WIDTH_20,
543     CHAN_BAND_WIDTH_40,
544     CHAN_BAND_WIDTH_80,
545     CHAN_BAND_WIDTH_80P80,
546     CHAN_BAND_WIDTH_160,
547 };
548 
549 typedef MLAN_PACK_START struct _nxp_wifi_ch_switch_info
550 {
551     int center_freq;
552     int ht_enabled;
553     int ch_offset;
554     enum chanWidth ch_width;
555     int center_freq1;
556     int center_freq2;
557 } MLAN_PACK_END nxp_wifi_ch_switch_info;
558 
559 typedef MLAN_PACK_START struct _nxp_wifi_dfs_cac_info
560 {
561     int center_freq;
562     int ht_enabled;
563     int ch_offset;
564     enum chanWidth ch_width;
565     int center_freq1;
566     int center_freq2;
567 } MLAN_PACK_END nxp_wifi_dfs_cac_info;
568 /**
569  * struct wifi_nxp_callbk_fns - Callback functions to be invoked by Wi-Fi driver
570  * when a paticular event occurs.
571  * @if_state_chg_callbk_fn: Callback function to be called when an interface
572  *                          state changes.
573  * @rx_frm_callbk_fn: Callback function to be called when a frame is received.
574  *
575  * This structure contains function pointers to all the callback functions that
576  * the Wi-Fi driver needs to invoked for various events.
577  */
578 typedef MLAN_PACK_START struct _wifi_nxp_callbk_fns
579 {
580     void (*mac_changed_callbk_fn)(void *if_priv);
581 
582     void (*chan_list_changed_callbk_fn)(void *if_priv, const char *alpha2);
583 
584     void (*scan_start_callbk_fn)(void *if_priv);
585 
586     void (*scan_done_callbk_fn)(void *if_priv, int aborted, int external_scan);
587 
588     void (*survey_res_callbk_fn)(void *if_priv,
589                                  nxp_wifi_event_new_survey_result_t *survey_res,
590                                  unsigned int event_len,
591                                  bool more_res);
592 
593     void (*auth_resp_callbk_fn)(void *if_priv, nxp_wifi_event_mlme_t *auth_resp_event, unsigned int event_len);
594 
595     void (*assoc_resp_callbk_fn)(void *if_priv, nxp_wifi_assoc_event_mlme_t *assoc_resp_event, unsigned int event_len);
596 
597     void (*deauth_callbk_fn)(void *if_priv, nxp_wifi_event_mlme_t *deauth_event, unsigned int event_len);
598 
599     void (*disassoc_callbk_fn)(void *if_priv, nxp_wifi_event_mlme_t *disassoc_event, unsigned int event_len);
600 
601     void (*acs_channel_sel_callbk_fn)(void *if_priv, nxp_wifi_acs_params *acs_params);
602 
603     void (*mgmt_rx_callbk_fn)(void *if_priv, nxp_wifi_event_mlme_t *mgmt_rx_event, unsigned int event_len, int rssi);
604     void (*get_wiphy_callbk_fn)(void *if_priv, struct wifi_nxp_event_get_wiphy *wiphy_info, unsigned int event_len);
605     void (*eapol_rx_callbk_fn)(void *if_priv, nxp_wifi_event_eapol_mlme_t *mgmt_rx_event, unsigned int event_len);
606     void (*unprot_mlme_mgmt_rx_callbk_fn)(void *if_priv,
607                                           nxp_wifi_event_mlme_t *unprot_mlme_event,
608                                           unsigned int event_len);
609 
610     void (*mgmt_tx_status_callbk_fn)(void *if_priv, nxp_wifi_event_mlme_t *mlme_event, unsigned int event_len);
611     void (*remain_on_channel_callbk_fn)(void *if_priv, int cancel_channel);
612     void (*ecsa_complete_callbk_fn)(void *if_priv, nxp_wifi_ch_switch_info *ch_switch_info);
613     void (*dfs_cac_started_callbk_fn)(void *if_priv, nxp_wifi_dfs_cac_info *ch_switch_info);
614     void (*dfs_cac_finished_callbk_fn)(void *if_priv, nxp_wifi_dfs_cac_info *ch_switch_info);
615     int (*is_supp_scan_in_progress_callbk_fn)(void *if_priv);
616     void (*signal_change_callbk_fn)(void *if_priv, t_s16 *rssi);
617 } MLAN_PACK_END wifi_nxp_callbk_fns_t;
618 
619 typedef struct _chan_to_freq_t
620 {
621     /** Channel */
622     t_u16 channel;
623     /** Frequency */
624     t_u32 freq;
625     /** Band */
626     t_u8 band;
627 } chan_to_freq_t;
628 static const chan_to_freq_t chan_to_freq[] = {
629     {1, 2412, 0},   {2, 2417, 0},   {3, 2422, 0},   {4, 2427, 0},   {5, 2432, 0},   {6, 2437, 0},   {7, 2442, 0},
630     {8, 2447, 0},   {9, 2452, 0},   {10, 2457, 0},  {11, 2462, 0},  {12, 2467, 0},  {13, 2472, 0},  {14, 2484, 0},
631     {183, 4915, 1}, {184, 4920, 1}, {185, 4925, 1}, {187, 4935, 1}, {188, 4940, 1}, {189, 4945, 1}, {192, 4960, 1},
632     {196, 4980, 1}, {7, 5035, 1},   {8, 5040, 1},   {9, 5045, 1},   {11, 5055, 1},  {12, 5060, 1},  {16, 5080, 1},
633     {34, 5170, 1},  {36, 5180, 1},  {38, 5190, 1},  {40, 5200, 1},  {42, 5210, 1},  {44, 5220, 1},  {46, 5230, 1},
634     {48, 5240, 1},  {52, 5260, 1},  {56, 5280, 1},  {60, 5300, 1},  {64, 5320, 1},  {100, 5500, 1}, {104, 5520, 1},
635     {108, 5540, 1}, {112, 5560, 1}, {116, 5580, 1}, {120, 5600, 1}, {124, 5620, 1}, {128, 5640, 1}, {132, 5660, 1},
636     {136, 5680, 1}, {140, 5700, 1}, {144, 5720, 1}, {149, 5745, 1}, {153, 5765, 1}, {157, 5785, 1}, {161, 5805, 1},
637 #if CONFIG_UNII4_BAND_SUPPORT
638     {165, 5825, 1}, {169, 5845, 1}, {173, 5865, 1}, {177, 5885, 1},
639 #else
640     {165, 5825, 1},
641 #endif
642 };
643 /** Convertion from/to frequency/channel */
644 /**
645  *  @brief Get frequency for channel in given band
646  *
647  *  @param channel      channel
648  *  @param band         band
649  *
650  *  @return             freq
651  */
channel_to_frequency(t_u16 channel,t_u8 band)652 static inline int channel_to_frequency(t_u16 channel, t_u8 band)
653 {
654     int i = 0;
655     for (i = 0; i < (int)ARRAY_SIZE(chan_to_freq); i++)
656     {
657         if (channel == chan_to_freq[i].channel && band == chan_to_freq[i].band)
658         {
659             return chan_to_freq[i].freq;
660         }
661     }
662     return 0;
663 }
664 
freq_to_chan(unsigned int freq)665 static inline t_u16 freq_to_chan(unsigned int freq)
666 {
667     int i = 0;
668     for (i = 0; i < (int)ARRAY_SIZE(chan_to_freq); i++)
669     {
670         if (freq == chan_to_freq[i].freq)
671         {
672             return chan_to_freq[i].channel;
673         }
674     }
675     return 0;
676 }
677 
678 #endif
679 
680 #endif /* __WIFI_NXP_INTERNAL_H__ */
681