初始提交

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()