初始提交

This commit is contained in:
2025-05-13 22:00:58 +08:00
commit e4c030b0c0
564 changed files with 78858 additions and 0 deletions

View File

@ -0,0 +1,169 @@
<?xml version="1.0" encoding="utf-8" ?>
<RulesImport>
<!--
All 'target' paths are relative to the parent of the 'source'. The 'source' is the field whose value is used
to control the visibility or length of the 'target'.
The source field will be implicitly matched using the UEMonitor type filter '**' to allow us to handle arrays
or unions.
A few examples:
<LengthRule Message="MSG" Array="data" Length="len" IsVariable="true"/>
MSG.a.data would be controlled by MSG.a.len
MSG.b[4].data would be controlled by MSG.b[4].len
<LengthRule Message="MSG" Array="sub.data" Length="len" IsVariable="true"/>
MSG.a.sub.data would be controlled by MSG.a.len
MSG.b[4].sub.data would be controlled by MSG.b[4].len
This might result in unwanted matches. We can disambiguate this by using the fully qualified name to indicate an
absolute path on the source.
<LengthRule Message="MSG" Array="MSG.data" Length="MSG.a.len" IsVariable="true"/>
MSG.a.data would be controlled by MSG.a.len
MSG.a.b.data would NOT be controlled by MSG.a.len or MSG.a.b.len
We differentiate between the "length of simple type array" and "length of array of (structures or arrays)" constraints.
This is done by extending the syntax of the target path using [*] for the latter.
<LengthRule Message="LL1_IDLE_MEAS_CONFIG_REQ" Array="intra_black_cells[*]" Length="num_intra_black_cells"/>
-->
<!--
Note on the use of the IsVariable attribute.
Structures that are dynamically allocated to be different sizes and tend to have a uint8 [1] at the end of the definition
are 'truly' variable length structures. These must have IsVariable attribute present and set. The Length field indicates
how the size of the array, all elements of which are in use.
Arrays that are a constant size within a structure and not deemed to be variable length, and so do NOT have the IsVariable
attribute. The Length field indicates how many of the array elements are present and in use.
-->
<!-- Note: LengthRules must be before the UnionRules and then the ValidRules -->
<!-- Message logging using dynamically sized messages, so IsVariable is set. -->
<Rules>
<LengthRule Array="message_data" IsVariable="true" Length="length" Message="APP_AT_LOG_MESSAGE_CMD_ID" />
<LengthRule Array="message_data" IsVariable="true" Length="length" Message="APP_AT_LOG_MESSAGE_RESPONSE_ID" />
<LengthRule Array="data" IsVariable="true" Length="length" Message="SOC_LWM2M_LOG_MESSAGE_STRING_ID" />
<LengthRule Array="data" IsVariable="true" Length="length" Message="SOC_MBEDTLS_LOG_MESSAGE_STRING_ID" />
<LengthRule Array="data" IsVariable="true" Length="length" Message="SOC_COAP_LOG_MESSAGE_STRING_ID" />
<LengthRule Array="data" IsVariable="true" Length="length" Message="LWIP_LOG_MESSAGE_STRING_ID" />
<LengthRule Array="data" IsVariable="true" Length="length" Message="SOC_ATINY_LOG_MESSAGE_STRING_ID" />
<LengthRule Array="message_data" IsVariable="true" Length="length" Message="APP_AT_LOG_MESSAGE_COMMON_ID" />
<!-- Autogenerated by json_at_code.py from JSON AT commands. Do not edit. -->
<UnionRule Message="APP_AT_LOG_MESSAGE_CMD_ID" Union="args" Selector="cmd_id">
<UnionSelection Selection="CMD_CCHC" Option="cchc"/>
<UnionSelection Selection="CMD_CCHO" Option="ccho"/>
<UnionSelection Selection="CMD_CCIOTOPT" Option="cciotopt"/>
<UnionSelection Selection="CMD_CCLK" Option="cclk"/>
<UnionSelection Selection="CMD_CEDRXRDP" Option="cedrxrdp"/>
<UnionSelection Selection="CMD_CEDRXS" Option="cedrxs"/>
<UnionSelection Selection="CMD_CEER" Option="ceer"/>
<UnionSelection Selection="CMD_CEREG" Option="cereg"/>
<UnionSelection Selection="CMD_CFUN" Option="cfun"/>
<UnionSelection Selection="CMD_CGACT" Option="cgact"/>
<UnionSelection Selection="CMD_CGAPNRC" Option="cgapnrc"/>
<UnionSelection Selection="CMD_CGATT" Option="cgatt"/>
<UnionSelection Selection="CMD_CGAUTH" Option="cgauth"/>
<UnionSelection Selection="CMD_CGCMOD" Option="cgcmod"/>
<UnionSelection Selection="CMD_CGCONTRDP" Option="cgcontrdp"/>
<UnionSelection Selection="CMD_CGDATA" Option="cgdata"/>
<UnionSelection Selection="CMD_CGDCONT" Option="cgdcont"/>
<UnionSelection Selection="CMD_CGEQOS" Option="cgeqos"/>
<UnionSelection Selection="CMD_CGLA" Option="cgla"/>
<UnionSelection Selection="CMD_CGMI" Option="cgmi"/>
<UnionSelection Selection="CMD_CGMM" Option="cgmm"/>
<UnionSelection Selection="CMD_CGMR" Option="cgmr"/>
<UnionSelection Selection="CMD_CGPADDR" Option="cgpaddr"/>
<UnionSelection Selection="CMD_CGSN" Option="cgsn"/>
<UnionSelection Selection="CMD_CGTFT" Option="cgtft"/>
<UnionSelection Selection="CMD_CIMI" Option="cimi"/>
<UnionSelection Selection="CMD_CIPCA" Option="cipca"/>
<UnionSelection Selection="CMD_CLAC" Option="clac"/>
<UnionSelection Selection="CMD_CMEE" Option="cmee"/>
<UnionSelection Selection="CMD_CMGC" Option="cmgc"/>
<UnionSelection Selection="CMD_CMGS" Option="cmgs"/>
<UnionSelection Selection="CMD_CMMS" Option="cmms"/>
<UnionSelection Selection="CMD_CNEC" Option="cnec"/>
<UnionSelection Selection="CMD_CNMA" Option="cnma"/>
<UnionSelection Selection="CMD_CNMPSD" Option="cnmpsd"/>
<UnionSelection Selection="CMD_COPS" Option="cops"/>
<UnionSelection Selection="CMD_CPIN" Option="cpin"/>
<UnionSelection Selection="CMD_CPINR" Option="cpinr"/>
<UnionSelection Selection="CMD_CPSDO" Option="cpsdo"/>
<UnionSelection Selection="CMD_CPSMS" Option="cpsms"/>
<UnionSelection Selection="CMD_CRSM" Option="crsm"/>
<UnionSelection Selection="CMD_CRTDCP" Option="crtdcp"/>
<UnionSelection Selection="CMD_CSCA" Option="csca"/>
<UnionSelection Selection="CMD_CSCON" Option="cscon"/>
<UnionSelection Selection="CMD_CSIM" Option="csim"/>
<UnionSelection Selection="CMD_CSMS" Option="csms"/>
<UnionSelection Selection="CMD_CSODCP" Option="csodcp"/>
<UnionSelection Selection="CMD_CSQ" Option="csq"/>
<UnionSelection Selection="CMD_CTZR" Option="ctzr"/>
<UnionSelection Selection="CMD_NATSPEED" Option="natspeed"/>
<UnionSelection Selection="CMD_NBAND" Option="nband"/>
<UnionSelection Selection="CMD_NBIPR" Option="nbipr"/>
<UnionSelection Selection="CMD_NCACHE" Option="ncache"/>
<UnionSelection Selection="CMD_NCALTEMPSENSOR" Option="ncaltempsensor"/>
<UnionSelection Selection="CMD_NCCID" Option="nccid"/>
<UnionSelection Selection="CMD_NCHIPINFO" Option="nchipinfo"/>
<UnionSelection Selection="CMD_NCIDSTATUS" Option="ncidstatus"/>
<UnionSelection Selection="CMD_NCONFIG" Option="nconfig"/>
<UnionSelection Selection="CMD_NCPCDPR" Option="ncpcdpr"/>
<UnionSelection Selection="CMD_NCSEARFCN" Option="ncsearfcn"/>
<UnionSelection Selection="CMD_NDEBUG" Option="ndebug"/>
<UnionSelection Selection="CMD_NDIEID" Option="ndieid"/>
<UnionSelection Selection="CMD_NEARFCN" Option="nearfcn"/>
<UnionSelection Selection="CMD_NFWUPD" Option="nfwupd"/>
<UnionSelection Selection="CMD_NGACTR" Option="ngactr"/>
<UnionSelection Selection="CMD_NGSEARFCN" Option="ngsearfcn"/>
<UnionSelection Selection="CMD_NGT3412" Option="ngt3412"/>
<UnionSelection Selection="CMD_NIPINFO" Option="nipinfo"/>
<UnionSelection Selection="CMD_NITZ" Option="nitz"/>
<UnionSelection Selection="CMD_NLOGLEVEL" Option="nloglevel"/>
<UnionSelection Selection="CMD_NPIN" Option="npin"/>
<UnionSelection Selection="CMD_NPING" Option="nping"/>
<UnionSelection Selection="CMD_NPOWERCLASS" Option="npowerclass"/>
<UnionSelection Selection="CMD_NPRDEFLASH" Option="nprdeflash"/>
<UnionSelection Selection="CMD_NPSMR" Option="npsmr"/>
<UnionSelection Selection="CMD_NPTWEDRXS" Option="nptwedrxs"/>
<UnionSelection Selection="CMD_NQPULD" Option="nqpuld"/>
<UnionSelection Selection="CMD_NQSOS" Option="nqsos"/>
<UnionSelection Selection="CMD_NRB" Option="nrb"/>
<UnionSelection Selection="CMD_NRDCTRL" Option="nrdctrl"/>
<UnionSelection Selection="CMD_NRDEXEC" Option="nrdexec"/>
<UnionSelection Selection="CMD_NRDMIPI" Option="nrdmipi"/>
<UnionSelection Selection="CMD_NRDSET" Option="nrdset"/>
<UnionSelection Selection="CMD_NRDTEST" Option="nrdtest"/>
<UnionSelection Selection="CMD_NRNPDM" Option="nrnpdm"/>
<UnionSelection Selection="CMD_NSESIM" Option="nsesim"/>
<UnionSelection Selection="CMD_NSET" Option="nset"/>
<UnionSelection Selection="CMD_NSNPD" Option="nsnpd"/>
<UnionSelection Selection="CMD_NSOCL" Option="nsocl"/>
<UnionSelection Selection="CMD_NSOCO" Option="nsoco"/>
<UnionSelection Selection="CMD_NSOCR" Option="nsocr"/>
<UnionSelection Selection="CMD_NSORF" Option="nsorf"/>
<UnionSelection Selection="CMD_NSOSD" Option="nsosd"/>
<UnionSelection Selection="CMD_NSOST" Option="nsost"/>
<UnionSelection Selection="CMD_NSOSTATUS" Option="nsostatus"/>
<UnionSelection Selection="CMD_NTPERMID" Option="ntpermid"/>
<UnionSelection Selection="CMD_NTSETID" Option="ntsetid"/>
<UnionSelection Selection="CMD_NUESTATS" Option="nuestats"/>
<UnionSelection Selection="CMD_NUICC" Option="nuicc"/>
<UnionSelection Selection="CMD_NXLOG" Option="nxlog"/>
<UnionSelection Selection="CMD_AT" Option=""/>
<UnionSelection Selection="CMD_UNKNOWN" Option=""/>
<UnionSelection Selection="CMD_DUMMY" Option="dummy"/>
</UnionRule>
<ValidRule Message="APP_AT_LOG_MESSAGE_CMD_ID" Field="args" Indicator="args_present"/>
<!-- Autogenerated. -->
</Rules>
</RulesImport>

View File

@ -0,0 +1,371 @@
<?xml version="1.0" encoding="utf-8" ?>
<RulesImport>
<!--
All 'target' paths are relative to the parent of the 'source'. The 'source' is the field whose value is used
to control the visibility or length of the 'target'.
The source field will be implicitly matched using the UEMonitor type filter '**' to allow us to handle arrays
or unions.
A few examples:
<LengthRule Message="MSG" Array="data" Length="len" IsVariable="true"/>
MSG.a.data would be controlled by MSG.a.len
MSG.b[4].data would be controlled by MSG.b[4].len
<LengthRule Message="MSG" Array="sub.data" Length="len" IsVariable="true"/>
MSG.a.sub.data would be controlled by MSG.a.len
MSG.b[4].sub.data would be controlled by MSG.b[4].len
This might result in unwanted matches. We can disambiguate this by using the fully qualified name to indicate an
absolute path on the source.
<LengthRule Message="MSG" Array="MSG.data" Length="MSG.a.len" IsVariable="true"/>
MSG.a.data would be controlled by MSG.a.len
MSG.a.b.data would NOT be controlled by MSG.a.len or MSG.a.b.len
We differentiate between the "length of simple type array" and "length of array of (structures or arrays)" constraints.
This is done by extending the syntax of the target path using [*] for the latter.
<LengthRule Message="LL1_IDLE_MEAS_CONFIG_REQ" Array="intra_black_cells[*]" Length="num_intra_black_cells"/>
-->
<!--
Note on the use of the IsVariable attribute.
Structures that are dynamically allocated to be different sizes and tend to have a uint8 [1] at the end of the definition
are 'truly' variable length structures. These must have IsVariable attribute present and set. The Length field indicates
how the size of the array, all elements of which are in use.
Arrays that are a constant size within a structure and not deemed to be variable length, and so do NOT have the IsVariable
attribute. The Length field indicates how many of the array elements are present and in use.
-->
<!-- Note: LengthRules must be before the UnionRules and then the ValidRules -->
<!-- Message logging using dynamically sized messages, so IsVariable is set. -->
<Rules>
<LengthRule Message="LPP_DEBUG_ASN" Array="data" Length="len" IsVariable="true"/>
<LengthRule Message="NAS_DBG_IP_PACKET" Array="data" Length="len" IsVariable="true"/>
<LengthRule Message="NAS_DBG_NAS_MSG" Array="data" Length="len" IsVariable="true"/>
<LengthRule Message="ROHC_DBG_ROHC_MSG" Array="data" Length="len" IsVariable="true"/>
<LengthRule Message="RRC_DEBUG_ASN" Array="data" Length="len" IsVariable="true"/>
<LengthRule Message="NB_IOT_UE_SET_KV_NVRAM" Array="data" Length="len" IsVariable="true"/>
<!-- DSP Length Constraints. -->
<LengthRule Message="DSP_LOG_IPC_DATA" Array="DSP_LOG_IPC_DATA.data" Length="DSP_LOG_IPC_DATA.header.length" IsVariable="true"/>
<!-- LL1 Length Constraints. -->
<LengthRule Message="LL1_BG_SCAN_REQ" Array="earfcn_list" Length="num_earfcn"/>
<LengthRule Message="LL1_SCAN_REQ" Array="earfcn_list" Length="num_earfcn"/>
<LengthRule Message="LL1_BG_FREQ_SEARCH_CNF" Array="cells_list[*]" Length="num_of_cells"/>
<LengthRule Message="LL1_FREQ_SEARCH_CNF" Array="cells_list[*]" Length="num_of_cells"/>
<LengthRule Message="LL1_COMMON_NON_ANCHOR_INFO" Array="common_non_anchor_cfg[*]" Length="num_non_anchor_carrier"/>
<LengthRule Message="LL1_CONNECTED_CONFIG_REQ" Array="si_scheduling[*]" Length="num_of_si"/>
<LengthRule Message="LL1_IDLE_CONFIG_REQ" Array="si_scheduling[*]" Length="num_of_si"/>
<LengthRule Message="LL1_SI_INFO_READ_REQ" Array="si_scheduling[*]" Length="num_of_si"/>
<LengthRule Message="LL1_IDLE_CONFIG_REQ" Array="prach_cfg_params[*]" Length="num_prach_cfg_params"/>
<LengthRule Message="LL1_IDLE_CONFIG_REQ" Array="LL1_IDLE_CONFIG_REQ.pusch_cfg.num_rep_ack_nack"
Length="LL1_IDLE_CONFIG_REQ.prach_cfg.num_prach_cfg_params"/>
<LengthRule Message="LL1_IDLE_MEAS_CONFIG_REQ" Array="intra_black_cells[*]" Length="num_intra_black_cells"/>
<LengthRule Message="LL1_IDLE_MEAS_CONFIG_REQ" Array="inter_freq_earfcn_list[*]" Length="num_inter_freq_channels"/>
<LengthRule Message="LL1_IDLE_MEAS_CONFIG_REQ" Array="inter_black_cells" Length="num_inter_black_cells"/>
<LengthRule Message="LL1_INTER_FREQ_MEAS_IND" Array="cell[*]" Length="num_cells"/>
<LengthRule Message="LL1_INTRA_FREQ_MEAS_IND" Array="cell[*]" Length="num_cells"/>
<LengthRule Message="LL1_LOG_ECL_INFO" Array="ecl_to_prach_map" Length="num_maps"/>
<LengthRule Message="LL1_OTDOA_LOCATION_CONFIG_REQ" Array="nprs_info[*]" Length="num_of_nprs_carriers"/>
<LengthRule Message="LL1_OTDOA_NEIGHBOUR_INFO" Array="nprs_info[*]" Length="num_of_nprs_carriers"/>
<LengthRule Message="LL1_OTDOA_NEIGHBOUR_INFO" Array="ncell[*]" Length="num_neighbour_cells"/>
<LengthRule Message="LL1_PAGING_NON_ANCHOR_INFO" Array="paging_non_anchor_cfg[*]" Length="num_non_anchor_carrier"/>
<LengthRule Message="LL1_RACH_NON_ANCHOR_INFO" Array="rach_non_anchor_cfg[*]" Length="num_non_anchor_carrier"/>
<LengthRule Message="LL1_RADIO_TEST_DUAL_NPDSCH_RX" Array="npdsch_params[*]" Length="num_npdsch"/>
<LengthRule Message="LL1_RADIO_TEST_DUAL_NPDSCH_RX" Array="npucch_params[*]" Length="num_npucch"/>
<LengthRule Message="LL1_RADIO_TEST_DUAL_NPDSCH_RX" Array="prach_params[*]" Length="num_of_prach"/>
<LengthRule Message="LL1_RADIO_TEST_DUAL_NPUSCH_TX" Array="prach_params[*]" Length="num_prach_elem"/>
<LengthRule Message="LL1_RADIO_TEST_NPUCCH_TX" Array="prach_params[*]" Length="num_of_prach"/>
<LengthRule Message="LL1_RADIO_TEST_NPUSCH_TX" Array="prach_params[*]" Length="num_prach_elem"/>
<LengthRule Message="LL1_RADIO_TEST_RF_PRODUCTION_TEST_RX_TX"
Array="prach_params[*]" Length="num_prach_elem"/>
<LengthRule Message="LL1_RADIO_TEST_RF_TX_CALI_LIST" Array="prach_params[*]" Length="num_prach_elem"/>
<LengthRule Message="LL1_RADIO_TEST_RF_RX_RSSI_CALI_LIST"
Array="prach_params[*]" Length="num_prach_elem"/>
<LengthRule Message="LL1_RADIO_TEST_DUAL_NPDSCH_RX" Array="dci_action[*]" Length="num_dci_actions"/>
<LengthRule Message="LL1_RADIO_TEST_DUAL_NPUSCH_TX" Array="dci_action[*]" Length="num_dci_actions"/>
<LengthRule Message="LL1_RADIO_TEST_DUAL_NPUSCH_TX" Array="npusch_params[*]" Length="num_npusch"/>
<LengthRule Message="LL1_RADIO_TEST_MULTICELL_NPRS_RX" Array="nprs_cfg_list[*]" Length="num_nprs_cells"/>
<LengthRule Message="LL1_RADIO_TEST_MULTICELL_NPRS_RX" Array="subframe_pattern" Length="subframe_pattern_size"/>
<LengthRule Message="LL1_RADIO_TEST_NPRS_RX" Array="subframe_pattern" Length="subframe_pattern_size"/>
<LengthRule Message="LL1_RADIO_TEST_SET_DATA" Array="data" Length="length"/>
<LengthRule Message="LL1_RADIO_TEST_RESULT_IND" Array="data" Length="len"/>
<LengthRule Message="LL1_RADIO_TEST_RESULT_IND" Array="data" Length="len"/>
<LengthRule Message="LL1_RADIO_TEST_RF_RX_RSSI_CALI_LIST_IND"
Array="data" Length="len"/>
<LengthRule Message="LL1_RF_GAPS_LOG" Array="transition_type" Length="num_transitions"/>
<LengthRule Message="LL1_RF_GAPS_LOG" Array="transition_times" Length="num_transitions" IsVariable="true"/>
<!-- UICC driver / SIM logging. Uses dynamically sized messages, so IsVariable is set. -->
<LengthRule Message="UICC_DBG_ATR_IND" Array="data" Length="len" IsVariable="true"/>
<LengthRule Message="UICC_DBG_PPS_REQ" Array="data" Length="len" IsVariable="true"/>
<LengthRule Message="UICC_DBG_PPS_CNF" Array="data" Length="len" IsVariable="true"/>
<LengthRule Message="UICC_DBG_RX_IND" Array="data" Length="len" IsVariable="true"/>
<LengthRule Message="UICC_DBG_TX_REQ" Array="data" Length="len" IsVariable="true"/>
<LengthRule Message="USIM_DBG_SIM_RX" Array="data" Length="len" IsVariable="true"/>
<LengthRule Message="USIM_DBG_SIM_TX" Array="data" Length="len" IsVariable="true"/>
<!-- RRC Length Constraints. -->
<LengthRule Message="RRC_ECID_NCELL_MEAS_IND" Array="ecid_info[*]" Length="ecid_num"/>
<LengthRule Message="RRC_DBG_OTDOA_ASSISTANCE_DATA_PCELL" Array="nprs_info[*]" Length="num_of_nprs_carriers"/>
<LengthRule Message="RRC_DBG_OTDOA_ASSISTANCE_DATA_NCELL" Array="nprs_info[*]" Length="num_of_nprs_carriers"/>
<LengthRule Message="RRC_DBG_RESELECTION_CANDIDATES" Array="candidates[*]" Length="num_candidates"/>
<LengthRule Message="RRC_DBG_RESELECTION_CANDIDATES" Array="plmn[*]" Length="num_plmns"/>
<LengthRule Message="RRC_CELL_SELECT_REQ" Array="plmn_list[*]" Length="num_plmns"/>
<LengthRule Message="RRC_UPDATE_LISTS_REQ" Array="plmn_list[*]" Length="num_plmns"/>
<LengthRule Message="RRC_UPDATE_LISTS_REQ" Array="tai_list[*]" Length="num_tais"/>
<LengthRule Message="RRC_CELL_SELECT_REJ" Array="plmn_list[*]" Length="num_plmns"/>
<LengthRule Message="RRC_CELL_SELECT_IND" Array="plmn_list[*]" Length="num_plmns"/>
<LengthRule Message="RRC_CELL_SELECT_IND" Array="att_w_o_pdn_conn" Length="num_plmns"/>
<LengthRule Message="RRC_CELL_SELECT_CNF" Array="plmn_list[*]" Length="num_plmns"/>
<LengthRule Message="RRC_CELL_SELECT_CNF" Array="att_w_o_pdn_conn" Length="num_plmns"/>
<LengthRule Message="RRC_PLMN_SEARCH_CNF" Array="plmn_list[*]" Length="num_plmns"/>
<LengthRule Message="RRC_PLMN_SEARCH_IND" Array="plmn_list[*]" Length="num_plmns"/>
<LengthRule Message="RRC_PLMN_SEARCH_REJ" Array="plmn_list[*]" Length="num_plmns"/>
<LengthRule Message="RRC_SEARCH_ABORT_CNF" Array="plmn_list[*]" Length="num_plmns"/>
<LengthRule Message="RRC_NO_SERVICE_IND" Array="plmn_list[*]" Length="num_plmns"/>
<LengthRule Message="RRC_SET_PLMN_SEARCH_RANGE_REQ" Array="earfcns" Length="earfcn_len"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="params[*]" Length="num_prach_res"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="edt_tbs_info[*]" Length="num_rx_edt_tbs_info"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="edt_params[*]" Length="num_rx_edt_params"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="fmt2_params[*]" Length="num_rx_fmt2_params"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="fmt2edt_params[*]" Length="num_rx_fmt2edt_params"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="sib22.dl_config_list[*]" Length="sib22.num_dl_configs"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="sib22.ul_config_list[*]" Length="sib22.num_ul_configs"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="sib22.dl_mixed_mode_config_list[*]" Length="sib22.num_dl_mixed_mode_configs"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="sib22.ul_mixed_mode_config_list[*]" Length="sib22.num_ul_mixed_mode_configs"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="sib22.nprach_prob_anchor_list" Length="sib22.num_nprach_prob_anchors"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="sib23.ul_cfg[*]" Length="sib23.num_ul_cfgs"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="sib23.ul_cfg_mixed_mode[*]" Length="sib23.num_ul_cfgs_mixed_mode"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="nprach_fmt2[*]" Length="num_nprach_params"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="nprach_edt_fmt2[*]" Length="num_edt_nprach_params"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="nprach_param_list[*]" Length="num_nprach_params"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="edt_nprach_param_list[*]" Length="num_edt_nprach_params"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="params[*]" Length="num_prach_res"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="edt_tbs_info[*]" Length="num_prach_res"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="edt_params[*]" Length="num_prach_res"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="fmt2_params[*]" Length="num_prach_res"/>
<LengthRule Message="RRC_DBG_SIBS_DB" Array="fmt2edt_params[*]" Length="num_prach_res"/>
<!-- MONITOR Length Constraints. -->
<LengthRule Message="MONITOR_MEM_STATS_MESSAGE" Array="task_data[*]" Length="num_tasks" IsVariable="true"/>
<!-- Union Constraints -->
<!-- An empty option means that there is no unionised data for that selection. -->
<UnionRule Message="LL1_SIB1_READ_REQ" Union="deployment_cfg" Selector="mode">
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_INBAND" Option="in_diffpci"/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_INBAND_SAMEPCI" Option="in_samepci"/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_GUARDBAND" Option="guard"/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_STANDALONE" Option=""/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_UNKNOWN" Option=""/>
</UnionRule>
<UnionRule Message="LL1_BG_SIB1_READ_REQ" Union="deployment_cfg" Selector="mode">
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_INBAND" Option="in_diffpci"/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_INBAND_SAMEPCI" Option="in_samepci"/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_GUARDBAND" Option="guard"/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_STANDALONE" Option=""/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_UNKNOWN" Option=""/>
</UnionRule>
<UnionRule Message="LL1_SI_INFO_READ_REQ" Union="deployment_cfg" Selector="mode">
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_INBAND" Option="in_diffpci"/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_INBAND_SAMEPCI" Option="in_samepci"/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_GUARDBAND" Option="guard"/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_STANDALONE" Option=""/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_UNKNOWN" Option=""/>
</UnionRule>
<UnionRule Message="LL1_CONNECTED_CONFIG_REQ" Union="deployment_cfg" Selector="mode">
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_INBAND" Option="in_diffpci"/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_INBAND_SAMEPCI" Option="in_samepci"/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_GUARDBAND" Option="guard"/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_STANDALONE" Option=""/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_UNKNOWN" Option=""/>
</UnionRule>
<UnionRule Message="LL1_COMMON_NON_ANCHOR_INFO" Union="cfg_params" Selector="mode">
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_INBAND" Option="in_diffpci"/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_INBAND_SAMEPCI" Option="in_samepci"/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_GUARDBAND" Option=""/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_STANDALONE" Option=""/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_UNKNOWN" Option=""/>
</UnionRule>
<UnionRule Message="LL1_CONNECTED_CONFIG_REQ" Union="cfg_params" Selector="mode">
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_INBAND" Option="in_diffpci"/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_INBAND_SAMEPCI" Option="in_samepci"/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_GUARDBAND" Option=""/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_STANDALONE" Option=""/>
<UnionSelection Selection="LL1_DEPLOYMENT_MODE_UNKNOWN" Option=""/>
</UnionRule>
<!-- For the "action" field the union branch depends only on the message, and as the dest field will always be LAYER_LL1 for
these radiotest messages, the rules make UEMonitor display the d or u branch depending on the message.
LAYER_NAS is used as a non-matching value to hide the inactive union branch.
The rules need to be specified for each element separately,
but as normally only two DCIs are used this has only been done for first 2 of 8 elements. -->
<UnionRule Message="LL1_RADIO_TEST_DUAL_NPDSCH_RX" Union="LL1_RADIO_TEST_DUAL_NPDSCH_RX.dci_action[0].action" Selector="LL1_RADIO_TEST_DUAL_NPDSCH_RX.header.dest">
<UnionSelection Selection="LAYER_LL1" Option="d"/>
<UnionSelection Selection="LAYER_NAS" Option="u"/>
</UnionRule>
<UnionRule Message="LL1_RADIO_TEST_DUAL_NPDSCH_RX" Union="LL1_RADIO_TEST_DUAL_NPDSCH_RX.dci_action[1].action" Selector="LL1_RADIO_TEST_DUAL_NPDSCH_RX.header.dest">
<UnionSelection Selection="LAYER_LL1" Option="d"/>
<UnionSelection Selection="LAYER_NAS" Option="u"/>
</UnionRule>
<UnionRule Message="LL1_RADIO_TEST_DUAL_NPUSCH_TX" Union="LL1_RADIO_TEST_DUAL_NPUSCH_TX.dci_action[0].action" Selector="LL1_RADIO_TEST_DUAL_NPUSCH_TX.header.dest">
<UnionSelection Selection="LAYER_NAS" Option="d"/>
<UnionSelection Selection="LAYER_LL1" Option="u"/>
</UnionRule>
<UnionRule Message="LL1_RADIO_TEST_DUAL_NPUSCH_TX" Union="LL1_RADIO_TEST_DUAL_NPUSCH_TX.dci_action[1].action" Selector="LL1_RADIO_TEST_DUAL_NPUSCH_TX.header.dest">
<UnionSelection Selection="LAYER_NAS" Option="d"/>
<UnionSelection Selection="LAYER_LL1" Option="u"/>
</UnionRule>
<UnionRule Message="USIM_EF_UPDATE_REQ" Union="data" Selector="data_id">
<UnionSelection Selection="EPS_LOCI_USIM_DATA" Option="eps_loci"/>
<UnionSelection Selection="FPLMN_USIM_DATA" Option="fplmn_list"/>
<UnionSelection Selection="EPS_NAS_SECURITY_CONTEXT_USIM_DATA" Option="eps_nas_security_context"/>
<UnionSelection Selection="RPM_COUNTS_USIM_DATA" Option="rpm_counts"/>
</UnionRule>
<UnionRule Message="NAS_DBG_LOG_RPC_IND" Union="data" Selector="rpc_command">
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_ATTACH_STATUS_SET_RESULT_IND" Option="attach_status_set_result"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_CFUN_RESULT_IND" Option="cfun_result"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_CRING_IND" Option="cring_ind"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_CURRENT_TIME_IND" Option="current_time_ind"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_DOWNLINK_PACKET" Option="downlink_packet"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_EMM_ESM_ERROR_CODE_IND" Option="emm_error_code"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_GET_PLMN_RESULTS_IND" Option="get_plmn_results_ind"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_IP_INFO" Option="ip_info"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_NON_IP_DATA_SENT" Option="non_ip_data_sent"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_NONIP_RECVFROM" Option="nonip_recvfrom"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_PDP_ACT_OR_DEACT_RESULT_IND" Option="pdp_act_deact_result"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_PDP_MODIFY_RESULT" Option="pdp_modify_result"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_PIN_RESULT_IND" Option="pin_result_ind"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_PIN_STATUS_IND" Option="pin_status"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_PLMN_SELECT_RESULT_IND" Option="plmn_select_result"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_PSM_STATUS_IND" Option="psm_status"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_RADIO_COMMAND_ABORT_IND" Option="abort_result"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_REGISTRATION_STATUS_IND" Option="cereg_status"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_SERVICE_RECOVERY" Option="service_recovery"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_SMS_CMD_RESULT_IND" Option="sms_cmd_result_ind"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_SMS_CMT_PDU_IND" Option="sms_cmt_pdu_ind"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_SMS_MGS_RESULT_IND" Option="sms_mgs_result_ind"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_SOCKET_DATA_SENT" Option="socket_data_sent"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_UL_DATA_RESUME_IND" Option="ul_data_resume"/>
<UnionSelection Selection="PROTOCOL_TO_APPLICATION_UL_DATA_SUSPEND_IND" Option="ul_data_suspend"/>
</UnionRule>
<!-- Vaild (or "Present") Constraints -->
<!-- Association between a field and the matching 'present' flag. -->
<!-- LL1 Valid (or "Present") Constraints. -->
<ValidRule Message="LL1_BG_MIB_DATA_IND" Field="rsrp" Indicator="measurements_valid"/>
<ValidRule Message="LL1_BG_MIB_DATA_IND" Field="rsrq" Indicator="measurements_valid"/>
<ValidRule Message="LL1_MIB_DATA_IND" Field="rsrp" Indicator="measurements_valid"/>
<ValidRule Message="LL1_MIB_DATA_IND" Field="rsrq" Indicator="measurements_valid"/>
<ValidRule Message="LL1_BG_SIB1_DATA_IND" Field="rsrp" Indicator="measurements_valid"/>
<ValidRule Message="LL1_BG_SIB1_DATA_IND" Field="rsrq" Indicator="measurements_valid"/>
<ValidRule Message="LL1_SIB1_DATA_IND" Field="rsrp" Indicator="measurements_valid"/>
<ValidRule Message="LL1_SIB1_DATA_IND" Field="rsrq" Indicator="measurements_valid"/>
<ValidRule Message="LL1_CONNECTED_CONFIG_REQ" Field="cfg_params" Indicator="valid"/>
<ValidRule Message="LL1_CONNECTED_CONFIG_REQ" Field="offset_x2" Indicator="valid"/>
<ValidRule Message="LL1_CONNECTED_CONFIG_REQ" Field="earfcn" Indicator="valid"/>
<ValidRule Message="LL1_CARRIER_SEL_INFO" Field="offset_x2" Indicator="valid"/>
<ValidRule Message="LL1_CARRIER_SEL_INFO" Field="earfcn" Indicator="valid"/>
<ValidRule Message="LL1_IDLE_CONFIG_REQ" Field="offset_x2" Indicator="valid"/>
<ValidRule Message="LL1_IDLE_CONFIG_REQ" Field="earfcn" Indicator="valid"/>
<!-- Ideally for values of num_valid_subframes of 10 and 40 we would display 2 and 5 bytes of valid_subframes,
But rules don't offer that flexibility so we just suppress the valid_subframes field when num_valid_subframes is zero. -->
<ValidRule Message="LL1_COMMON_NON_ANCHOR_INFO" Field="valid_subframes" Indicator="num_valid_subframes"/>
<ValidRule Message="LL1_CONNECTED_CONFIG_REQ" Field="valid_subframes" Indicator="num_valid_subframes"/>
<ValidRule Message="LL1_IDLE_CONFIG_REQ" Field="valid_subframes" Indicator="num_valid_subframes"/>
<ValidRule Message="LL1_SI_INFO_READ_REQ" Field="valid_subframes" Indicator="num_valid_subframes"/>
<ValidRule Message="LL1_IDLE_CONFIG_REQ" Field="anchor_weight" Indicator="num_non_anchor_carriers"/>
<ValidRule Message="LL1_IDLE_CONFIG_REQ" Field="gap_cfg" Indicator="gap_cfg_present"/>
<ValidRule Message="LL1_IDLE_CONFIG_REQ" Field="p_max" Indicator="p_max_present"/>
<ValidRule Message="LL1_CONNECTED_CONFIG_REQ" Field="gap_cfg" Indicator="gap_cfg_present"/>
<ValidRule Message="LL1_CONNECTED_CONFIG_REQ" Field="p_max" Indicator="p_max_present"/>
<ValidRule Message="LL1_LOG_FREQ_ERROR_TIME_CONVERSION" Field="time_rtc_ticks" Indicator="reftime_is_valid"/>
<ValidRule Message="LL1_LOG_FREQ_ERROR_TIME_CONVERSION" Field="time_rf_ticks" Indicator="reftime_is_valid"/>
<ValidRule Message="LL1_LOG_FREQ_ERROR_TIME_CONVERSION" Field="frame_time" Indicator="reftime_is_valid"/>
<ValidRule Message="LL1_MSG3_CQI_REPORT" Field="num_reps_short" Indicator="short_cqi_used"/>
<ValidRule Message="LL1_OTDOA_LOCATION_INFO_IND" Field="ref_quality" Indicator="valid"/>
<ValidRule Message="LL1_OTDOA_LOCATION_INFO_IND" Field="measurement" Indicator="valid"/>
<ValidRule Message="LL1_RACH_NON_ANCHOR_INFO" Field="periodicity" Indicator="cfg_valid"/>
<ValidRule Message="LL1_RACH_NON_ANCHOR_INFO" Field="starting_subframe" Indicator="cfg_valid"/>
<ValidRule Message="LL1_RACH_NON_ANCHOR_INFO" Field="sub_carriers_offset" Indicator="cfg_valid"/>
<ValidRule Message="LL1_RACH_NON_ANCHOR_INFO" Field="num_sub_carriers" Indicator="cfg_valid"/>
<ValidRule Message="LL1_RACH_NON_ANCHOR_INFO" Field="mt_subcarrier_start_range" Indicator="cfg_valid"/>
<ValidRule Message="LL1_RACH_NON_ANCHOR_INFO" Field="num_repetitions_ra" Indicator="cfg_valid"/>
<ValidRule Message="LL1_RACH_NON_ANCHOR_INFO" Field="pdcch_start_subframe" Indicator="cfg_valid"/>
<ValidRule Message="LL1_RACH_NON_ANCHOR_INFO" Field="pdcch_offset_ra" Indicator="cfg_valid"/>
<ValidRule Message="LL1_RACH_NON_ANCHOR_INFO" Field="num_cbra_start_subcarriers" Indicator="cfg_valid"/>
<ValidRule Message="LL1_RACH_NON_ANCHOR_INFO" Field="npdcch_carrier_index" Indicator="cfg_valid"/>
<ValidRule Message="LL1_SI_INFO_READ_REQ" Field="valid_subframes" Indicator="num_valid_subframes"/>
<ValidRule Message="LL1_TIMING_ADVANCE_REQ" Field="ta" Indicator="timing_advance_ce"/>
<!-- RRC Valid (or "Present") Constraints. -->
<ValidRule Message="RRC_EST_REJ" Field="ext_wait_timer_value" Indicator="ext_wait_timer_value_present"/>
<ValidRule Message="RRC_ECID_NCELL_MEAS_IND" Field="global_cell_id" Indicator="global_cell_id_present"/>
<ValidRule Message="RRC_ECID_PCELL_MEAS_IND" Field="global_cell_id" Indicator="global_cell_id_present"/>
<ValidRule Message="RRC_DBG_RESELECTION_CANDIDATES" Field="cellid" Indicator="cellid_valid"/>
<ValidRule Message="RRC_DBG_RESELECTION_MEASUREMENTS" Field="relaxed_monitoring_met" Indicator="relaxed_monitoring_support"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="mib" Indicator="mib_valid"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="sib1" Indicator="sib1_valid"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="sib2" Indicator="sib2_valid"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="sib3" Indicator="sib3_valid"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="sib4" Indicator="sib4_valid"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="sib5" Indicator="sib5_valid"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="sib14" Indicator="sib14_valid"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="sib16" Indicator="sib16_valid"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="sib22" Indicator="sib22_valid"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="sib23" Indicator="sib23_valid"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="edt_tbs_info[*]" Indicator="edt_cfg_present"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="edt_params[*]" Indicator="edt_cfg_present"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="fmt2_params[*]" Indicator="fmt2_cfg_present"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="fmt2edt_params[*]" Indicator="fmt2_cfg_present"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="num_rx_edt_tbs_info" Indicator="edt_cfg_present"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="num_rx_edt_params" Indicator="edt_cfg_present"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="num_rx_fmt2_params" Indicator="fmt2_cfg_present"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="num_rx_fmt2edt_params" Indicator="fmt2_cfg_present"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="num_rx_fmt2edt_params" Indicator="edt_cfg_present"/>
<ValidRule Message="RRC_DBG_SIBS_DB" Field="edt_small_tbs_subset" Indicator="edt_cfg_present"/>
</Rules>
</RulesImport>

View File

@ -0,0 +1,396 @@
#!/usr/bin/env python3
# coding=utf-8
#===============================================================================
# @brief XML tools
# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd.
#===============================================================================
import ctypes
import sys
import inspect
import os
import re
from xml.etree import ElementTree
from xml.dom import minidom
sys.path.append(os.path.join("build", "script", "hdbxml_custom", "parse"))
import parse_msgdefs
def isStackmessage(id, core):
if (core in ['protocol_core']) and ((id >> 26) != 0x10):
return True
return False
def swap16(x):
return (((x << 8) & 0xFF00) |
((x >> 8) & 0x00FF))
def swap32(x):
return (((x << 24) & 0xFF000000) |
((x << 8) & 0x00FF0000) |
((x >> 8) & 0x0000FF00) |
((x >> 24) & 0x000000FF))
def getIdFromParts(core, msg_class, msg_module, msg_id):
return (((core << 30) & 0xC0000000) | ((msg_class << 29) & 0x20000000) | ((msg_module << 16) & 0x00FF0000) | (swap16(msg_id) & 0x0000FFFF))
def getIdForMessage(id, core):
if isStackmessage(id, core):
# A stack message needs to be dissasembled and put back together
msg_module = (((id) >> 24) & 0xFF)
msg_log = (((id) >> 21) & 0x1)
msg_verbosity = (((id) >> 22) & 0x3)
msg_id = (((id) & 0x3ff) | (msg_log << 13) | (msg_verbosity << 14))
messageIDOut = getIdFromParts(1, 1, msg_module, msg_id)
else:
# All other messages need their low two bytes swapped
messageIDOut = ((id) & 0xFFFF0000) | (((id) & 0x0000FF00) >> 8) | (((id) & 0x000000FF) << 8)
messageIDOut = swap32(messageIDOut)
return messageIDOut
def getFirmwareVersion():
versionfile = os.path.join("build_scons", "VERSION_STRING")
if os.path.exists(versionfile):
with open(versionfile) as f:
firmware_version = f.read().strip()
else:
# This can happen when the messagexml generation is used outside the build.
# The DSP build uses this via tools/scripts/messagesxml.bat
firmware_version = "UNKNOWN"
return firmware_version
# just used to include comments from rules files.
class CommentedTreeBuilder(ElementTree.TreeBuilder):
def __init__(self, *args, **kwargs):
super(CommentedTreeBuilder, self).__init__(*args, **kwargs)
def comment(self, data):
self.start(ElementTree.Comment, {})
self.data(data)
self.end(ElementTree.Comment)
class messageTree(object):
def __init__(self, distribution, firmware_version, coreName, imageName):
self.parser = ElementTree.XMLParser(target=CommentedTreeBuilder())
ElementTree.register_namespace("","http://tempuri.org/xmlDefinition.xsd" )
debugInformationAttributes = { \
'Distribution': distribution, \
'FirmwareVersion':firmware_version, \
'MulticoreLoggingSupported':"true", \
'SocXMLVersion':"2", \
'SequenceNumbersSupported':"true", \
'xmlns':"http://tempuri.org/xmlDefinition.xsd", \
}
if imageName in ['SEBoot', 'SERecovery', 'updater']:
isBootImage = 'true'
else:
isBootImage = 'false'
coreAttributes = { \
'CoreName': str(coreName), \
'ImageName': str(imageName), \
'BootImage': isBootImage, \
}
self.top = ElementTree.Element('DebugInformation', debugInformationAttributes)
self.tree = ElementTree.ElementTree(element=self.top, file=None)
loghdr = ElementTree.SubElement(self.top, 'CommonLogHeader', {'LogIndexMask': '0x0000001F'})
coreEntry = ElementTree.SubElement(self.top, 'Core', coreAttributes)
self.messages = ElementTree.SubElement(coreEntry, 'Messages')
self.structs_dict = ElementTree.SubElement(coreEntry, 'StructureDictionary')
self.enums_dict = ElementTree.SubElement(coreEntry, 'EnumsDictionary')
def addMessageHeader(self, messageEnumName, messageId, core, elemName):
messageAttributes = { \
'Name': messageEnumName, \
'MessageID': "0x"+str(hex(messageId))[2:].zfill(8), \
'Type': 'structure', \
}
if isStackmessage(messageId, core):
messageAttributes['MessageType'] = 'StackMessage'
message = ElementTree.SubElement(self.messages, "Message",messageAttributes)
return message
def addStructure(self, nodeTypeName, fieldElementType, elementSize):
structureAttributes = { \
'Type': nodeTypeName, \
'FieldType': fieldElementType, \
}
fieldEntry = ElementTree.SubElement(self.structs_dict, 'Structure', structureAttributes)
return fieldEntry
def structureInDictionary(self, structName):
found = False
for i in self.structs_dict:
nameEntry = i.attrib["Type"]
if structName == nameEntry:
found = True
return found
def addField(self, parent, fieldName, nodeTypeName, fieldElementType, elementSize, length, enumName):
fieldAttributes = { \
'FieldName': fieldName, \
'Type': nodeTypeName, \
'FieldType': fieldElementType, \
'Size': str(elementSize), \
'Length': str(length), \
}
if enumName is not None:
fieldAttributes['Enum'] = enumName
fieldSubEntry = ElementTree.SubElement(parent, 'Field', fieldAttributes)
return fieldSubEntry
def addEnum(self, enum_type_name, enumList):
found = False
for i in self.enums_dict:
nameEntry = i.find("Name").text
if enum_type_name == nameEntry:
found = True
if not found:
enumsEntry = ElementTree.SubElement(self.enums_dict, 'EnumsEntry')
enumName = ElementTree.SubElement(enumsEntry, 'Name')
enumName.text = enum_type_name
#enumsArray = ElementTree.SubElement(enumsEntry, 'Enums')
for name, val in enumList:
self.addEnumEntry(enumsEntry, name, val)
def addEnumEntry(self, parent, name, val):
enumAttributes = { \
'Name': name, \
'Value': str(val), \
}
enumValueEntry = ElementTree.SubElement(parent, 'Enum', enumAttributes)
def dump(self):
return ElementTree.dump(self.top)
def prettify(self, elem, encoding = 'utf-8'):
"""Return a pretty-printed XML string for the Element.
"""
initial_string = ElementTree.tostring(elem, encoding=encoding, method='xml')
reparsed_string = minidom.parseString(initial_string)
return reparsed_string.toprettyxml(indent=" ")
def write_xml_file (self, file, xml_root_element, xml_declaration=False, pretty_print=False, encoding='unicode', indent='\t'):
if xml_declaration:
file.write('<?xml version="1.0" encoding="utf-8" ?>')
pretty_printed_xml = self.prettify(xml_root_element, encoding = 'utf-8')
file.write(pretty_printed_xml)
def outputMessageTree(self, regexp, rulesfilename, outfilename):
if regexp:
matcher = re.compile(regexp)
# Filter out any messages we don't want to publish, then add the rules and write it out
internal_message_list = []
for message in self.messages:
name = message.attrib['Name']
internal = regexp and matcher.search(name) is not None
if internal:
internal_message_list.append(message)
for message in internal_message_list:
name = message.attrib['Name']
self.messages.remove(message)
if rulesfilename != None:
rules_data = ElementTree.parse(rulesfilename, self.parser)
if rules_data is None:
raise SystemExit('Error: failed to parse %s' % rulesfilename)
rules_root = rules_data.getroot()
if rules_root is None:
raise SystemExit('Error: failed to find root section in %s' % rulesfilename)
rulesEntry = self.top.find('Core')
if rulesEntry is None:
raise SystemExit('Error: failed to find "Core" section')
rulesEntry.extend(rules_root)
with open(outfilename, 'w') as outfile:
self.write_xml_file(outfile, self.top, xml_declaration=False, pretty_print=True, encoding='unicode', indent='\t')
# Taking some ctypes element, recursively analyse it, and build a tree of nodes representing it
def buildTree(xmlTree, message_fields, elem):
if hasattr(elem, "_fields_"):
for field in elem._fields_:
structAlreadyPopulated = False
current_message_fields = message_fields
fieldType = field[1]
arrayItemNamePostfix=''
# This is potentiallay a multi-dimensional array that must be descended into so do so until an actual type is encountered
while True:
# If this is an array there will be some kind of length
length = fieldType._length_ if hasattr(fieldType, "_length_") else 1
# This size includes all the different elements (if this is an array) or just the size of the single field if not
size = ctypes.sizeof(fieldType)
# Deduce the size of a single element
elementSize = size // length
# Pointers have a "contents" attribute
isPointer = hasattr(fieldType, "contents")
# Simple single dimension arrays can be handled using the length
isSomeKindOfArray = issubclass(fieldType, ctypes.Array)
if isSomeKindOfArray:
# This is some kind of array so get the element within the array - the fieldType from now onwards is within the array
fieldType = fieldType._type_
# Base types have no fields in their "type" (note - arrays of base types are considered to be base types)
isBaseType = not hasattr(fieldType, "_fields_")
isUnion = isinstance(fieldType, ctypes.Union)
isEnum = hasattr(fieldType, "members")
if isEnum:
for class_ in inspect.getmro(fieldType):
if issubclass(class_, ctypes._SimpleCData) and class_ is not fieldType:
fullTypeName = class_
break
else:
raise TypeError("Can't find a ctypes class to use for enum %s" % fieldType)
else:
fullTypeName = fieldType
# Extract a useful type name from the verbose name in CTypes
(junk, separator, fullTypeName) = str(fullTypeName).partition(".")
(fullTypeName, separator, junk) = fullTypeName.partition("'")
# Check to see if there are further array dimensions that need to be unwrapped and if not exit to actually
if not issubclass(fieldType, ctypes.Array):
break
# This is a multi-dimensional array so use a fake struct here to hold the next dimensionality
arrayItemNamePostfix='_item'
nodeTypeName = ''.join(["struct_", fullTypeName])
fieldEntry = xmlTree.addField(current_message_fields, field[0], nodeTypeName, 'struct', elementSize, length, enum_type_name)
# If the fake structure has already been populated then stop here
if xmlTree.structureInDictionary(nodeTypeName):
structAlreadyPopulated = True
break
# Add the fake struct definition and start populating it during the next iteration
current_message_fields = xmlTree.addStructure(nodeTypeName, 'struct', elementSize)
# Only need to do anything if a struct has not already been populated
if not structAlreadyPopulated:
# Now dealing with something that is not an array
(friendlyTypeName, separator, junk) = fullTypeName.partition("_Array_")
nodeTypeName = friendlyTypeName
if 'struct' in nodeTypeName and not isPointer:
fieldElementType = 'struct'
elif 'union' in nodeTypeName:
fieldElementType = 'union'
else:
fieldElementType = 'base'
if isEnum:
enum_type_name = inspect.getmro(fieldType)[0].__name__
xmlTree.addEnum(enum_type_name, sorted(fieldType.members.items()))
else:
enum_type_name = None
# write the message entry in all cases.
fieldEntry = xmlTree.addField(current_message_fields, field[0] + arrayItemNamePostfix, nodeTypeName, fieldElementType, elementSize, length, enum_type_name)
# if it's a structure add to structure dict etc, if not it's a base type and go to the next one
if fieldElementType == 'struct':
if not xmlTree.structureInDictionary(nodeTypeName):
fields_SubEntry = xmlTree.addStructure(nodeTypeName, fieldElementType, elementSize)
buildTree(xmlTree, fields_SubEntry, fieldType)
else:
if not isBaseType and not isPointer:
buildTree(xmlTree, fieldEntry, fieldType)
def xml_gen_main(outputBasepath, source, cfgfilename, core, image, rulesfilename):
messages = parse_msgdefs.parse_preprocessed_headers(source, core)
# Load the configuration file
with open(cfgfilename) as cfgfile:
if cfgfile == None:
raise SystemExit("Error: Could not find configuration file %s." % cfgfilename)
# Load the core
if core not in ['acore', 'protocol_core', 'security_core']:
raise SystemExit("Error: Invalid core %s." % core)
if rulesfilename is not None:
with open(rulesfilename) as rulesfile:
if rulesfile == None:
raise SystemExit("Error: Could not find rules file %s." %rulesfilename)
# List of filenames and regular expressions
if not os.path.isdir(outputBasepath):
# If given an output filename rather than base directory,
# strip off the filename and keep the path
outputBasepath = os.path.dirname(outputBasepath)
outputs = []
# Parse the pairs of filenames and regular expressions
for line in cfgfile.readlines():
if not line.startswith("#"): # Exclude comments
if line.strip() != "": # Exclude empty lines
# Format is: filename , regexp
distribution, filename, regexp = line.split(",", 2)
# Remove regexp whitespace
regexp = regexp.strip()
# Remove whitespace and add base path
filename = filename.strip()
filename = os.path.join(outputBasepath, filename)
outputs.append((distribution, filename, regexp))
firmware_version = getFirmwareVersion()
for distribution, outfilename, regexp in outputs:
#with messageTree(distribution, firmware_version, core) as xmlTree:
xmlTree = None
xmlTree = messageTree(distribution, firmware_version, core, image)
# And a list of message IDs already used
# (These should ideally be stored in a tree for scalable search speed, but the number of messages is small so the wasted time isn't a problem)
messageIdList = []
for messageEnumName, structname, messageId, struct in messages:
# If not a stack xml then convert the IDs to the log IDs
#
# if distribution != "stack":
# messageId = getIdForMessage(messageId, core)
fieldsEntry = xmlTree.addMessageHeader(messageEnumName, messageId, core, structname)
buildTree(xmlTree, fieldsEntry, struct)
xmlTree.outputMessageTree(regexp, rulesfilename, outfilename)
del xmlTree
if len(sys.argv) < 6:
raise SystemExit("Usage: python MessageXmlGen.py <ctypes_library> <output_dir> <configuration_file> <corename> <imagename> [<rules_file>]")
source = sys.argv[1]
outputBasepath = sys.argv[2]
cfgfilename = sys.argv[3]
corename = sys.argv[4]
imagename = sys.argv[5]
# Optional Rules File
if len(sys.argv) == 7:
rulesfilename = sys.argv[6]
else:
rulesfilename = None
# 删除.i文件中的#pragma预编译指令
with open(source, "rb+") as f:
write_lines = []
for line in f.readlines():
if not re.match("#pragma", line.decode("utf-8", errors="replace").strip()):
write_lines.append(line)
f.seek(0, 0)
f.truncate()
for line in write_lines:
f.write(line)
xml_gen_main(outputBasepath, source, cfgfilename, corename, imagename, rulesfilename)

View File

@ -0,0 +1,12 @@
# The format of the configuration file is:
# <filename>, <regular expression - signals matching the regex are EXCLUDED from the generated file>
# If the regular expression is blank, NO filtering will be performed.
#
# Lines starting # are not processed.
# Default for INTERNAL use only - NO messages are removed.
soc,acore_messages.xml,
# Customer facing file
customer,acore_messages_external.xml,

View File

@ -0,0 +1,16 @@
# The format of the configuration file is:
# <filename>, <regular expression - signals matching the regex are EXCLUDED from the generated file>
# If the regular expression is blank, NO filtering will be performed.
#
# Lines starting # are not processed.
# Default for INTERNAL use only - NO messages are removed.
soc,protocol_core_messages.xml,
# Stack messages - No stack ID to log ID conversions are performed for "stack"
stack,stack.xml,
# Customer facing file - REMOVE all DSP and RF related events.
customer,protocol_core_messages_external.xml,DSP|LL1_RF|LL1_WARNING_RF|LL1_LOG_RF|FSM|DUMP_PDU|LL1_LOG_DEBUG_VALUE|LPM_VETO|VALID_SUBFRAMES|SCHEDULER_SLEEP|TIME_CONVERSION|MEM_STATS|NPDCCH_CANCELLED|LL1_SLEEP_TIMER_EXPIRY_IND|FREQ_ERROR|LL1_READ_NVCONFIG_DATA

View File

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://tempuri.org/xmlDefinition.xsd" elementFormDefault="qualified" targetNamespace="http://tempuri.org/xmlDefinition.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="DebugInformation" type="tns:MessagesAndRules" />
<xs:complexType name="MessagesAndRules">
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="CommonLogHeader" nillable="true" type="tns:LogHeaderType" />
<xs:element minOccurs="1" maxOccurs="unbounded" name="Core" nillable="true" type="tns:ArrayOfCoresType" />
</xs:sequence>
<xs:attribute name="SequenceNumbersSupported" type="xs:boolean" />
<xs:attribute name="MulticoreLoggingSupported" type="xs:boolean" />
<xs:attribute name="FirmwareVersion" type="xs:string" />
<xs:attribute name="Distribution" type="xs:string" />
<xs:attribute name="SocXMLVersion" type="xs:integer" />
</xs:complexType>
<xs:element name="CommonLogHeader" type="tns:LogHeaderType" />
<xs:complexType name="LogHeaderType">
<xs:attribute name="LogIndexMask" type="xs:string" />
</xs:complexType>
<xs:element name="Core" type="tns:ArrayOfCoresType" />
<xs:complexType name="ArrayOfCoresType">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Messages" nillable="true" type="tns:ArrayOfMessagesType" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="StructureDictionary" nillable="true" type="tns:ArrayOfStructureType" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="EnumsDictionary" nillable="true" type="tns:ArrayOfEnumsType" />
<xs:element minOccurs="0" maxOccurs="1" name="Rules" nillable="true" type="tns:ArrayOfRulesTypes" />
</xs:sequence>
<xs:attribute name="CoreName" type="xs:string" />
<xs:attribute name="ImageName" type="xs:string" />
<xs:attribute name="BootImage" type="xs:boolean" />
</xs:complexType>
<xs:element name="Messages" type="tns:ArrayOfMessagesType" />
<xs:complexType name="ArrayOfMessagesType">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Message" nillable="true" type="tns:messageType" />
</xs:sequence>
</xs:complexType>
<xs:element name="StructureDictionary" type="tns:ArrayOfStructureType" />
<xs:complexType name="ArrayOfStructureType">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Structure" nillable="true" type="tns:structureType" />
</xs:sequence>
</xs:complexType>
<xs:element name="EnumsDictionary" type="tns:ArrayOfEnumsType" />
<xs:complexType name="ArrayOfEnumsType">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="EnumsEntry" nillable="true" type="tns:enumEntryType" />
</xs:sequence>
</xs:complexType>
<xs:element name="EnumsEntry" type="tns:enumEntryType" />
<xs:complexType name="enumEntryType">
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="Name" type="xs:string" />
<xs:element minOccurs="1" maxOccurs="unbounded" name="Enum" nillable="true" type="tns:enumType" />
</xs:sequence>
</xs:complexType>
<xs:element name="Message" type="tns:messageType" />
<xs:complexType name="messageType">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Field" type="tns:fieldType" />
</xs:sequence>
<xs:attribute name="Name" type="xs:string" />
<xs:attribute name="MessageID" type="xs:string" />
<xs:attribute name="MessageType" type="xs:string" />
<xs:attribute name="Type" type="xs:string" />
<xs:attribute name="Offset" type="xs:long" />
<xs:attribute name="Size" type="xs:long" />
<xs:attribute name="Length" type="xs:long" />
</xs:complexType>
<xs:element name="Structure" type="tns:structureType" />
<xs:complexType name="structureType" >
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Field" type="tns:fieldType" />
</xs:sequence>
<xs:attribute name="Type" type="xs:string" />
<xs:attribute name="FieldType" type="xs:string" />
<xs:attribute name="Size" type="xs:long" />
</xs:complexType>
<xs:element name="Field" type="tns:fieldType" />
<xs:complexType name="fieldType" >
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Field" type="tns:fieldType" />
</xs:sequence>
<xs:attribute name="FieldName" type="xs:string" />
<xs:attribute name="Type" type="xs:string" />
<xs:attribute name="FieldType" type="xs:string" />
<xs:attribute name="Offset" type="xs:long" />
<xs:attribute name="Size" type="xs:long" />
<xs:attribute name="Length" type="xs:long" />
<xs:attribute name="Enum" type="xs:string" />
</xs:complexType>
<xs:complexType name="ArrayOfFieldType">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Field" nillable="true" type="tns:fieldType" />
</xs:sequence>
</xs:complexType>
<xs:element name="Enum" type="tns:enumType" />
<xs:complexType name="enumType" >
<xs:attribute name="Name" type="xs:string" />
<xs:attribute name="Value" type="xs:long" />
</xs:complexType>
<xs:element name="Rules" type="tns:ArrayOfRulesTypes"/>
<xs:complexType name="ArrayOfRulesTypes">
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="LengthRule" type="tns:LengthRule" />
<xs:element name="UnionRule" type="tns:UnionRule" />
<xs:element name="ValidRule" type="tns:ValidRule" />
</xs:choice>
</xs:sequence>
</xs:complexType>
<xs:element name="LengthRule" type="tns:LengthRule"/>
<xs:complexType name="LengthRule" >
<xs:attribute name="Message" type="xs:string" />
<xs:attribute name="Array" type="xs:string" />
<xs:attribute name="Length" type="xs:string" />
<xs:attribute name="IsVariable" type="xs:boolean" default="false"/>
</xs:complexType>
<xs:element name="ValidRule" type="tns:ValidRule"/>
<xs:complexType name="ValidRule" >
<xs:attribute name="Message" type="xs:string" />
<xs:attribute name="Field" type="xs:string" />
<xs:attribute name="Indicator" type="xs:string" />
</xs:complexType>
<xs:element name="UnionRule" type="tns:UnionRule" />
<xs:complexType name="UnionRule" >
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="unbounded" name="UnionSelection" type="tns:UnionSelection" />
</xs:sequence>
<xs:attribute name="Message" type="xs:string" />
<xs:attribute name="Union" type="xs:string" />
<xs:attribute name="Selector" type="xs:string" />
</xs:complexType>
<xs:element name="UnionSelection" type="tns:UnionSelection"/>
<xs:complexType name="UnionSelection" >
<xs:attribute name="Selection" type="xs:string" />
<xs:attribute name="Option" type="xs:string" />
</xs:complexType>
</xs:schema>

View File

@ -0,0 +1,32 @@
#!/usr/bin/env python3
# coding=utf-8
#===============================================================================
# @brief Merge per-core messages xml files.
# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd.
#===============================================================================
# Note: The merged messages file must be written in a separate process to
# SCons to avoid file-in-use errors on Windows where the SCons python
# process fails to call CloseFile even though close() is called in python.
import os
import sys
from xml.etree import ElementTree
merged_messages_xml_filename = sys.argv[1]
messages_xml_list = sorted(sys.argv[2:])
def combine_messages_xml(files, output_file):
ElementTree.register_namespace("","http://tempuri.org/xmlDefinition.xsd" )
tree = ElementTree.parse(files[0])
root = tree.getroot()
for filename in files[1:]:
data = ElementTree.parse(filename).getroot()
core_data = data.findall("{http://tempuri.org/xmlDefinition.xsd}Core")
root.extend(core_data)
with open(output_file, 'wb') as output_file_handle:
tree.write(output_file_handle, encoding='utf-8', method='xml', xml_declaration=True)
combine_messages_xml(messages_xml_list, merged_messages_xml_filename)

View File

@ -0,0 +1,125 @@
function(messagexml TARGETDIR)
string(REPLACE "${CMAKE_SOURCE_DIR}/" "" RE_TARGETDIR ${TARGETDIR})
set(TARGET "${RE_TARGETDIR}/${CORE}_messages")
set(STACK_XML "${RE_TARGETDIR}/stack.xml")
set(MESSAGES_XML "${TARGET}.xml")
set(MESSAGES_EXTERNAL_XML "${TARGET}_external.xml")
set(MESSAGES_HFILE "${TARGET}.h")
set(MESSAGES_CPPFILE "${TARGET}.i")
set(MESSAGEXMLCONFIG ${CMAKE_SOURCE_DIR}/build/script/hdbxml_custom/MessageXmlGen/MessageXmlGen_${CORE}.cfg)
set(MESSAGERULES ${CMAKE_SOURCE_DIR}/build/script/hdbxml_custom/MessageXmlGen/MessageRules_${CORE}.xml)
if(EXISTS "${CMAKE_SOURCE_DIR}/${MESSAGES_HFILE}")
message(STATUS "REMOVE ${CMAKE_SOURCE_DIR}/${MESSAGES_HFILE}")
file(REMOVE "${CMAKE_SOURCE_DIR}/${MESSAGES_HFILE}")
endif()
list(LENGTH WANTED_HEADERS LI_LEN)
set(INDEX 1)
foreach(h_file ${WANTED_HEADERS})
string(REPLACE "${CMAKE_SOURCE_DIR}/" "" re_h_file ${h_file})
if (${INDEX} EQUAL ${LI_LEN})
file(APPEND ${MESSAGES_HFILE} "#include \"${re_h_file}\"")
else()
file(APPEND ${MESSAGES_HFILE} "#include \"${re_h_file}\"\n")
math(EXPR INDEX "${INDEX}+1")
endif()
endforeach()
set(XML_CPPINCFLAGS)
foreach(inc ${INCLUDES})
string(REPLACE "${CMAKE_SOURCE_DIR}/" "" re_inc ${inc})
list(APPEND XML_CPPINCFLAGS "-I${re_inc} ")
endforeach()
set(XML_CPPDEFFLAGS)
# 解析json时会给public_define添加-D前缀
foreach(def ${XML_DEFINES})
string(FIND "${def}" "-D" RET)
if(${RET} EQUAL 0)
list(APPEND XML_CPPDEFFLAGS "${def} ")
else()
list(APPEND XML_CPPDEFFLAGS "-D${def} ")
endif()
endforeach()
file(WRITE ${RE_TARGETDIR}/database_include.rsp ${XML_CPPINCFLAGS})
file(WRITE ${RE_TARGETDIR}/database_define.rsp ${XML_CPPDEFFLAGS})
execute_process(COMMAND ${CMAKE_C_COMPILER} -E @${RE_TARGETDIR}/database_include.rsp @${RE_TARGETDIR}/database_define.rsp ${MESSAGES_HFILE}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE RES
ERROR_VARIABLE ERR
OUTPUT_VARIABLE OUT)
if(NOT (${RES} EQUAL 0))
message(FATAL_ERROR "${ERR}")
endif()
set(MESSAGES_IFILE "${TARGETDIR}/${CORE}_messages.i")
if(EXISTS ${MESSAGES_IFILE})
file(REMOVE ${MESSAGES_IFILE})
endif()
file(APPEND ${MESSAGES_CPPFILE} "${OUT}")
message(STATUS ${Python3_EXECUTABLE})
message(STATUS "${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/build/script/hdbxml_custom/MessageXmlGen/MessageXmlGen.py ${MESSAGES_CPPFILE} ${MESSAGES_XML} ${MESSAGEXMLCONFIG} ${CORE} ${CORE} ${MESSAGERULES}")
execute_process(COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/build/script/hdbxml_custom/MessageXmlGen/MessageXmlGen.py ${MESSAGES_CPPFILE} ${MESSAGES_XML} ${MESSAGEXMLCONFIG} ${CORE} ${CORE} ${MESSAGERULES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE RES
ERROR_VARIABLE ERR
OUTPUT_VARIABLE OUT)
if(NOT (${RES} EQUAL 0))
message(FATAL_ERROR "${ERR}")
else()
message(STATUS "${OUT}")
endif()
# create_database()
endfunction()
function(messagexml_generate_defs)
set(SOURCE)
set(SOURCEPATHS)
foreach(h ${ALL_HEADERS})
get_filename_component(SOURCEPATH ${h} ABSOLUTE)
list(FIND SOURCEPATHS ${SOURCEPATH} RET)
if(${RET} EQUAL -1)
list(APPEND SOURCE ${h})
list(APPEND SOURCEPATHS ${SOURCEPATH})
endif()
endforeach()
set(WANTED_HEADERS)
foreach(h ${SOURCE})
get_filename_component(H_FILENAME ${h} NAME)
if((${H_FILENAME} STREQUAL "rf_log_messages.h") AND (${CORE} STREQUAL "acore"))
continue()
endif()
if((${H_FILENAME} MATCHES ".*_messages.h$") OR (${H_FILENAME} MATCHES ".*_if.h$") OR
(${H_FILENAME} MATCHES ".*_messages_internal.h$") OR (${H_FILENAME} MATCHES ".*_message.h$"))
list(APPEND WANTED_HEADERS ${h})
endif()
endforeach()
get_property(MSGDEF_HEADERS GLOBAL PROPERTY TARGET_MSGDEF_HEADERS)
foreach(fsm ${MSGDEF_HEADERS})
list(APPEND WANTED_HEADERS ${fsm})
endforeach()
# message(STATUS ${WANTED_HEADERS})
list(INSERT INCLUDES 0 ${MSGDEF_INCLUDES})
list(INSERT INCLUDES 0 ${MSGDEF_INCLUDES_DFX})
list(APPEND INCLUDES ${CMAKE_SOURCE_DIR})
list(APPEND INCLUDES ${CMAKE_SOURCE_DIR}/kernel/liteos/liteos_v208.6.0_b017_cat1/Huawei_LiteOS/platform/libsec/include)
set(XML_DEFINES ${ALL_DEFINES})
list(APPEND XML_DEFINES "SOC_DO_NOT_PACK_STRUCTS")
messagexml("${PROJECT_BINARY_DIR}")
endfunction()
function(build_xml)
set(MSGDEF_INCLUDES "protocol/${CHIP}/include/message_headers/msgdef")
set(MSGDEF_INCLUDES_DFX "protocol/${CHIP}/include/message_headers/include")
set(ALL_HEADERS)
set(INCLUDES ${ALL_HEADER_DIRS})
foreach(p ${INCLUDES})
file(GLOB HEADERS "${p}/*.h")
foreach(h ${HEADERS})
list(APPEND ALL_HEADERS ${h})
endforeach()
endforeach()
messagexml_generate_defs()
endfunction()

View File

@ -0,0 +1,41 @@
#include "base_datatype_def.txt"
typedef enum {
SOC_DUMP_ACORE_CRASH_MEMORY = DUMP_TYPE_CRASH_MEMORY | (APPS << 8),
SOC_DUMP_PCORE_CRASH_MEMORY = DUMP_TYPE_CRASH_MEMORY | (PROTOCOL << 8),
} soc_dump_id;
typedef struct {
osal_u32 attribute;
osal_u32 dump_id; /* soc_dump_id */
} soc_dump_info_req;
typedef struct {
osal_u32 cmd_ver;
osal_u32 dump_id; /* soc_dump_id */
osal_u32 ret;
osal_u32 size;
osal_u32 pad;
} soc_dump_info_ind;
typedef struct {
osal_u32 offser;
osal_u32 size;
} soc_dump_content_item;
typedef struct {
osal_u32 cmd_ver;
osal_u32 dump_id; /* soc_dump_id */
osal_u8 item_cnt;
soc_dump_content_item items[0];
} soc_dump_content_req;
typedef struct {
osal_u32 cmd_ver;
osal_u32 dump_id; /* soc_dump_id */
osal_u32 ret;
osal_u32 offset;
osal_u32 size;
osal_u32 data[0];
} soc_dump_content_ind;

View File

@ -0,0 +1,69 @@
uint32_t 32 0
uint16_t 16 0
uint8_t 8 0
int32_t 32 1
int16_t 16 1
int8_t 8 1
enum 32 0
HSO_ENUM 32 0
u32 32 0
u16 16 0
u8 8 0
s32 32 1
s16 16 1
s8 8 1
BOOL 8 0
TD_U8A 8 0
TD_U16A 16 0
TD_CHARTA 8 1 1
TD_U32 32 0
TD_U16 16 0
TD_U8 8 0
TD_S32 32 1
TD_S16 16 1
TD_S8 8 1
TD_BOOL 8 0
TD_CHAR 8 1 1
char 8 1 1
long 32 1
TD_PVOID 32 0
TD_PBYTE 32 0
td_u32 32 0
td_u16 16 0
td_u8 8 0
td_s32 32 1
td_s16 16 1
td_s8 8 1
td_bool 8 0
td_char 8 1 1
td_pvoid 32 0
td_pbyte 32 0
uintptr_t 32 0
td_u64 64 0
td_uintptr_t 32 0
td_void 32 0
c_ubyte 8 0
c_bool 8 0
c_byte 8 1
c_char 8 1 1
c_ushort 16 0
c_short 16 1
c_ulong 32 0
c_uint 32 0
c_int 32 1
LP_c_ubyte 32 0
LP_c_ulong 32 0
c_long 32 1
c_void_p 32 0
c_ulonglong 64 0

View File

@ -0,0 +1,8 @@
#include "base_datatype_def.txt"

View File

@ -0,0 +1,4 @@
#include "base_datatype_def.txt"
#include "extern_datatype_def.txt"

View File

@ -0,0 +1,13 @@
#include "base_datatype_def.txt"
typedef struct {
} null_stru;

View File

@ -0,0 +1,7 @@
#include "base_datatype_def.txt"

View File

@ -0,0 +1,6 @@
#include "base_datatype_def.txt"

View File

@ -0,0 +1,67 @@
#include "base_datatype_def.txt"
typedef struct {
} null_stru;
typedef struct {
char str[1];
} str_type;
typedef struct {
long data[2];
} s32_array_2_stru;
typedef struct {
long data[3];
} s32_array_3_stru;
typedef struct {
long data[4];
} s32_array_4_stru;
typedef struct {
long data[5];
} s32_array_5_stru;
typedef struct {
long data[6];
} s32_array_6_stru;
typedef struct {
osal_u32 data[2];
} u32_array_2_stru;
typedef struct {
unsigned long data[3];
} u32_array_3_stru;
typedef struct {
osal_u32 data[4];
} u32_array_4_stru;
typedef struct {
char str[128];
} file_type;
typedef struct {
char str[1];
} dump_data_stru;
typedef struct {
char str[1];
} dump_hex_stru;
typedef struct {
osal_u32 baud_rate;
osal_u8 data_bits;
osal_u8 stop_bits;
osal_u8 parity;
osal_u8 pad;
} soc_uart_attr;

View File

@ -0,0 +1,761 @@
#include "base_datatype_def.txt"
typedef struct {
} null_stru;
typedef struct
{
osal_u32 id;
} SOC_DBG_STAT_Q_S;
typedef struct {
osal_u8 a;
osal_u8 b;
} soc_stat_diag_p_qry;
typedef struct {
osal_u16 send_uart_fail_cnt;
osal_u16 ack_ind_malloc_fail_cnt;
osal_u16 msg_malloc_fail_cnt;
osal_u16 msg_send_fail_cnt;
osal_u16 msg_overbig_cnt;
osal_u16 ind_send_fail_cnt;
osal_u16 ind_malloc_fail_cnt;
osal_u8 diag_queue_used_cnt;
osal_u8 diag_queue_total_cnt;
osal_u8 dec_fail_cnt;
osal_u8 enc_fail_cnt;
osal_u16 pkt_size_err_cnt;
osal_u32 local_req_cnt;
osal_u32 remote_req_cnt;
osal_u16 req_cache_overflow_cnt;
osal_u8 conn_excep_cnt;
osal_u8 conn_bu_cnt;
osal_u8 chl_busy_cnt;
osal_u8 req_overbig1_cnt;
osal_u16 rx_remote_req_cnt;
osal_u16 rx_remote_req_invalid_cnt;
osal_u8 cmd_list_total_cnt;
osal_u8 cmd_list_used_cnt;
osal_u8 stat_list_total_cnt;
osal_u8 stat_list_used_cnt;
osal_u8 req_overbig2_cnt;
osal_u8 invalid_dec_id;
osal_u8 heart_beat_timeout_cnt;
osal_u8 rx_start_flag_wrong_cnt;
osal_u8 rx_ver_wrong_cnt;
osal_u8 rx_pkt_data_size_wrong_cnt;
osal_u8 rx_crc16_req_wrong_cnt;
osal_u8 rx_crc16_mux_wrong_cnt;
osal_u8 pad[2];
} soc_stat_diag_qry;
typedef struct tag_atiny_critical_information {
osal_u16 network_access_count_total;
osal_u16 bs_reg_retry_count_total[3];
osal_u16 reg_retry_count_total[3];
osal_u16 send_data_last_mid;
osal_u16 recv_data_last_mid;
osal_u32 send_data_total;
osal_u32 recv_data_total;
} atiny_critical_information;
typedef struct tag_atiny_platform_state {
osal_u8 context_state[3];
osal_u8 lwm2m_state[3];
osal_u8 bootstrap_state[3];
osal_u8 dtls_state[3];
} atiny_platform_state;
typedef struct tag_atiny_retrans_data {
osal_u32 mid[9];
osal_u8 retrans_count[9];
osal_u8 dtls_retrans_count[3];
} atiny_retrans_data;
typedef struct tag_atiny_ota_data {
osal_u16 req_fota_block_size;
osal_bool force_suspend_firmware;
osal_bool sota_update_flag;
} atiny_ota_data;
typedef struct tag_atiny_retry_counter {
osal_u8 bs_reg_retry_count_current[3];
osal_u8 reg_retry_count_current[3];
} atiny_retry_counter;
typedef struct {
osal_u16 cmd_cnt;
osal_u16 evt_cnt;
osal_u16 cmd_opcode[10];
osal_u32 cmd_time_stamp[10];
osal_u16 evt_opcode[10];
osal_u32 evt_time_stamp[10];
osal_u8 evt_status[10];
} tl_dfx_stru;
typedef struct {
osal_u32 sleep_cnt;
osal_u32 wakeup_cnt;
osal_u32 ble_int_mask;
osal_u32 adv_miss_cnt;
osal_u32 idx;
osal_u32 wakeup_finetarget[10];
osal_u32 ble_finetarget[10];
osal_u32 ble_grosstarget[10];
osal_u32 wakeup_end_clkn[10];
} bt_sleep_dfx;
typedef struct {
osal_bool en_print_period;
osal_u32 ds_proc_times;
osal_u32 ds_wake_times;
osal_u32 lp3_ds_times;
osal_u32 n_ds_kick_reson;
osal_u32 n_ds_os_schedule;
osal_u32 n_ds_veto_reson[29];
osal_u32 stat_end;
} soc_lpc_stat_a;
typedef struct {
osal_bool en_print_period;
osal_u32 ds_proc_times;
osal_u32 ds_wake_times;
osal_u32 lp3_ds_times;
osal_u32 n_ds_kick_reson;
osal_u32 n_ds_os_schedule;
osal_u32 n_ds_veto_reson[12];
osal_u32 stat_end;
} soc_lpc_stat_p;
typedef struct {
osal_bool backup_watchdog;
osal_bool enable;
osal_u32 ds_os_schedule_tick;
osal_u32 ds_veto;
osal_u32 clk_veto;
c_ulonglong clk_permit_ms;
c_ulonglong ds_permit_ms;
osal_u32 g_restore_funcs[29];
osal_u32 g_restore_param[29];
osal_u32 g_check_funcs[29];
osal_u32 g_check_param[29];
osal_u32 veto_lp3;
osal_u32 en_magic;
osal_u32 en_idle_time;
osal_u32 en_no_action_time;
} soc_lpc_process_ctrl_a_s;
typedef struct {
osal_bool backup_watchdog;
osal_bool enable;
osal_u32 ds_os_schedule_tick;
osal_u32 ds_veto;
osal_u32 clk_veto;
c_ulonglong clk_permit_ms;
c_ulonglong ds_permit_ms;
osal_u32 g_restore_funcs[12];
osal_u32 g_restore_param[12];
osal_u32 g_check_funcs[12];
osal_u32 g_check_param[12];
osal_u32 veto_lp3;
osal_u32 en_magic;
osal_u32 en_idle_time;
osal_u32 en_no_action_time;
} soc_lpc_process_ctrl_s;
typedef struct {
osal_u32 total;
osal_u32 used;
osal_u32 free;
osal_u32 free_node_num;
osal_u32 used_node_num;
osal_u32 max_free_node_size;
osal_u32 malloc_fail_count;
osal_u32 peek_size;
} soc_mem_info;
typedef struct {
osal_u32 will_ds_times;
osal_u32 real_ds_times;
osal_u32 nds_kick_times;
osal_u32 ds_veto;
osal_u32 lpc_max_id;
osal_u32 real_lp3_times;
osal_u32 lp3_veto;
c_ulonglong ds_permit_ms;
} soc_lpc_info;
typedef struct {
osal_u32 dfx_write_cnt;
osal_u32 dfx_read_cnt;
osal_u32 dfx_writed_cnt;
osal_u32 dfx_readed_cnt;
osal_u8 deinit_fail_times;
osal_u8 pad[3];
osal_u32 tx_mux;
} diag_uart_driver_extra;
typedef struct {
osal_u8 timer_usage;
osal_u8 task_usage;
osal_u8 sem_usage;
osal_u8 queue_usage;
osal_u8 mux_usage;
osal_u8 pad[3];
osal_u32 err_info;
} soc_os_resource_use_stat_s;
typedef struct {
osal_bool valid;
osal_bool last;
osal_u32 crash_sec;
osal_u32 main_type;
osal_u32 sub_type;
osal_u32 core;
osal_u32 data[5];
osal_u32 mepc;
osal_u32 mstatus;
osal_u32 mtval;
osal_u32 mcause;
osal_u32 ccause;
osal_u32 ra;
osal_u32 sp;
osal_u32 mem_total;
osal_u32 mem_used;
osal_u32 mem_free;
osal_u32 mem_peek_size;
} diag_syserr_info;
typedef enum {
AT_CMD_EXECUTE_SET,
AT_CMD_EXECUTE_READ,
AT_CMD_EXECUTE_EXEC,
AT_CMD_EXECUTE_TEST,
} at_cmd_execute_type;
typedef struct {
osal_u8 cmd_id;
at_cmd_execute_type type;
} at_cmd_record;
typedef struct {
at_cmd_record last_at_cmd_record;
osal_bool at_cmd_in_progress;
osal_u16 app_data_of_bytes;
osal_u16 async_list_node_count;
osal_u16 reboot_reset_reason;
} report_at_stat;
typedef struct {
osal_u8 psm_status;
osal_u8 psm_enter_action;
osal_u8 psm_exit_action;
osal_bool as_deactivating_pover_save;
osal_bool psm_enhance;
} mmc_psm_mng_t_report;
typedef struct {
osal_u8 sim_present_status;
osal_u8 ps_reg_status;
mmc_psm_mng_t_report psm_mng_info;
osal_bool user_reselection_in_progress;
osal_bool switch_off_pending;
osal_bool force_power_off;
} mmc_mml_context_report;
typedef struct {
osal_u8 spec_plmn_search_state;
osal_u8 as_cell_camp_on;
osal_u8 selection_mode;
osal_bool is_first_search;
osal_bool is_stored_search;
osal_bool is_need_deep_search;
osal_bool out_of_service;
osal_bool is_need_abort_rsp;
osal_u8 select_plmn[3];
osal_u8 user_spec_plmn_id[3];
osal_u8 user_reselect_plmn_id[3];
osal_u16 plmn_search_time_out_count;
osal_u16 stored_search_max_count;
osal_u16 stored_search_count;
osal_u8 search_cause;
osal_u8 abort_cause;
osal_u8 coverage_state;
osal_u8 ps_reg_additional_action;
} mmc_plmn_search_report;
typedef struct {
mmc_plmn_search_report plmn_search_ctrl;
osal_u8 attach_pending;
osal_bool attach_locked;
osal_u8 detach_pending;
osal_bool plmn_search_in_progress;
osal_bool bg_search_in_progress;
osal_bool only_forbidden_plmns_found;
osal_bool cell_available;
osal_u32 search_period;
osal_bool user_plmn_search_req_pending;
osal_bool plmn_search_may_be_resumed;
} mmc_context_ctrl_info_report;
typedef struct {
osal_u8 sim_state;
osal_u8 autostart_state;
osal_u8 reg_state;
} at_info_report;
typedef struct {
osal_bool nslpi;
osal_bool need_reattach;
osal_bool is_cplane_cntx;
osal_u8 cid;
osal_u8 ebi;
osal_u8 h_comp;
osal_u8 trigger;
osal_u8 ul_data_route;
osal_bool t3396_is_running;
osal_u32 pdp_fsm_contx_state;
} taf_pdp_cntx_report;
typedef struct {
osal_u8 ps_status;
osal_u8 service_status;
osal_u8 plmn_eps_max;
osal_u8 plmn[3];
} esm_ctx_t_report;
typedef struct {
osal_bool enabled;
osal_u8 f[4];
osal_u8 c_pdn[4];
} esm_rpm_param;
typedef struct {
esm_ctx_t_report ctx;
osal_u8 def_pdn_cid;
osal_u8 attach_cid;
osal_u8 pdn_num;
osal_u8 eps_num;
osal_u8 pti_num;
osal_u16 data_num;
osal_u16 excpt_num;
osal_u16 ping_num;
osal_u16 wait_cnf_num;
osal_u8 current_state;
esm_rpm_param rpm_param;
} esm_entry_report;
typedef struct {
osal_u8 attach_type;
osal_bool reg_without_pdn;
osal_u8 camped_type;
osal_bool roaming;
osal_u8 attempt_count;
osal_u8 attach_complete_count;
} emm_attach_report;
typedef struct {
osal_u8 detach_mode;
osal_bool detach_req_send_succ;
osal_u8 detach_atmp_cnt;
osal_u8 cause;
} emm_detach_report;
typedef struct {
osal_bool enabled;
osal_u8 n1;
osal_u8 t1;
osal_u8 c_br_1;
osal_u8 c_r_1;
osal_u8 cur_n1_count;
}emm_rpm_ctrl_data;
typedef struct {
osal_u8 ksiasme;
osal_u32 ul_nas_count;
osal_u32 dl_nas_count;
osal_u32 fail_times;
osal_u8 integrity_check_fail_times;
} emm_secu_report;
typedef struct {
osal_u8 ser_start_cause;
osal_u8 est_cause;
osal_bool data_valid;
osal_u8 attempt_count;
osal_bool start_in_conn;
} emm_ser_report;
typedef struct {
osal_u8 emm_tau_type;
osal_u8 tau_start_cause;
osal_u8 tau_attempt_cnt;
osal_bool idle_tau;
osal_bool active_flag;
osal_bool signalling_active_flag;
osal_bool t3412_expired;
osal_u8 param_changes;
osal_bool settings_synced;
osal_u8 trigger_tau_rrc_rel;
osal_bool local_bearer_deactivation;
osal_bool wait_as_camp_on;
} emm_tau_report;
typedef struct {
osal_u8 as_state;
osal_u8 drb_status;
osal_u8 sim_stat;
osal_u8 ps_sim_validity;
} emm_pub_info_report;
typedef struct {
osal_u8 bar_attempt_counter;
osal_u16 bar_req_cause_mask;
osal_u8 bar_rel_action;
} emm_bar_rel_timer_info;
typedef struct {
osal_bool low_priority_flag;
osal_bool exception_flag;
osal_u8 backoff_plmn[3];
osal_u32 start_time;
osal_u8 expiry_action;
} emm_backoff_timer_info;
typedef struct {
osal_u8 emm_main_state;
osal_u8 emm_sub_state;
osal_u8 secu_main_state;
osal_u8 secu_sub_state;
osal_u8 msg_buff_count;
osal_u8 rrc_conn_state;
} emm_main_context_report;
typedef struct {
osal_u32 usim_update_count;
osal_u32 usim_cur_state;
osal_u32 usim_deactive_cause;
osal_u32 pres_timer_status;
osal_u32 sleep_veto_active;
osal_u32 usim_ind_status;
} usim_info_report;
typedef struct {
mmc_mml_context_report mmc_mml_ctx;
mmc_context_ctrl_info_report mmc_context;
at_info_report at_info;
taf_pdp_cntx_report taf_pdp_cntx[11];
esm_entry_report esm_entry;
emm_attach_report emm_attach;
emm_detach_report emm_detach;
emm_rpm_ctrl_data emm_rpm;
emm_secu_report emm_secu;
emm_ser_report emm_ser;
emm_tau_report emm_tau;
emm_pub_info_report emm_pub_info;
osal_u8 emm_t3440_rel_cau;
emm_bar_rel_timer_info emm_bar_rel_timer;
emm_backoff_timer_info emm_backoff_timer;
emm_main_context_report emm_main_context;
usim_info_report usim_info;
} report_nas_stat;
typedef osal_u32 secnds;
typedef struct {
osal_s8 default_s_search_delta_p;
} nb_iot_relaxed_monitoring_config_t;
typedef struct {
osal_s8 meas_threshold_sinr_db;
osal_s8 meas_offset_sinr_db;
osal_u8 max_sinr_enable_times;
osal_u8 max_sinr_disable_times;
} nb_iot_sinr_meas_control_config_t;
typedef struct {
osal_bool reselection_enabled;
osal_u8 resel_min_coverage_level;
osal_s8 srxlev_meas_disable_hyst_db;
osal_bool relaxed_monitoring_enabled;
nb_iot_relaxed_monitoring_config_t relaxed_monitoring_config;
osal_bool sinr_meas_control_enabled;
nb_iot_sinr_meas_control_config_t sinr_meas_control_config;
} nb_iot_cell_reselection_config_t;
typedef struct {
osal_u8 max_pcell_mib_sib_attempt_counter;
osal_u8 max_ncell_mib_sib_attempt_counter;
osal_u16 band_scan_puncture_rate;
osal_s32 fast_search_threshold;
osal_s32 slow_search_threshold;
secnds data_inactivity_timeout;
secnds sib16_read_period_s;
nb_iot_cell_reselection_config_t cell_reselection_config;
osal_bool serving_cell_idle_meas_report_enabled;
osal_bool multi_carrier_enabled;
osal_bool early_contention_resolution_report_enabled;
} rrc_nvconfig_info_t;
typedef enum {
RRC_BAR_CAUSE_CELL_SELECTION,
RRC_BAR_CAUSE_CELL_RESELECTION
} rrc_barred_cause;
typedef enum {
TRANS_OUT_OF_CONNECTED_STATE,
SERVING_CELL_LOST_TRANS_TO_SEARCH,
IDLE_STATE_TRANS_TO_SEARCH,
REESTAB_SERVING_CELL_LOST_TRANS_TO_SEARCH,
REESTAB_ABORT_CONTINUE_SEARCH,
} rrc_oos_cause;
typedef struct {
osal_u16 est_fail_count;
osal_u16 asn_decode_fail_count;
osal_u16 asn_encode_fail_count;
osal_u16 reselect_count;
osal_u16 search_count;
osal_u32 last_search_start_time;
osal_u32 last_search_time;
osal_u32 search_avg_time;
rrc_barred_cause last_bar_cause;
rrc_oos_cause last_oos_cause;
} rrc_debug_info_t;
typedef enum {
RRC_TOP_FSM_STATE_SEARCH,
RRC_TOP_FSM_STATE_DEACTIVATED,
RRC_TOP_FSM_STATE_IDLE,
RRC_TOP_FSM_STATE_CONNECTED,
RRC_TOP_FSM_STATE_CONNECTING,
RRC_TOP_FSM_STATE_REESTAB,
RRC_TOP_FSM_STATE_NULL,
MAX_NUM_TOP_FSM_STATES
} rrc_top_fsm_state_t;
typedef struct {
rrc_nvconfig_info_t rrc_nvcfg;
rrc_debug_info_t rrc_debug_info;
rrc_top_fsm_state_t rrc_current_state;
rrc_top_fsm_state_t rrc_next_state;
osal_u32 rrc_last_msg_id;
/* g_rrc_ctxt */
osal_bool rrc_cell_select_req_running;
osal_bool ll1_l2_deactivated;
osal_bool bg_search_active;
osal_bool as_security_active;
} report_rrc_stat;
typedef osal_u32 sf_count;
typedef struct {
/* mac_l2_context */
osal_u16 crnti;
osal_bool rai_activation;
} report_mac_ul_stat;
typedef enum {
RLC_DL_FSM_STATE_ACTIVATED,
RLC_DL_FSM_STATE_INITIALISED,
RLC_DL_FSM_STATE_SUSPENDED,
} rlc_dl_fsm_state_t;
typedef struct {
rlc_dl_fsm_state_t rlc_dl_fsm[5];
} report_rlc_dl_stat;
typedef osal_u16 l2_size;
typedef enum {
RLC_UL_FSM_STATE_ACTIVATED,
RLC_UL_FSM_STATE_INITIALISED,
RLC_UL_FSM_STATE_SUSPENDED,
} rlc_ul_fsm_state_t;
typedef struct {
rlc_ul_fsm_state_t rlc_ul_fsm[5];
/* rlc_ul_buffer_status */
l2_size srb0_datalen;
osal_u16 rlc_ul_byte_without_poll[4];
osal_u16 rlc_ul_pdu_num_without_poll[4];
} report_rlc_ul_stat;
typedef struct {
osal_u32 cipher_decipher_failure_count;
osal_u32 intefrity_check_failure_count;
} security_debug_info_t;
typedef enum {
PDCP_SRB_FSM_STATE_FIRST_PDU_RECEIVED,
PDCP_SRB_FSM_STATE_IDLE,
PDCP_SRB_FSM_STATE_INTEGRITY_CHECKED,
PDCP_SRB_FSM_STATE_INTEGRITY_FAILED,
PDCP_SRB_FSM_STATE_READ_INTEGRITY_CHECK_STATUS,
PDCP_SRB_FSM_STATE_REESTABLISHED,
PDCP_SRB_FSM_STATE_SECURED,
PDCP_SRB_FSM_STATE_SUSPENDED,
} pdcp_srb_fsm_state_t;
typedef enum {
PDCP_DRB_FSM_STATE_CIPHERED,
PDCP_DRB_FSM_STATE_REESTABLISHED,
PDCP_DRB_FSM_STATE_SUSPENDED,
PDCP_DRB_FSM_STATE_UNINITIALISED,
} pdcp_drb_fsm_state_t;
typedef struct {
pdcp_srb_fsm_state_t pdcp_srb_fsm[1];
pdcp_drb_fsm_state_t pdcp_drb_fsm[1];
security_debug_info_t security_debug_info;
} report_pdcp_stat;
typedef struct {
osal_u16 direct_ind_rx_count;
osal_u16 paging_rx_count;
osal_u16 missed_paging_count;
osal_u16 missed_paging_opportunity;
} report_paging_stat;
typedef struct {
osal_u16 rar_fail_count;
osal_u16 contention_resolution_fail_count;
osal_u16 rach_fail_count;
} report_rach_stat;
typedef struct {
osal_u16 nack_pdu;
osal_u16 total_pdu;
osal_u32 rate;
} mac_uldl_stat;
typedef struct {
mac_uldl_stat ul;
mac_uldl_stat dl;
} report_mac_trans_stat;
typedef osal_u32 nb_iot_earfcn;
typedef osal_s16 centibels;
typedef enum {
LL1_NULL,
LL1_INIT,
LL1_CELL_SEARCH,
LL1_IDLE,
LL1_CONNECTED,
LL1_RADIO_TEST,
} ll1_states;
typedef struct {
nb_iot_earfcn earfcn;
osal_u16 pci;
osal_u16 rsrp;
osal_u16 snr;
} report_signal_stat;
typedef struct {
ll1_states current_state;
ll1_states previous_state;
} report_fsm_state;
typedef enum {
LL1_ERROR_TAG_DSP_COMPLETION_IGNORED_TX,
LL1_ERROR_TAG_DSP_COMPLETION_IGNORED_RX,
LL1_ERROR_TAG_MSG_DROPPED_NOT_INTER_THREAD,
LL1_ERROR_TAG_MSG_DROPPED_NOT_INTER_THREAD_IDLE,
LL1_ERROR_TAG_PDCCH_ORDER_NPRACH_REPETITION_NUMBER_INDEX_TOO_LARGE,
LL1_ERROR_TAG_UNKNOWN_STATE,
LL1_ERROR_TAG_UNKNOWN_EVENT,
LL1_ERROR_TAG_INVALID_PRACH_NUM_REP_PER_PREAMBLE,
LL1_ERROR_TAG_INVALID_RNTI_TYPE,
LL1_ERROR_TAG_INVALID_RNTI_TYPE_PDSCH,
LL1_ERROR_TAG_INVALID_DCI_FORMAT_DELAY,
LL1_ERROR_TAG_INVALID_DCI_FORMAT_LOG,
LL1_ERROR_TAG_INVALID_DCI_FORMAT_LOAD_PUSCH,
LL1_ERROR_TAG_INVALID_DCI_FORMAT_SEND_PUSCH,
LL1_ERROR_TAG_INVALID_DCI_FORMAT_RAR,
LL1_ERROR_TAG_INVALID_DCI_FORMAT_MSG4,
LL1_ERROR_TAG_INVALID_DCI_FORMAT_MSG4_SDU,
LL1_ERROR_TAG_INVALID_RACH_INITIATOR,
LL1_ERROR_TAG_INVALID_RACH_INITIATOR_RETRY,
LL1_ERROR_TAG_INVALID_RACH_INITIATOR_MSG4_SDU,
LL1_ERROR_TAG_INVALID_RACH_INITIATOR_MSG3_SENT,
LL1_ERROR_TAG_INVALID_PRACH_PREAMBLE_RANGE,
LL1_ERROR_TAG_INVALID_PRACH_PREAMBLE_RANGE_LIB,
LL1_ERROR_TAG_UNEXPECTED_STATE,
LL1_ERROR_TAG_UNEXPECTED_STATE_KICK,
LL1_ERROR_TAG_UNEXPECTED_STATE_LEAVING,
LL1_ERROR_TAG_UNEXPECTED_STATE_RACH_REQ,
LL1_ERROR_TAG_PAGING_OCCASSION_CALC,
LL1_ERROR_TAG_FREQ_CHANGE_ALREADY_SAVED,
LL1_ERROR_TAG_INVALID_DRX_CYCLE_LENGTH,
LL1_ERROR_TAG_SCHEDULE_DETECTION_FAILED,
LL1_ERROR_TAG_CANNOT_MEASURE_CELL,
LL1_ERROR_TAG_CANNOT_MEASURE_CELL_NO_CELL,
LL1_ERROR_TAG_INVALID_SUBCARRIER_SPACE,
LL1_ERROR_TAG_INVALID_SUBCARRIER_SPACE_PUSCH,
LL1_ERROR_TAG_INVALID_SUBCARRIER_SPACE_PUCCH,
LL1_ERROR_TAG_INVALID_SUBCARRIER_IND,
LL1_ERROR_TAG_INVALID_SUBCARRIER_IND_DURATION,
LL1_ERROR_TAG_CELL_SELECT_ALREADY_PENDING,
LL1_ERROR_TAG_INVALID_THREE_TONE_SET,
LL1_ERROR_TAG_INVALID_SIX_TONE_SET,
LL1_ERROR_TAG_INVALID_SUBCARRIER_FREQ,
LL1_ERROR_TAG_UNSUPPORTED_DSP_COMMAND,
LL1_ERROR_TAG_UNSUPPORTED_DSP_COMMAND_FLASH,
LL1_ERROR_TAG_CONNECTED_LPM_RESYNC_FAILURE,
LL1_ERROR_TAG_CELL_DETECT_EXCEEDS_MAX,
LL1_ERROR_TAG_INVALID_CARRIER_TYPE_PDSCH,
LL1_ERROR_TAG_INVALID_CARRIER_TYPE_SELECT,
LL1_ERROR_TAG_INVALID_CARRIER_TYPE_PDCCH,
LL1_ERROR_TAG_INVALID_CARRIER_TYPE_GET_MODE,
LL1_ERROR_TAG_INVALID_BASE_SUBFRAME_PATTERN,
LL1_ERROR_TAG_RF_MULTITONE_READ_FAILED,
LL1_ERROR_TAG_RF_SET_CALIBRATION_FAILURE,
LL1_ERROR_TAG_RF_RX_NOT_ACTIVE,
LL1_ERROR_TAG_INVALID_ANCHOR_CARRIER_DL_RASTER_OFFSET,
LL1_ERROR_TAG_NO_HARQ_WAITING_FOR_MAC_DATA,
LL1_ERROR_TAG_NO_DL_HARQ_PENDING,
LL1_ERROR_TAG_INVALID_HARQ_ID_DATA_DROPPED,
LL1_ERROR_TAG_INVALID_HARQ_ID_DATA_DROPPED_PUSCH,
LL1_ERROR_TAG_INVALID_HARQ_ID_DATA_DROPPED_REQ_HANDLER,
LL1_ERROR_TAG_INVALID_NPDCCH_COMPLETION_STATE,
LL1_ERROR_TAG_CARRIER_HAS_NO_RACH_RESOURCE_FOR_ECL,
LL1_ERROR_TAG_DIDNT_LOG_RF_EVENTS,
LL1_ERROR_TAG_MALLOC_FAILURE_SOFT_COMBINING,
LL1_ERROR_TAG_SSS_RESYNC_STATE_INVALID,
LL1_ERROR_TAG_SIB1_SCHD_INFO_INVALID,
} ll1_log_error_value_tag_t;
typedef enum {
LL1_WARNING_TAG_RE_TX_UL_TBS_MISMATCH,
LL1_WARNING_TAG_RE_TX_UL_TBS_MISMATCH_N0,
LL1_WARNING_TAG_RACH_OPPORTUNITY_PASSED,
LL1_WARNING_TAG_PAGING_OPPORTUNITY_PASSED,
LL1_WARNING_TAG_NWUS_OPPORTUNITY_PASSED,
LL1_WARNING_MCS_BIGGER_THAN_TWO_WITHOUT_EDT,
LL1_WARNING_CONN_RACH_DCI_N1_RECEIVED_WITH_TCRNTI,
} ll1_log_warning_value_tag_t;
typedef struct {
report_paging_stat paging_stat;
osal_u16 power_ratio_fail_count;
report_rach_stat rach_stat;
report_mac_trans_stat mac_trans_stat;
osal_u16 cell_switch_count;
osal_u16 rlf_out_sync_count;
ll1_log_error_value_tag_t last_error_log;
ll1_log_warning_value_tag_t last_warning_log;
report_signal_stat signal_stat;
report_fsm_state fsm_state;
} report_ll1_stat;

View File

@ -0,0 +1,232 @@
<?xml version="1.0" encoding="utf-8"?>
<DebugKits>
<GROUP NAME="MAC" DATA_STRUCT_FILE="..\diag\mac_struct_def.txt" MULTIMODE="NBIOT" PLUGIN="0x111,0x110(1),0x252">
</GROUP>
<GROUP NAME="PHY" DATA_STRUCT_FILE="..\diag\phy_struct_def.txt" MULTIMODE="LTE">
</GROUP>
<GROUP NAME="DBK" DATA_STRUCT_FILE="..\diag\struct_def.txt" MULTIMODE="NBIOT">
<CMD ID="0x5314" TYPE="IND" NAME="msg_sys" PLUGIN="0x110(1)" DESCRIPTION="MSG上报SYS"></CMD>
<CMD ID="0x5315" TYPE="IND" NAME="msg_layer(dev)" PLUGIN="0x110(1)" DESCRIPTION="MSG上报LAYER"></CMD>
<CMD ID="0x5316" TYPE="IND" NAME="msg_usr" PLUGIN="0x110(1),0x110(5)" DESCRIPTION="MSG上报USR"></CMD>
<CMD ID="0x5304" TYPE="IND" NAME="msg_air" PLUGIN="0x110(1),0x110(5)" DESCRIPTION="MSG上报AIR"></CMD>
<CMD ID="0x5310" TYPE="IND" NAME="msg_set_sys" PLUGIN="0x110(1)" DESCRIPTION="MSG上报SYS"></CMD>
<CMD ID="0x5311" TYPE="IND" NAME="msg_set_layer(dev)" PLUGIN="0x110(1)" DESCRIPTION="MSG上报LAYER"></CMD>
<CMD ID="0x5312" TYPE="IND" NAME="msg_set_usr" PLUGIN="0x110(1),0x110(5)" DESCRIPTION="MSG上报USR"></CMD>
<CMD ID="0x5512" TYPE="IND" NAME="msg_set_air" PLUGIN="0x110(1),0x110(5)" DESCRIPTION="MSG上报USR"></CMD>
<CMD ID="0x7000" TYPE="IND" NAME="sal_mac_diag_chl" PLUGIN="0x100,0x102,0x252,0x260" DESCRIPTION=""></CMD>
<CMD ID="0xF1000000" TYPE="IND" NAME="GTR" PLUGIN="0x110(1)" DESCRIPTION=""></CMD>
<CMD ID="0x3013" NAME="ver" DESCRIPTION="" PLUGIN="0x100,0x102" TYPE="REQ">
<REQ STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="diag_cmd_soft_new_ver_stru" TYPE="Auto" RESULT_CODE="" />
</CMD>
<CMD ID="0x5331" NAME="sdm_attd" DESCRIPTION="attach debug mode" PLUGIN="0x100,0x102(2)" TYPE="REQ">
<REQ STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0x5332" NAME="sdm_dttd" DESCRIPTION="detach debug mode" PLUGIN="0x100,0x102(2)" TYPE="REQ">
<REQ STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0x7003" NAME="syserr" DESCRIPTION="" PLUGIN="0x100,0x252" TYPE="REQ">
<REQ STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="soc_syserr_info" TYPE="Auto" />
</CMD>
<CMD ID="0x3017" NAME="mini_syserr" DESCRIPTION="" PLUGIN="0x100,0x102" TYPE="REQ">
<REQ STRUCTURE=" null_stru" TYPE="Auto" PARAM_VALUE="" />
<CNF STRUCTURE="diag_cmd_new_syserr_qry_stu" TYPE="Auto" RESULT_CODE="" />
<IND STRUCTURE="diag_cmd_new_syserr_qry_stu" TYPE="Auto" RESULT_CODE="" />
</CMD>
<CMD ID="0x7004" NAME="clssyserr" DESCRIPTION="" PLUGIN="0x100" TYPE="REQ">
<REQ STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0x5322" NAME="sdm_ef" DESCRIPTION="" PLUGIN="0x100,0x102(2)" TYPE="REQ">
<REQ STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
<CNF STRUCTURE="soc_syserr_info" TYPE="Auto" RESULT_CODE="" />
<IND STRUCTURE="soc_syserr_info" TYPE="Auto" RESULT_CODE="" />
</CMD>
<CMD ID="0x7005" TYPE="IND" NAME="syserrdump" PLUGIN="0x252,0x260" DESCRIPTION="">
<IND STRUCTURE="dump_data_stru" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0x7008" TYPE="REQ" NAME="dumpfile" PLUGIN="0x100" DESCRIPTION="">
<REQ STRUCTURE="dump_bin_req_stru" TYPE="Auto" PARAM_VALUE="{0x10000000,4096,1024,0}" />
<IND STRUCTURE="dump_bin_stru" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0x7009" TYPE="IND" NAME="md2k" PLUGIN="0x100" DESCRIPTION="">
<IND STRUCTURE="dump_data2k_stru" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0x7030" TYPE="IND" NAME="sysdumpfinish" PLUGIN="0x252,0x260" DESCRIPTION="">
<IND STRUCTURE="u32_type_stru" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0x7006" TYPE="REQ" NAME="dosyserr" PLUGIN="0x100" DESCRIPTION="">
<REQ STRUCTURE="u32_type_stru" TYPE="Auto" PARAM_VALUE="{0}" />
</CMD>
<CMD ID="0x7007" TYPE="IND" NAME="prompt" PLUGIN="0x100,0x252" DESCRIPTION="">
<IND STRUCTURE="str_type" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0x7012" NAME="sdm_sys" DESCRIPTION="" PLUGIN="0x100,0x102(2)" TYPE="REQ">
<REQ STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="diag_cmd_sal_sys_sdm" TYPE="Auto" />
</CMD>
<CMD ID="0x5501" NAME="sdm_nvw" DESCRIPTION="" PLUGIN="0x100,0x102(2)" TYPE="REQ">
<REQ STRUCTURE="nv_req_stru" TYPE="Auto" PARAM_VALUE="" />
<CNF STRUCTURE="diag_cmd_nv_wr_cnf_stru" TYPE="Auto" RESULT_CODE="" />
</CMD>
<CMD ID="0x5503" NAME="sdm_nvr" DESCRIPTION="" PLUGIN="0x100,0x102(2)" TYPE="REQ">
<REQ STRUCTURE="u32_type_stru" TYPE="Auto" PARAM_VALUE="" />
<CNF STRUCTURE="nv_ack_stru" TYPE="Auto" RESULT_CODE="" />
</CMD>
<CMD ID="0x550f" NAME="setuart" DESCRIPTION="" PLUGIN="0x100,0x102(2)" TYPE="REQ">
<REQ STRUCTURE="soc_uart_attr" TYPE="Auto" PARAM_VALUE="" />
<CNF STRUCTURE="null_stru" TYPE="Auto" RESULT_CODE="" />
</CMD>
</GROUP>
<GROUP NAME="System" DATA_STRUCT_FILE="..\diag\sys_struct_def.txt" MULTIMODE="NBIOT">
<CMD ID="0x3014" NAME="diag_stat" DESCRIPTION="" PLUGIN="0x100" TYPE="REQ">
<REQ STRUCTURE=" null_stru" TYPE="Auto" PARAM_VALUE="" />
<CNF STRUCTURE="soc_stat_diag_qry" TYPE="Auto" RESULT_CODE="" />
<IND STRUCTURE="soc_stat_diag_qry" TYPE="Auto" RESULT_CODE="" />
</CMD>
<CMD ID="0x3430" TYPE="IND" NAME="stat" PLUGIN="0x100" DESCRIPTION="">
<REQ STRUCTURE="SOC_DBG_STAT_Q_S" TYPE="Auto" PARAM_VALUE="" />
<CNF STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0xB101" NAME="report_mac_ul_stat" DESCRIPTION="" PLUGIN="0x100" TYPE="REQ">
<REQ STRUCTURE=" null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="report_mac_ul_stat" TYPE="Auto" RESULT_CODE="" />
</CMD>
<CMD ID="0xB102" NAME="report_rlc_dl_stat" DESCRIPTION="" PLUGIN="0x100" TYPE="REQ">
<REQ STRUCTURE=" null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="report_rlc_dl_stat" TYPE="Auto" RESULT_CODE="" />
</CMD>
<CMD ID="0xB103" NAME="report_rlc_ul_stat" DESCRIPTION="" PLUGIN="0x100" TYPE="REQ">
<REQ STRUCTURE=" null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="report_rlc_ul_stat" TYPE="Auto" RESULT_CODE="" />
</CMD>
<CMD ID="0xB104" NAME="report_pdcp_stat" DESCRIPTION="" PLUGIN="0x100" TYPE="REQ">
<REQ STRUCTURE=" null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="report_pdcp_stat" TYPE="Auto" RESULT_CODE="" />
</CMD>
<CMD ID="0xB105" NAME="report_ll1_stat" DESCRIPTION="" PLUGIN="0x100" TYPE="REQ">
<REQ STRUCTURE=" null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="report_ll1_stat" TYPE="Auto" RESULT_CODE="" />
</CMD>
<CMD ID="0xB200" NAME="report_nas_stat" DESCRIPTION="" PLUGIN="0x100" TYPE="REQ">
<REQ STRUCTURE=" null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="report_nas_stat" TYPE="Auto" RESULT_CODE="" />
</CMD>
<CMD ID="0xB201" NAME="report_rrc_stat" DESCRIPTION="" PLUGIN="0x100" TYPE="REQ">
<REQ STRUCTURE=" null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="report_rrc_stat" TYPE="Auto" RESULT_CODE="" />
</CMD>
<CMD ID="0xB301" NAME="aGetMemInfo" DESCRIPTION="" PLUGIN="0x100" TYPE="REQ">
<REQ STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="soc_mem_info" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0xB303" NAME="aGetUartExtra" DESCRIPTION="" PLUGIN="0x100" TYPE="REQ">
<REQ STRUCTURE="SOC_DBG_STAT_Q_S" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="diag_uart_driver_extra" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0xB304" NAME="aGetResourceStat" DESCRIPTION="" PLUGIN="0x100" TYPE="REQ">
<REQ STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="soc_os_resource_use_stat_s" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0xB305" NAME="aGetSyserrInfo" DESCRIPTION="" PLUGIN="0x100" TYPE="REQ">
<REQ STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="diag_syserr_info" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0xB382" NAME="pGetLpcStat" DESCRIPTION="" PLUGIN="0x100" TYPE="REQ">
<REQ STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="soc_lpc_info" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0xB383" NAME="pGetUartExtra" DESCRIPTION="" PLUGIN="0x100" TYPE="REQ">
<REQ STRUCTURE="SOC_DBG_STAT_Q_S" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="diag_uart_driver_extra" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0xB385" NAME="pGetSyserrInfo" DESCRIPTION="" PLUGIN="0x100" TYPE="REQ">
<REQ STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="diag_syserr_info" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0xB400" NAME="report_at_stat" DESCRIPTION="" PLUGIN="0x100" TYPE="REQ">
<REQ STRUCTURE=" null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="report_at_stat" TYPE="Auto" RESULT_CODE="" />
</CMD>
<CMD ID="0xA301" TYPE="IND" NAME="aCoreTest" PLUGIN="0x100" DESCRIPTION="">
<IND STRUCTURE="soc_stat_diag_qry" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0xA384" TYPE="IND" NAME="pCoreLpcStat" PLUGIN="0x100" DESCRIPTION="">
<IND STRUCTURE="soc_lpc_stat_p" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0xA385" TYPE="IND" NAME="pCoreLpcProcessCtrl" PLUGIN="0x100" DESCRIPTION="">
<IND STRUCTURE="soc_lpc_process_ctrl_p_s" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0xA010" TYPE="IND" NAME="提示" PLUGIN="0x100,0x252,0x303" DESCRIPTION="">
<IND STRUCTURE="str_type" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0xA011" TYPE="IND" NAME="提示" PLUGIN="0x100,0x252,0x303" DESCRIPTION="">
<IND STRUCTURE="str_type" TYPE="Auto" PARAM_VALUE="" />
</CMD>
<CMD ID="0xA500" NAME="atiny参数统计" TYPE="IND" PLUGIN="0x100" DESCRIPTION="">
<IND STRUCTURE="atiny_critical_information" TYPE="Auto" />
</CMD>
<CMD ID="0xB500" NAME="get_platform_state" DESCRIPTION="" PLUGIN="0x100, 0x259" TYPE="REQ">
<REQ STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="atiny_platform_state" TYPE="Auto" RESULT_CODE="" />
</CMD>
<CMD ID="0xB501" NAME="get_retrans_data" DESCRIPTION="" PLUGIN="0x100, 0x259" TYPE="REQ">
<REQ STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="atiny_retrans_data" TYPE="Auto" RESULT_CODE="" />
</CMD>
<CMD ID="0xB502" NAME="get_ota_data" DESCRIPTION="" PLUGIN="0x100, 0x259" TYPE="REQ">
<REQ STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="atiny_ota_data" TYPE="Auto" RESULT_CODE="" />
</CMD>
<CMD ID="0xB503" NAME="get_retry_count" DESCRIPTION="" PLUGIN="0x100, 0x259" TYPE="REQ">
<REQ STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="atiny_retry_counter" TYPE="Auto" RESULT_CODE="" />
</CMD>
<CMD ID="0xA600" NAME="BLE HCI统计" TYPE="IND" PLUGIN="0x100" DESCRIPTION="">
<IND STRUCTURE="tl_dfx_stru" TYPE="Auto" />
</CMD>
<CMD ID="0xA601" NAME="BLE sleep time" TYPE="IND" PLUGIN="0x100" DESCRIPTION="">
<IND STRUCTURE="bt_sleep_dfx" TYPE="Auto" />
</CMD>
</GROUP>
<GROUP NAME="APP" DATA_STRUCT_FILE="..\diag\app_struct_def.txt" MULTIMODE="NBIOT">
<CMD ID="0xB124" NAME="SOC_DSID_SDM_QUERY_INFO" DESCRIPTION="" PLUGIN="0x100, 0x259" TYPE="REQ">
<REQ STRUCTURE="soc_dump_info_req" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="soc_dump_info_ind" TYPE="Auto" RESULT_CODE="" />
</CMD>
<CMD ID="0xB125" NAME="SOC_DSID_SDM_QUERY_CONTENT" DESCRIPTION="" PLUGIN="0x100, 0x259" TYPE="REQ">
<REQ STRUCTURE="soc_dump_content_req" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="soc_dump_content_ind" TYPE="Auto" RESULT_CODE="" />
</CMD>
</GROUP>
<GROUP NAME="OS" DATA_STRUCT_FILE="..\diag\os_struct_def.txt" MULTIMODE="NBIOT">
<CMD ID="0x3001" NAME="osm" TYPE="REQ" PLUGIN="0x100,0x252" DESCRIPTION="">
<REQ STRUCTURE="str_type" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="str_type" TYPE="Auto" />
</CMD>
<CMD ID="0x3002" NAME="ossm" TYPE="REQ" PLUGIN="0x100,0x252" DESCRIPTION="">
<REQ STRUCTURE="str_type" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="str_type" TYPE="Auto" />
</CMD>
<CMD ID="0x3009" NAME="osreset" TYPE="REQ" PLUGIN="0x100" DESCRIPTION="">
<REQ STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
<CNF STRUCTURE="str_type" TYPE="Auto" />
</CMD>
<CMD ID="0x3071" NAME="test_cmd" TYPE="REQ" PLUGIN="0x100" DESCRIPTION="">
<REQ STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="null_stru" TYPE="Auto" />
</CMD>
<CMD ID="0x3072" NAME="test_cmd2" TYPE="REQ" PLUGIN="0x100" DESCRIPTION="">
<REQ STRUCTURE="null_stru" TYPE="Auto" PARAM_VALUE="" />
<IND STRUCTURE="null_stru" TYPE="Auto" />
</CMD>
</GROUP>
<GROUP NAME="Pseudo Cmd" DATA_STRUCT_FILE="..\diag\pseudo_cmd_struct_def.txt" MULTIMODE="NBIOT">
</GROUP>
</DebugKits>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<DebugKits>
</DebugKits>

View File

@ -0,0 +1,12 @@
<?xml version='1.0' encoding='UTF-8'?>
<DebugKits>
<GROUP FEATURE="1&lt;&lt;0,1&lt;&lt;5" ID="0x1" NAME="Application" PARAM_DEF_FILE="../nv/nv_app_struct_def.txt" USEDMODE="0">
</GROUP>
<GROUP FEATURE="1&lt;&lt;0,1&lt;&lt;5" ID="0x2" NAME="Protocol" PARAM_DEF_FILE="../nv/nv_protocol_struct_def.txt" USEDMODE="0">
</GROUP>
<GROUP FEATURE="1&lt;&lt;0,1&lt;&lt;5" ID="0x3" NAME="Security" PARAM_DEF_FILE="../nv/nv_security_struct_def.txt" USEDMODE="0">
</GROUP>
</DebugKits>

View File

@ -0,0 +1,14 @@
<?xml version='1.0' encoding='UTF-8'?>
<MSS>
<SUBSYSTEM DATA_STRUCT_FILE="..\diag\msg_struct_def.txt" DESCRIPTION="" MULTIMODE="NBIOT" NAME="NBIOT">
<MSG_LOG>
</MSG_LOG>
<AIR_LOG>
</AIR_LOG>
<LAYER_LOG>
</LAYER_LOG>
<USERPLANE_LOG NAME="MAC_PHY_UL_GRANT_HARQ_IND">
</USERPLANE_LOG>
</SUBSYSTEM>
</MSS>

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<!--HiSilicon (Shanghai) Technologies Co., Ltd.-->
<MSS>
<!--The definition of MSS basic ID, including Category ID, Module ID and name. Category / Module ID between subsystems must be unique-->
<SUBSYSTEM>
<CATEGORY>
<CAT NAME="System" ID="0x00000400" DESCRIPTION="System" />
<CAT NAME="Print" ID="0x00008000" DESCRIPTION="Print" />
<CAT NAME="Event" ID="0x00004000" DESCRIPTION="Event" />
<CAT NAME="Air" ID="0x00002000" DESCRIPTION="Air" />
<CAT NAME="Layer" ID="0x00001000" DESCRIPTION="Layer" />
<CAT NAME="User Plane" ID="0x00000200" DESCRIPTION="UserPlane" />
<CAT NAME="Message" ID="0x00000100" DESCRIPTION="Message" />
<CAT NAME="Custom messages" ID="0x00000010" DESCRIPTION="Custom messages" />
</CATEGORY>
<TITLE>
<ITEM ID="0x00" NAME="NO." STAT="1" VALUE="0" DESCRIPTION="..." />
<ITEM ID="0x01" NAME="Category" STAT="0" DESCRIPTION="..." />
<ITEM ID="0x02" STAT="0" NAME="Level" DESCRIPTION="..." />
<ITEM ID="0x03" STAT="1" NAME="Date" DESCRIPTION="..." />
<ITEM ID="0x04" NAME="Time" STAT="1" DESCRIPTION="..." />
<ITEM ID="0x05" NAME="TimeStamp" STAT="1" DESCRIPTION="..." />
<ITEM ID="0x06" NAME="Chip" STAT="0" DESCRIPTION="..." />
<ITEM ID="0x07" NAME="Cpu" STAT="0" DESCRIPTION="..." />
<ITEM ID="0x08" NAME="Side" STAT="0" DESCRIPTION="..." />
<ITEM ID="0x09" NAME="Layer" STAT="0" DESCRIPTION="..." />
<ITEM ID="0x0A" NAME="Prim" STAT="0" DESCRIPTION="..." />
<ITEM ID="0x0B" NAME="Source" STAT="0" DESCRIPTION="..." />
<ITEM ID="0x0C" NAME="Destination" STAT="0" DESCRIPTION="..." />
<ITEM ID="0x0D" NAME="FileName" STAT="0" DESCRIPTION="..." />
<ITEM ID="0x0E" NAME="LineNo" STAT="0" DESCRIPTION="..." />
<ITEM ID="0x0F" NAME="Data" STAT="0" DESCRIPTION="..." />
</TITLE>
<LEVEL>
<PRINT ICON="\logging_item_type_icon.png">
<LEVEL NAME="Error" ID="0x40000000" ICON_OFFSET="0x1" DESCRIPTION="Error" />
<LEVEL NAME="Warning" ID="0x20000000" ICON_OFFSET="0x0" DESCRIPTION="Warning" />
<LEVEL NAME="Info" ID="0x10000000" ICON_OFFSET="0x2" DESCRIPTION="Info" />
<LEVEL NAME="Normal" ID="0x08000000" ICON_OFFSET="0x4" DESCRIPTION="Normal" />
</PRINT>
</LEVEL>
<MODULES RANGE="0x001,0xFFFF">
<MOD ID="0x00000100" NAME="INVALID" DESCRIPTION="INVALID" />
<MOD ID="0x00000101" NAME="DSP" DESCRIPTION="DSP" />
<MOD ID="0x00000102" NAME="LL1" DESCRIPTION="LL1" />
<MOD ID="0x00000103" NAME="L2_UL" DESCRIPTION="L2_UL" />
<MOD ID="0x00000104" NAME="L2_DL" DESCRIPTION="L2_DL" />
<MOD ID="0x00000105" NAME="MAC_DL" DESCRIPTION="MAC_DL" />
<MOD ID="0x00000106" NAME="MAC_UL" DESCRIPTION="MAC_UL" />
<MOD ID="0x00000107" NAME="RLC_UL" DESCRIPTION="RLC_UL" />
<MOD ID="0x00000108" NAME="RLC_DL" DESCRIPTION="RLC_DL" />
<MOD ID="0x00000109" NAME="PDCP" DESCRIPTION="PDCP" />
<MOD ID="0x0000010a" NAME="RRC" DESCRIPTION="RRC" />
<MOD ID="0x0000010b" NAME="EMMSM" DESCRIPTION="EMMSM" />
<MOD ID="0x0000010c" NAME="MN" DESCRIPTION="MN" />
<MOD ID="0x0000010d" NAME="AT" DESCRIPTION="AT" />
<MOD ID="0x0000010e" NAME="PDH" DESCRIPTION="PDH" />
<MOD ID="0x0000010f" NAME="LWIP" DESCRIPTION="LWIP" />
<MOD ID="0x00000110" NAME="SIM" DESCRIPTION="SIM" />
<MOD ID="0x00000111" NAME="LOG" DESCRIPTION="LOG" />
<MOD ID="0x00000112" NAME="MONITOR" DESCRIPTION="MONITOR" />
<MOD ID="0x00000113" NAME="HOSTTEST_RF" DESCRIPTION="HOSTTEST_RF" />
<MOD ID="0x00000114" NAME="HOSTTEST_TX" DESCRIPTION="HOSTTEST_TX" />
<MOD ID="0x00000115" NAME="HOSTTEST_RX" DESCRIPTION="HOSTTEST_RX" />
<MOD ID="0x00000116" NAME="NVCONFIG" DESCRIPTION="NVCONFIG" />
<MOD ID="0x00000117" NAME="NAS" DESCRIPTION="NAS" />
<MOD ID="0x00000118" NAME="IRMALLOC" DESCRIPTION="IRMALLOC" />
<MOD ID="0x00000119" NAME="PROTO" DESCRIPTION="PROTO" />
<MOD ID="0x0000011a" NAME="SMS" DESCRIPTION="SMS" />
<MOD ID="0x0000011b" NAME="LPP" DESCRIPTION="LPP" />
<MOD ID="0x0000011c" NAME="ROHC" DESCRIPTION="ROHC" />
<MOD ID="0x0000011d" NAME="UICC" DESCRIPTION="UICC" />
<MOD ID="0x0000011e" NAME="UE" DESCRIPTION="UE" />
<MOD ID="0x0000011f" NAME="BLE" DESCRIPTION="BLE" />
<MOD ID="0x00000120" NAME="RF" DESCRIPTION="RF" />
<MOD ID="0x00000121" NAME="EMM" DESCRIPTION="EMM" />
<MOD ID="0x00000122" NAME="ESM" DESCRIPTION="ESM" />
<MOD ID="0x00000123" NAME="MMC" DESCRIPTION="MMC" />
<MOD ID="0x00000124" NAME="TAF" DESCRIPTION="TAF" />
<MOD ID="0x00000127" NAME="RADIO" DESCRIPTION="RADIO" />
<MOD ID="0x00000201" NAME="APP_LWIP_SUPPORT" DESCRIPTION="APP_LWIP_SUPPORT" />
<MOD ID="0x00000208" NAME="APP_AT" DESCRIPTION="APP_AT" />
<MOD ID="0x00000214" NAME="APP_OTA" DESCRIPTION="APP_OTA" />
<MOD ID="0x0000021C" NAME="APP_NETWORK" DESCRIPTION="APP_NETWORK" />
<MOD ID="0x00000125" NAME="APP_ATINY" DESCRIPTION="APP_ATINY" />
<MOD ID="0x00000126" NAME="APP_DTLS" DESCRIPTION="APP_DTLS" />
<MOD ID="0x00000241" NAME="APP_LOG" DESCRIPTION="APP_LOG" />
</MODULES>
</SUBSYSTEM>
</MSS>

View File

@ -0,0 +1,39 @@
UINT64 64 0
UINT32 32 0
UINT16 16 0
UINT8 8 0
INT64 64 1
INT32 32 1
INT16 16 1
INT8 8 1
enum 32 0
u64 64 0
u32 32 0
u16 16 0
u8 8 0
s64 64 1
s32 32 1
s16 16 1
s8 8 1
BOOL 8 0
osal_u64 64 0
osal_u32 32 0
osal_u16 16 0
osal_u8 8 0
osal_s64 64 1
osal_s32 32 1
osal_s16 16 1
osal_s8 8 1
osal_bool 8 0
osal_char 8 1 1
char 8 1 1
long 32 1
osal_pvoid 32 0
osal_pbyte 32 0

View File

@ -0,0 +1,2 @@
#include "base_datatype_def.txt"

View File

@ -0,0 +1,13 @@
#include "base_datatype_def.txt"

View File

@ -0,0 +1,10 @@
#include "base_datatype_def.txt"

View File

@ -0,0 +1 @@
NB1X V100R001C00

View File

@ -0,0 +1,244 @@
#!/usr/bin/env python3
# coding=utf-8
#===============================================================================
# @brief create database
# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd.
#===============================================================================
import xml.dom.minidom
import sys
import re
import os
import shutil
import xml.etree.ElementTree as ET
def write_enum_struct(name, enums, file):
file.write('typedef enum {\r\n')
for enum in enums:
file.write(''.join([' ', enum.getAttribute('Name'), '=', enum.getAttribute('Value'), ',\r\n']))
file.write(''.join(['} ', name, ';\r\n']))
def write_nomal_struct(name, fields, file):
file.write('typedef struct {\r\n')
for field in fields:
if field.nodeType != xml.dom.Node.ELEMENT_NODE:
continue
if field.getAttribute('Enum') == '':
if field.getAttribute('Length') == '1':
file.write(''.join([' ', field.getAttribute('Type'), ' ', field.getAttribute('FieldName'), ';\r\n']))
else:
file.write(''.join([' ', field.getAttribute('Type'), ' ', field.getAttribute('FieldName'), '[', field.getAttribute('Length') , '];\r\n']))
else:
if field.getAttribute('Length') == '1':
file.write(''.join([' ', field.getAttribute('Enum'), ' ', field.getAttribute('FieldName'), ';\r\n']))
else:
file.write(''.join([' ', field.getAttribute('Enum'), ' ', field.getAttribute('FieldName'), '[', field.getAttribute('Length'), '];\r\n']))
file.write(''.join(['} ', name, ';\r\n']))
def write_union(item, file):
file.write('typedef union {\r\n')
fields = item.getElementsByTagName("Field")
for field in fields:
file.write(''.join([' ', field.getAttribute('Type'), ' ', field.getAttribute('FieldName'), ';\r\n']))
file.write(''.join(['} ', item.getAttribute('Type'), ';\r\n']))
def find_union(fields, union_name_to_node):
for field in fields:
if field.getAttribute('FieldType') == 'union':
union_name_to_node[field.getAttribute('Type')] = field
def write_msg_struct(name, fields, file):
file.write('typedef struct {\r\n')
for field in fields:
if field.nodeType != xml.dom.Node.ELEMENT_NODE:
continue
if field.getAttribute('Enum') == '':
if field.getAttribute('Length') == '1':
file.write(''.join([' ', field.getAttribute('Type'), ' ', field.getAttribute('FieldName'), ';\r\n']))
else:
file.write(''.join([' ', field.getAttribute('Type'), ' ', field.getAttribute('FieldName'), '[', field.getAttribute('Length'), '];\r\n']))
else:
if field.getAttribute('Length') == '1':
file.write(''.join([' ', field.getAttribute('Enum'), ' ', field.getAttribute('FieldName'), ';\r\n']))
else:
file.write(''.join([' ' , field.getAttribute('Enum'), ' ', field.getAttribute('FieldName'), '[', field.getAttribute('Length'), '];\r\n']))
file.write(''.join(['} ', name, '_STRU;\r\n']))
def int_prim_xml_air_tree(tree):
root = tree.getroot()
layer_root_element = ET.Element('')
for child_1 in root:
if child_1.tag=='SUBSYSTEM':
for child_2 in child_1:
if child_2.tag=='AIR_LOG':
layer_root_element = child_2
break
break
if layer_root_element.tag=='AIR_LOG':
temp_attrib=layer_root_element.attrib
temp_text=layer_root_element.text
temp_tail = layer_root_element.tail
#layer_root_element.clear()
layer_root_element.attrib = temp_attrib
layer_root_element.text = temp_text
layer_root_element.tail = temp_tail
return layer_root_element
def int_prim_xml_layer_tree(tree):
root = tree.getroot()
layer_root_element = ET.Element('')
for child_1 in root:
if child_1.tag=='SUBSYSTEM':
for child_2 in child_1:
if child_2.tag=='LAYER_LOG':
layer_root_element = child_2
break
break
if layer_root_element.tag=='LAYER_LOG':
temp_attrib=layer_root_element.attrib
temp_text=layer_root_element.text
temp_tail = layer_root_element.tail
#layer_root_element.clear()
layer_root_element.attrib = temp_attrib
layer_root_element.text = temp_text
layer_root_element.tail = temp_tail
return layer_root_element
def int_prim_xml_msg_tree(tree):
root = tree.getroot()
layer_root_element = ET.Element('')
for child_1 in root:
if child_1.tag=='SUBSYSTEM':
for child_2 in child_1:
if child_2.tag=='MSG_LOG':
layer_root_element = child_2
break
break
if layer_root_element.tag=='MSG_LOG':
temp_attrib=layer_root_element.attrib
temp_text=layer_root_element.text
temp_tail = layer_root_element.tail
#layer_root_element.clear()
layer_root_element.attrib = temp_attrib
layer_root_element.text = temp_text
layer_root_element.tail = temp_tail
return layer_root_element
def add_element_to_xml(root_element):
global num_to_id
sorted_list=sorted(num_to_id.items(),key=lambda e:e[1])
for key,value in sorted_list:
#print('key2=',key, 'value=',value)
new_element=ET.Element('')
new_element.tag='MSG'
new_element.attrib['NAME']=key
new_element.attrib['ID']=value
new_element.attrib['DESCRIPTION']=''
new_element.attrib['STRUCTURE']=''.join([key, '_STRU'])
new_element.tail='\n\t\t\t'
root_element.append(new_element)
def write_prim_xml_tree(tree, dest):
dst_xml_dir = os.path.dirname(dest)
if not os.path.exists(dst_xml_dir):
os.makedirs(dst_xml_dir)
# print(g_params['PRIM_XML_DST_XML_FILE'].strip())
tree.write(dest,encoding="UTF-8",xml_declaration = '<?xml version="1.0" encoding="utf-8" ?>',method="xml")
try:
msg_xml, mss_prim_db, destination = sys.argv[1:]
except ValueError:
raise SystemExit("Usage: %s msg_xml mss_prim_db destination" % sys.argv[0])
msg_struct_def = os.path.join(destination, 'cco', 'system', 'diag', 'msg_struct_def.txt')
extern_datatype_def = os.path.join(destination, 'cco','system', 'diag', 'extern_datatype_def.txt')
mss_prim_db_new = os.path.join(destination, 'cco', 'system', 'hdbcfg', 'mss_prim_db.xml')
src_database_dir = os.path.join(os.path.dirname(sys.argv[0]), "database")
shutil.rmtree(destination, ignore_errors=True, onerror=None)
shutil.copytree(src_database_dir, destination)
dom_tree = xml.dom.minidom.parse(msg_xml)
collection = dom_tree.documentElement
enum_fields = collection.getElementsByTagName("EnumsEntry")
struct_fields = collection.getElementsByTagName("Structure")
msg_fields = collection.getElementsByTagName("Message")
all_fields = collection.getElementsByTagName("Field")
num_to_id={}
enum_to_size = {}
type_to_size = {}
union_name_to_node = {}
lp_struct_to_size = {}
for item in msg_fields:
message_id = item.getAttribute('MessageID')
name = item.getAttribute('Name')
num_to_id[name] = message_id
with open(msg_struct_def,'w') as f:
f.write('#include \"base_datatype_def.txt\"\r\n')
f.write('#include \"extern_datatype_def.txt\"\r\n')
for item in enum_fields:
name = item.getElementsByTagName("Name")[0].childNodes[0].data
enums = item.getElementsByTagName('Enum')
write_enum_struct(name, enums, f)
for item in struct_fields:
name = item.getAttribute('Type')
fields = item.getElementsByTagName('Field')
write_nomal_struct(name, item.childNodes, f)
find_union(all_fields, union_name_to_node)
for key, value in union_name_to_node.items():
write_union(value, f)
for item in msg_fields:
name = item.getAttribute('Name')
fields = item.getElementsByTagName('Field')
write_msg_struct(name, item.childNodes, f)
f.close()
with open(extern_datatype_def,'w') as f:
for field in all_fields:
enum = field.getAttribute('Enum')
if enum == '':
continue
size = field.getAttribute('Size')
enum_to_size[enum] = size
for item in enum_to_size.items():
if item[1] == '1':
line = ''.join([item[0], ' 8 0\r\n'])
elif item[1] == '2':
line = ''.join([item[0], ' 16 0\r\n'])
elif item[1] == '4':
line = ''.join([item[0], ' 32 0\r\n'])
else:
continue
f.write(line)
for field in all_fields:
lp_struct = field.getAttribute('Type')
if 'LP_' not in lp_struct:
continue
size = field.getAttribute('Size')
lp_struct_to_size[lp_struct] = size
for item in lp_struct_to_size.items():
if item[1] == '1':
line = ''.join([item[0], ' 8 0\r\n'])
elif item[1] == '2':
line = ''.join([item[0], ' 16 0\r\n'])
elif item[1] == '4':
line = ''.join([item[0], ' 32 0\r\n'])
else:
continue
f.write(line)
f.close()
tree = ET.parse(mss_prim_db)
add_element_to_xml(int_prim_xml_msg_tree(tree))
write_prim_xml_tree(tree, mss_prim_db_new)

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<MSS>
<SUBSYSTEM NAME="cat1" DATA_STRUCT_FILE="..\diag\msg_struct_def.txt" DESCRIPTION="" MULTIMODE="cat1">
<MSG_LOG>
</MSG_LOG>
<AIR_LOG>
</AIR_LOG>
<LAYER_LOG>
</LAYER_LOG>
<USERPLANE_LOG NAME="MAC_PHY_UL_GRANT_HARQ_IND">
</USERPLANE_LOG>
</SUBSYSTEM>
</MSS>

View File

@ -0,0 +1,312 @@
#!/usr/bin/env python3
# coding=utf-8
#===============================================================================
# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd.
# Description: Parse C headers and extract message definitions as ctypes objects.
#===============================================================================
import pycparser
import ctypes
binary_operators = {
"&": lambda x, y: x & y,
"|": lambda x, y: x | y,
"*": lambda x, y: x * y,
"+": lambda x, y: x + y,
"-": lambda x, y: x - y,
"/": lambda x, y: x // y,
"<<": lambda x, y: x << y,
">>": lambda x, y: x >> y,
"<=": lambda x, y: int(x <= y),
">=": lambda x, y: int(x >= y),
"==": lambda x, y: int(x == y),
"&&": lambda x, y: int(bool(x and y)),
"||": lambda x, y: int(bool(x or y)),
}
unary_operators = {
"-": lambda x: -x,
"!": lambda x: 1 if x else 0,
"sizeof": lambda x: ctypes.sizeof(x),
}
fundamental_types = {
"": ctypes.c_int,
"_Bool": ctypes.c_bool,
"char unsigned": ctypes.c_ubyte,
"char": ctypes.c_byte,
"double": ctypes.c_double,
#
# 32bit arm and riscv compilers define "long double" type as 8 and 16 byte long respectively.
# ctypes.c_longdouble under 32bit windows, 32bit linux, 64bit windows, 64bit linux OS has length 8, 12, 8, 16 respectively.
# We cannot find a ctype mapping to generalize.
# Especially that 16 byte riscv "long double" type cannot be interpreted by any 32/64bit windows ctype.
# Fortunately we don't have any long doubles in messages and etypes. So disable this mapping for now.
#
# "double long": ctypes.c_longdouble,
"float": ctypes.c_float,
"long long unsigned": ctypes.c_ulonglong,
"long long": ctypes.c_longlong,
#
# 32bit arm and riscv compilers define "long" type as 4 byte long.
# Messages xml generation calls this script with 32bit python while kv generation uses 64bit python.
# We need to map "long" type to ctypes.c_int which is 4 byte across 32/64bit OSs
# instead of ctypes.c_long which is 8 byte on 64bit linux and 4 byte otherwise.
# This also applies to "unsigned long" type.
#
"long unsigned": ctypes.c_uint,
"long": ctypes.c_int,
"short unsigned": ctypes.c_ushort,
"short": ctypes.c_short,
"unsigned": ctypes.c_uint,
"void": None,
}
# These types will have a typedef but map to alternative ctypes values.
override_typedefs = {
"osal_char": ctypes.c_char,
}
def get_typename(names):
specifiers = []
for name in sorted(names):
if name in ["signed", "int"]:
continue
specifiers.append(name)
return " ".join(specifiers)
def create_enum_type(enumname, enums):
smallest = min(enums.values())
largest = max(enums.values())
if smallest < 0:
if -128 <= smallest and largest <= 127:
base = ctypes.c_byte
elif -32768 <= smallest and largest <= 32767:
base = ctypes.c_short
else:
base = ctypes.c_int
else:
if largest < 256:
base = ctypes.c_ubyte
elif largest < 65536:
base = ctypes.c_ushort
else:
base = ctypes.c_uint
return type(enumname, (base,), {"members": enums})
class Visitor(pycparser.c_ast.NodeVisitor):
# Parse all typedefs and expand identifiers.
def __init__(self):
self.enums = {}
self.typedefs = dict(fundamental_types)
# The context in which the ID names exist.
self.id_context = self.enums
self.anon_struct_count = 1
self.anon_enum_count = 1
self.anon_union_count = 1
def generic_visit(self, node):
# Dump ast to see what is not implemented.
raise SystemExit("Unhandled ast element at %s: %s" % (node.coord, node))
def visit_Decl(self, node):
return
def visit_FuncDef(self, node):
return
def visit_FuncDecl(self, node):
return
def visit_FileAST(self, node):
for c in node:
self.visit(c)
def visit_ID(self, node):
try:
return self.id_context[node.name]
except KeyError:
raise SystemExit("Failed to resolve identifier '%s' at %s" % (node.name, node.coord))
def visit_Typename(self, node):
return self.visit(node.type)
def visit_TypeDecl(self, node):
return self.visit(node.type)
def visit_CompoundLiteral(self, node):
return self.visit(node.type)
def visit_PtrDecl(self, node):
return ctypes.POINTER(self.visit(node.type))
def visit_Typedef(self, node):
if node.name in self.typedefs:
raise SystemExit("Duplicate typedef '%s' at %s" % (node.name, node.coord))
if node.name in override_typedefs:
value = override_typedefs[node.name]
else:
value = self.visit(node.type)
self.typedefs[node.name] = value
def visit_ArrayRef(self, node):
# For accessing type of an array element
array = self.visit(node.name)
#index = self.visit(node.subscript)
return array._type_
def visit_StructRef(self, node):
# This is needed to get access to types inside a struct.
struct = self.visit(node.name)
self.id_context = dict(struct._fields_)
try:
return self.visit(node.field)
finally:
self.id_context = self.enums
def visit_BinaryOp(self, node):
try:
op = binary_operators[node.op]
except KeyError:
raise SystemExit("Unhandled binary operator '%s' at %s" % (node.op, node.coord))
leftval = self.visit(node.left)
rightval = self.visit(node.right)
return op(leftval, rightval)
def visit_UnaryOp(self, node):
value = self.visit(node.expr)
try:
op = unary_operators[node.op]
except KeyError:
raise SystemExit("Unhandled unary operator '%s' at %s" % (node.op, node.coord))
return op(value)
def visit_Enum(self, node):
# Mapping of enum names to enum values from all parsed enums.
value = -1
enums = {}
for enum in node.values:
if enum.value is None:
value += 1
else:
value = self.visit(enum.value)
self.enums[enum.name] = enums[enum.name] = value
if node.name is None:
enumname = "enum_anon_%d" % self.anon_enum_count
self.anon_enum_count += 1
else:
enumname = "enum_%s" % str(node.name)
return create_enum_type(enumname, enums)
def visit_Constant(self, node):
if node.type not in ["int", "unsigned int"]:
raise SystemExit("Unhandled Constant node type '%s' at %s" % (node.type, node.coord))
value = node.value.rstrip("LlUu")
if value.startswith(("0x", "0X")):
return int(value, 16)
return int(value)
def visit_IdentifierType(self, node):
name = get_typename(node.names)
try:
return self.typedefs[name]
except KeyError:
raise SystemExit("Invalid type specifier '%s' at %s" % (name, node.coord))
def _handle_fields(self, decls):
fields = []
# node.decls can be None when the struct declaration is outside the typedef.
if decls is not None:
field_count = 1
for decl in decls:
value = self.visit(decl.type)
if value is None:
# This is the void type - indicates an invalid message definition type.
return None
if decl.name is None:
fieldname = "unnamed_%d" % field_count
field_count += 1
else:
fieldname = decl.name
fields.append((fieldname, value))
return fields
def visit_Struct(self, node):
fields = self._handle_fields(node.decls)
if fields is None:
return None
if node.name is None:
structname = "struct_anon_%d" % self.anon_struct_count
self.anon_struct_count += 1
else:
structname = "struct_%s" % str(node.name)
return type(structname, (ctypes.Structure,), {"_fields_": fields})
def visit_Union(self, node):
fields = self._handle_fields(node.decls)
if fields is None:
return None
if node.name is None:
unionname = "union_anon_%d" % self.anon_union_count
self.anon_union_count += 1
else:
unionname = "union_%s" % str(node.name)
return type(unionname, (ctypes.Union,), {"_fields_": fields})
def visit_ArrayDecl(self, node):
type = self.visit(node.type)
if node.dim is None:
# Flexible array members do not have a size.
# Return a pointer for compatibility with old ctypesgen based implementation.
return ctypes.POINTER(type)
length = self.visit(node.dim)
if length is None or length < 0:
raise SystemExit("Invalid array len %s at %s" % (length, node.dim.coord))
if type is None:
raise SystemExit("Invalid array type %s at %s" % (type, node.type.coord))
return type * length
def message_enum_name(elemName):
if elemName.endswith("_t"):
return elemName[:-2].upper()
if elemName.endswith("_s"):
# NAS messages, already uppercase
return elemName[:-2]
if elemName.endswith("_STRUCT"):
return elemName[:-7]
if elemName.upper().find("LOG_MESSAGE") != -1:
return elemName.upper() +'_ID'
def parse_preprocessed_headers(source, core):
# Public function that returns the required data for producing messagexml
try:
node = pycparser.parse_file(source)
except pycparser.plyparser.ParseError as e:
raise SystemExit("ERROR parsing msgdefs %s: %s" % (source, e))
v = Visitor()
if core == 'acore':
v.anon_struct_count = 0x8001
v.anon_enum_count = 0x8001
v.anon_union_count = 0x8001
v.visit(node)
messages = []
for structname, fields in sorted(v.typedefs.items()):
messageEnumName = message_enum_name(structname)
if messageEnumName is None:
# Not a valid message definition name.
continue
try:
messageId = v.enums[messageEnumName]
except KeyError:
# No associated message id, so not a message definition.
continue
if fields is None:
raise SystemExit("Message definition contains undefined type: %s" % structname)
messages.append((messageEnumName, structname, messageId, fields))
return messages