Merge remote-tracking branch 'origin/nfapi-parser' into integration_2025_w04 (!3199)
Add a small FAPI Hex parser utility Adds a small FAPI hex parser utility nfapi_hex_parser, that takes in a FAPI message hexdump, either from the command line or a file, unpacks it and prints the contents out to the console. The functions to print the data to the console were added alongside the existing utility functions, for both P5 and P7 messages. This allows the user to quickly check if a message has the valid format to be unpacked in OAI. The file examples.md contains some examples of execution and output. This utility is compiled alongside the NFAPI_LIB, as such, it is compiled whenever we compile nr-softmodem, or any other target that uses the NFAPI_LIB.
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
add_subdirectory(common)
|
||||
add_subdirectory(fapi)
|
||||
add_subdirectory(utils)
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include "assertions.h"
|
||||
#include "debug.h"
|
||||
|
||||
#define INDENTED_PRINTF(format, ...) printf("%*s" format, depth * 2, "", ##__VA_ARGS__)
|
||||
|
||||
#define EQ_TLV(_tlv_a, _tlv_b) \
|
||||
do { \
|
||||
EQ(_tlv_a.tl.tag, _tlv_b.tl.tag); \
|
||||
|
||||
@@ -56,4 +56,15 @@ void copy_stop_request(const nfapi_nr_stop_request_scf_t *src, nfapi_nr_stop_req
|
||||
void copy_stop_indication(const nfapi_nr_stop_indication_scf_t *src, nfapi_nr_stop_indication_scf_t *dst);
|
||||
void copy_error_indication(const nfapi_nr_error_indication_scf_t *src, nfapi_nr_error_indication_scf_t *dst);
|
||||
|
||||
void dump_param_request(const nfapi_nr_param_request_scf_t *msg);
|
||||
void dump_param_response(const nfapi_nr_param_response_scf_t *msg);
|
||||
void dump_config_request(const nfapi_nr_config_request_scf_t *msg);
|
||||
void dump_config_response(const nfapi_nr_config_response_scf_t *msg);
|
||||
void dump_start_request(const nfapi_nr_start_request_scf_t *msg);
|
||||
void dump_start_response(const nfapi_nr_start_response_scf_t *msg);
|
||||
void dump_stop_request(const nfapi_nr_stop_request_scf_t *msg);
|
||||
void dump_stop_indication(const nfapi_nr_stop_indication_scf_t *msg);
|
||||
void dump_error_indication(const nfapi_nr_error_indication_scf_t *msg);
|
||||
|
||||
|
||||
#endif // OPENAIRINTERFACE_NR_FAPI_P5_UTILS_H
|
||||
|
||||
@@ -75,4 +75,16 @@ size_t get_crc_indication_size(const nfapi_nr_crc_indication_t *msg);
|
||||
size_t get_uci_indication_size(const nfapi_nr_uci_indication_t *msg);
|
||||
size_t get_srs_indication_size(const nfapi_nr_srs_indication_t *msg);
|
||||
size_t get_rach_indication_size(nfapi_nr_rach_indication_t *msg);
|
||||
|
||||
void dump_dl_tti_request(const nfapi_nr_dl_tti_request_t *msg);
|
||||
void dump_ul_tti_request(const nfapi_nr_ul_tti_request_t *msg);
|
||||
void dump_slot_indication(const nfapi_nr_slot_indication_scf_t *msg);
|
||||
void dump_ul_dci_request(const nfapi_nr_ul_dci_request_t *msg);
|
||||
void dump_tx_data_request(const nfapi_nr_tx_data_request_t *msg);
|
||||
void dump_rx_data_indication(const nfapi_nr_rx_data_indication_t *msg);
|
||||
void dump_crc_indication(const nfapi_nr_crc_indication_t *msg);
|
||||
void dump_uci_indication(const nfapi_nr_uci_indication_t *msg);
|
||||
void dump_srs_indication(const nfapi_nr_srs_indication_t *msg);
|
||||
void dump_rach_indication(const nfapi_nr_rach_indication_t *msg);
|
||||
|
||||
#endif // OPENAIRINTERFACE_NR_FAPI_P7_UTILS_H
|
||||
|
||||
@@ -936,3 +936,113 @@ void copy_error_indication(const nfapi_nr_error_indication_scf_t *src, nfapi_nr_
|
||||
dst->message_id = src->message_id;
|
||||
dst->error_code = src->error_code;
|
||||
}
|
||||
|
||||
static void dump_p5_message_header(const nfapi_nr_p4_p5_message_header_t *hdr, int depth)
|
||||
{
|
||||
INDENTED_PRINTF("Message ID = 0x%02x\n", hdr->message_id);
|
||||
INDENTED_PRINTF("Message Length = 0x%02x\n", hdr->message_length);
|
||||
}
|
||||
|
||||
void dump_param_request(const nfapi_nr_param_request_scf_t *msg)
|
||||
{
|
||||
int depth = 0;
|
||||
dump_p5_message_header(&msg->header,depth);
|
||||
}
|
||||
|
||||
void dump_param_response(const nfapi_nr_param_response_scf_t *msg)
|
||||
{
|
||||
int depth = 0;
|
||||
dump_p5_message_header(&msg->header,depth);
|
||||
depth++;
|
||||
INDENTED_PRINTF("Error Code = 0x%02x\n", msg->error_code);
|
||||
INDENTED_PRINTF("Number of TLVs = 0x%02x\n", msg->num_tlv);
|
||||
/* dump all TLVs from each table */
|
||||
depth--;
|
||||
}
|
||||
|
||||
void dump_config_request(const nfapi_nr_config_request_scf_t *msg)
|
||||
{
|
||||
int depth = 0;
|
||||
dump_p5_message_header(&msg->header,depth);
|
||||
depth++;
|
||||
INDENTED_PRINTF("Number of TLVs = 0x%02x\n", msg->num_tlv);
|
||||
/* dump all TLVs from each table */
|
||||
depth--;
|
||||
}
|
||||
|
||||
void dump_config_response(const nfapi_nr_config_response_scf_t *msg)
|
||||
{
|
||||
int depth = 0;
|
||||
dump_p5_message_header(&msg->header,depth);
|
||||
depth++;
|
||||
INDENTED_PRINTF("Error Code = 0x%02x\n", msg->error_code);
|
||||
INDENTED_PRINTF("Number of Invalid or Unsupported TLVs = 0x%02x\n", msg->num_invalid_tlvs);
|
||||
INDENTED_PRINTF("Number of Invalid TLVs that can be configured in IDLE = 0x%02x\n", msg->num_invalid_tlvs_configured_in_idle);
|
||||
INDENTED_PRINTF("Number of Invalid TLVs that can be configured in RUNNING = 0x%02x\n",
|
||||
msg->num_invalid_tlvs_configured_in_running);
|
||||
INDENTED_PRINTF("Number of Missing TLVs = 0x%02x\n", msg->num_missing_tlvs);
|
||||
/* dump all TLVs from each table */
|
||||
depth--;
|
||||
}
|
||||
|
||||
void dump_start_request(const nfapi_nr_start_request_scf_t *msg)
|
||||
{
|
||||
int depth = 0;
|
||||
dump_p5_message_header(&msg->header,depth);
|
||||
}
|
||||
|
||||
void dump_start_response(const nfapi_nr_start_response_scf_t *msg)
|
||||
{
|
||||
int depth = 0;
|
||||
dump_p5_message_header(&msg->header,depth);
|
||||
}
|
||||
|
||||
void dump_stop_request(const nfapi_nr_stop_request_scf_t *msg)
|
||||
{
|
||||
int depth = 0;
|
||||
dump_p5_message_header(&msg->header,depth);
|
||||
}
|
||||
|
||||
void dump_stop_indication(const nfapi_nr_stop_indication_scf_t *msg)
|
||||
{
|
||||
int depth = 0;
|
||||
dump_p5_message_header(&msg->header,depth);
|
||||
}
|
||||
|
||||
static char *error_code_to_str(uint8_t error_code)
|
||||
{
|
||||
switch (error_code) {
|
||||
case NFAPI_NR_PHY_API_MSG_OK:
|
||||
return "NFAPI_NR_PHY_API_MSG_OK";
|
||||
case NFAPI_NR_PHY_API_MSG_INVALID_STATE:
|
||||
return "NFAPI_NR_PHY_API_MSG_INVALID_STATE";
|
||||
case NFAPI_NR_PHY_API_MSG_INVALID_CONFIG:
|
||||
return "NFAPI_NR_PHY_API_MSG_INVALID_CONFIG";
|
||||
case NFAPI_NR_PHY_API_SFN_OUT_OF_SYNC:
|
||||
return "NFAPI_NR_PHY_API_SFN_OUT_OF_SYNC";
|
||||
case NFAPI_NR_PHY_API_MSG_SLOR_ERR:
|
||||
return "NFAPI_NR_PHY_API_MSG_SLOR_ERR";
|
||||
case NFAPI_NR_PHY_API_MSG_BCH_MISSING:
|
||||
return "NFAPI_NR_PHY_API_MSG_BCH_MISSING";
|
||||
case NFAPI_NR_PHY_API_MSG_INVALID_SFN:
|
||||
return "NFAPI_NR_PHY_API_MSG_INVALID_SFN";
|
||||
case NFAPI_NR_PHY_API_MSG_UL_DCI_ERR:
|
||||
return "NFAPI_NR_PHY_API_MSG_UL_DCI_ERR";
|
||||
case NFAPI_NR_PHY_API_MSG_TX_ERR:
|
||||
return "NFAPI_NR_PHY_API_MSG_TX_ERR";
|
||||
default:
|
||||
return "Unknown Error code";
|
||||
}
|
||||
}
|
||||
|
||||
void dump_error_indication(const nfapi_nr_error_indication_scf_t *msg)
|
||||
{
|
||||
int depth = 0;
|
||||
dump_p5_message_header(&msg->header,depth);
|
||||
depth++;
|
||||
INDENTED_PRINTF("SFN = 0x%02x (%d)\n", msg->sfn, msg->sfn);
|
||||
INDENTED_PRINTF("Slot = 0x%02x (%d)\n", msg->slot, msg->slot);
|
||||
INDENTED_PRINTF("Message ID = 0x%02x\n", msg->message_id);
|
||||
INDENTED_PRINTF("Error Code = 0x%02x (%s) \n", msg->error_code, error_code_to_str(msg->error_code));
|
||||
depth--;
|
||||
}
|
||||
|
||||
@@ -2001,3 +2001,743 @@ size_t get_rach_indication_size(nfapi_nr_rach_indication_t *msg)
|
||||
|
||||
return total_size;
|
||||
}
|
||||
|
||||
static void dump_p7_message_header(const nfapi_nr_p7_message_header_t *hdr, int depth)
|
||||
{
|
||||
INDENTED_PRINTF("Message ID = 0x%02x\n", hdr->message_id);
|
||||
INDENTED_PRINTF("Message Length = 0x%02x\n", hdr->message_length);
|
||||
}
|
||||
|
||||
static void dump_dl_beamforming_pdu(const nfapi_nr_tx_precoding_and_beamforming_t *pdu, int depth)
|
||||
{
|
||||
INDENTED_PRINTF("numPRGs = %d\n", pdu->num_prgs);
|
||||
INDENTED_PRINTF("prgSize = %d\n", pdu->prg_size);
|
||||
INDENTED_PRINTF("digBFInterfaces = %d\n", pdu->dig_bf_interfaces);
|
||||
depth++;
|
||||
for (int i = 0; i < pdu->num_prgs; ++i) {
|
||||
INDENTED_PRINTF("PMIdx = %d\n", pdu->prgs_list[i].pm_idx);
|
||||
depth++;
|
||||
for (int j = 0; j < pdu->dig_bf_interfaces; ++j) {
|
||||
INDENTED_PRINTF("beamIDX = %d\n", pdu->prgs_list[i].dig_bf_interface_list[j].beam_idx);
|
||||
}
|
||||
depth--;
|
||||
}
|
||||
}
|
||||
|
||||
static void dump_dl_dci_pdu(const nfapi_nr_dl_dci_pdu_t *pdu, int depth)
|
||||
{
|
||||
INDENTED_PRINTF("RNTI = 0x%x\n", pdu->RNTI);
|
||||
INDENTED_PRINTF("ScramblingId = %d\n", pdu->ScramblingId);
|
||||
INDENTED_PRINTF("ScramblingRNTI = 0x%x\n", pdu->ScramblingRNTI);
|
||||
INDENTED_PRINTF("CCEIndex = %d\n", pdu->CceIndex);
|
||||
INDENTED_PRINTF("AggregationLevel = %d\n", pdu->AggregationLevel);
|
||||
dump_dl_beamforming_pdu(&pdu->precodingAndBeamforming, depth + 1);
|
||||
INDENTED_PRINTF("beta_PDCCH_1_0 = %d\n", pdu->beta_PDCCH_1_0);
|
||||
INDENTED_PRINTF("powerControlOffsetSS = %d\n", pdu->powerControlOffsetSS);
|
||||
INDENTED_PRINTF("PayloadSizeBits = %d\n", pdu->PayloadSizeBits);
|
||||
INDENTED_PRINTF("Payload = ");
|
||||
for (int i = 0; i < (pdu->PayloadSizeBits + 7) / 8; ++i) {
|
||||
printf("0x%02x ", pdu->Payload[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void dump_dl_tti_request_PDCCH_PDU(const nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdu, int depth)
|
||||
{
|
||||
INDENTED_PRINTF("BWPSize = %d\n", pdu->BWPSize);
|
||||
INDENTED_PRINTF("BWPStart = %d\n", pdu->BWPStart);
|
||||
INDENTED_PRINTF("Subcarrier Spacing = %d\n", pdu->SubcarrierSpacing);
|
||||
INDENTED_PRINTF("Ciclic Prefix = %d\n", pdu->CyclicPrefix);
|
||||
INDENTED_PRINTF("StartSymbolIndex = %d\n", pdu->StartSymbolIndex);
|
||||
INDENTED_PRINTF("DurationSymbols = %d\n", pdu->DurationSymbols);
|
||||
INDENTED_PRINTF("FrequencyDomainResource : ");
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
printf("%d ", pdu->FreqDomainResource[i]);
|
||||
}
|
||||
printf("\n");
|
||||
INDENTED_PRINTF("CCE Reg Mapping Type = %d\n", pdu->CceRegMappingType);
|
||||
INDENTED_PRINTF("Reg Bundle Size = %d\n", pdu->RegBundleSize);
|
||||
INDENTED_PRINTF("Interleaver Size = %d\n", pdu->InterleaverSize);
|
||||
INDENTED_PRINTF("CoreSetType = %d\n", pdu->CoreSetType);
|
||||
INDENTED_PRINTF("ShiftIndex = %d\n", pdu->ShiftIndex);
|
||||
INDENTED_PRINTF("precoderGranularity = %d\n", pdu->precoderGranularity);
|
||||
INDENTED_PRINTF("numDLDCI = %d\n", pdu->numDlDci);
|
||||
for (int i = 0; i < pdu->numDlDci; ++i) {
|
||||
dump_dl_dci_pdu(&pdu->dci_pdu[i], depth + 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void dump_dl_tti_request_PDSCH_PDU(const nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdu, int depth)
|
||||
{
|
||||
INDENTED_PRINTF("pduBitmap = %d\n", pdu->pduBitmap);
|
||||
INDENTED_PRINTF("RNTI = 0x%x\n", pdu->rnti);
|
||||
INDENTED_PRINTF("pduIndex = %d\n", pdu->pduIndex);
|
||||
INDENTED_PRINTF("BWPSize = %d\n", pdu->BWPSize);
|
||||
INDENTED_PRINTF("BWPStart = %d\n", pdu->BWPStart);
|
||||
INDENTED_PRINTF("SubcarrierSpacing = %d\n", pdu->SubcarrierSpacing);
|
||||
INDENTED_PRINTF("CyclicPrefix = %d\n", pdu->CyclicPrefix);
|
||||
INDENTED_PRINTF("NrOfCodewords = %d\n", pdu->NrOfCodewords);
|
||||
for (int i = 0; i < pdu->NrOfCodewords; ++i) {
|
||||
depth++;
|
||||
INDENTED_PRINTF("Codeword #%d\n", i);
|
||||
depth++;
|
||||
INDENTED_PRINTF("targetCoderate = %d\n", pdu->targetCodeRate[i]);
|
||||
INDENTED_PRINTF("qamModOrder = %d\n", pdu->qamModOrder[i]);
|
||||
INDENTED_PRINTF("mcsIndex = %d\n", pdu->mcsIndex[i]);
|
||||
INDENTED_PRINTF("mcsTable = %d\n", pdu->mcsTable[i]);
|
||||
INDENTED_PRINTF("rvIndex = %d\n", pdu->rvIndex[i]);
|
||||
INDENTED_PRINTF("TBSize = %d\n", pdu->TBSize[i]);
|
||||
depth--;
|
||||
depth--;
|
||||
}
|
||||
|
||||
INDENTED_PRINTF("dataScramblingId = %d\n", pdu->dataScramblingId);
|
||||
INDENTED_PRINTF("nrOfLayers = %d\n", pdu->nrOfLayers);
|
||||
INDENTED_PRINTF("transmissionScheme = %d\n", pdu->transmissionScheme);
|
||||
INDENTED_PRINTF("refPoint = %d\n", pdu->refPoint);
|
||||
INDENTED_PRINTF("dlDmrsSymbPos = %d\n", pdu->dlDmrsSymbPos);
|
||||
INDENTED_PRINTF("dmrsConfigType = %d\n", pdu->dmrsConfigType);
|
||||
INDENTED_PRINTF("dlDmrsScramblingId = %d\n", pdu->dlDmrsScramblingId);
|
||||
INDENTED_PRINTF("SCID = %d\n", pdu->SCID);
|
||||
INDENTED_PRINTF("numDmrsCdmGrpsNoData = %d\n", pdu->numDmrsCdmGrpsNoData);
|
||||
INDENTED_PRINTF("dmrsPorts = %d\n", pdu->dmrsPorts);
|
||||
INDENTED_PRINTF("resourceAlloc = %d\n", pdu->resourceAlloc);
|
||||
INDENTED_PRINTF("rbBitmap = ");
|
||||
for (int i = 0; i < 36; ++i) {
|
||||
printf("%d ", pdu->rbBitmap[i]);
|
||||
}
|
||||
printf("\n");
|
||||
INDENTED_PRINTF("rbStart = %d\n", pdu->rbStart);
|
||||
INDENTED_PRINTF("rbSize = %d\n", pdu->rbSize);
|
||||
INDENTED_PRINTF("VRBtoPRBMapping = %d\n", pdu->VRBtoPRBMapping);
|
||||
INDENTED_PRINTF("StartSymbolIndex = %d\n", pdu->StartSymbolIndex);
|
||||
INDENTED_PRINTF("NrOfSymbols = %d\n", pdu->NrOfSymbols);
|
||||
|
||||
INDENTED_PRINTF("PTRSPortIndex = %d\n", pdu->PTRSPortIndex);
|
||||
INDENTED_PRINTF("PTRSTimeDensity = %d\n", pdu->PTRSTimeDensity);
|
||||
INDENTED_PRINTF("PTRSFreqDensity = %d\n", pdu->PTRSFreqDensity);
|
||||
INDENTED_PRINTF("PTRSReOffset = %d\n", pdu->PTRSReOffset);
|
||||
INDENTED_PRINTF("nEpreRatioOfPDSCHToPTRS = %d\n", pdu->nEpreRatioOfPDSCHToPTRS);
|
||||
|
||||
dump_dl_beamforming_pdu(&pdu->precodingAndBeamforming, depth + 1);
|
||||
INDENTED_PRINTF("powerControlOffset = %d\n", pdu->powerControlOffset);
|
||||
INDENTED_PRINTF("powerControlOffsetSS = %d\n", pdu->powerControlOffsetSS);
|
||||
|
||||
INDENTED_PRINTF("isLastCbPresent = %d\n", pdu->isLastCbPresent);
|
||||
INDENTED_PRINTF("isInlineTbCrc = %d\n", pdu->isInlineTbCrc);
|
||||
INDENTED_PRINTF("dlTbCrc = %d\n", pdu->dlTbCrc);
|
||||
}
|
||||
|
||||
static void dump_dl_tti_request_CSI_RS_PDU(const nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *pdu, int depth)
|
||||
{
|
||||
INDENTED_PRINTF("BWPSize = %d\n", pdu->bwp_size);
|
||||
INDENTED_PRINTF("BWPStart = %d\n", pdu->bwp_start);
|
||||
INDENTED_PRINTF("SubcarrierSpacing = %d\n", pdu->subcarrier_spacing);
|
||||
INDENTED_PRINTF("CyclicPrefix = %d\n", pdu->cyclic_prefix);
|
||||
INDENTED_PRINTF("StartRB = %d\n", pdu->start_rb);
|
||||
INDENTED_PRINTF("NrOfRBs = %d\n", pdu->nr_of_rbs);
|
||||
INDENTED_PRINTF("CSIType = %d\n", pdu->csi_type);
|
||||
INDENTED_PRINTF("Row = %d\n", pdu->row);
|
||||
INDENTED_PRINTF("FreqDomain = %d\n", pdu->freq_domain);
|
||||
INDENTED_PRINTF("SymbL0 = %d\n", pdu->symb_l0);
|
||||
INDENTED_PRINTF("SymbL1 = %d\n", pdu->symb_l1);
|
||||
INDENTED_PRINTF("CDMType = %d\n", pdu->cdm_type);
|
||||
INDENTED_PRINTF("FreqDensity = %d\n", pdu->freq_density);
|
||||
INDENTED_PRINTF("ScrambId = %d\n", pdu->scramb_id);
|
||||
INDENTED_PRINTF("powerControllOffset = %d\n", pdu->power_control_offset);
|
||||
INDENTED_PRINTF("powerControllOffsetSS = %d\n", pdu->power_control_offset_ss);
|
||||
dump_dl_beamforming_pdu(&pdu->precodingAndBeamforming, depth + 1);
|
||||
}
|
||||
|
||||
static void dump_dl_tti_request_SSB_PDU(const nfapi_nr_dl_tti_ssb_pdu_rel15_t *pdu, int depth)
|
||||
{
|
||||
INDENTED_PRINTF("physCellId = %d\n", pdu->PhysCellId);
|
||||
INDENTED_PRINTF("BetaPss = %d\n", pdu->BetaPss);
|
||||
INDENTED_PRINTF("SSBBlockIndex = %d\n", pdu->SsbBlockIndex);
|
||||
INDENTED_PRINTF("SSBSubcarrierOffset = %d\n", pdu->SsbSubcarrierOffset);
|
||||
INDENTED_PRINTF("SSBOffsetPointA = %d\n", pdu->ssbOffsetPointA);
|
||||
INDENTED_PRINTF("bchPayloadFlag = %d\n", pdu->bchPayloadFlag);
|
||||
INDENTED_PRINTF("bchPayload = %x\n", pdu->bchPayload);
|
||||
dump_dl_beamforming_pdu(&pdu->precoding_and_beamforming, depth + 1);
|
||||
}
|
||||
|
||||
static char *dl_tti_pdu_type_to_str(uint16_t pdu_type)
|
||||
{
|
||||
switch (pdu_type) {
|
||||
case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE:
|
||||
return "NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE";
|
||||
case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE:
|
||||
return "NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE";
|
||||
case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE:
|
||||
return "NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE";
|
||||
case NFAPI_NR_DL_TTI_SSB_PDU_TYPE:
|
||||
return "NFAPI_NR_DL_TTI_SSB_PDU_TYPE";
|
||||
default:
|
||||
return "Unknown";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void dump_dl_tti_request(const nfapi_nr_dl_tti_request_t *msg)
|
||||
{
|
||||
int depth = 0;
|
||||
dump_p7_message_header(&msg->header, depth);
|
||||
depth++;
|
||||
INDENTED_PRINTF("SFN = %d\n", msg->SFN);
|
||||
INDENTED_PRINTF("Slot = %d\n", msg->Slot);
|
||||
INDENTED_PRINTF("nPDUs = %d\n", msg->dl_tti_request_body.nPDUs);
|
||||
INDENTED_PRINTF("nGroup = %d\n", msg->dl_tti_request_body.nGroup);
|
||||
for (int i = 0; i < msg->dl_tti_request_body.nPDUs; ++i) {
|
||||
const nfapi_nr_dl_tti_request_pdu_t *pdu = &msg->dl_tti_request_body.dl_tti_pdu_list[i];
|
||||
depth++;
|
||||
INDENTED_PRINTF("PDU #%d\n", i);
|
||||
INDENTED_PRINTF("PDUType = 0x%02x (%s)\n", pdu->PDUType, dl_tti_pdu_type_to_str(pdu->PDUType));
|
||||
INDENTED_PRINTF("PDUSize = 0x%02x\n", pdu->PDUSize);
|
||||
/* call to dump_dl_tti_request_<PDU_Type>_pdu */
|
||||
switch (pdu->PDUType) {
|
||||
case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE:
|
||||
dump_dl_tti_request_PDCCH_PDU(&pdu->pdcch_pdu.pdcch_pdu_rel15, depth + 1);
|
||||
break;
|
||||
case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE:
|
||||
dump_dl_tti_request_PDSCH_PDU(&pdu->pdsch_pdu.pdsch_pdu_rel15, depth + 1);
|
||||
break;
|
||||
case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE:
|
||||
dump_dl_tti_request_CSI_RS_PDU(&pdu->csi_rs_pdu.csi_rs_pdu_rel15, depth + 1);
|
||||
break;
|
||||
case NFAPI_NR_DL_TTI_SSB_PDU_TYPE:
|
||||
dump_dl_tti_request_SSB_PDU(&pdu->ssb_pdu.ssb_pdu_rel15, depth + 1);
|
||||
break;
|
||||
default:
|
||||
INDENTED_PRINTF("Unknown PDU type 0x%02x\n", pdu->PDUType);
|
||||
break;
|
||||
}
|
||||
depth--;
|
||||
}
|
||||
for (int group_idx = 0; group_idx < msg->dl_tti_request_body.nGroup; group_idx++) {
|
||||
depth++;
|
||||
INDENTED_PRINTF("Group #%d\n", group_idx);
|
||||
INDENTED_PRINTF("nUe[%d] = 0x%02x\n", group_idx, msg->dl_tti_request_body.nUe[group_idx]);
|
||||
for (int ue_idx = 0; ue_idx < msg->dl_tti_request_body.nUe[group_idx]; ue_idx++) {
|
||||
depth++;
|
||||
INDENTED_PRINTF("UE #%d\n", ue_idx);
|
||||
INDENTED_PRINTF("PduIdx[%d][%d] = 0x%02x\n", group_idx, ue_idx, msg->dl_tti_request_body.PduIdx[group_idx][ue_idx]);
|
||||
depth--;
|
||||
}
|
||||
depth--;
|
||||
}
|
||||
}
|
||||
|
||||
static void dump_ul_tti_beamforming(const nfapi_nr_ul_beamforming_t *pdu, int depth)
|
||||
{
|
||||
INDENTED_PRINTF("TRP Scheme = %d\n", pdu->trp_scheme);
|
||||
INDENTED_PRINTF("numPRGs = %d\n", pdu->num_prgs);
|
||||
INDENTED_PRINTF("prgSize = %d\n", pdu->prg_size);
|
||||
INDENTED_PRINTF("digBFInterface = %d\n", pdu->dig_bf_interface);
|
||||
for (int prg = 0; prg < pdu->num_prgs; ++prg) {
|
||||
INDENTED_PRINTF("PRG #%d \n", prg);
|
||||
depth++;
|
||||
for (int dbf_if = 0; dbf_if < pdu->dig_bf_interface; ++dbf_if) {
|
||||
INDENTED_PRINTF("digBFInterface #%d \n", dbf_if);
|
||||
depth++;
|
||||
INDENTED_PRINTF("beamIdx = %d\n", pdu->prgs_list[prg].dig_bf_interface_list[dbf_if].beam_idx);
|
||||
depth--;
|
||||
}
|
||||
depth--;
|
||||
}
|
||||
}
|
||||
|
||||
static char *ul_tti_prach_format_to_str(int prach_format)
|
||||
{
|
||||
switch (prach_format) {
|
||||
case 0:
|
||||
return "0";
|
||||
case 1:
|
||||
return "1";
|
||||
case 2:
|
||||
return "2";
|
||||
case 3:
|
||||
return "3";
|
||||
case 4:
|
||||
return "A1";
|
||||
case 5:
|
||||
return "A2";
|
||||
case 6:
|
||||
return "A3";
|
||||
case 7:
|
||||
return "B1";
|
||||
case 8:
|
||||
return "B4";
|
||||
case 9:
|
||||
return "C0";
|
||||
case 10:
|
||||
return "C2";
|
||||
case 11:
|
||||
return "A1/B1";
|
||||
case 12:
|
||||
return "A2/B2";
|
||||
case 13:
|
||||
return "A3/B3";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
static void dump_ul_tti_request_PRACH_PDU(const nfapi_nr_prach_pdu_t *pdu, int depth)
|
||||
{
|
||||
INDENTED_PRINTF("physCellID = %d\n", pdu->phys_cell_id);
|
||||
INDENTED_PRINTF("NumPrachOcas = %d\n", pdu->num_prach_ocas);
|
||||
INDENTED_PRINTF("prachFormat = %d (%s)\n", pdu->prach_format, ul_tti_prach_format_to_str(pdu->prach_format));
|
||||
INDENTED_PRINTF("numRa = %d\n", pdu->num_ra);
|
||||
INDENTED_PRINTF("prachStartSymbol = %d\n", pdu->prach_start_symbol);
|
||||
INDENTED_PRINTF("numCs = %d\n", pdu->num_cs);
|
||||
dump_ul_tti_beamforming(&pdu->beamforming, depth + 1);
|
||||
}
|
||||
|
||||
static void dump_ul_tti_request_PUSCH_PDU(const nfapi_nr_pusch_pdu_t *pdu, int depth)
|
||||
{
|
||||
INDENTED_PRINTF("pduBitmap = %d\n", pdu->pdu_bit_map);
|
||||
INDENTED_PRINTF("RNTI = 0x%x\n", pdu->rnti);
|
||||
INDENTED_PRINTF("Handle = %d\n", pdu->handle);
|
||||
INDENTED_PRINTF("BWPSize = %d\n", pdu->bwp_size);
|
||||
INDENTED_PRINTF("BWPStart = %d\n", pdu->bwp_start);
|
||||
INDENTED_PRINTF("SubcarrierSpacing = %d\n", pdu->subcarrier_spacing);
|
||||
INDENTED_PRINTF("CyclicPrefix = %d\n", pdu->cyclic_prefix);
|
||||
INDENTED_PRINTF("targetCodeRate = %d\n", pdu->target_code_rate);
|
||||
INDENTED_PRINTF("qamModOrder = %d\n", pdu->qam_mod_order);
|
||||
INDENTED_PRINTF("mcsIndex = %d\n", pdu->mcs_index);
|
||||
INDENTED_PRINTF("mcsTable = %d\n", pdu->mcs_table);
|
||||
INDENTED_PRINTF("TransformPrecoding = %d\n", pdu->transform_precoding);
|
||||
INDENTED_PRINTF("dataScramblingId = %d\n", pdu->data_scrambling_id);
|
||||
INDENTED_PRINTF("nrOfLayers = %d\n", pdu->nrOfLayers);
|
||||
INDENTED_PRINTF("ulDmrsSymbPos = %d\n", pdu->ul_dmrs_symb_pos);
|
||||
INDENTED_PRINTF("dmrsConfigType = %d\n", pdu->dmrs_config_type);
|
||||
INDENTED_PRINTF("ulDmrsScramblingId = %d\n", pdu->ul_dmrs_scrambling_id);
|
||||
INDENTED_PRINTF("puschIdentity = %d\n", pdu->pusch_identity);
|
||||
INDENTED_PRINTF("SCID = %d\n", pdu->scid);
|
||||
INDENTED_PRINTF("numDmrsCdmGrpsNoData = %d\n", pdu->num_dmrs_cdm_grps_no_data);
|
||||
INDENTED_PRINTF("dmrsPorts = %d\n", pdu->dmrs_ports);
|
||||
INDENTED_PRINTF("resourceAlloc = %d\n", pdu->resource_alloc);
|
||||
INDENTED_PRINTF("rbBitmap = ");
|
||||
for (int i = 0; i < 36; ++i) {
|
||||
printf("%d ", pdu->rb_bitmap[i]);
|
||||
}
|
||||
printf("\n");
|
||||
INDENTED_PRINTF("rbStart = %d\n", pdu->rb_start);
|
||||
INDENTED_PRINTF("rbSize = %d\n", pdu->rb_size);
|
||||
INDENTED_PRINTF("VRBtoPRBMapping = %d\n", pdu->vrb_to_prb_mapping);
|
||||
INDENTED_PRINTF("FrequencyHopping = %d\n", pdu->frequency_hopping);
|
||||
INDENTED_PRINTF("txDirectCurrentLocation = %d\n", pdu->tx_direct_current_location);
|
||||
INDENTED_PRINTF("uplinkFrequencyShift7p5khz = %d\n", pdu->uplink_frequency_shift_7p5khz);
|
||||
INDENTED_PRINTF("NrOfSymbols = %d\n", pdu->nr_of_symbols);
|
||||
|
||||
INDENTED_PRINTF("puschData (%s)\n", pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_DATA ? "included" : "not included");
|
||||
if (pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_DATA) {
|
||||
depth++;
|
||||
INDENTED_PRINTF("rvIndex = %d\n", pdu->pusch_data.rv_index);
|
||||
INDENTED_PRINTF("harqProcessID = %d\n", pdu->pusch_data.harq_process_id);
|
||||
INDENTED_PRINTF("newDataIndicator = %d\n", pdu->pusch_data.new_data_indicator);
|
||||
INDENTED_PRINTF("TBSize = %d\n", pdu->pusch_data.tb_size);
|
||||
INDENTED_PRINTF("numCB = %d\n", pdu->pusch_data.num_cb);
|
||||
INDENTED_PRINTF("cbPresentAndPosition = ");
|
||||
for (int i = 0; i < (pdu->pusch_data.num_cb + 7) / 8; i++) {
|
||||
printf("%d ", pdu->pusch_data.cb_present_and_position[i]);
|
||||
}
|
||||
printf("\n");
|
||||
depth--;
|
||||
}
|
||||
|
||||
INDENTED_PRINTF("puschUci (%s)\n", pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_UCI ? "included" : "not included");
|
||||
if (pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_UCI) {
|
||||
depth++;
|
||||
INDENTED_PRINTF("harqAckBitLength = %d\n", pdu->pusch_uci.harq_ack_bit_length);
|
||||
INDENTED_PRINTF("csiPart1BitLength = %d\n", pdu->pusch_uci.csi_part1_bit_length);
|
||||
INDENTED_PRINTF("csiPart2BitLength = %d\n", pdu->pusch_uci.csi_part2_bit_length);
|
||||
INDENTED_PRINTF("AlphaScaling = %d\n", pdu->pusch_uci.alpha_scaling);
|
||||
INDENTED_PRINTF("betaOffsetHarqAck = %d\n", pdu->pusch_uci.beta_offset_harq_ack);
|
||||
INDENTED_PRINTF("betaOffsetCsi1 = %d\n", pdu->pusch_uci.beta_offset_csi1);
|
||||
INDENTED_PRINTF("betaOffsetCsi2 = %d\n", pdu->pusch_uci.beta_offset_csi2);
|
||||
depth--;
|
||||
}
|
||||
|
||||
INDENTED_PRINTF("puschPtrs (%s)\n", pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS ? "included" : "not included");
|
||||
if (pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
|
||||
depth++;
|
||||
INDENTED_PRINTF("lowPaprGroupNumber = %d\n", pdu->pusch_ptrs.num_ptrs_ports);
|
||||
for (int i = 0; i < pdu->pusch_ptrs.num_ptrs_ports; ++i) {
|
||||
INDENTED_PRINTF("ptrsPort #%d\n", i);
|
||||
depth++;
|
||||
INDENTED_PRINTF("PTRSPortIndex = %d\n", pdu->pusch_ptrs.ptrs_ports_list[i].ptrs_port_index);
|
||||
INDENTED_PRINTF("PTRSDmrsPort = %d\n", pdu->pusch_ptrs.ptrs_ports_list[i].ptrs_dmrs_port);
|
||||
INDENTED_PRINTF("PTRSReOffset = %d\n", pdu->pusch_ptrs.ptrs_ports_list[i].ptrs_re_offset);
|
||||
depth--;
|
||||
}
|
||||
INDENTED_PRINTF("PTRSTimeDensity = %d\n", pdu->pusch_ptrs.ptrs_time_density);
|
||||
INDENTED_PRINTF("PTRSFreqDensity = %d\n", pdu->pusch_ptrs.ptrs_freq_density);
|
||||
INDENTED_PRINTF("ulPTRSPower = %d\n", pdu->pusch_ptrs.ul_ptrs_power);
|
||||
depth--;
|
||||
}
|
||||
|
||||
INDENTED_PRINTF("dtfsOfdm (%s)\n", pdu->pdu_bit_map & PUSCH_PDU_BITMAP_DFTS_OFDM ? "included" : "not included");
|
||||
if (pdu->pdu_bit_map & PUSCH_PDU_BITMAP_DFTS_OFDM) {
|
||||
depth++;
|
||||
INDENTED_PRINTF("lowPaprGroupNumber = %d\n", pdu->dfts_ofdm.low_papr_group_number);
|
||||
INDENTED_PRINTF("lowPaprSequenceNumber = %d\n", pdu->dfts_ofdm.low_papr_sequence_number);
|
||||
INDENTED_PRINTF("ulPtrsSampleDensity = %d\n", pdu->dfts_ofdm.ul_ptrs_sample_density);
|
||||
INDENTED_PRINTF("ulPtrsTimeDensityTransformPrecoding = %d\n", pdu->dfts_ofdm.ul_ptrs_time_density_transform_precoding);
|
||||
depth--;
|
||||
}
|
||||
dump_ul_tti_beamforming(&pdu->beamforming, depth + 1);
|
||||
}
|
||||
|
||||
static void dump_ul_tti_request_PUCCH_PDU(const nfapi_nr_pucch_pdu_t *pdu, int depth)
|
||||
{
|
||||
INDENTED_PRINTF("RNTI = 0x%x\n", pdu->rnti);
|
||||
INDENTED_PRINTF("Handle = %d\n", pdu->handle);
|
||||
INDENTED_PRINTF("BWPSize = %d\n", pdu->bwp_size);
|
||||
INDENTED_PRINTF("BWPStart = %d\n", pdu->bwp_start);
|
||||
INDENTED_PRINTF("SubcarrierSpacing = %d\n", pdu->subcarrier_spacing);
|
||||
INDENTED_PRINTF("CyclicPrefix = %d\n", pdu->cyclic_prefix);
|
||||
INDENTED_PRINTF("FormatType = %d\n", pdu->format_type);
|
||||
INDENTED_PRINTF("multiSlotTxIndicator = %d\n", pdu->multi_slot_tx_indicator);
|
||||
INDENTED_PRINTF("pi2Bpsk = %d\n", pdu->pi_2bpsk);
|
||||
INDENTED_PRINTF("prbStart = %d\n", pdu->prb_start);
|
||||
INDENTED_PRINTF("prbSize = %d\n", pdu->prb_size);
|
||||
INDENTED_PRINTF("StartSymbolIndex = %d\n", pdu->start_symbol_index);
|
||||
INDENTED_PRINTF("NrOfSymbols = %d\n", pdu->nr_of_symbols);
|
||||
INDENTED_PRINTF("freqHopFlag = %d\n", pdu->freq_hop_flag);
|
||||
INDENTED_PRINTF("secondHopPRB = %d\n", pdu->second_hop_prb);
|
||||
INDENTED_PRINTF("groupHopFlag = %d\n", pdu->group_hop_flag);
|
||||
INDENTED_PRINTF("sequenceHopFlag = %d\n", pdu->sequence_hop_flag);
|
||||
INDENTED_PRINTF("hoppingId = %d\n", pdu->hopping_id);
|
||||
INDENTED_PRINTF("InitialCyclicShift = %d\n", pdu->initial_cyclic_shift);
|
||||
INDENTED_PRINTF("dataScramblingId = %d\n", pdu->data_scrambling_id);
|
||||
INDENTED_PRINTF("TimeDomainOccIdx = %d\n", pdu->time_domain_occ_idx);
|
||||
INDENTED_PRINTF("PreDftOccIdx = %d\n", pdu->pre_dft_occ_idx);
|
||||
INDENTED_PRINTF("PreDftOccLen = %d\n", pdu->pre_dft_occ_len);
|
||||
INDENTED_PRINTF("AddDmrsFlag = %d\n", pdu->add_dmrs_flag);
|
||||
INDENTED_PRINTF("DmrsScramblingId = %d\n", pdu->dmrs_scrambling_id);
|
||||
INDENTED_PRINTF("DMRScyclicshift = %d\n", pdu->dmrs_cyclic_shift);
|
||||
INDENTED_PRINTF("SRFlag = %d\n", pdu->sr_flag);
|
||||
INDENTED_PRINTF("BitLenHarq = %d\n", pdu->bit_len_harq);
|
||||
INDENTED_PRINTF("BitLenCsiPart1 = %d\n", pdu->bit_len_csi_part1);
|
||||
INDENTED_PRINTF("BitLenCsiPart2 = %d\n", pdu->bit_len_csi_part2);
|
||||
dump_ul_tti_beamforming(&pdu->beamforming, depth + 1);
|
||||
}
|
||||
|
||||
static void dump_ul_tti_request_srs_parameters(const nfapi_v4_srs_parameters_t *pdu, const uint8_t num_symbols, uint8_t depth)
|
||||
{
|
||||
INDENTED_PRINTF("srsBandwidthSize = %d\n", pdu->srs_bandwidth_size);
|
||||
for (int symbol_idx = 0; symbol_idx < num_symbols; ++symbol_idx) {
|
||||
const nfapi_v4_srs_parameters_symbols_t *symbol = &pdu->symbol_list[symbol_idx];
|
||||
INDENTED_PRINTF("Symbol #%d\n", symbol_idx);
|
||||
depth++;
|
||||
INDENTED_PRINTF("srsBandwidthStart = %d\n", symbol->srs_bandwidth_start);
|
||||
INDENTED_PRINTF("sequenceGroup = %d\n", symbol->sequence_group);
|
||||
INDENTED_PRINTF("sequenceNumber = %d\n", symbol->sequence_number);
|
||||
depth--;
|
||||
}
|
||||
const uint8_t nUsage = __builtin_popcount(pdu->usage);
|
||||
INDENTED_PRINTF("Usage = %d (nUsage = %d)\n", pdu->usage, nUsage);
|
||||
depth++;
|
||||
for (int idx = 0; idx < nUsage; ++idx) {
|
||||
INDENTED_PRINTF("ReportType[%d] = %d\n", idx, pdu->report_type[idx]);
|
||||
}
|
||||
depth--;
|
||||
INDENTED_PRINTF("singular Value Representation = %d\n", pdu->singular_Value_representation);
|
||||
INDENTED_PRINTF("iq Representation = %d\n", pdu->iq_representation);
|
||||
INDENTED_PRINTF("prgSize = %d\n", pdu->prg_size);
|
||||
INDENTED_PRINTF("numTotalUeAntennas = %d\n", pdu->num_total_ue_antennas);
|
||||
INDENTED_PRINTF("ueAntennasInThisSrsResourceSet = %d\n", pdu->ue_antennas_in_this_srs_resource_set);
|
||||
INDENTED_PRINTF("sampledUeAntennas = %d\n", pdu->sampled_ue_antennas);
|
||||
INDENTED_PRINTF("reportScope = %d\n", pdu->report_scope);
|
||||
INDENTED_PRINTF("NumULSpatialStreamsPorts = %d\n", pdu->num_ul_spatial_streams_ports);
|
||||
depth++;
|
||||
for (int idx = 0; idx < pdu->num_ul_spatial_streams_ports; ++idx) {
|
||||
INDENTED_PRINTF("UlSpatialStreamPorts[%d] = %d\n", idx, pdu->Ul_spatial_stream_ports[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
static void dump_ul_tti_request_SRS_PDU(const nfapi_nr_srs_pdu_t *pdu, int depth)
|
||||
{
|
||||
INDENTED_PRINTF("RNTI = 0x%x\n", pdu->rnti);
|
||||
INDENTED_PRINTF("Handle = %d\n", pdu->handle);
|
||||
INDENTED_PRINTF("BWPSize = %d\n", pdu->bwp_size);
|
||||
INDENTED_PRINTF("BWPStart = %d\n", pdu->bwp_start);
|
||||
INDENTED_PRINTF("SubcarrierSpacing = %d\n", pdu->subcarrier_spacing);
|
||||
INDENTED_PRINTF("CyclicPrefix = %d\n", pdu->cyclic_prefix);
|
||||
INDENTED_PRINTF("numAntPorts = %d\n", pdu->num_ant_ports);
|
||||
INDENTED_PRINTF("numSymbols = %d\n", pdu->num_symbols);
|
||||
INDENTED_PRINTF("numRepetitions = %d\n", pdu->num_repetitions);
|
||||
INDENTED_PRINTF("timeStartPosition = %d\n", pdu->time_start_position);
|
||||
INDENTED_PRINTF("configIndex = %d\n", pdu->config_index);
|
||||
INDENTED_PRINTF("sequenceId = %d\n", pdu->sequence_id);
|
||||
INDENTED_PRINTF("bandwidthIndex = %d\n", pdu->bandwidth_index);
|
||||
INDENTED_PRINTF("combSize = %d\n", pdu->comb_size);
|
||||
INDENTED_PRINTF("combOffset = %d\n", pdu->comb_offset);
|
||||
INDENTED_PRINTF("cyclicShift = %d\n", pdu->cyclic_shift);
|
||||
INDENTED_PRINTF("frequencyPosition = %d\n", pdu->frequency_position);
|
||||
INDENTED_PRINTF("frequencyShift = %d\n", pdu->frequency_shift);
|
||||
INDENTED_PRINTF("frequencyHopping = %d\n", pdu->frequency_hopping);
|
||||
INDENTED_PRINTF("groupOrSequenceHopping = %d\n", pdu->group_or_sequence_hopping);
|
||||
INDENTED_PRINTF("resourceType = %d\n", pdu->resource_type);
|
||||
INDENTED_PRINTF("Tsrs = %d\n", pdu->t_srs);
|
||||
INDENTED_PRINTF("Toffset = %d\n", pdu->t_offset);
|
||||
dump_ul_tti_beamforming(&pdu->beamforming, depth + 1);
|
||||
dump_ul_tti_request_srs_parameters(&pdu->srs_parameters_v4, 1 << pdu->num_symbols, depth + 1);
|
||||
}
|
||||
|
||||
static char *ul_tti_pdu_type_to_str(uint16_t pdu_type)
|
||||
{
|
||||
switch (pdu_type) {
|
||||
case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE:
|
||||
return "NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE";
|
||||
case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
|
||||
return "NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE";
|
||||
case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
|
||||
return "NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE";
|
||||
case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE:
|
||||
return "NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE";
|
||||
default:
|
||||
return "Unknown";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void dump_ul_tti_request(const nfapi_nr_ul_tti_request_t *msg)
|
||||
{
|
||||
int depth = 0;
|
||||
dump_p7_message_header(&msg->header, depth);
|
||||
depth++;
|
||||
INDENTED_PRINTF("SFN = %d\n", msg->SFN);
|
||||
INDENTED_PRINTF("Slot = %d\n", msg->Slot);
|
||||
INDENTED_PRINTF("nPDUs = %d\n", msg->n_pdus);
|
||||
INDENTED_PRINTF("RachPresent = %d\n", msg->rach_present);
|
||||
INDENTED_PRINTF("nULSCH = %d\n", msg->n_ulsch);
|
||||
INDENTED_PRINTF("nULCCH = %d\n", msg->n_ulcch);
|
||||
INDENTED_PRINTF("nGroup = %d\n", msg->n_group);
|
||||
for (int i = 0; i < msg->n_pdus; ++i) {
|
||||
const nfapi_nr_ul_tti_request_number_of_pdus_t *pdu = &msg->pdus_list[i];
|
||||
depth++;
|
||||
INDENTED_PRINTF("PDU #%d\n", i);
|
||||
INDENTED_PRINTF("PDUType = 0x%02x (%s)\n", pdu->pdu_type, ul_tti_pdu_type_to_str(pdu->pdu_type));
|
||||
INDENTED_PRINTF("PDUSize = 0x%02x\n", pdu->pdu_size);
|
||||
/* call to dump_ul_tti_request_<PDU_Type>_pdu */
|
||||
switch (pdu->pdu_type) {
|
||||
case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE:
|
||||
dump_ul_tti_request_PRACH_PDU(&pdu->prach_pdu, depth + 1);
|
||||
break;
|
||||
case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
|
||||
dump_ul_tti_request_PUSCH_PDU(&pdu->pusch_pdu, depth + 1);
|
||||
break;
|
||||
case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
|
||||
dump_ul_tti_request_PUCCH_PDU(&pdu->pucch_pdu, depth + 1);
|
||||
break;
|
||||
case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE:
|
||||
dump_ul_tti_request_SRS_PDU(&pdu->srs_pdu, depth + 1);
|
||||
break;
|
||||
default:
|
||||
INDENTED_PRINTF("Unknown PDU type 0x%02x\n", pdu->pdu_type);
|
||||
break;
|
||||
}
|
||||
depth--;
|
||||
}
|
||||
for (int group_idx = 0; group_idx < msg->n_group; group_idx++) {
|
||||
const nfapi_nr_ul_tti_request_number_of_groups_t *grp = &msg->groups_list[group_idx];
|
||||
depth++;
|
||||
INDENTED_PRINTF("Group #%d\n", group_idx);
|
||||
INDENTED_PRINTF("nUe[%d] = 0x%02x\n", group_idx, grp->n_ue);
|
||||
for (int ue_idx = 0; ue_idx < grp->n_ue; ue_idx++) {
|
||||
depth++;
|
||||
INDENTED_PRINTF("UE #%d\n", ue_idx);
|
||||
INDENTED_PRINTF("PduIdx[%d][%d] = 0x%02x\n", group_idx, ue_idx, grp->ue_list[ue_idx].pdu_idx);
|
||||
depth--;
|
||||
}
|
||||
depth--;
|
||||
}
|
||||
}
|
||||
|
||||
void dump_slot_indication(const nfapi_nr_slot_indication_scf_t *msg)
|
||||
{
|
||||
int depth = 0;
|
||||
dump_p7_message_header(&msg->header, depth);
|
||||
depth++;
|
||||
INDENTED_PRINTF("SFN = %d\n", msg->sfn);
|
||||
INDENTED_PRINTF("Slot = %d\n", msg->slot);
|
||||
}
|
||||
|
||||
void dump_ul_dci_request(const nfapi_nr_ul_dci_request_t *msg)
|
||||
{
|
||||
int depth = 0;
|
||||
dump_p7_message_header(&msg->header, depth);
|
||||
depth++;
|
||||
INDENTED_PRINTF("SFN = %d\n", msg->SFN);
|
||||
INDENTED_PRINTF("Slot = %d\n", msg->Slot);
|
||||
|
||||
INDENTED_PRINTF("numPDUs = %d\n", msg->numPdus);
|
||||
for (int i = 0; i < msg->numPdus; i++) {
|
||||
depth++;
|
||||
INDENTED_PRINTF("PDU #%d\n", i);
|
||||
const nfapi_nr_ul_dci_request_pdus_t *pdu = &msg->ul_dci_pdu_list[i];
|
||||
INDENTED_PRINTF("PDUType = 0x%02x\n", pdu->PDUType);
|
||||
INDENTED_PRINTF("PDUSize = 0x%02x\n", pdu->PDUSize);
|
||||
/* call to dump_dl_tti_request_pdcch_pdu */
|
||||
dump_dl_tti_request_PDCCH_PDU(&pdu->pdcch_pdu.pdcch_pdu_rel15, depth + 1);
|
||||
depth--;
|
||||
}
|
||||
}
|
||||
|
||||
void dump_tx_data_request(const nfapi_nr_tx_data_request_t *msg)
|
||||
{
|
||||
int depth = 0;
|
||||
dump_p7_message_header(&msg->header, depth);
|
||||
depth++;
|
||||
INDENTED_PRINTF("SFN = %d\n", msg->SFN);
|
||||
INDENTED_PRINTF("Slot = %d\n", msg->Slot);
|
||||
INDENTED_PRINTF("Number of PDUs = %d\n", msg->Number_of_PDUs);
|
||||
for (int i = 0; i < msg->Number_of_PDUs; i++) {
|
||||
depth++;
|
||||
INDENTED_PRINTF("PDU #%d\n", i);
|
||||
const nfapi_nr_pdu_t *pdu = &msg->pdu_list[i];
|
||||
INDENTED_PRINTF("PDU Length = 0x%02x\n", pdu->PDU_length);
|
||||
INDENTED_PRINTF("PDU Index = 0x%02x\n", pdu->PDU_index);
|
||||
INDENTED_PRINTF("numTLV = 0x%02x\n", pdu->num_TLV);
|
||||
/* call to dump_tx_data_request_tlv */
|
||||
depth--;
|
||||
}
|
||||
}
|
||||
|
||||
void dump_rx_data_indication(const nfapi_nr_rx_data_indication_t *msg)
|
||||
{
|
||||
int depth = 0;
|
||||
dump_p7_message_header(&msg->header, depth);
|
||||
depth++;
|
||||
INDENTED_PRINTF("SFN = %d\n", msg->sfn);
|
||||
INDENTED_PRINTF("Slot = %d\n", msg->slot);
|
||||
INDENTED_PRINTF("Number of PDUs = %d\n", msg->number_of_pdus);
|
||||
for (int pdu_idx = 0; pdu_idx < msg->number_of_pdus; pdu_idx++) {
|
||||
depth++;
|
||||
INDENTED_PRINTF("PDU #%d\n", pdu_idx);
|
||||
const nfapi_nr_rx_data_pdu_t *pdu = &msg->pdu_list[pdu_idx];
|
||||
INDENTED_PRINTF("Handle = 0x%02x\n", pdu->handle);
|
||||
INDENTED_PRINTF("RNTI = 0x%02x\n", pdu->rnti);
|
||||
INDENTED_PRINTF("HarqID = 0x%02x\n", pdu->harq_id);
|
||||
INDENTED_PRINTF("PDU Length = 0x%02x\n", pdu->pdu_length);
|
||||
INDENTED_PRINTF("UL_CQI = 0x%02x\n", pdu->ul_cqi);
|
||||
INDENTED_PRINTF("Timing advance = 0x%02x\n", pdu->timing_advance);
|
||||
INDENTED_PRINTF("RSSI = 0x%02x\n", pdu->rssi);
|
||||
INDENTED_PRINTF("PDU =");
|
||||
for (int i = 0; i < pdu->pdu_length; i++) {
|
||||
printf("%02x ", pdu->pdu[i]);
|
||||
}
|
||||
printf("\n");
|
||||
depth--;
|
||||
}
|
||||
}
|
||||
|
||||
void dump_crc_indication(const nfapi_nr_crc_indication_t *msg)
|
||||
{
|
||||
int depth = 0;
|
||||
dump_p7_message_header(&msg->header, depth);
|
||||
depth++;
|
||||
INDENTED_PRINTF("SFN = %d\n", msg->sfn);
|
||||
INDENTED_PRINTF("Slot = %d\n", msg->slot);
|
||||
INDENTED_PRINTF("NumCRCs = %d\n", msg->number_crcs);
|
||||
for (int i = 0; i < msg->number_crcs; i++) {
|
||||
depth++;
|
||||
INDENTED_PRINTF("CRC #%d\n", i);
|
||||
const nfapi_nr_crc_t *crc = &msg->crc_list[i];
|
||||
INDENTED_PRINTF("Handle = 0x%02x\n", crc->handle);
|
||||
INDENTED_PRINTF("RNTI = 0x%02x\n", crc->rnti);
|
||||
INDENTED_PRINTF("HarqID = 0x%02x\n", crc->harq_id);
|
||||
INDENTED_PRINTF("TbCrcStatus = 0x%02x\n", crc->tb_crc_status);
|
||||
INDENTED_PRINTF("NumCb = 0x%02x\n", crc->num_cb);
|
||||
const uint16_t cb_len = (crc->num_cb / 8) + 1; // length is ceil(NumCb/8)
|
||||
INDENTED_PRINTF("CbCrcStatus =\n");
|
||||
for (int j = 0; j < cb_len; j++) {
|
||||
printf("%02x ", crc->cb_crc_status[j]);
|
||||
}
|
||||
printf("\n");
|
||||
INDENTED_PRINTF("UL_CQI = 0x%02x\n", crc->ul_cqi);
|
||||
INDENTED_PRINTF("Timing advance = 0x%02x\n", crc->timing_advance);
|
||||
INDENTED_PRINTF("RSSI = 0x%02x\n", crc->rssi);
|
||||
depth--;
|
||||
}
|
||||
}
|
||||
|
||||
void dump_uci_indication(const nfapi_nr_uci_indication_t *msg)
|
||||
{
|
||||
int depth = 0;
|
||||
dump_p7_message_header(&msg->header, depth);
|
||||
depth++;
|
||||
INDENTED_PRINTF("SFN = %d\n", msg->sfn);
|
||||
INDENTED_PRINTF("Slot = %d\n", msg->slot);
|
||||
|
||||
INDENTED_PRINTF("NumUCIS = %d\n", msg->num_ucis);
|
||||
for (int i = 0; i < msg->num_ucis; i++) {
|
||||
depth++;
|
||||
INDENTED_PRINTF("UCI #%d\n", i);
|
||||
const nfapi_nr_uci_t *uci = &msg->uci_list[i];
|
||||
INDENTED_PRINTF("PDUType = 0x%02x\n", uci->pdu_type);
|
||||
INDENTED_PRINTF("PDUSize = 0x%02x\n", uci->pdu_size);
|
||||
/* call to dump_uci_indication_<PDU_Type>_pdu */
|
||||
depth--;
|
||||
}
|
||||
}
|
||||
|
||||
void dump_srs_indication(const nfapi_nr_srs_indication_t *msg)
|
||||
{
|
||||
int depth = 0;
|
||||
dump_p7_message_header(&msg->header, depth);
|
||||
depth++;
|
||||
INDENTED_PRINTF("SFN = %d\n", msg->sfn);
|
||||
INDENTED_PRINTF("Slot = %d\n", msg->slot);
|
||||
|
||||
INDENTED_PRINTF("controlLength = %d\n", msg->control_length);
|
||||
INDENTED_PRINTF("Number of PDUs = %d\n", msg->number_of_pdus);
|
||||
for (int i = 0; i < msg->number_of_pdus; i++) {
|
||||
depth++;
|
||||
INDENTED_PRINTF("PDU #%d\n", i);
|
||||
const nfapi_nr_srs_indication_pdu_t *pdu = &msg->pdu_list[i];
|
||||
INDENTED_PRINTF("Handle = 0x%02x\n", pdu->handle);
|
||||
INDENTED_PRINTF("RNTI = 0x%02x\n", pdu->rnti);
|
||||
INDENTED_PRINTF("Timing advance offset = 0x%02x\n", pdu->timing_advance_offset);
|
||||
INDENTED_PRINTF("Timing advance offset in nanoseconds = 0x%02x\n", pdu->timing_advance_offset_nsec);
|
||||
INDENTED_PRINTF("SRS usage = 0x%02x\n", pdu->srs_usage);
|
||||
INDENTED_PRINTF("Report Type = 0x%02x\n", pdu->report_type);
|
||||
/* call to dump_srs_report_tlv */
|
||||
depth--;
|
||||
}
|
||||
}
|
||||
|
||||
void dump_rach_indication(const nfapi_nr_rach_indication_t *msg)
|
||||
{
|
||||
int depth = 0;
|
||||
dump_p7_message_header(&msg->header, depth);
|
||||
depth++;
|
||||
INDENTED_PRINTF("SFN = %d\n", msg->sfn);
|
||||
INDENTED_PRINTF("Slot = %d\n", msg->slot);
|
||||
|
||||
INDENTED_PRINTF("Number of PDUs = %d\n", msg->number_of_pdus);
|
||||
for (int i = 0; i < msg->number_of_pdus; i++) {
|
||||
depth++;
|
||||
INDENTED_PRINTF("PRACH PDU #%d\n", i);
|
||||
const nfapi_nr_prach_indication_pdu_t *pdu = &msg->pdu_list[i];
|
||||
INDENTED_PRINTF("physCellID = 0x%02x\n", pdu->phy_cell_id);
|
||||
INDENTED_PRINTF("SymbolIndex = 0x%02x\n", pdu->symbol_index);
|
||||
INDENTED_PRINTF("SlotIndex = 0x%02x\n", pdu->slot_index);
|
||||
INDENTED_PRINTF("FreqIndex = 0x%02x\n", pdu->freq_index);
|
||||
INDENTED_PRINTF("avgRssi = 0x%02x\n", pdu->avg_rssi);
|
||||
INDENTED_PRINTF("avgSnr = 0x%02x\n", pdu->avg_snr);
|
||||
INDENTED_PRINTF("numPreamble = 0x%02x\n", pdu->num_preamble);
|
||||
for (int j = 0; j < pdu->num_preamble; j++) {
|
||||
depth++;
|
||||
INDENTED_PRINTF("Preamble #%d\n", j);
|
||||
const nfapi_nr_prach_indication_preamble_t *preamble = &pdu->preamble_list[j];
|
||||
INDENTED_PRINTF("preambleIndex = 0x%02x\n", preamble->preamble_index);
|
||||
INDENTED_PRINTF("Timing advance = 0x%02x\n", preamble->timing_advance);
|
||||
INDENTED_PRINTF("PreamblePwr = 0x%02x\n", preamble->preamble_pwr);
|
||||
depth--;
|
||||
}
|
||||
depth--;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
add_executable(nfapi_hex_parser nfapi_hex_parser.c)
|
||||
target_link_libraries(nfapi_hex_parser PUBLIC nr_fapi_p5 nr_fapi_p7)
|
||||
# This makes it so nfapi_hex_parser is always compiled whenever NFAPI_LIB is compiled
|
||||
add_dependencies(NFAPI_LIB nfapi_hex_parser )
|
||||
@@ -0,0 +1,401 @@
|
||||
# Example runs of nfapi_hex_parser
|
||||
## 1 - An invalid DL_TTI.request
|
||||
```
|
||||
./nfapi/open-nFAPI/utils/nfapi_hex_parser 0x00 0x00 0x00 0x80 0x00 0x00 0x01 0x7e 0x00 0x62 0x00 0x00 0x03 0x01 0x00 0x03 0x00 0x15 0x00 0x01 0x00 0x00 0x00 0x00 0x18 0x01 0x06 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x34 0x01 0x11 0x00 0x00 0x00 0x00 0x00 0x02 0x00 0x00 0x00 0x00 0xe0 0x01 0x01 0x06 0x02 0x00 0x00 0x01 0x00 0x00 0x01 0xff 0xff 0x00 0x01 0x00 0x00 0x00 0x04 0x00 0x01 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x1c 0x00 0x00 0x00 0x80 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x00 0x71 0x00 0x00 0xff 0xff 0x00 0x00 0x01 0x11 0x00 0x00 0x00 0x00 0x01 0x01 0x34 0x02 0x04 0x00 0x00 0x00 0x00 0x00 0x7b 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x04 0x00 0x00 0x01 0x00 0x01 0x00 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x2d 0x00 0x0e 0x00 0x03 0x0b 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
|
||||
Parsed 382 bytes:
|
||||
00 00 00 80 00 00 01 7e 00 62 00 00 03 01 00 03
|
||||
00 15 00 01 00 00 00 00 18 01 06 00 0d 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 34 01 11 00 00 00 00 00 02 00
|
||||
00 00 00 e0 01 01 06 02 00 00 01 00 00 01 ff ff
|
||||
00 01 00 00 00 04 00 01 00 01 00 00 00 00 00 00
|
||||
00 00 1c 00 00 00 80 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 01 00 71 00 00 ff ff
|
||||
00 00 01 11 00 00 00 00 01 01 34 02 04 00 00 00
|
||||
00 00 7b 00 00 00 00 00 00 00 00 00 00 00 01 01
|
||||
00 00 00 04 00 00 01 00 01 00 01 01 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 2d 00 0e 00 03 0b 00 00 00 00 00 00 01 00 01
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
Decoded message NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST message length 0x17e
|
||||
Message ID = 0x80
|
||||
Message Length = 0x17e
|
||||
SFN = 98
|
||||
Slot = 0
|
||||
nPDUs = 3
|
||||
nGroup = 1
|
||||
PDU #0
|
||||
PDUType = 0x03 (NFAPI_NR_DL_TTI_SSB_PDU_TYPE)
|
||||
PDUSize = 0x15
|
||||
physCellId = 1
|
||||
BetaPss = 0
|
||||
SSBBlockIndex = 0
|
||||
SSBSubcarrierOffset = 0
|
||||
SSBOffsetPointA = 24
|
||||
bchPayloadFlag = 1
|
||||
bchPayload = 6000d
|
||||
numPRGs = 0
|
||||
prgSize = 0
|
||||
digBFInterfaces = 0
|
||||
PDU #1
|
||||
PDUType = 0x00 (NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE)
|
||||
PDUSize = 0x00
|
||||
BWPSize = 0
|
||||
BWPStart = 0
|
||||
Subcarrier Spacing = 0
|
||||
Ciclic Prefix = 0
|
||||
StartSymbolIndex = 0
|
||||
DurationSymbols = 0
|
||||
FrequencyDomainResource : 0 0 0 0 0 0
|
||||
CCE Reg Mapping Type = 0
|
||||
Reg Bundle Size = 0
|
||||
Interleaver Size = 0
|
||||
CoreSetType = 0
|
||||
ShiftIndex = 0
|
||||
precoderGranularity = 0
|
||||
numDLDCI = 0
|
||||
PDU #2
|
||||
PDUType = 0x00 (NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE)
|
||||
PDUSize = 0x00
|
||||
BWPSize = 0
|
||||
BWPStart = 0
|
||||
Subcarrier Spacing = 0
|
||||
Ciclic Prefix = 0
|
||||
StartSymbolIndex = 0
|
||||
DurationSymbols = 0
|
||||
FrequencyDomainResource : 0 0 0 0 0 0
|
||||
CCE Reg Mapping Type = 0
|
||||
Reg Bundle Size = 0
|
||||
Interleaver Size = 0
|
||||
CoreSetType = 0
|
||||
ShiftIndex = 0
|
||||
precoderGranularity = 0
|
||||
numDLDCI = 0
|
||||
Group #0
|
||||
nUe[0] = 0x00
|
||||
```
|
||||
|
||||
## 2 - A valid ERROR.indication
|
||||
```
|
||||
./nfapi/open-nFAPI/utils/nfapi_hex_parser 0x00 0x00 0x00 0x07 0x00 0x00 0x00 0x06 0x00 0x0a 0x00 0x10 0x80 0x06
|
||||
Parsed values:
|
||||
00 00 00 07 00 00 00 06 00 0a 00 10 80 06
|
||||
Processing message NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION
|
||||
Message ID = 0x07
|
||||
Message Length = 0x06
|
||||
SFN = 0x0a
|
||||
Slot = 0x10
|
||||
Message ID = 0x80
|
||||
Error Code = 0x06 (NFAPI_NR_PHY_API_MSG_INVALID_SFN)
|
||||
```
|
||||
|
||||
## 3 - A valid SLOT.indication
|
||||
```
|
||||
./nfapi/open-nFAPI/utils/nfapi_hex_parser 0x00 0x01 0x00 0x82 0x00 0x00 0x00 0x04 0x00 0x05 0x00 0x06
|
||||
Parsed values:
|
||||
00 01 00 82 00 00 00 04 00 05 00 06
|
||||
Processing message NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION
|
||||
Message ID = 0x82
|
||||
Message Length = 0x04
|
||||
SFN = 5
|
||||
Slot = 6
|
||||
```
|
||||
|
||||
## 4 - A valid ERROR.indication, with diverging formats for the hexdump passed as a parameter
|
||||
```
|
||||
user@user-PC:~/nfapi_parser/cmake_targets/ran_build/build$ ./nfapi/open-nFAPI/utils/nfapi_hex_parser "00 0 0x00 7 0x00 0x00 0x00" 0x06 0x00 "a 0x00 0x10 0x80 7"
|
||||
Parsed 14 bytes:
|
||||
00 00 00 07 00 00 00 06 00 0a 00 10 80 07
|
||||
Decoded message NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION message length 0x06
|
||||
Message ID = 0x07
|
||||
Message Length = 0x06
|
||||
SFN = 0x0a (10)
|
||||
Slot = 0x10 (16)
|
||||
Message ID = 0x80
|
||||
Error Code = 0x07 (NFAPI_NR_PHY_API_MSG_UL_DCI_ERR)
|
||||
```
|
||||
|
||||
## 5 - An invalid message, passing less bytes than the minimum required to encode a FAPI message header
|
||||
```
|
||||
user@user-PC:~/nfapi_parser/cmake_targets/ran_build/build$ ./nfapi/open-nFAPI/utils/nfapi_hex_parser 1
|
||||
Parsed 1 bytes:
|
||||
01
|
||||
|
||||
Assertion (byte_count >= sizeof(fapi_message_header_t)) failed!
|
||||
In main() /home/user/nfapi_parser/nfapi/open-nFAPI/utils/nfapi_hex_parser.c:293
|
||||
Read byte amount not enough to encode the header. Should have a minimum of 8 bytes, aborting...
|
||||
Exiting execution
|
||||
/home/user/nfapi_parser/nfapi/open-nFAPI/utils/nfapi_hex_parser.c:293 main() Exiting OAI (n)FAPI Hex Parser: _Assert_Exit_
|
||||
Aborted (core dumped)
|
||||
```
|
||||
|
||||
## 7 - A valid DL_TTI.request
|
||||
```
|
||||
./nfapi/open-nFAPI/utils/nfapi_hex_parser 0x00 0x01 0x00 0x80 0x00 0x00 0x00 0xc3 0x00 0x02 0x00 0x00 0x03 0x00 0x00 0x03 0x00 0x19 0x00 0x00 0x00 0x00 0x0c 0x00 0xfc 0x01 0x06 0xc6 0x01 0x00 0x00 0x01 0x01 0x13 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x31 0x00 0x30 0x00 0x6e 0x01 0x00 0x00 0x01 0xff 0x00 0x00 0x00 0x00 0x00 0x01 0x06 0x02 0x00 0x00 0x00 0x00 0x00 0x01 0xff 0xff 0x00 0x00 0x00 0x00 0x00 0x04 0x00 0x00 0x00 0x00 0x01 0x00 0x01 0x00 0x27 0x00 0x00 0x14 0x01 0x2d 0x00 0x01 0x00 0x61 0x00 0x00 0xff 0xff 0x00 0x00 0x00 0x30 0x00 0x6e 0x01 0x00 0x01 0x0e 0xce 0x02 0x05 0x00 0x00 0x00 0x00 0x00 0x81 0x00 0x00 0x01 0x00 0x01 0x02 0x44 0x00 0x00 0x00 0x00 0x02 0x00 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x10 0x00 0x02 0x0a 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x02 0x00 0x00 0xe0 0x20 0x10 0x29 0x00 0x01 0x62 0x00 0x00 0x00
|
||||
Parsed 193 bytes:
|
||||
00 01 00 80 00 00 00 c3 00 02 00 00 03 00 00 03
|
||||
00 19 00 00 00 00 0c 00 fc 01 06 c6 01 00 00 01
|
||||
01 13 01 00 00 00 00 00 00 00 31 00 30 00 6e 01
|
||||
00 00 01 ff 00 00 00 00 00 01 06 02 00 00 00 00
|
||||
00 01 ff ff 00 00 00 00 00 04 00 00 00 00 01 00
|
||||
01 00 27 00 00 14 01 2d 00 01 00 61 00 00 ff ff
|
||||
00 00 00 30 00 6e 01 00 01 0e ce 02 05 00 00 00
|
||||
00 00 81 00 00 01 00 01 02 44 00 00 00 00 02 00
|
||||
01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 10 00 02 0a 00 00 00
|
||||
00 01 00 00 02 00 00 e0 20 10 29 00 01 62 00 00
|
||||
00
|
||||
Decoded message NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST message length 0xc3
|
||||
Message ID = 0x80
|
||||
Message Length = 0xc3
|
||||
SFN = 2
|
||||
Slot = 0
|
||||
nPDUs = 3
|
||||
nGroup = 0
|
||||
PDU #0
|
||||
PDUType = 0x03 (NFAPI_NR_DL_TTI_SSB_PDU_TYPE)
|
||||
PDUSize = 0x19
|
||||
physCellId = 0
|
||||
BetaPss = 0
|
||||
SSBBlockIndex = 0
|
||||
SSBSubcarrierOffset = 12
|
||||
SSBOffsetPointA = 252
|
||||
bchPayloadFlag = 1
|
||||
bchPayload = 6c601
|
||||
numPRGs = 1
|
||||
prgSize = 275
|
||||
digBFInterfaces = 1
|
||||
PMIdx = 0
|
||||
beamIDX = 0
|
||||
PDU #1
|
||||
PDUType = 0x00 (NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE)
|
||||
PDUSize = 0x31
|
||||
BWPSize = 48
|
||||
BWPStart = 110
|
||||
Subcarrier Spacing = 1
|
||||
Ciclic Prefix = 0
|
||||
StartSymbolIndex = 0
|
||||
DurationSymbols = 1
|
||||
FrequencyDomainResource : 255 0 0 0 0 0
|
||||
CCE Reg Mapping Type = 1
|
||||
Reg Bundle Size = 6
|
||||
Interleaver Size = 2
|
||||
CoreSetType = 0
|
||||
ShiftIndex = 0
|
||||
precoderGranularity = 0
|
||||
numDLDCI = 1
|
||||
RNTI = 0xffff
|
||||
ScramblingId = 0
|
||||
ScramblingRNTI = 0x0
|
||||
CCEIndex = 0
|
||||
AggregationLevel = 4
|
||||
numPRGs = 0
|
||||
prgSize = 0
|
||||
digBFInterfaces = 1
|
||||
beta_PDCCH_1_0 = 0
|
||||
powerControlOffsetSS = 1
|
||||
PayloadSizeBits = 39
|
||||
Payload = 0x00 0x00 0x14 0x01 0x2d
|
||||
PDU #2
|
||||
PDUType = 0x01 (NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE)
|
||||
PDUSize = 0x61
|
||||
pduBitmap = 0
|
||||
RNTI = ffff
|
||||
pduIndex = 0
|
||||
BWPSize = 48
|
||||
BWPStart = 110
|
||||
SubcarrierSpacing = 1
|
||||
CyclicPrefix = 0
|
||||
NrOfCodewords = 1
|
||||
Codeword #0
|
||||
targetCoderate = 3790
|
||||
qamModOrder = 2
|
||||
mcsIndex = 5
|
||||
mcsTable = 0
|
||||
rvIndex = 0
|
||||
TBSize = 129
|
||||
dataScramblingId = 0
|
||||
nrOfLayers = 1
|
||||
transmissionScheme = 0
|
||||
refPoint = 1
|
||||
dlDmrsSymbPos = 580
|
||||
dmrsConfigType = 0
|
||||
dlDmrsScramblingId = 0
|
||||
SCID = 0
|
||||
numDmrsCdmGrpsNoData = 2
|
||||
dmrsPorts = 1
|
||||
resourceAlloc = 1
|
||||
rbBitmap = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
rbStart = 0
|
||||
rbSize = 16
|
||||
VRBtoPRBMapping = 0
|
||||
StartSymbolIndex = 2
|
||||
NrOfSymbols = 10
|
||||
PTRSPortIndex = 0
|
||||
PTRSTimeDensity = 0
|
||||
PTRSFreqDensity = 0
|
||||
PTRSReOffset = 0
|
||||
nEpreRatioOfPDSCHToPTRS = 0
|
||||
numPRGs = 0
|
||||
prgSize = 0
|
||||
digBFInterfaces = 1
|
||||
powerControlOffset = 0
|
||||
powerControlOffsetSS = 0
|
||||
isLastCbPresent = 0
|
||||
isInlineTbCrc = 0
|
||||
dlTbCrc = 0
|
||||
```
|
||||
|
||||
## 7 - A Valid UL_TTI.request
|
||||
|
||||
```
|
||||
./nfapi/open-nFAPI/utils/nfapi_hex_parser 0x00 0x01 0x00 0x81 0x00 0x00 0x00 0x98 0x02 0xd0 0x00 0x04 0x02 0x00 0x00 0x01 0x00 0x00 0x03 0x00 0x45 0x30 0x39 0x00 0x00 0x00 0x00 0x01 0x11 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x0c 0x3d 0x00 0x28 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x02 0x00 0x50 0x00 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x10 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x02 0x01 0x00 0x01 0x00 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x02 0x00 0x38 0x30 0x39 0x00 0x00 0x00 0x00 0x01 0x11 0x00 0x00 0x01 0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x03 0x0d 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x28 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x07 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
|
||||
Parsed 150 bytes:
|
||||
00 01 00 81 00 00 00 98 02 d0 00 04 02 00 00 01
|
||||
00 00 03 00 45 30 39 00 00 00 00 01 11 00 00 01
|
||||
00 00 00 00 0c 3d 00 28 00 00 00 00 00 00 00 00
|
||||
00 02 00 50 00 04 00 00 00 00 00 00 01 10 00 00
|
||||
00 00 00 00 00 02 01 00 01 00 01 01 00 00 00 00
|
||||
00 00 00 00 00 00 00 02 00 38 30 39 00 00 00 00
|
||||
01 11 00 00 01 00 02 00 00 00 00 00 03 0d 01 00
|
||||
00 00 00 00 00 28 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 07 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00
|
||||
Decoded message NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST message length 0x98
|
||||
Message ID = 0x81
|
||||
Message Length = 0x98
|
||||
SFN = 720
|
||||
Slot = 4
|
||||
nPDUs = 2
|
||||
RachPresent = 0
|
||||
nULSCH = 0
|
||||
nULCCH = 1
|
||||
nGroup = 0
|
||||
PDU #0
|
||||
PDUType = 0x03 (NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE)
|
||||
PDUSize = 0x45
|
||||
RNTI = 3039
|
||||
Handle = 0
|
||||
BWPSize = 273
|
||||
BWPStart = 0
|
||||
SubcarrierSpacing = 1
|
||||
CyclicPrefix = 0
|
||||
numAntPorts = 0
|
||||
numSymbols = 0
|
||||
numRepetitions = 0
|
||||
timeStartPosition = 12
|
||||
configIndex = 61
|
||||
sequenceId = 40
|
||||
bandwidthIndex = 0
|
||||
combSize = 0
|
||||
combOffset = 0
|
||||
cyclicShift = 0
|
||||
frequencyPosition = 0
|
||||
frequencyShift = 0
|
||||
frequencyHopping = 0
|
||||
groupOrSequenceHopping = 0
|
||||
resourceType = 2
|
||||
Tsrs = 80
|
||||
Toffset = 4
|
||||
TRP Scheme = 0
|
||||
numPRGs = 0
|
||||
prgSize = 0
|
||||
digBFInterface = 0
|
||||
srsBandwidthSize = 272
|
||||
Symbol #0
|
||||
srsBandwidthStart = 0
|
||||
sequenceGroup = 0
|
||||
sequenceNumber = 0
|
||||
Usage = 2 (nUsage = 1)
|
||||
ReportType[0] = 1
|
||||
singular Value Representation = 0
|
||||
iq Representation = 1
|
||||
prgSize = 1
|
||||
numTotalUeAntennas = 1
|
||||
ueAntennasInThisSrsResourceSet = 0
|
||||
sampledUeAntennas = 0
|
||||
reportScope = 0
|
||||
NumULSpatialStreamsPorts = 0
|
||||
PDU #1
|
||||
PDUType = 0x02 (NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE)
|
||||
PDUSize = 0x38
|
||||
RNTI = 3039
|
||||
Handle = 0
|
||||
BWPSize = 273
|
||||
BWPStart = 0
|
||||
SubcarrierSpacing = 1
|
||||
CyclicPrefix = 0
|
||||
FormatType = 2
|
||||
multiSlotTxIndicator = 0
|
||||
pi2Bpsk = 0
|
||||
prbStart = 0
|
||||
prbSize = 3
|
||||
StartSymbolIndex = 13
|
||||
NrOfSymbols = 1
|
||||
freqHopFlag = 0
|
||||
secondHopPRB = 0
|
||||
groupHopFlag = 0
|
||||
sequenceHopFlag = 0
|
||||
hoppingId = 40
|
||||
InitialCyclicShift = 0
|
||||
dataScramblingId = 0
|
||||
TimeDomainOccIdx = 0
|
||||
PreDftOccIdx = 0
|
||||
PreDftOccLen = 0
|
||||
AddDmrsFlag = 0
|
||||
DmrsScramblingId = 0
|
||||
DMRScyclicshift = 0
|
||||
SRFlag = 0
|
||||
BitLenHarq = 0
|
||||
BitLenCsiPart1 = 7
|
||||
BitLenCsiPart2 = 0
|
||||
TRP Scheme = 0
|
||||
numPRGs = 0
|
||||
prgSize = 0
|
||||
digBFInterface = 0
|
||||
|
||||
```
|
||||
|
||||
## 8 - A valid UL_TTI.request with a PRACH PDU
|
||||
|
||||
```
|
||||
./nfapi/open-nFAPI/utils/nfapi_hex_parser 0x00 0x01 0x00 0x81 0x00 0x00 0x00 0x2d 0x02 0xd1 0x00 0x13 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x12 0x00 0x00 0x03 0x05 0x00 0x00 0x00 0x1b 0x00 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x08 0x00 0x01 0x0d 0x01 0x00
|
||||
Parsed 43 bytes:
|
||||
00 01 00 81 00 00 00 2d 02 d1 00 13 01 01 00 00
|
||||
00 00 00 00 12 00 00 03 05 00 00 00 1b 00 00 00
|
||||
00 00 01 00 00 08 00 01 0d 01 00
|
||||
Decoded message NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST message length 0x2d
|
||||
Message ID = 0x81
|
||||
Message Length = 0x2d
|
||||
SFN = 721
|
||||
Slot = 19
|
||||
nPDUs = 1
|
||||
RachPresent = 1
|
||||
nULSCH = 0
|
||||
nULCCH = 0
|
||||
nGroup = 0
|
||||
PDU #0
|
||||
PDUType = 0x00 (NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE)
|
||||
PDUSize = 0x12
|
||||
physCellID = 0
|
||||
NumPrachOcas = 3
|
||||
prachFormat = 5 (A2)
|
||||
numRa = 0
|
||||
prachStartSymbol = 0
|
||||
numCs = 27
|
||||
TRP Scheme = 0
|
||||
numPRGs = 0
|
||||
prgSize = 0
|
||||
digBFInterface = 1
|
||||
```
|
||||
@@ -0,0 +1,294 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "nr_fapi.h"
|
||||
#include "nr_fapi_p5.h"
|
||||
#include "nr_fapi_p5_utils.h"
|
||||
#include "nr_fapi_p7.h"
|
||||
#include "nr_fapi_p7_utils.h"
|
||||
#define MAX_BUFFER_SIZE (1024 * 1024 * 2)
|
||||
|
||||
void exit_function(const char *file, const char *function, const int line, const char *s, const int assert)
|
||||
{
|
||||
if (s != NULL) {
|
||||
printf("%s:%d %s() Exiting OAI (n)FAPI Hex Parser: %s\n", file, line, function, s);
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
char *message_id_to_str(uint32_t message_id)
|
||||
{
|
||||
switch (message_id) {
|
||||
case NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST:
|
||||
return "NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST";
|
||||
case NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE:
|
||||
return "NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE";
|
||||
case NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST:
|
||||
return "NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST";
|
||||
case NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE:
|
||||
return "NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE";
|
||||
case NFAPI_NR_PHY_MSG_TYPE_START_REQUEST:
|
||||
return "NFAPI_NR_PHY_MSG_TYPE_START_REQUEST";
|
||||
case NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE:
|
||||
return "NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE";
|
||||
case NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST:
|
||||
return "NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST";
|
||||
case NFAPI_NR_PHY_MSG_TYPE_STOP_INDICATION:
|
||||
return "NFAPI_NR_PHY_MSG_TYPE_STOP_INDICATION";
|
||||
case NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION:
|
||||
return "NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION";
|
||||
case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
|
||||
return "NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST";
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
|
||||
return "NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST";
|
||||
case NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION:
|
||||
return "NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION";
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST:
|
||||
return "NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST";
|
||||
case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST:
|
||||
return "NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST";
|
||||
case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
|
||||
return "NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION";
|
||||
case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
|
||||
return "NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION";
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
|
||||
return "NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION";
|
||||
case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
|
||||
return "NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION";
|
||||
case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
|
||||
return "NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION";
|
||||
default:
|
||||
return "UNKNOWN PHY MSG TYPE";
|
||||
}
|
||||
}
|
||||
|
||||
void unpack_and_dump_message(void *buf, fapi_message_header_t hdr)
|
||||
{
|
||||
void *unpacked_req = calloc(1,MAX_BUFFER_SIZE);
|
||||
AssertFatal(unpacked_req != NULL, "malloc failed");
|
||||
if (hdr.message_id >= NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST && hdr.message_id <= NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION) {
|
||||
const int ret = fapi_nr_p5_message_unpack(buf, hdr.message_length + NFAPI_HEADER_LENGTH, unpacked_req, MAX_BUFFER_SIZE, 0);
|
||||
DevAssert(ret >= 0);
|
||||
} else if (hdr.message_id >= NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST && hdr.message_id <= NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION) {
|
||||
const int ret = fapi_nr_p7_message_unpack(buf, hdr.message_length + NFAPI_HEADER_LENGTH, unpacked_req, MAX_BUFFER_SIZE, 0);
|
||||
DevAssert(ret >= 0);
|
||||
}
|
||||
|
||||
switch (hdr.message_id) {
|
||||
/* P5 messages */
|
||||
case NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST: {
|
||||
dump_param_request(unpacked_req);
|
||||
free_param_request(unpacked_req);
|
||||
return;
|
||||
}
|
||||
case NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE: {
|
||||
dump_param_response(unpacked_req);
|
||||
free_param_response(unpacked_req);
|
||||
return;
|
||||
}
|
||||
case NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST: {
|
||||
dump_config_request(unpacked_req);
|
||||
free_config_request(unpacked_req);
|
||||
return;
|
||||
}
|
||||
case NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE: {
|
||||
dump_config_response(unpacked_req);
|
||||
free_config_response(unpacked_req);
|
||||
return;
|
||||
}
|
||||
case NFAPI_NR_PHY_MSG_TYPE_START_REQUEST: {
|
||||
dump_start_request(unpacked_req);
|
||||
free_start_request(unpacked_req);
|
||||
return;
|
||||
}
|
||||
case NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE: {
|
||||
dump_start_response(unpacked_req);
|
||||
free_start_response(unpacked_req);
|
||||
return;
|
||||
}
|
||||
case NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST: {
|
||||
dump_stop_request(unpacked_req);
|
||||
free_stop_request(unpacked_req);
|
||||
return;
|
||||
}
|
||||
case NFAPI_NR_PHY_MSG_TYPE_STOP_INDICATION: {
|
||||
dump_stop_indication(unpacked_req);
|
||||
free_stop_indication(unpacked_req);
|
||||
return;
|
||||
}
|
||||
case NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION: {
|
||||
dump_error_indication(unpacked_req);
|
||||
free_error_indication(unpacked_req);
|
||||
return;
|
||||
}
|
||||
/* P7 messages */
|
||||
case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST: {
|
||||
dump_dl_tti_request(unpacked_req);
|
||||
free_dl_tti_request(unpacked_req);
|
||||
return;
|
||||
}
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST: {
|
||||
dump_ul_tti_request(unpacked_req);
|
||||
free_ul_tti_request(unpacked_req);
|
||||
return;
|
||||
}
|
||||
case NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION: {
|
||||
dump_slot_indication(unpacked_req);
|
||||
free_slot_indication(unpacked_req);
|
||||
return;
|
||||
}
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST: {
|
||||
dump_ul_dci_request(unpacked_req);
|
||||
free_ul_dci_request(unpacked_req);
|
||||
return;
|
||||
}
|
||||
case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST: {
|
||||
dump_tx_data_request(unpacked_req);
|
||||
free_tx_data_request(unpacked_req);
|
||||
return;
|
||||
}
|
||||
case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION: {
|
||||
dump_rx_data_indication(unpacked_req);
|
||||
free_rx_data_indication(unpacked_req);
|
||||
return;
|
||||
}
|
||||
case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION: {
|
||||
dump_crc_indication(unpacked_req);
|
||||
free_crc_indication(unpacked_req);
|
||||
return;
|
||||
}
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION: {
|
||||
dump_uci_indication(unpacked_req);
|
||||
free_crc_indication(unpacked_req);
|
||||
return;
|
||||
}
|
||||
case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION: {
|
||||
dump_srs_indication(unpacked_req);
|
||||
free_srs_indication(unpacked_req);
|
||||
return;
|
||||
}
|
||||
case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION: {
|
||||
dump_rach_indication(unpacked_req);
|
||||
free_rach_indication(unpacked_req);
|
||||
return;
|
||||
}
|
||||
default:
|
||||
printf("Unknown Msg ID 0x%02x\n", hdr.message_id);
|
||||
}
|
||||
free(unpacked_req);
|
||||
}
|
||||
|
||||
static uint8_t to_hex(char c)
|
||||
{
|
||||
if (c >= '0' && c <= '9')
|
||||
return c - '0';
|
||||
if (c >= 'a' && c <= 'f')
|
||||
return c - 'a' + 10;
|
||||
printf("found invalid char %c\n", c);
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
/* @brief decodes one byte in text representation (0xab or just ab) of s and places it in b
|
||||
* @return the number of bytes read, or -1 on error */
|
||||
static int parse_byte(const char *s, uint8_t *b)
|
||||
{
|
||||
if (!s)
|
||||
return -1;
|
||||
int c = 0;
|
||||
// skip any whitespaces
|
||||
while (s[0] && isspace(*s)) {
|
||||
c++;
|
||||
s++;
|
||||
}
|
||||
// end of string -> nothing to be read
|
||||
if (s[0] == 0)
|
||||
return -1;
|
||||
// jump over leading "0x"
|
||||
if (s[0] == '0' && s[1] == 'x') {
|
||||
c += 2;
|
||||
s += 2;
|
||||
}
|
||||
// only one digit, if s[1] has other garbage, it will be caught after
|
||||
if (s[1] == 0 || s[1] == ' ') {
|
||||
// only one digit
|
||||
*b = to_hex(s[0]);
|
||||
// check if valid
|
||||
return *b != 0xff ? c + 1 : -1;
|
||||
}
|
||||
// read both bytes, check if valid
|
||||
uint8_t hb = to_hex(s[0]);
|
||||
uint8_t lb = to_hex(s[1]);
|
||||
if (hb == 0xff || lb == 0xff)
|
||||
return -1;
|
||||
*b = ((hb & 0xf) << 4) | (lb & 0xf);
|
||||
return c + 2;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Check if there are enough arguments
|
||||
if (argc < 2) {
|
||||
printf("Usage: %s [0xNN 0xNN ... | NN NN ... ]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t hex_values[MAX_BUFFER_SIZE]; // Array to hold the parsed values, assuming max 1024 values
|
||||
int byte_count = 0;
|
||||
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
const char *l = argv[i];
|
||||
int ret;
|
||||
do {
|
||||
ret = parse_byte(l, &hex_values[byte_count]);
|
||||
if (ret > 0)
|
||||
byte_count++;
|
||||
l += ret;
|
||||
} while (ret > 0 && byte_count < MAX_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
// Print the converted values
|
||||
printf("Parsed %d bytes:\n", byte_count);
|
||||
for (int i = 0; i < byte_count; i++) {
|
||||
if (i % 16 == 0 && i != 0) {
|
||||
printf("\n"); // Start a new line every 16 bytes
|
||||
} else if (i % 8 == 0 && i % 16 != 0) {
|
||||
printf(" "); // Add extra space between 8-byte sections
|
||||
}
|
||||
printf("%02x ", hex_values[i]);
|
||||
}
|
||||
printf("\n");
|
||||
AssertFatal(byte_count >= sizeof(fapi_message_header_t), "Read byte amount not enough to encode the header. Should have a minimum of %lu bytes, aborting...", sizeof(fapi_message_header_t));
|
||||
uint8_t *ptr = hex_values; // Points to the first element of the array
|
||||
uint8_t **msg_ptr = &ptr; // Pointer to the pointer
|
||||
|
||||
fapi_message_header_t hdr = {.num_msg = 0, .opaque_handle = 0, .message_id = 0, .message_length = 0};
|
||||
fapi_nr_message_header_unpack(msg_ptr, NFAPI_HEADER_LENGTH, &hdr, sizeof(fapi_message_header_t), 0);
|
||||
|
||||
printf("Decoded message %s message length 0x%02x\n", message_id_to_str(hdr.message_id), hdr.message_length);
|
||||
// Unpack the message
|
||||
unpack_and_dump_message((uint8_t *)hex_values, hdr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user