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 PHL_DBG_SET_LEVEL 63 }; 64 65 static const struct phl_dbg_cmd_info phl_dbg_cmd_i[] = { 66 {"-h", PHL_DBG_MON_HELP}, /*@do not move this element to other position*/ 67 {"test", PHL_DBG_MON_TEST}, 68 {"dbgcomp", PHL_DBG_COMP}, 69 {"role", PHL_DBG_DUMP_WROLE}, 70 {"set_ch", PHL_DBG_SET_CH_BW}, 71 {"rxrate", PHL_DBG_SHOW_RX_RATE}, 72 {"asoc_sta", PHL_DBG_ASOC_STA}, 73 {"sound", PHL_DBG_SOUND}, 74 #ifdef CONFIG_FSM 75 {"fsm",PHL_DBG_FSM}, 76 #endif 77 {"trx_stats", PHL_DBG_TRX_STATS}, 78 {"show_rssi", PHL_SHOW_RSSI_STAT}, 79 {"ser", PHL_DBG_SER}, 80 {"wow", PHL_DBG_WOW}, 81 #ifdef CONFIG_POWER_SAVE 82 {"ps", PHL_DBG_PS}, 83 #endif 84 {"ecsa", PHL_DBG_ECSA}, 85 {"mcc", PHL_DBG_MCC}, 86 {"ltr", PHL_DBG_LTR}, 87 {"tx_duty", PHL_DBG_CFG_TX_DUTY}, 88 {"dbglevel", PHL_DBG_SET_LEVEL} 89 }; 90 91 enum rtw_hal_status 92 rtw_phl_dbg_proc_cmd(struct phl_info_t *phl_info, 93 struct rtw_proc_cmd *incmd, 94 char *output, 95 u32 out_len); 96 bool 97 _get_hex_from_string(char *szstr, u32 *val); 98 #else 99 100 #define rtw_phl_dbg_proc_cmd(_phl_info, _incmd, _output, _out_len) RTW_HAL_STATUS_SUCCESS 101 102 #endif 103 #endif 104