hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
/******************************************************************************
 *
 * Copyright(c) 2019 Realtek Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 *****************************************************************************/
#define _HAL_API_C_
#include "hal_headers.h"
 
enum rtw_hal_status rtw_hal_get_tsf(void *hal, enum phl_band_idx band,
                   u8 port, u32 *tsf_h, u32 *tsf_l)
{
   return rtw_hal_mac_get_tsf(hal, band, port, tsf_h, tsf_l);
}
 
enum rtw_hal_status
rtw_hal_tsf_sync(void *hal, u8 port_sync_from,
                   u8 port_sync_to, enum phl_band_idx band,
                   s32 sync_offset_tu, enum hal_tsf_sync_act act)
{
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
 
   return rtw_hal_mac_tsf_sync(hal_info, port_sync_from,
                       port_sync_to, band, sync_offset_tu, act);
}
 
enum rtw_hal_status
rtw_hal_config_rts_th(void *hal, u8 band_idx, u16 rts_time_th, u16 rts_len_th)
{
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
 
   return rtw_hal_mac_set_hw_rts_th(hal_info, band_idx, rts_time_th, rts_len_th);
}
 
u32 rtw_hal_get_btc_req_slot(void *hal, enum phl_band_idx hw_band)
{
   return rtw_hal_btc_req_bt_slot_t(hal, hw_band);
}
 
/**
 * This function is used to pause/unpause multiple macid
 * @hal: see hal_info_t
 * @macid_arr: macid array to be pause/unpause
 * 1 means to be set (pause/unpause)
 * 0 means don't care
 * @macid_arr_sz: size of macid array
 * @pause: all macid of this array to be paused/unpaused
 *  1=paused,0=unpaused
 */
enum rtw_hal_status
rtw_hal_set_macid_grp_pause(void *hal, u32 *macid_arr, u8 arr_size, bool pause)
{
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
   struct rtw_hal_com_t *hal_com = hal_info->hal_com;
 
   return rtw_hal_mac_set_macid_grp_pause(hal_com, macid_arr, arr_size, pause);
}
 
/**
 * This function is used to pause/unpause single macid
 * @hal: see hal_info_t
 * @macid: macid be pause/unpause
 * @pause: all macid of this array to be paused/unpaused
 *  1=paused,0=unpaused
 */
enum rtw_hal_status
rtw_hal_set_macid_pause(void *hal, u16 macid, bool pause)
{
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
   struct rtw_hal_com_t *hal_com = hal_info->hal_com;
 
   return rtw_hal_mac_set_macid_pause(hal_com, macid, pause);
}
 
/**
 * This function is used to pause/unpause AC queue of a single macid
 * @hal: see hal_info_t
 * @macid: macid be pause/unpause
 * @pause: paused/unpaused (1=paused,0=unpaused)
 */
enum rtw_hal_status rtw_hal_set_macid_pause_ac(void *hal, u16 macid, bool pause)
{
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
   struct rtw_hal_com_t *hal_com = hal_info->hal_com;
 
   return rtw_hal_mac_set_macid_pause_sleep(hal_com, macid, pause, false);
}
 
enum rtw_hal_status
rtw_hal_set_macid_pkt_drop(void *hal, u16 macid, u8 sel, u8 band, u8 port,
                           u8 mbssid)
{
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
   struct rtw_hal_com_t *hal_com = hal_info->hal_com;
 
   return rtw_hal_mac_set_macid_pkt_drop(hal_com, macid, sel, band, port,
                                         mbssid);
}
 
enum rtw_hal_status rtw_hal_set_dfs_tb_ctrl(void *hal, u8 set)
{
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
 
   return rtw_hal_mac_set_dfs_tb_ctrl(hal_info, set);
}
 
u32 rtw_hal_get_phy_stat_info(void *hal, enum phl_band_idx hw_band,
                 enum phl_stat_info_query phy_stat)
{
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
   struct rtw_hal_com_t *hal_com = hal_info->hal_com;
   struct rtw_hal_stat_info *stat_info = &hal_com->band[hw_band].stat_info;
 
   switch (phy_stat) {
   case STAT_INFO_FA_ALL:
       return stat_info->cnt_fail_all;
   case STAT_INFO_CCA_ALL:
       return stat_info->cnt_cca_all;
   default:
       return 0;
   }
}
 
enum rtw_hal_status rtw_hal_get_rx_cnt_by_idx(void *hal,
                         enum phl_band_idx hw_band,
                         enum phl_rxcnt_idx idx,
                         u16 *rx_cnt)
{
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
 
   return rtw_hal_mac_get_rx_cnt_by_idx(hal_info, hw_band, idx, rx_cnt);
}
 
enum rtw_hal_status rtw_hal_set_reset_rx_cnt(void *hal,
                        enum phl_band_idx hw_band)
{
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
 
   return rtw_hal_mac_set_reset_rx_cnt(hal_info, hw_band);
}
 
enum rtw_hal_status
rtw_hal_set_dctrl_tbl_seq(void *hal,
       struct rtw_phl_stainfo_t *sta, u32 seq)
{
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
   enum rtw_hal_status sts = RTW_HAL_STATUS_FAILURE;
   struct mac_ax_dctl_info dctrl = {0}, dctrl_mask = {0};
 
   if (NULL == sta)
       goto out;
 
   dctrl.seq0 = seq;
   dctrl.seq1 = seq;
   dctrl.seq2 = seq;
   dctrl.seq3 = seq;
 
   dctrl_mask.seq0 = 0x0FFF;
   dctrl_mask.seq1 = 0x0FFF;
   dctrl_mask.seq2 = 0x0FFF;
   dctrl_mask.seq3 = 0x0FFF;
 
   sts = rtw_hal_dmc_tbl_cfg(hal_info, &dctrl ,&dctrl_mask, sta->macid);
 
out:
   return sts;
}
 
#ifdef CONFIG_PHL_DRV_HAS_NVM
enum rtw_hal_status
rtw_hal_extract_efuse_info(void *hal, u8 *efuse_map,
                           enum rtw_efuse_info info_type,
                           void *value,
                           u8 size, u8 map_valid)
{
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
   enum rtw_phl_status hal_status = RTW_HAL_STATUS_FAILURE;
 
   if (info_type <= EFUSE_INFO_MAC_MAX)
       hal_status = rtw_hal_mac_get_efuse_info(hal_info->hal_com,
                           efuse_map,
                           info_type,
                           value,
                           size,
                           1);
   else if (info_type <= EFUSE_INFO_BB_MAX)
       hal_status = rtw_hal_bb_get_efuse_info(hal_info->hal_com,
                                              efuse_map,
                                              info_type,
                                              value,
                                              size,
                                              1);
   else if (info_type <= EFUSE_INFO_RF_MAX)
       hal_status = rtw_hal_rf_get_efuse_info(hal_info->hal_com,
                                              efuse_map,
                                              info_type,
                                              value,
                                              size,
                                              1);
   else if (info_type <= EFUSE_INFO_BTCOEX_MAX)
       hal_status = rtw_hal_btc_get_efuse_info(hal_info->hal_com,
                           efuse_map,
                           info_type,
                           value,
                           size,
                           1);
   return hal_status;
}
 
enum rtw_hal_status
rtw_hal_get_efuse_size(void *hal, u32 *log_efuse_size, u32 *limit_efuse_size,
                       u32 *mask_size, u32 *limit_mask_size)
{
   enum rtw_hal_status hal_status = RTW_HAL_STATUS_SUCCESS;
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
 
   if (log_efuse_size)
       hal_status = rtw_hal_mac_get_log_efuse_size(hal_info->hal_com,
                                                   log_efuse_size,
                                                   false);
   if (limit_efuse_size && (hal_status == RTW_HAL_STATUS_SUCCESS))
       hal_status = rtw_hal_mac_get_log_efuse_size(hal_info->hal_com,
                                                   limit_efuse_size,
                                                   true);
   if (mask_size && (hal_status == RTW_HAL_STATUS_SUCCESS))
       hal_status = rtw_hal_mac_get_efuse_mask_size(hal_info->hal_com,
                                                    mask_size,
                                                    false);
   if (limit_mask_size  && (hal_status == RTW_HAL_STATUS_SUCCESS))
       hal_status = rtw_hal_mac_get_efuse_mask_size(hal_info->hal_com,
                                                    limit_mask_size,
                                                    true);
   return hal_status;
}
 
enum rtw_hal_status
rtw_hal_nvm_apply_dev_cap(void *hal, struct rtw_phl_com_t *phl_com)
{
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
   struct rtw_hal_com_t *hal_com = hal_info->hal_com;
   enum rtw_hal_status hal_sts;
 
   hal_com->dev_hw_cap.pkg_type = phl_com->dev_sw_cap.pkg_type;
   hal_com->dev_hw_cap.rfe_type = phl_com->dev_sw_cap.rfe_type;
   hal_com->dev_hw_cap.xcap = phl_com->dev_sw_cap.xcap;
   hal_com->dev_hw_cap.domain = phl_com->dev_sw_cap.domain;
 
   hal_sts = rtw_hal_mac_set_xcap(hal_com, 0, hal_com->dev_hw_cap.xcap);
 
   if (hal_sts != RTW_HAL_STATUS_SUCCESS)
       return RTW_HAL_STATUS_FAILURE;
 
   hal_sts = rtw_hal_mac_set_xcap(hal_com, 1, hal_com->dev_hw_cap.xcap);
 
   #ifdef CONFIG_RTW_MULTI_DEV_MULTI_BAND
   if (hal_sts == RTW_HAL_STATUS_SUCCESS) {
       struct hal_ops_t *hal_ops = hal_get_ops(hal_info);
 
       if (hal_ops->cfg_share_xstal != NULL) {
           #ifdef CONFIG_SHARE_XSTAL
           hal_sts = hal_ops->cfg_share_xstal(hal_info, phl_com,
                               true);
           #else
           hal_sts = hal_ops->cfg_share_xstal(hal_info, phl_com,
                               false);
           #endif /* CONFIG_SHARE_XSTAL */
       }
   }
   #endif /* CONFIG_RTW_MULTI_DEV_MULTI_BAND */
 
   return hal_sts;
}
 
enum rtw_hal_status
rtw_hal_flash_get_info(struct rtw_hal_com_t *hal_com,
              enum rtw_efuse_info info_type,
              void *value,
              u8 size)
{
   u32 ret = _os_nvm_get_info(hal_com->drv_priv, info_type, value, size);
 
   return (ret == _SUCCESS) ? RTW_HAL_STATUS_SUCCESS : RTW_HAL_STATUS_FAILURE;
}
 
#endif /* CONFIG_PHL_DRV_HAS_NVM */
 
enum rtw_hal_status
rtw_hal_set_fw_ul_fixinfo(void *hal,
             struct rtw_phl_ax_ul_fixinfo *ul_fixinfo)
{
   enum rtw_hal_status hstatus = RTW_HAL_STATUS_FAILURE;
 
   hstatus = rtw_hal_mac_set_fw_ul_fixinfo(hal, ul_fixinfo);
 
   return hstatus;
}
 
u16 rtw_hal_get_ampdu_num(void *hal, u8 band)
{
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
 
   return rtw_hal_mac_query_ampdu_num(hal_info, band);
}
 
enum rtw_chip_id rtw_hal_get_chip_id(void *hal)
{
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
 
   return hal_get_chip_id(hal_info->hal_com);
}
 
enum rtw_hal_status rtw_hal_set_append_fcs(void *hal, u8 enable)
{
   return rtw_hal_mac_set_append_fcs((struct hal_info_t *)hal, enable);
}
 
enum rtw_hal_status
rtw_hal_pwr_switch_mac(void *hal, bool on)
{
   enum rtw_hal_status hstatus = RTW_HAL_STATUS_FAILURE;
   hstatus = rtw_hal_mac_pwr_switch(hal, on);
   return hstatus;
}
 
enum rtw_hal_status rtw_hal_get_freerun_counter(void *hal, u8 band, u32 *freerun_h, u32 *freerun_l)
{
   enum rtw_hal_status status = RTW_HAL_STATUS_FAILURE;
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
 
   status = rtw_hal_mac_get_freerun_cnt(hal_info->hal_com, band, freerun_h, freerun_l);
 
   if (status != RTW_HAL_STATUS_SUCCESS) {
       PHL_TRACE(COMP_PHL_MCC, _PHL_ERR_, "rtw_hal_get_freerun_counter(): get failed\n");
   }
 
   return status;
}
 
enum rtw_hal_status rtw_hal_reset_freerun_counter(void *hal, u8 band)
{
   enum rtw_hal_status status = RTW_HAL_STATUS_FAILURE;
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
 
   status = rtw_hal_mac_reset_freerun_cnt(hal_info->hal_com, band);
 
   if (status != RTW_HAL_STATUS_SUCCESS) {
       PHL_TRACE(COMP_PHL_MCC, _PHL_ERR_, "rtw_hal_reset_freerun_counter(): get failed\n");
   }
 
   return status;
}
 
u8 rtw_hal_query_group_cntry_num(void *hal, struct rtw_regu_policy *policy,
   u8 group_id)
{
   struct hal_info_t *hal_info = NULL;
   struct hal_ops_t *hal_ops = NULL;
   struct hal_regu_ops *regu_ops = NULL;
 
   if (!hal || !policy)
       return 0;
 
   hal_info = (struct hal_info_t *)hal;
   hal_ops = hal_get_ops(hal_info);
   if (!hal_ops)
       return 0;
 
   regu_ops = hal_get_regu_ops(hal_ops);
   if (regu_ops && regu_ops->hal_query_group_cntry_num)
       return regu_ops->hal_query_group_cntry_num(policy, group_id);
 
   return 0;
}
 
void rtw_hal_fill_group_cntry_list(void *hal,
   struct rtw_regu_policy *policy, char *list,
   u32 group_size, u8 group_id)
{
   struct hal_info_t *hal_info = NULL;
   struct hal_ops_t *hal_ops = NULL;
   struct hal_regu_ops *regu_ops = NULL;
 
   if (!hal || !policy)
       return;
 
   hal_info = (struct hal_info_t *)hal;
   hal_ops = hal_get_ops(hal_info);
   if (!hal_ops)
       return;
 
   regu_ops = hal_get_regu_ops(hal_ops);
   if (regu_ops && regu_ops->hal_fill_group_cntry_list)
       regu_ops->hal_fill_group_cntry_list(policy, list,
       group_size, group_id);
}
 
u8 rtw_hal_get_cntry_idx(void *hal, char *cntry)
{
   struct hal_info_t *hal_info = NULL;
   struct hal_ops_t *hal_ops = NULL;
   struct hal_regu_ops *regu_ops = NULL;
 
   if (!hal)
       return INVALID_CNTRY_IDX;
 
   hal_info = (struct hal_info_t *)hal;
   hal_ops = hal_get_ops(hal_info);
   if (!hal_ops)
       return INVALID_CNTRY_IDX;
 
   regu_ops = hal_get_regu_ops(hal_ops);
   if (regu_ops && regu_ops->hal_get_cntry_idx)
       return regu_ops->hal_get_cntry_idx(cntry);
 
   return INVALID_CNTRY_IDX;
}
 
u8 rtw_hal_get_cntry_tbl_size(void *hal)
{
   struct hal_info_t *hal_info = NULL;
   struct hal_ops_t *hal_ops = NULL;
   struct hal_regu_ops *regu_ops = NULL;
 
   if (!hal)
       return 0;
 
   hal_info = (struct hal_info_t *)hal;
   hal_ops = hal_get_ops(hal_info);
   if (!hal_ops)
       return 0;
 
   regu_ops = hal_get_regu_ops(hal_ops);
   if (regu_ops && regu_ops->hal_get_cntry_tbl_size)
       return regu_ops->hal_get_cntry_tbl_size();
 
   return 0;
}
 
void rtw_hal_qry_cntry_chnlplan(
   void *hal, struct rtw_regulation_country_chplan *chplan,
   char *country)
{
   struct hal_info_t *hal_info = NULL;
   struct hal_ops_t *hal_ops = NULL;
   struct hal_regu_ops *regu_ops = NULL;
 
   if (!hal)
       return;
 
   hal_info = (struct hal_info_t *)hal;
   hal_ops = hal_get_ops(hal_info);
   if (!hal_ops)
       return;
 
   regu_ops = hal_get_regu_ops(hal_ops);
   if (regu_ops && regu_ops->hal_qry_cntry_chnlplan)
       regu_ops->hal_qry_cntry_chnlplan(chplan, country);
}
 
void rtw_hal_get_chplan_update_info(
   void *hal, u8 group, u8 did,
   void *info, enum band_type band)
{
   struct hal_info_t *hal_info = NULL;
   struct hal_ops_t *hal_ops = NULL;
   struct hal_regu_ops *regu_ops = NULL;
 
   if (!hal)
       return;
 
   hal_info = (struct hal_info_t *)hal;
   hal_ops = hal_get_ops(hal_info);
   if (!hal_ops)
       return;
 
   regu_ops = hal_get_regu_ops(hal_ops);
   if (regu_ops && regu_ops->hal_get_chplan_update_info)
       regu_ops->hal_get_chplan_update_info(group, did, info, band);
}
 
u8 rtw_hal_get_chnlplan_ver(void *hal)
{
   struct hal_info_t *hal_info = NULL;
   struct hal_ops_t *hal_ops = NULL;
   struct hal_regu_ops *regu_ops = NULL;
 
   if (!hal)
       return INVALID_VER;
 
   hal_info = (struct hal_info_t *)hal;
   hal_ops = hal_get_ops(hal_info);
   if (!hal_ops)
       return INVALID_VER;
 
   regu_ops = hal_get_regu_ops(hal_ops);
   if (regu_ops && regu_ops->hal_get_chnlplan_ver)
       return regu_ops->hal_get_chnlplan_ver();
 
   return INVALID_VER;
}
 
u8 rtw_hal_get_country_ver(void *hal)
{
   struct hal_info_t *hal_info = NULL;
   struct hal_ops_t *hal_ops = NULL;
   struct hal_regu_ops *regu_ops = NULL;
 
   if (!hal)
       return INVALID_VER;
 
   hal_info = (struct hal_info_t *)hal;
   hal_ops = hal_get_ops(hal_info);
   if (!hal_ops)
       return INVALID_VER;
 
   regu_ops = hal_get_regu_ops(hal_ops);
   if (regu_ops && regu_ops->hal_get_country_ver)
       return regu_ops->hal_get_country_ver();
 
   return INVALID_VER;
}
 
void rtw_hal_get_chdef_6g(void * hal, u8 ch_idx,
   struct chdef_6ghz *chdef)
{
   struct hal_info_t *hal_info = NULL;
   struct hal_ops_t *hal_ops = NULL;
   struct hal_regu_ops *regu_ops = NULL;
 
   if (!hal)
       return;
 
   hal_info = (struct hal_info_t *)hal;
   hal_ops = hal_get_ops(hal_info);
   if (!hal_ops)
       return;
 
   regu_ops = hal_get_regu_ops(hal_ops);
   if (regu_ops && regu_ops->hal_get_chdef_6g)
       regu_ops->hal_get_chdef_6g(ch_idx, chdef);
}
 
u8 rtw_hal_get_domain_regulation(void *hal,
   u8 domain, u8 band)
{
   struct hal_info_t *hal_info = NULL;
   struct hal_ops_t *hal_ops = NULL;
   struct hal_regu_ops *regu_ops = NULL;
 
   if (!hal)
       return REGULATION_MAX;
 
   hal_info = (struct hal_info_t *)hal;
   hal_ops = hal_get_ops(hal_info);
   if (!hal_ops)
       return REGULATION_MAX;
 
   regu_ops = hal_get_regu_ops(hal_ops);
   if (regu_ops && regu_ops->hal_get_domain_regulation)
       return regu_ops->hal_get_domain_regulation(domain, band);
 
   return REGULATION_MAX;
}
 
u8 rtw_hal_get_domain_idx(void *hal,
   u8 domain, bool is_6g)
{
   struct hal_info_t *hal_info = NULL;
   struct hal_ops_t *hal_ops = NULL;
   struct hal_regu_ops *regu_ops = NULL;
 
   if (!hal)
       return INVALID_DOMAIN_INDEX;
 
   hal_info = (struct hal_info_t *)hal;
   hal_ops = hal_get_ops(hal_info);
   if (!hal_ops)
       return INVALID_DOMAIN_INDEX;
 
   regu_ops = hal_get_regu_ops(hal_ops);
   if (regu_ops && regu_ops->hal_get_domain_idx)
       return regu_ops->hal_get_domain_idx(domain, is_6g);
 
   return INVALID_DOMAIN_INDEX;
}
 
u8 rtw_hal_get_cat6g_by_country(
   void *hal, char * country)
{
   struct hal_info_t *hal_info = NULL;
   struct hal_ops_t *hal_ops = NULL;
   struct hal_regu_ops *regu_ops = NULL;
 
   if (!hal)
       return 0;
 
   hal_info = (struct hal_info_t *)hal;
   hal_ops = hal_get_ops(hal_info);
   if (!hal_ops)
       return 0;
 
   regu_ops = hal_get_regu_ops(hal_ops);
   if (regu_ops && regu_ops->hal_get_cat6g_by_country)
       return regu_ops->hal_get_cat6g_by_country(country);
 
   return 0;
}
 
void rtw_hal_get_6g_regulatory_info(void *hal, u8 domain,
   u8 *dm_code, u8 *regulation, u8 *ch_idx)
{
   struct hal_info_t *hal_info = NULL;
   struct hal_ops_t *hal_ops = NULL;
   struct hal_regu_ops *regu_ops = NULL;
 
   if (!hal)
       return;
 
   hal_info = (struct hal_info_t *)hal;
   hal_ops = hal_get_ops(hal_info);
   if (!hal_ops)
       return;
 
   regu_ops = hal_get_regu_ops(hal_ops);
   if (regu_ops && regu_ops->hal_get_6g_regulatory_info)
       regu_ops->hal_get_6g_regulatory_info(domain,
           dm_code, regulation, ch_idx);
}
 
enum rtw_hal_status
rtw_hal_set_bcn_early_rpt(void *hal, u8 band, u8 port, u8 en)
{
   enum rtw_hal_status hstatus = RTW_HAL_STATUS_FAILURE;
 
   hstatus = rtw_hal_mac_cfg_bcn_early_rpt(hal, band, port, en);
 
   return hstatus;
}
 
#ifdef CONFIG_PHL_CSUM_OFFLOAD_RX
enum rtw_hal_status rtw_hal_chk_rx_tcpip_chksum_ofd(void *h,
                           struct rtw_r_meta_data *mdata,
                                                    u8 status)
{
   struct hal_info_t *hal = (struct hal_info_t *)h;
 
   return rtw_hal_mac_chk_rx_tcpip_chksum_ofd(hal, mdata, status);
}
#endif /* CONFIG_PHL_CSUM_OFFLOAD_RX */