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
/******************************************************************************
 *
 * 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_NOTIFY_C_
#include "hal_headers.h"
 
 
void rtw_hal_notification_ex(void *hal, enum phl_msg_evt_id event,
                bool to_bb, bool to_mac, bool to_rf, u8 hw_idx)
{
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
   u8 idx = 0;
 
   PHL_TRACE(COMP_PHL_DBG, _PHL_INFO_, "%s: event(%d), hw_idx(%d), mac(%d), bb(%d), rf(%d)\n",
             __func__, event, hw_idx,
             to_mac ? 1 : 0, to_bb ? 1 : 0, to_rf ? 1 : 0);
 
   if (!hal_info->hal_com->is_hal_init) {
       PHL_TRACE(COMP_PHL_DBG, _PHL_INFO_, "%s:hal is not started!\n",
               __func__);
       return;
   }
 
   if (hw_idx == HW_BAND_MAX) {
       for (idx = 0; idx < hw_idx; idx++) {
           if (true == to_bb)
               rtw_hal_bb_notification(hal_info, event, idx);
 
           if (true == to_mac)
               rtw_hal_mac_notification(hal_info, event, idx);
 
           if (true == to_rf)
               rtw_hal_rf_notification(hal_info, event, idx);
       }
   } else {
       if (true == to_bb)
           rtw_hal_bb_notification(hal_info, event, hw_idx);
 
       if (true == to_mac)
           rtw_hal_mac_notification(hal_info, event, hw_idx);
 
       if (true == to_rf)
           rtw_hal_rf_notification(hal_info, event, idx);
   }
}
 
void rtw_hal_notification(void *hal, enum phl_msg_evt_id event, u8 hw_idx)
{
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
   u8 idx = 0;
 
   PHL_TRACE(COMP_PHL_DBG, _PHL_INFO_, "%s: event(%d), hw_idx(%d)\n",
             __func__, event, hw_idx);
   if (!hal_info->hal_com->is_hal_init) {
       PHL_TRACE(COMP_PHL_DBG, _PHL_INFO_, "%s:hal is not started!\n",
               __func__);
       return;
   }
 
   if (hw_idx == HW_BAND_MAX) {
       for (idx = 0; idx < hw_idx; idx++) {
           rtw_hal_bb_notification(hal_info, event, idx);
           rtw_hal_mac_notification(hal_info, event, idx);
           rtw_hal_rf_notification(hal_info, event, idx);
       }
   } else {
       rtw_hal_bb_notification(hal_info, event, hw_idx);
       rtw_hal_mac_notification(hal_info, event, hw_idx);
       rtw_hal_rf_notification(hal_info, event, idx);
   }
}
 
 
void rtw_hal_cmd_notification(void *hal,
                               enum phl_msg_evt_id event,
                               void *hal_cmd,
                               u8 hw_idx)
{
   struct hal_info_t *hal_info = (struct hal_info_t *)hal;
 
   if (event == MSG_EVT_NOTIFY_BB)
       rtw_hal_bb_cmd_notification(hal_info, hal_cmd, hw_idx);
   else if (event == MSG_EVT_NOTIFY_RF)
       rtw_hal_rf_cmd_notification(hal_info, hal_cmd, hw_idx);
   else if (event == MSG_EVT_NOTIFY_MAC)
       rtw_hal_mac_cmd_notification(hal_info, hal_cmd, hw_idx);
   else
       PHL_ERR("%s unexpect eve id = 0x%x\n", __func__, event);
 
}
 
enum rtw_phl_status
rtw_hal_cmd_notify(struct rtw_phl_com_t *phl_com,
                   enum phl_msg_evt_id event,
                   void *hal_cmd,
                   u8 hw_idx)
{
#ifdef CONFIG_CMD_DISP
   return rtw_phl_cmd_notify(phl_com, event, hal_cmd, hw_idx);
#else
   PHL_TRACE(COMP_PHL_DBG, _PHL_INFO_, "%s: not support cmd notify\n",
             __func__);
 
   return RTW_PHL_STATUS_FAILURE;
#endif /* CONFIG_CMD_DISP */
}