1 /****************************************************************************** 2 * 3 * Copyright(c) 2019 Realtek Corporation. 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms of version 2 of the GNU General Public License as 7 * published by the Free Software Foundation. 8 * 9 * This program is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 * more details. 13 * 14 *****************************************************************************/ 15 #ifndef _PHL_API_H_ 16 #define _PHL_API_H_ 17 18 u8 rtw_phl_read8(void *phl, u32 addr); 19 u16 rtw_phl_read16(void *phl, u32 addr); 20 u32 rtw_phl_read32(void *phl, u32 addr); 21 void rtw_phl_write8(void *phl, u32 addr, u8 val); 22 void rtw_phl_write16(void *phl, u32 addr, u16 val); 23 void rtw_phl_write32(void *phl, u32 addr, u32 val); 24 25 u32 rtw_phl_read_macreg(void *phl, u32 offset, u32 bit_mask); 26 void rtw_phl_write_macreg(void *phl, 27 u32 offset, u32 bit_mask, u32 data); 28 u32 rtw_phl_read_bbreg(void *phl, u32 offset, u32 bit_mask); 29 void rtw_phl_write_bbreg(void *phl, 30 u32 offset, u32 bit_mask, u32 data); 31 u32 rtw_phl_read_rfreg(void *phl, 32 enum rf_path path, u32 offset, u32 bit_mask); 33 void rtw_phl_write_rfreg(void *phl, 34 enum rf_path path, u32 offset, u32 bit_mask, u32 data); 35 enum rtw_phl_status rtw_phl_interrupt_handler(void *phl); 36 void rtw_phl_enable_interrupt(void *phl); 37 void rtw_phl_disable_interrupt(void *phl); 38 bool rtw_phl_recognize_interrupt(void *phl); 39 void rtw_phl_clear_interrupt(void *phl); 40 void rtw_phl_restore_interrupt(void *phl); 41 42 43 #ifdef PHL_PLATFORM_LINUX 44 void rtw_phl_mac_reg_dump(void *sel, void *phl); 45 void rtw_phl_bb_reg_dump(void *sel, void *phl); 46 void rtw_phl_bb_reg_dump_ex(void *sel, void *phl); 47 void rtw_phl_rf_reg_dump(void *sel, void *phl); 48 #endif 49 bool rtw_phl_get_sec_cam(void *phl, u16 num, u8 *buf, u16 size); 50 bool rtw_phl_get_addr_cam(void *phl, u16 num, u8 *buf, u16 size); 51 52 struct rtw_phl_com_t *rtw_phl_get_com(void *phl); 53 enum rtw_phl_status rtw_phl_init(void *drv_priv, void **phl, 54 struct rtw_ic_info *ic_info); 55 void rtw_phl_deinit(void *phl); 56 57 void rtw_phl_watchdog_init(void *phl, 58 u16 period, 59 void (*core_sw_wdog)(void *drv_priv), 60 void (*core_hw_wdog)(void *drv_priv)); 61 void rtw_phl_watchdog_deinit(void *phl); 62 void rtw_phl_watchdog_start(void *phl); 63 void rtw_phl_watchdog_stop(void *phl); 64 65 enum rtw_phl_status rtw_phl_trx_alloc(void *phl); 66 void rtw_phl_trx_free(void *phl); 67 void rtw_phl_trx_free_handler(void *phl); 68 void rtw_phl_trx_free_sw_rsc(void *phl); 69 void rtw_phl_cap_pre_config(void *phl); 70 enum rtw_phl_status rtw_phl_preload(void *phl); 71 enum rtw_phl_status rtw_phl_start(void *phl); 72 void rtw_phl_stop(void *phl); 73 bool rtw_phl_is_init_completed(void *phl); 74 75 void rtw_phl_ps_set_rt_cap(void *phl, u8 band_idx, bool ps_allow, enum phl_ps_rt_rson rt_rson); 76 enum rtw_phl_status rtw_phl_ps_set_rf_state(void *phl, u8 band_idx, enum rtw_rf_state rf_state); 77 78 enum rtw_phl_status rtw_phl_suspend(void *phl, struct rtw_phl_stainfo_t *sta, u8 wow_en); 79 enum rtw_phl_status rtw_phl_resume(void *phl, struct rtw_phl_stainfo_t *sta, u8 *hw_reinit); 80 81 enum rtw_phl_status rtw_phl_tx_req_notify(void *phl); 82 enum rtw_phl_status rtw_phl_add_tx_req(void *phl, struct rtw_xmit_req *tx_req); 83 void rtw_phl_tx_stop(void *phl); 84 void rtw_phl_tx_resume(void *phl); 85 u16 rtw_phl_tring_rsc(void *phl, u16 macid, u8 tid); 86 u16 rtw_phl_query_new_rx_num(void *phl); 87 struct rtw_recv_pkt *rtw_phl_query_rx_pkt(void *phl); 88 89 void rtw_phl_rx_deferred_In_token(void *phl); 90 void rtw_phl_post_in_complete(void *phl, void *rxobj, u32 inbuf_len, u8 status_code); 91 enum rtw_phl_status rtw_phl_return_rxbuf(void *phl, u8* rxpkt); 92 93 enum rtw_phl_status rtw_phl_recycle_tx_buf(void *phl, u8 *tx_buf_ptr); 94 95 enum rtw_phl_status 96 rtw_phl_cmd_cfg_ampdu(void *phl, 97 struct rtw_wifi_role_t *wrole, 98 struct rtw_phl_stainfo_t *sta, 99 enum phl_cmd_type cmd_type, 100 u32 cmd_timeout); 101 102 void rtw_phl_proc_cmd(void *phl, char proc_cmd, 103 struct rtw_proc_cmd *incmd, char *output, u32 out_len); 104 105 void rtw_phl_get_fw_ver(void *phl, char *ver_str, u16 len); 106 107 enum rtw_fw_status rtw_phl_get_fw_status(void *phl); 108 109 /* command thread jobs */ 110 enum rtw_phl_status rtw_phl_job_run_func(void *phl, 111 void *func, void *priv, void *parm, char *name); 112 113 /*WIFI Role management section*/ 114 u8 rtw_phl_wifi_role_alloc(void *phl, u8 *mac_addr, enum role_type type, 115 u8 ridx, struct rtw_wifi_role_t **wifi_role, bool ignore_hw_fail); 116 117 enum rtw_phl_status 118 rtw_phl_cmd_wrole_change(void *phl, 119 struct rtw_wifi_role_t *wrole, 120 enum wr_chg_id chg_id, u8 *chg_info, u8 chg_info_len, 121 enum phl_cmd_type cmd_type, u32 cmd_timeout); 122 123 void rtw_phl_wifi_role_free(void *phl, u8 role_idx); 124 125 /*WIFI sta_info management section*/ 126 struct rtw_phl_stainfo_t * 127 rtw_phl_alloc_stainfo_sw(void *phl, 128 u8 *sta_addr, 129 struct rtw_wifi_role_t *wrole); 130 131 enum rtw_phl_status 132 rtw_phl_free_stainfo_sw(void *phl, struct rtw_phl_stainfo_t *sta); 133 134 enum rtw_phl_status 135 rtw_phl_cmd_alloc_stainfo(void *phl, 136 struct rtw_phl_stainfo_t **sta, 137 u8 *sta_addr, 138 struct rtw_wifi_role_t *wrole, 139 bool alloc, 140 bool only_hw, 141 enum phl_cmd_type cmd_type, 142 u32 cmd_timeout); 143 144 enum rtw_phl_status 145 rtw_phl_cmd_change_stainfo(void *phl, 146 struct rtw_phl_stainfo_t *sta, enum sta_chg_id chg_id, 147 u8 *chg_info, u8 chg_info_len, 148 enum phl_cmd_type cmd_type, u32 cmd_timeout); 149 150 enum rtw_phl_status 151 rtw_phl_cmd_update_media_status(void *phl, 152 struct rtw_phl_stainfo_t *sta, 153 u8 *sta_addr, 154 bool is_connect, 155 enum phl_cmd_type cmd_type, 156 u32 cmd_timeout); 157 158 struct rtw_phl_stainfo_t * 159 rtw_phl_get_stainfo_self(void *phl, struct rtw_wifi_role_t *wrole); 160 161 struct rtw_phl_stainfo_t * 162 rtw_phl_get_stainfo_by_addr(void *phl, struct rtw_wifi_role_t *wrole, u8 *addr); 163 164 struct rtw_phl_stainfo_t * 165 rtw_phl_get_stainfo_by_macid(void *phl, u16 macid); 166 167 u8 168 rtw_phl_get_sta_rssi(struct rtw_phl_stainfo_t *sta); 169 170 enum rtw_phl_status 171 rtw_phl_query_rainfo(void *phl, struct rtw_phl_stainfo_t *phl_sta, 172 struct rtw_phl_rainfo *ra_info); 173 174 void rtw_phl_sta_up_rx_bcn(void *phl, struct rtw_bcn_pkt_info *info); 175 176 /*macid management section, temporary for debuge*/ 177 u16 178 rtw_phl_get_macid_max_num(void *phl); 179 180 u16 181 rtw_phl_wrole_bcmc_id_get(void *phl, struct rtw_wifi_role_t *wrole); 182 183 u8 184 rtw_phl_macid_is_bmc(void *phl, u16 macid); 185 186 u8 187 rtw_phl_macid_is_used(void *phl, u16 macid); 188 189 enum rtw_phl_status 190 rtw_phl_cmd_add_key(void *phl, 191 struct rtw_phl_stainfo_t *sta, 192 struct phl_sec_param_h *crypt, 193 u8 *keybuf, 194 enum phl_cmd_type cmd_type, 195 u32 cmd_timeout); 196 197 enum rtw_phl_status 198 rtw_phl_cmd_del_key(void *phl, 199 struct rtw_phl_stainfo_t *sta, 200 struct phl_sec_param_h *crypt, 201 enum phl_cmd_type cmd_type, 202 u32 cmd_timeout); 203 /* phy msg forwarder functions*/ 204 enum rtw_phl_status rtw_phl_msg_hub_register_recver(void* phl, 205 struct phl_msg_receiver* ctx, enum phl_msg_recver_layer layer); 206 enum rtw_phl_status rtw_phl_msg_hub_update_recver_mask(void* phl, 207 enum phl_msg_recver_layer layer, u8* mdl_id, u32 len, u8 clr); 208 enum rtw_phl_status rtw_phl_msg_hub_deregister_recver(void* phl, 209 enum phl_msg_recver_layer layer); 210 enum rtw_phl_status rtw_phl_msg_hub_send(void* phl, 211 struct phl_msg_attribute* attr, struct phl_msg* msg); 212 213 214 u8 rtw_phl_trans_sec_mode(u8 unicast, u8 multicast); 215 216 u8 rtw_phl_get_sec_cam_idx(void *phl, struct rtw_phl_stainfo_t *sta, 217 u8 keyid, u8 key_type); 218 219 void rtw_phl_test_txtb_cfg(struct rtw_phl_com_t* phl_com, void *buf, 220 u32 buf_len, u8 *cfg_bssid, u16 cfg_aid, u8 cfg_bsscolor); 221 /* command dispatcher module section*/ 222 enum rtw_phl_status rtw_phl_register_module(void *phl, u8 band_idx, 223 enum phl_module_id id, 224 struct phl_bk_module_ops* ops); 225 enum rtw_phl_status rtw_phl_deregister_module(void *phl,u8 band_idx, 226 enum phl_module_id id); 227 u8 rtw_phl_is_fg_empty(void *phl, u8 band_idx); 228 /* opt: refer to enum phl_msg_opt */ 229 enum rtw_phl_status rtw_phl_send_msg_to_dispr(void *phl, struct phl_msg* msg, 230 struct phl_msg_attribute* attr, u32* msg_hdl); 231 enum rtw_phl_status rtw_phl_cancel_dispr_msg(void *phl, u8 band_idx, u32* msg_hdl); 232 233 enum rtw_phl_status rtw_phl_add_cmd_token_req(void *phl, u8 band_idx, 234 struct phl_cmd_token_req* req, u32* req_hdl); 235 enum rtw_phl_status rtw_phl_cancel_cmd_token(void *phl, u8 band_idx, u32* req_hdl); 236 enum rtw_phl_status rtw_phl_set_cur_cmd_info(void *phl, u8 band_idx, 237 struct phl_module_op_info* op_info); 238 enum rtw_phl_status rtw_phl_query_cur_cmd_info(void *phl, u8 band_idx, 239 struct phl_module_op_info* op_info); 240 241 enum rtw_phl_status rtw_phl_free_cmd_token(void *phl, u8 band_idx, u32* req_hdl); 242 enum rtw_phl_status rtw_phl_set_bk_module_info(void *phl, u8 band_idx, 243 enum phl_module_id id, struct phl_module_op_info* op_info); 244 enum rtw_phl_status rtw_phl_query_bk_module_info(void *phl, u8 band_idx, 245 enum phl_module_id id, struct phl_module_op_info* op_info); 246 enum rtw_phl_status rtw_phl_set_msg_disp_seq(void *phl, 247 struct phl_msg_attribute *attr, 248 struct msg_self_def_seq* seq); 249 250 /* BA session management */ 251 void rtw_phl_stop_rx_ba_session(void *phl, struct rtw_phl_stainfo_t *sta, 252 u16 tid); 253 enum rtw_phl_status 254 rtw_phl_start_rx_ba_session(void *phl, struct rtw_phl_stainfo_t *sta, 255 u8 dialog_token, u16 timeout, u16 start_seq_num, 256 u16 ba_policy, u16 tid, u16 buf_size); 257 void rtw_phl_rx_bar(void *phl, struct rtw_phl_stainfo_t *sta, u8 tid, u16 seq); 258 void rtw_phl_flush_reorder_buf(void *phl, struct rtw_phl_stainfo_t *sta); 259 enum rtw_phl_status 260 rtw_phl_enter_mon_mode(void *phl, struct rtw_wifi_role_t *wrole); 261 enum rtw_phl_status 262 rtw_phl_leave_mon_mode(void *phl, struct rtw_wifi_role_t *wrole); 263 #ifdef RTW_PHL_BCN 264 enum rtw_phl_status rtw_phl_free_bcn_entry(void *phl, struct rtw_wifi_role_t *wrole); 265 enum rtw_phl_status 266 rtw_phl_cmd_issue_beacon(void *phl, 267 struct rtw_wifi_role_t *wifi_role, 268 struct rtw_bcn_info_cmn *bcn_cmn, 269 enum phl_cmd_type cmd_type, 270 u32 cmd_timeout); 271 enum rtw_phl_status 272 rtw_phl_cmd_stop_beacon(void *phl, 273 struct rtw_wifi_role_t *wifi_role, 274 u8 stop, 275 enum phl_cmd_type cmd_type, 276 u32 cmd_timeout); 277 #endif 278 279 #ifdef CONFIG_CMD_DISP 280 enum rtw_phl_status 281 rtw_phl_cmd_chg_op_chdef(struct rtw_wifi_role_t *wrole, 282 struct rtw_chan_def *new_chdef, bool cmd_wait, u32 cmd_timeout, 283 void (*chg_opch_done)(void *priv, u8 ridx, enum rtw_phl_status status)); 284 285 286 enum rtw_phl_status 287 rtw_phl_cmd_set_ch_bw(struct rtw_wifi_role_t *wifi_role, 288 struct rtw_chan_def *chdef, 289 bool do_rfk, 290 enum phl_cmd_type cmd_type, 291 u32 cmd_timeout); 292 293 enum rtw_phl_status 294 rtw_phl_cmd_enqueue(void *phl, 295 enum phl_band_idx band_idx, 296 enum phl_msg_evt_id evt_id, 297 u8 *cmd_buf, 298 u32 cmd_len, 299 void (*core_cmd_complete)(void *priv, u8 *cmd, u32 cmd_len, enum rtw_phl_status status), 300 enum phl_cmd_type cmd_type, 301 u32 cmd_timeout); 302 303 #endif /*CONFIG_CMD_DISP*/ 304 305 u8 rtw_phl_get_cur_ch(struct rtw_wifi_role_t *wifi_role); 306 enum rtw_phl_status 307 rtw_phl_get_cur_hal_chdef(struct rtw_wifi_role_t *wifi_role, 308 struct rtw_chan_def *cur_chandef); 309 310 enum band_type rtw_phl_get_band_type(u8 chan); 311 u8 rtw_phl_get_center_ch(u8 ch, 312 enum channel_width bw, enum chan_offset offset); 313 314 enum rtw_phl_status 315 rtw_phl_cmd_dfs_tx_pause(struct rtw_wifi_role_t *wifi_role, bool pause, 316 enum phl_cmd_type cmd_type, u32 cmd_timeout); 317 318 u8 319 rtw_phl_get_operating_class( 320 struct rtw_chan_def chan_def 321 ); 322 323 bool 324 rtw_phl_get_chandef_from_operating_class( 325 u8 channel, 326 u8 operating_class, 327 struct rtw_chan_def *chan_def 328 ); 329 /* 330 * export API from sw cap module 331 */ 332 void rtw_phl_final_cap_decision(void *phl); 333 334 335 enum rtw_phl_status 336 rtw_phl_get_dft_proto_cap(void *phl, u8 hw_band, enum role_type rtype, 337 struct protocol_cap_t *role_proto_cap); 338 enum rtw_phl_status 339 rtw_phl_get_dft_cap(void *phl, u8 hw_band, struct role_cap_t *role_cap); 340 341 void rtw_phl_mac_dbg_status_dump(void *phl, u32 *val, u8 *en); 342 343 #ifdef CONFIG_DBCC_SUPPORT 344 enum rtw_phl_status 345 rtw_phl_dbcc_test(void *phl, enum dbcc_test_id id, void *param); 346 #endif 347 /* 348 * API for config channel info CR 349 */ 350 #ifdef CONFIG_PHL_CHANNEL_INFO 351 enum rtw_phl_status 352 rtw_phl_cmd_cfg_chinfo(void *phl, struct rtw_phl_stainfo_t *sta, 353 u8 enable, enum phl_cmd_type cmd_type, u32 cmd_timeout); 354 enum rtw_phl_status rtw_phl_query_chan_info(void *phl, u32 buf_len, 355 u8* chan_info_buffer, u32 *length, struct csi_header_t *csi_header); 356 #endif /* CONFIG_PHL_CHANNEL_INFO */ 357 358 void rtw_phl_set_edcca_mode(void *phl, enum rtw_edcca_mode mode); 359 enum rtw_edcca_mode rtw_phl_get_edcca_mode(void *phl); 360 361 bool rtw_phl_set_user_def_chplan(void *phl, struct rtw_user_def_chplan *udef); 362 bool rtw_phl_valid_regulation_domain(u8 domain); 363 bool rtw_phl_regulation_set_domain(void *phl, u8 domain, 364 enum regulation_rsn reason); 365 bool rtw_phl_regulation_set_country(void *phl, char *country, 366 enum regulation_rsn reason); 367 bool rtw_phl_regulation_set_capability(void *phl, 368 enum rtw_regulation_capability capability); 369 bool rtw_phl_regulation_query_chplan( 370 void *phl, enum rtw_regulation_query type, 371 struct rtw_chlist *filter, 372 struct rtw_regulation_chplan *plan); 373 bool rtw_phl_query_specific_chplan(void *phl, u8 domain, 374 struct rtw_regulation_chplan *plan); 375 bool rtw_phl_query_country_chplan(char *country, 376 struct rtw_regulation_country_chplan *country_chplan); 377 bool rtw_phl_generate_scan_instance(struct instance_strategy *strategy, 378 struct rtw_regulation_chplan *chplan, 379 struct instance *inst); 380 bool rtw_phl_scan_instance_insert_ch(void *phl, struct instance *inst, 381 enum band_type band, u8 channel, 382 u8 strategy_period); 383 bool rtw_phl_regulation_valid_channel(void *phl, enum band_type band, 384 u16 channel, u8 reject); 385 bool rtw_phl_regulation_dfs_channel(void *phl, enum band_type band, 386 u16 channel, bool *dfs); 387 bool rtw_phl_query_regulation_info(void *phl, struct rtw_regulation_info *info); 388 bool rtw_phl_regulation_query_ch(void *phl, enum band_type band, u8 channel, 389 struct rtw_regulation_channel *ch); 390 u8 rtw_phl_get_domain_regulation_2g(u8 domain); 391 u8 rtw_phl_get_domain_regulation_5g(u8 domain); 392 393 enum rtw_phl_status rtw_phl_get_mac_addr_efuse(void* phl, u8 *addr); 394 395 /** 396 * rtw_phl_usb_tx_ep_id - query USB tx end point index 397 * identified by macid, tid and band 398 * @macid: input target macid is 0 ~ 127 399 * @tid: input target tid, range is 0 ~ 7 400 * @band: input target band, 0 for band 0 / 1 for band 1 401 * 402 * returns corresponding end point idx of a specific tid 403 */ 404 u8 rtw_phl_usb_tx_ep_id(void *phl, u16 macid, u8 tid, u8 band); 405 406 enum rtw_phl_status 407 rtw_phl_cfg_trx_path(void* phl, enum rf_path tx, u8 tx_nss, 408 enum rf_path rx, u8 rx_nss); 409 410 void rtw_phl_reset_stat_ma_rssi(struct rtw_phl_com_t *phl_com); 411 412 u8 413 rtw_phl_get_ma_rssi(struct rtw_phl_com_t *phl_com, 414 enum rtw_rssi_type rssi_type); 415 416 bool rtw_phl_chanctx_chk(void *phl, struct rtw_wifi_role_t *wifi_role, 417 u8 chan, enum channel_width bw, enum chan_offset offset); 418 bool rtw_phl_chanctx_add(void *phl, struct rtw_wifi_role_t *wifi_role, 419 u8 *chan, enum channel_width *bw, enum chan_offset *offset); 420 int rtw_phl_chanctx_del(void *phl, struct rtw_wifi_role_t *wifi_role, 421 struct rtw_chan_def *chan_def); 422 enum rtw_phl_status rtw_phl_chanctx_del_no_self(void *phl, struct rtw_wifi_role_t *wifi_role); 423 int rtw_phl_mr_get_chanctx_num(void *phl, struct rtw_wifi_role_t *wifi_role); 424 enum rtw_phl_status rtw_phl_mr_get_chandef(void *phl, struct rtw_wifi_role_t *wifi_role, 425 struct rtw_chan_def *chandef); 426 enum rtw_phl_status rtw_phl_mr_upt_chandef(void *phl, struct rtw_wifi_role_t *wifi_role); 427 428 #ifdef CONFIG_MCC_SUPPORT 429 u8 rtw_phl_mr_query_mcc_inprogress (void *phl, struct rtw_wifi_role_t *wrole, 430 enum rtw_phl_mcc_chk_inprocess_type check_type); 431 #endif 432 433 u8 rtw_phl_mr_dump_mac_addr(void *phl, 434 struct rtw_wifi_role_t *wifi_role); 435 u8 rtw_phl_mr_buddy_dump_mac_addr(void *phl, 436 struct rtw_wifi_role_t *wifi_role); 437 enum rtw_phl_status 438 rtw_phl_mr_rx_filter(void *phl, struct rtw_wifi_role_t *wrole); 439 440 #ifdef CONFIG_FSM 441 enum rtw_phl_status 442 rtw_phl_mr_offch_hdl(void *phl, 443 struct rtw_wifi_role_t *wrole, 444 bool off_ch, 445 void *obj_priv, 446 u8 (*issue_null_data)(void *priv, u8 ridx, bool ps), 447 struct rtw_chan_def *chandef); 448 #endif 449 void rtw_phl_mr_ops_init (void *phl, struct rtw_phl_mr_ops *mr_ops); 450 451 #ifdef PHL_MR_PROC_CMD 452 void rtw_phl_mr_dump_info(void *phl, bool show_caller); 453 void rtw_phl_mr_dump_band_ctl(void *phl, bool show_caller); 454 bool rtw_phl_chanctx_test(void *phl, struct rtw_wifi_role_t *wifi_role, bool is_add, 455 u8 *chan, enum channel_width *bw, enum chan_offset *offset); 456 #endif 457 void rtw_phl_sta_dump_info(void *phl, bool show_caller, struct rtw_wifi_role_t *wr, u8 mode); 458 459 bool rtw_phl_mr_query_info(void *phl, struct rtw_wifi_role_t *wrole, 460 struct mr_query_info *info); 461 462 u8 rtw_phl_mr_get_opch_list(void *phl, struct rtw_wifi_role_t *wifi_role, 463 struct rtw_chan_def *chdef_list, u8 list_size); 464 465 void rtw_phl_mr_dump_cur_chandef(void *phl, struct rtw_wifi_role_t *wifi_role); 466 467 enum mr_op_mode 468 rtw_phl_mr_get_opmode(void *phl, struct rtw_wifi_role_t *wrole); 469 470 void rtw_phl_led_set_ctrl_mode(void *phl, enum rtw_led_id led_id, 471 enum rtw_led_ctrl_mode ctrl_mode); 472 void rtw_phl_led_set_toggle_intervals(void *phl, u8 intervals_idx, 473 u32 *intervals, u8 intervals_len); 474 void rtw_phl_led_set_action(void *phl, enum rtw_led_event event, 475 enum rtw_led_state state_condition, 476 struct rtw_led_action_args_t *action_args_arr, 477 u8 action_args_arr_len, u32 toggle_delay_unit); 478 void rtw_phl_led_control(void *phl, enum rtw_led_event led_event); 479 480 #ifdef CONFIG_RTW_ACS 481 u16 rtw_phl_acs_get_channel_by_idx(void *phl, u8 ch_idx); 482 u8 rtw_phl_acs_get_clm_ratio_by_idx(void *phl, u8 ch_idx); 483 s8 rtw_phl_noise_query_by_idx(void *phl, u8 ch_idx); 484 #endif /* CONFIG_RTW_ACS */ 485 486 void rtw_phl_get_env_rpt(void *phl, struct rtw_env_report *env_rpt, struct rtw_wifi_role_t *wrole); 487 488 #ifdef RTW_WKARD_DYNAMIC_BFEE_CAP 489 enum rtw_phl_status 490 rtw_phl_bfee_ctrl(void *phl, struct rtw_wifi_role_t *wrole, bool ctrl); 491 #endif 492 493 enum rtw_phl_status 494 rtw_phl_snd_init_ops_send_ndpa(void *phl, 495 enum rtw_phl_status (*snd_send_ndpa)(void *, 496 struct rtw_wifi_role_t *, 497 u8 *, 498 u32 *, 499 enum channel_width)); 500 501 u8 rtw_phl_snd_chk_in_progress(void *phl); 502 503 enum rtw_phl_status 504 rtw_phl_sound_start(void *phl, u8 wrole_idx, u8 st_dlg_tkn, u8 period, u8 test_flag); 505 506 enum rtw_phl_status 507 rtw_phl_sound_abort(void *phl); 508 509 enum rtw_phl_status 510 rtw_phl_set_power_lmt(void *phl, u8 hw_band); 511 512 s8 rtw_phl_get_power_limit(void *phl, u8 hw_band, 513 u16 rate, u8 bandwidth, u8 beamforming, u8 tx_num, u8 channel); 514 515 void 516 rtw_phl_enable_ext_pwr_lmt(void *phl, u8 hw_band, 517 struct rtw_phl_ext_pwr_lmt_info *ext_pwr_lmt_info); 518 519 void rtw_phl_init_ppdu_sts_para(struct rtw_phl_com_t *phl_com, 520 bool en_psts_per_pkt, bool psts_ampdu, 521 u8 rx_fltr); 522 523 enum rtw_phl_status rtw_phl_rf_on(void *phl); 524 enum rtw_phl_status rtw_phl_rf_off(void *phl); 525 526 527 #ifdef CONFIG_PHL_TWT 528 enum rtw_phl_status 529 rtw_phl_twt_alloc_twt_config(void *phl, struct rtw_wifi_role_t *role, 530 struct rtw_phl_twt_setup_info setup_info, u8 benable, u8 *id); 531 532 enum rtw_phl_status 533 rtw_phl_twt_free_twt_config(void *phl, u8 id); 534 535 enum rtw_phl_status 536 rtw_phl_twt_enable_twt_config(void *phl, u8 id); 537 538 enum rtw_phl_status 539 rtw_phl_twt_free_all_twt_by_role(void *phl, struct rtw_wifi_role_t *role); 540 541 enum rtw_phl_status 542 rtw_phl_twt_disable_all_twt_by_role(void *phl, struct rtw_wifi_role_t *role); 543 544 enum rtw_phl_status 545 rtw_phl_twt_enable_all_twt_by_role(void *phl, struct rtw_wifi_role_t *role); 546 547 enum rtw_phl_status 548 rtw_phl_twt_add_sta_info(void *phl, struct rtw_phl_stainfo_t *phl_sta, 549 u8 config_id, u8 id); 550 551 enum rtw_phl_status 552 rtw_phl_twt_teardown_sta(void *phl, struct rtw_phl_stainfo_t *phl_sta, 553 struct rtw_phl_twt_flow_field *twt_flow, u8 *bitmap); 554 555 enum rtw_phl_status 556 rtw_phl_twt_get_new_flow_id(void *phl, struct rtw_phl_stainfo_t *phl_sta, u8 *id); 557 558 559 enum rtw_phl_status 560 rtw_phl_twt_accept_for_sta_mode(void *phl, struct rtw_phl_stainfo_t *phl_sta, 561 struct rtw_phl_twt_setup_info *setup_info, u8 *id); 562 563 enum rtw_phl_status 564 rtw_phl_twt_teardown_for_sta_mode(void *phl, struct rtw_phl_stainfo_t *phl_sta, 565 struct rtw_phl_twt_flow_field *twt_flow); 566 567 enum rtw_phl_status 568 rtw_phl_twt_delete_all_sta_info(void *phl, struct rtw_phl_stainfo_t *phl_sta, 569 u8 *bitmap); 570 571 enum rtw_phl_status 572 rtw_phl_twt_get_target_wake_time(void *phl, u8 port, u8 id, u16 offset, u32 *tsf_h, 573 u32 *tsf_l); 574 575 enum rtw_phl_status 576 rtw_phl_twt_sta_announce_to_fw(void *phl, u16 macid); 577 578 enum rtw_phl_status 579 rtw_phl_twt_handle_c2h(void *phl_com, void *c); 580 581 enum rtw_phl_status 582 rtw_phl_twt_fill_twt_element(struct rtw_phl_twt_element *twt_ele, u8 *buf, 583 u8 *length); 584 585 enum rtw_phl_status 586 rtw_phl_twt_fill_flow_field(struct rtw_phl_twt_flow_field *twt_flow, u8 *buf, 587 u16 *length); 588 enum rtw_phl_status 589 rtw_phl_twt_parse_element(u8 *twt_ele, u16 length, 590 struct rtw_phl_twt_element *twt_element); 591 592 enum rtw_phl_status 593 rtw_phl_twt_parse_setup_info(u8 *pkt, u16 length, 594 struct rtw_phl_twt_setup_info *setup_info); 595 596 enum rtw_phl_status 597 rtw_phl_twt_parse_flow_field(u8 *ie_twt_flow, u16 length, 598 struct rtw_phl_twt_flow_field *twt_flow); 599 #endif /* CONFIG_PHL_TWT */ 600 601 enum rtw_phl_status 602 rtw_phl_snd_cmd_set_vht_gid(void *phl, 603 struct rtw_wifi_role_t *wrole, 604 struct rtw_phl_gid_pos_tbl *tbl); 605 606 enum rtw_phl_status 607 rtw_phl_snd_cmd_set_aid(void *phl, 608 struct rtw_wifi_role_t *wrole, 609 struct rtw_phl_stainfo_t *sta, 610 u16 aid); 611 612 #ifdef RTW_WKARD_P2PPS_REFINE 613 #ifdef CONFIG_PHL_P2PPS 614 enum rtw_phl_status 615 rtw_phl_p2pps_noa_update(void *phl, struct rtw_phl_noa_desc *in_desc); 616 617 void 618 rtw_phl_p2pps_init_ops(void *phl, struct rtw_phl_p2pps_ops *ops); 619 620 void rtw_phl_p2pps_noa_disable_all(void *phl, struct rtw_wifi_role_t *w_role); 621 #endif 622 #endif 623 enum rtw_phl_status 624 rtw_phl_snd_cmd_set_vht_gid(void *phl, 625 struct rtw_wifi_role_t *wrole, 626 struct rtw_phl_gid_pos_tbl *tbl); 627 628 void rtw_phl_event_notify(void *phl, enum phl_msg_evt_id event, 629 struct rtw_wifi_role_t *wrole); 630 void rtw_phl_notification(void *phl, 631 enum phl_msg_evt_id event, 632 struct rtw_wifi_role_t *wrole); 633 void rtw_phl_dev_terminate_ntf(void *phl); 634 635 enum rtw_phl_status 636 rtw_phl_cmd_force_usb_switch(void *phl, u32 speed, 637 enum phl_band_idx band_idx, 638 enum phl_cmd_type cmd_type, u32 cmd_timeout); 639 enum rtw_phl_status 640 rtw_phl_cmd_get_usb_speed(void *phl, u32* speed, 641 enum phl_band_idx band_idx, 642 enum phl_cmd_type cmd_type, u32 cmd_timeout); 643 enum rtw_phl_status 644 rtw_phl_cmd_get_usb_support_ability(void *phl, u32* ability, 645 enum phl_band_idx band_idx, 646 enum phl_cmd_type cmd_type, u32 cmd_timeout); 647 u8 rtw_phl_get_sta_mgnt_rssi(struct rtw_phl_stainfo_t *psta); 648 649 enum rtw_phl_status 650 rtw_phl_txsts_rpt_config(void *phl, struct rtw_phl_stainfo_t *phl_sta); 651 652 #ifdef CONFIG_USB_HCI 653 /* tx_ok/tx_fail are from release report*/ 654 enum rtw_phl_status 655 rtw_phl_get_tx_ok_rpt(void *phl, struct rtw_phl_stainfo_t *phl_sta, u32 *tx_ok_cnt, 656 enum phl_ac_queue qsel); 657 658 enum rtw_phl_status 659 rtw_phl_get_tx_fail_rpt(void *phl, struct rtw_phl_stainfo_t *phl_sta, u32 *tx_fail_cnt, 660 enum phl_ac_queue qsel); 661 662 /* tx retry is from ra sts report.*/ 663 enum rtw_phl_status 664 rtw_phl_get_tx_retry_rpt(void *phl, struct rtw_phl_stainfo_t *phl_sta, u32 *tx_retry_cnt, 665 enum phl_ac_queue qsel); 666 #endif /* CONFIG_USB_HCI */ 667 668 enum rtw_rx_status rtw_phl_get_rx_status(void *phl); 669 670 void rtw_phl_dbg_dump_rx(void *phl, struct rtw_wifi_role_t *wrole); 671 672 /****************************************************************************** 673 * 674 * TX power APIs 675 * 676 *****************************************************************************/ 677 const char *rtw_phl_get_pw_lmt_regu_type_str(void *phl, enum band_type band); 678 679 bool rtw_phl_get_pwr_lmt_en(void *phl, u8 band_idx); 680 681 enum rtw_phl_status rtw_phl_set_tx_power(void *phl, u8 band_idx); 682 /*****************************************************************************/ 683 684 u32 rtw_phl_get_phy_stat_info(void *phl, enum phl_band_idx hw_band, 685 enum phl_stat_info_query phy_stat); 686 #endif /*_PHL_API_H_*/ 687 688