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_DBG_CMD_H__ 16 #define __PHL_DBG_CMD_H__ 17 18 #include "../phl_headers.h" 19 #include "../phl_types.h" 20 #include "../phl_struct.h" 21 22 #define PHL_DBG_MON_INFO(max_buff_len, used_len, buff_addr, remain_len, fmt, ...)\ 23 do { \ 24 u32 *used_len_tmp = &(used_len); \ 25 if (*used_len_tmp < max_buff_len) \ 26 *used_len_tmp += _os_snprintf(buff_addr, remain_len, fmt, ##__VA_ARGS__);\ 27 } while (0) 28 29 struct phl_dbg_cmd_info { 30 char name[16]; 31 u8 id; 32 }; 33 34 enum rtw_phl_status 35 rtw_phl_dbg_core_cmd(struct phl_info_t *phl_info, struct rtw_proc_cmd *incmd, char *output, u32 out_len); 36 37 #ifdef CONFIG_PHL_TEST_SUITE 38 39 enum PHL_DBG_CMD_ID { 40 PHL_DBG_MON_HELP, 41 PHL_DBG_MON_TEST, 42 PHL_DBG_COMP, 43 PHL_DBG_DUMP_WROLE, 44 PHL_DBG_SET_CH_BW, 45 PHL_DBG_SHOW_RX_RATE, 46 PHL_DBG_ASOC_STA, 47 PHL_DBG_SOUND, 48 #ifdef CONFIG_FSM 49 PHL_DBG_FSM, 50 #endif 51 PHL_DBG_TRX_STATS, 52 PHL_SHOW_RSSI_STAT, 53 PHL_DBG_SER, 54 PHL_DBG_WOW, 55 #ifdef CONFIG_POWER_SAVE 56 PHL_DBG_PS, 57 #endif 58 PHL_DBG_ECSA, 59 PHL_DBG_MCC, 60 PHL_DBG_LTR, 61 PHL_DBG_CFG_TX_DUTY 62 }; 63 64 static const struct phl_dbg_cmd_info phl_dbg_cmd_i[] = { 65 {"-h", PHL_DBG_MON_HELP}, /*@do not move this element to other position*/ 66 {"test", PHL_DBG_MON_TEST}, 67 {"dbgcomp", PHL_DBG_COMP}, 68 {"role", PHL_DBG_DUMP_WROLE}, 69 {"set_ch", PHL_DBG_SET_CH_BW}, 70 {"rxrate", PHL_DBG_SHOW_RX_RATE}, 71 {"asoc_sta", PHL_DBG_ASOC_STA}, 72 {"sound", PHL_DBG_SOUND}, 73 #ifdef CONFIG_FSM 74 {"fsm",PHL_DBG_FSM}, 75 #endif 76 {"trx_stats", PHL_DBG_TRX_STATS}, 77 {"show_rssi", PHL_SHOW_RSSI_STAT}, 78 {"ser", PHL_DBG_SER}, 79 {"wow", PHL_DBG_WOW}, 80 #ifdef CONFIG_POWER_SAVE 81 {"ps", PHL_DBG_PS}, 82 #endif 83 {"ecsa", PHL_DBG_ECSA}, 84 {"mcc", PHL_DBG_MCC}, 85 {"ltr", PHL_DBG_LTR}, 86 {"tx_duty", PHL_DBG_CFG_TX_DUTY} 87 }; 88 89 enum rtw_hal_status 90 rtw_phl_dbg_proc_cmd(struct phl_info_t *phl_info, 91 struct rtw_proc_cmd *incmd, 92 char *output, 93 u32 out_len); 94 bool 95 _get_hex_from_string(char *szstr, u32 *val); 96 #else 97 98 #define rtw_phl_dbg_proc_cmd(_phl_info, _incmd, _output, _out_len) RTW_HAL_STATUS_SUCCESS 99 100 #endif 101 #endif 102