Merge remote-tracking branch 'origin/develop-CSI' into develop-CSI-Measurements
# Conflicts: # openair2/GNB_APP/gnb_paramdef.h # openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
This commit is contained in:
@@ -243,13 +243,13 @@ void oai_create_gnb(void) {
|
||||
|
||||
if (RC.gNB == NULL) {
|
||||
RC.gNB = (PHY_VARS_gNB **) calloc(1, sizeof(PHY_VARS_gNB *));
|
||||
LOG_I(PHY,"gNB L1 structure RC.gNB allocated @ %p\n",RC.gNB);
|
||||
LOG_D(PHY,"gNB L1 structure RC.gNB allocated @ %p\n",RC.gNB);
|
||||
}
|
||||
|
||||
|
||||
if (RC.gNB[0] == NULL) {
|
||||
RC.gNB[0] = (PHY_VARS_gNB *) calloc(1, sizeof(PHY_VARS_gNB));
|
||||
LOG_I(PHY,"[nr-gnb.c] gNB structure RC.gNB[%d] allocated @ %p\n",0,RC.gNB[0]);
|
||||
LOG_D(PHY,"[nr-gnb.c] gNB structure RC.gNB[%d] allocated @ %p\n",0,RC.gNB[0]);
|
||||
}
|
||||
|
||||
PHY_VARS_gNB *gNB = RC.gNB[0];
|
||||
@@ -491,7 +491,7 @@ int wake_gNB_rxtx(PHY_VARS_gNB *gNB, uint16_t sfn, uint16_t slot) {
|
||||
L1_proc->frame_tx = (L1_proc->slot_rx > (19-gNB->if_inst->sl_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx;
|
||||
L1_proc->slot_tx = (L1_proc->slot_rx + gNB->if_inst->sl_ahead)%20;
|
||||
|
||||
//LOG_I(PHY, "sfn/sf:%d%d proc[rx:%d%d] rx:%d%d] About to wake rxtx thread\n\n", sfn, slot, proc->frame_rx, proc->slot_rx, L1_proc->frame_rx, L1_proc->slot_rx);
|
||||
//LOG_D(PHY, "sfn/sf:%d%d proc[rx:%d%d] rx:%d%d] About to wake rxtx thread\n\n", sfn, slot, proc->frame_rx, proc->slot_rx, L1_proc->frame_rx, L1_proc->slot_rx);
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "\nEntering wake_gNB_rxtx sfn %d slot %d\n",L1_proc->frame_rx,L1_proc->slot_rx);
|
||||
// the thread can now be woken up
|
||||
if (pthread_cond_signal(&L1_proc->cond) != 0) {
|
||||
@@ -757,7 +757,7 @@ int phy_nr_rach_indication(nfapi_nr_rach_indication_t *ind)
|
||||
int phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind)
|
||||
{
|
||||
|
||||
LOG_I(NR_MAC, "In %s() NFAPI SFN/SF: %d/%d number_of_pdus :%u\n",
|
||||
LOG_D(NR_MAC, "In %s() NFAPI SFN/SF: %d/%d number_of_pdus :%u\n",
|
||||
__FUNCTION__,ind->sfn, ind->slot, ind->num_ucis);
|
||||
if(NFAPI_MODE == NFAPI_MODE_VNF)
|
||||
{
|
||||
@@ -787,12 +787,12 @@ int phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind)
|
||||
if (ind_pdu->harq) {
|
||||
uci_ind_pdu->harq = CALLOC(1, sizeof(*uci_ind_pdu->harq));
|
||||
AssertFatal(uci_ind_pdu->harq != NULL, "Memory not allocated for uci_ind_pdu->harq in phy_nr_uci_indication.");
|
||||
|
||||
*uci_ind_pdu->harq = *ind_pdu->harq;
|
||||
|
||||
uci_ind_pdu->harq->harq_list = CALLOC(uci_ind_pdu->harq->num_harq, sizeof(*uci_ind_pdu->harq->harq_list));
|
||||
AssertFatal(uci_ind_pdu->harq->harq_list != NULL, "Memory not allocated for uci_ind_pdu->harq->harq_list in phy_nr_uci_indication.");
|
||||
for (int j = 0; j < uci_ind_pdu->harq->num_harq; j++)
|
||||
uci_ind_pdu->harq->harq_list[j].harq_value = ind_pdu->harq->harq_list[j].harq_value;
|
||||
uci_ind_pdu->harq->harq_list[j].harq_value = ind_pdu->harq->harq_list[j].harq_value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -800,21 +800,27 @@ int phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind)
|
||||
case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: {
|
||||
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_ind_pdu = &uci_ind->uci_list[i].pucch_pdu_format_2_3_4;
|
||||
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *ind_pdu = &ind->uci_list[i].pucch_pdu_format_2_3_4;
|
||||
|
||||
uci_ind_pdu->harq.harq_payload = CALLOC(1, sizeof(*uci_ind_pdu->harq.harq_payload));
|
||||
AssertFatal(uci_ind_pdu->harq.harq_payload != NULL, "Memory not allocated for uci_ind_pdu->harq.harq_payload in phy_nr_uci_indication.");
|
||||
*uci_ind_pdu->harq.harq_payload = *ind_pdu->harq.harq_payload;
|
||||
|
||||
|
||||
uci_ind_pdu->csi_part1.csi_part1_payload = CALLOC(1, sizeof(*uci_ind_pdu->csi_part1.csi_part1_payload));
|
||||
AssertFatal(uci_ind_pdu->csi_part1.csi_part1_payload != NULL, "Memory not allocated for uci_ind_pdu->csi_part1.csi_part1_payload in phy_nr_uci_indication.");
|
||||
*uci_ind_pdu->csi_part1.csi_part1_payload = *ind_pdu->csi_part1.csi_part1_payload;
|
||||
|
||||
|
||||
uci_ind_pdu->csi_part2.csi_part2_payload = CALLOC(1, sizeof(*uci_ind_pdu->csi_part2.csi_part2_payload));
|
||||
AssertFatal(uci_ind_pdu->csi_part2.csi_part2_payload != NULL, "Memory not allocated for uci_ind_pdu->csi_part2.csi_part2_payload in phy_nr_uci_indication.");
|
||||
*uci_ind_pdu->csi_part2.csi_part2_payload = *ind_pdu->csi_part2.csi_part2_payload;
|
||||
|
||||
*uci_ind_pdu = *ind_pdu;
|
||||
if (ind_pdu->harq.harq_payload) {
|
||||
uci_ind_pdu->harq.harq_payload = CALLOC(1, sizeof(*uci_ind_pdu->harq.harq_payload));
|
||||
AssertFatal(uci_ind_pdu->harq.harq_payload != NULL, "Memory not allocated for uci_ind_pdu->harq.harq_payload in phy_nr_uci_indication.");
|
||||
*uci_ind_pdu->harq.harq_payload = *ind_pdu->harq.harq_payload;
|
||||
}
|
||||
if (ind_pdu->sr.sr_payload) {
|
||||
uci_ind_pdu->sr.sr_payload = CALLOC(1, sizeof(*uci_ind_pdu->sr.sr_payload));
|
||||
AssertFatal(uci_ind_pdu->sr.sr_payload != NULL, "Memory not allocated for uci_ind_pdu->sr.sr_payload in phy_nr_uci_indication.");
|
||||
*uci_ind_pdu->sr.sr_payload = *ind_pdu->sr.sr_payload;
|
||||
}
|
||||
if (ind_pdu->csi_part1.csi_part1_payload) {
|
||||
uci_ind_pdu->csi_part1.csi_part1_payload = CALLOC(1, sizeof(*uci_ind_pdu->csi_part1.csi_part1_payload));
|
||||
AssertFatal(uci_ind_pdu->csi_part1.csi_part1_payload != NULL, "Memory not allocated for uci_ind_pdu->csi_part1.csi_part1_payload in phy_nr_uci_indication.");
|
||||
*uci_ind_pdu->csi_part1.csi_part1_payload = *ind_pdu->csi_part1.csi_part1_payload;
|
||||
}
|
||||
if (ind_pdu->csi_part2.csi_part2_payload) {
|
||||
uci_ind_pdu->csi_part2.csi_part2_payload = CALLOC(1, sizeof(*uci_ind_pdu->csi_part2.csi_part2_payload));
|
||||
AssertFatal(uci_ind_pdu->csi_part2.csi_part2_payload != NULL, "Memory not allocated for uci_ind_pdu->csi_part2.csi_part2_payload in phy_nr_uci_indication.");
|
||||
*uci_ind_pdu->csi_part2.csi_part2_payload = *ind_pdu->csi_part2.csi_part2_payload;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -944,7 +950,7 @@ int phy_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_crc_indication_
|
||||
|
||||
int phy_nr_crc_indication(nfapi_nr_crc_indication_t *ind) {
|
||||
|
||||
LOG_I(NR_MAC, "In %s() NFAPI SFN/SF: %d/%d number_of_pdus :%u\n",
|
||||
LOG_D(NR_MAC, "In %s() NFAPI SFN/SF: %d/%d number_of_pdus :%u\n",
|
||||
__FUNCTION__,ind->sfn, ind->slot, ind->number_crcs);
|
||||
|
||||
if(NFAPI_MODE == NFAPI_MODE_VNF)
|
||||
@@ -967,7 +973,7 @@ int phy_nr_crc_indication(nfapi_nr_crc_indication_t *ind) {
|
||||
crc_ind->crc_list[j].tb_crc_status = ind->crc_list[j].tb_crc_status;
|
||||
crc_ind->crc_list[j].timing_advance = ind->crc_list[j].timing_advance;
|
||||
crc_ind->crc_list[j].ul_cqi = ind->crc_list[j].ul_cqi;
|
||||
LOG_I(NR_MAC, "Received crc_ind.harq_id = %d for %d index SFN SLot %u %u with rnti %x\n",
|
||||
LOG_D(NR_MAC, "Received crc_ind.harq_id = %d for %d index SFN SLot %u %u with rnti %x\n",
|
||||
ind->crc_list[j].harq_id, j, ind->sfn, ind->slot, ind->crc_list[j].rnti);
|
||||
}
|
||||
if (!put_queue(&gnb_crc_ind_queue, crc_ind))
|
||||
@@ -1063,7 +1069,7 @@ int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t
|
||||
|
||||
int phy_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) {
|
||||
|
||||
LOG_I(NR_MAC, "In %s() NFAPI SFN/SF: %d/%d number_of_pdus :%u, and pdu %p\n",
|
||||
LOG_D(NR_MAC, "In %s() NFAPI SFN/SF: %d/%d number_of_pdus :%u, and pdu %p\n",
|
||||
__FUNCTION__,ind->sfn, ind->slot, ind->number_of_pdus, ind->pdu_list[0].pdu);
|
||||
|
||||
if(NFAPI_MODE == NFAPI_MODE_VNF)
|
||||
@@ -1165,7 +1171,7 @@ static void analyze_cqi_pdus_for_duplicates(nfapi_cqi_indication_t *ind)
|
||||
{
|
||||
nfapi_cqi_indication_pdu_t *src_pdu = &ind->cqi_indication_body.cqi_pdu_list[i];
|
||||
|
||||
LOG_I(MAC, "CQI_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n", i, src_pdu->rx_ue_information.rnti,
|
||||
LOG_D(MAC, "CQI_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n", i, src_pdu->rx_ue_information.rnti,
|
||||
src_pdu->ul_cqi_information.ul_cqi, src_pdu->ul_cqi_information.channel);
|
||||
|
||||
for (int j = i + 1; j < num_cqis; j++)
|
||||
@@ -1887,7 +1893,7 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) {
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||
dl_config_req->header.message_id = NFAPI_DL_CONFIG_REQUEST;
|
||||
LOG_I(PHY, "[VNF] %s() DL_CONFIG_REQ sfn_sf:%d_%d number_of_pdus:%d\n", __FUNCTION__,
|
||||
LOG_D(PHY, "[VNF] %s() DL_CONFIG_REQ sfn_sf:%d_%d number_of_pdus:%d\n", __FUNCTION__,
|
||||
NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),NFAPI_SFNSF2SF(dl_config_req->sfn_sf), dl_config_req->dl_config_request_body.number_pdu);
|
||||
if (dl_config_req->dl_config_request_body.number_pdu > 0)
|
||||
{
|
||||
@@ -1898,7 +1904,7 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) {
|
||||
{
|
||||
uint16_t dl_rnti = dl_config_req->dl_config_request_body.dl_config_pdu_list[i].dlsch_pdu.dlsch_pdu_rel8.rnti;
|
||||
uint16_t numPDUs = dl_config_req->dl_config_request_body.number_pdu;
|
||||
LOG_I(MAC, "(OAI eNB) Sending dl_config_req at VNF during Frame: %d and Subframe: %d,"
|
||||
LOG_D(MAC, "(OAI eNB) Sending dl_config_req at VNF during Frame: %d and Subframe: %d,"
|
||||
" with a RNTI value of: %x and with number of PDUs: %u\n",
|
||||
NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),NFAPI_SFNSF2SF(dl_config_req->sfn_sf), dl_rnti, numPDUs);
|
||||
}
|
||||
@@ -1919,8 +1925,7 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) {
|
||||
|
||||
int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req)
|
||||
{
|
||||
//LOG_I(PHY, "sfn:%d,slot:%d\n",dl_config_req->SFN,dl_config_req->Slot);
|
||||
//printf("\nEntering oai_nfapi_nr_dl_config_req sfn:%d,slot:%d\n",dl_config_req->SFN,dl_config_req->Slot);
|
||||
LOG_D(NR_PHY, "Entering oai_nfapi_nr_dl_config_req sfn:%d,slot:%d\n", dl_config_req->SFN, dl_config_req->Slot);
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
dl_config_req->header.message_id= NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST;
|
||||
dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||
@@ -1939,6 +1944,7 @@ int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req)
|
||||
|
||||
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req)
|
||||
{
|
||||
LOG_D(NR_PHY, "Entering oai_nfapi_nr_tx_data_req sfn:%d,slot:%d\n", tx_data_req->SFN, tx_data_req->Slot);
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
tx_data_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||
tx_data_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST;
|
||||
@@ -2056,7 +2062,7 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) {
|
||||
{
|
||||
uint8_t pdu_type = pdu_list[i].pdu_type;
|
||||
|
||||
LOG_I(MAC, "ul_config_req num_pdus: %u pdu_number: %d pdu_type: %u SFN.SF: %d.%d\n",
|
||||
LOG_D(MAC, "ul_config_req num_pdus: %u pdu_number: %d pdu_type: %u SFN.SF: %d.%d\n",
|
||||
num_pdus, i, pdu_type, ul_config_req->sfn_sf >> 4, ul_config_req->sfn_sf & 15);
|
||||
|
||||
if (pdu_type != NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE)
|
||||
|
||||
@@ -44,13 +44,21 @@ uint8_t pulls32(uint8_t **in, int32_t *out, uint8_t *end);
|
||||
uint32_t pullarray8(uint8_t **in, uint8_t out[], uint32_t max_len, uint32_t len, uint8_t *end);
|
||||
uint32_t pullarray16(uint8_t **in, uint16_t out[], uint32_t max_len, uint32_t len, uint8_t *end);
|
||||
uint32_t pullarrays16(uint8_t **in, int16_t out[], uint32_t max_len, uint32_t len, uint8_t *end);
|
||||
uint32_t pullarray32(uint8_t **in, uint32_t out[], uint32_t max_len, uint32_t len, uint8_t *end);
|
||||
uint32_t pullarray32(uint8_t **values_to_pull,
|
||||
uint32_t out[],
|
||||
uint32_t max_num_values_to_pull,
|
||||
uint32_t num_values_to_pull,
|
||||
uint8_t *out_end);
|
||||
uint32_t pullarrays32(uint8_t **in, int32_t out[], uint32_t max_len, uint32_t len, uint8_t *end);
|
||||
|
||||
uint32_t pusharray8(uint8_t in[], uint32_t max_len, uint32_t len, uint8_t **out, uint8_t *end);
|
||||
uint32_t pusharray16(uint16_t in[], uint32_t max_len, uint32_t len, uint8_t **out, uint8_t *end);
|
||||
uint32_t pusharrays16(int16_t in[], uint32_t max_len, uint32_t len, uint8_t **out, uint8_t *end);
|
||||
uint32_t pusharray32(uint32_t in[], uint32_t max_len, uint32_t len, uint8_t **out, uint8_t *end);
|
||||
uint32_t pusharray32(const uint32_t *values_to_push,
|
||||
uint32_t max_num_values_to_push,
|
||||
uint32_t num_values_to_push,
|
||||
uint8_t **out,
|
||||
uint8_t *out_end);
|
||||
uint32_t pusharrays32(int32_t in[], uint32_t max_len, uint32_t len, uint8_t **out, uint8_t *end);
|
||||
|
||||
typedef uint8_t (*pack_array_elem_fn)(void* elem, uint8_t **ppWritePackedMsg, uint8_t *end);
|
||||
|
||||
+855
-783
File diff suppressed because it is too large
Load Diff
@@ -1046,7 +1046,7 @@ static uint8_t pack_ul_tti_request_srs_pdu(nfapi_nr_srs_pdu_t *srs_pdu, uint8_t
|
||||
push8(srs_pdu->comb_offset, ppWritePackedMsg, end) &&
|
||||
push8(srs_pdu->cyclic_shift, ppWritePackedMsg, end) &&
|
||||
push8(srs_pdu->frequency_position, ppWritePackedMsg, end) &&
|
||||
push8(srs_pdu->frequency_shift, ppWritePackedMsg, end) &&
|
||||
push16(srs_pdu->frequency_shift, ppWritePackedMsg, end) &&
|
||||
push8(srs_pdu->frequency_hopping, ppWritePackedMsg, end) &&
|
||||
push8(srs_pdu->group_or_sequence_hopping, ppWritePackedMsg, end) &&
|
||||
push8(srs_pdu->resource_type, ppWritePackedMsg, end) &&
|
||||
@@ -1581,13 +1581,19 @@ static uint8_t pack_ul_config_request_body_value(void *tlv, uint8_t **ppWritePac
|
||||
static uint8_t pack_ul_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
|
||||
nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t *)msg;
|
||||
|
||||
if (!(push16(pNfapiMsg->SFN, ppWritePackedMsg, end) &&
|
||||
push16(pNfapiMsg->Slot, ppWritePackedMsg, end) &&
|
||||
push8(pNfapiMsg->n_pdus, ppWritePackedMsg, end) &&
|
||||
push8(pNfapiMsg->rach_present, ppWritePackedMsg, end) &&
|
||||
push8(pNfapiMsg->n_ulsch, ppWritePackedMsg, end) &&
|
||||
push8(pNfapiMsg->n_ulcch, ppWritePackedMsg, end) &&
|
||||
push8(pNfapiMsg->n_group, ppWritePackedMsg, end) ))
|
||||
if (!push16(pNfapiMsg->SFN, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(pNfapiMsg->Slot, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push8(pNfapiMsg->n_pdus, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push8(pNfapiMsg->n_group, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push8(pNfapiMsg->rach_present, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push8(pNfapiMsg->n_ulsch, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push8(pNfapiMsg->n_ulcch, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
|
||||
for(int i=0; i<pNfapiMsg->n_pdus; i++) {
|
||||
@@ -1891,15 +1897,23 @@ static uint8_t pack_tx_data_pdu_list_value(void *tlv, uint8_t **ppWritePackedMsg
|
||||
|
||||
switch(value->TLVs[i].tag) {
|
||||
case 0: {
|
||||
if(!pusharray32(value->TLVs[i].value.direct, 16384, value->TLVs[i].length, ppWritePackedMsg, end))
|
||||
if (!pusharray32(value->TLVs[i].value.direct, sizeof(value->TLVs[i].value.direct) / sizeof(uint32_t),
|
||||
value->TLVs[i].length / sizeof(uint32_t), ppWritePackedMsg, end)) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s():%d. value->TLVs[i].length %d \n",
|
||||
__FUNCTION__, __LINE__, value->TLVs[i].length);
|
||||
return 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 1: {
|
||||
if(!pusharray32(value->TLVs[i].value.ptr, value->TLVs[i].length, value->TLVs[i].length, ppWritePackedMsg, end))
|
||||
if (!pusharray32(value->TLVs[i].value.ptr, value->TLVs[i].length / sizeof(uint32_t),
|
||||
value->TLVs[i].length / sizeof(uint32_t), ppWritePackedMsg, end)) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s():%d. value->TLVs[i].length %d \n",
|
||||
__FUNCTION__, __LINE__, value->TLVs[i].length);
|
||||
return 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -3006,10 +3020,8 @@ return 1;
|
||||
|
||||
//RX DATA INDICATION
|
||||
|
||||
static uint8_t pack_nr_rx_data_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
|
||||
static uint8_t pack_nr_rx_data_indication_body(nfapi_nr_rx_data_pdu_t *value, uint8_t **ppWritePackedMsg, uint8_t *end)
|
||||
{
|
||||
nfapi_nr_rx_data_pdu_t* value = (nfapi_nr_rx_data_pdu_t*)tlv;
|
||||
|
||||
if(!(push32(value->handle, ppWritePackedMsg, end) &&
|
||||
push16(value->rnti, ppWritePackedMsg, end) &&
|
||||
push8(value->harq_id, ppWritePackedMsg, end) &&
|
||||
@@ -3039,7 +3051,7 @@ static uint8_t pack_nr_rx_data_indication(void *msg, uint8_t **ppWritePackedMsg,
|
||||
|
||||
for (int i = 0; i < pNfapiMsg->number_of_pdus; i++)
|
||||
{
|
||||
if(!pack_nr_rx_data_indication_body(&(pNfapiMsg->pdu_list[i]), ppWritePackedMsg, end))
|
||||
if(!pack_nr_rx_data_indication_body(&(pNfapiMsg->pdu_list[i]), ppWritePackedMsg, end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3087,10 +3099,8 @@ return 1;
|
||||
|
||||
//SRS INDICATION
|
||||
|
||||
static uint8_t pack_nr_srs_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
|
||||
static uint8_t pack_nr_srs_indication_body(nfapi_nr_srs_indication_pdu_t *value, uint8_t **ppWritePackedMsg, uint8_t *end)
|
||||
{
|
||||
nfapi_nr_srs_indication_pdu_t* value = (nfapi_nr_srs_indication_pdu_t*)tlv;
|
||||
|
||||
if(!(push32(value->handle, ppWritePackedMsg, end) &&
|
||||
push16(value->rnti, ppWritePackedMsg, end) &&
|
||||
push16(value->timing_advance, ppWritePackedMsg, end) &&
|
||||
@@ -3102,8 +3112,7 @@ static uint8_t pack_nr_srs_indication_body(void* tlv, uint8_t **ppWritePackedMsg
|
||||
return 0;
|
||||
for(int i = 0; i < value->reported_symbol_list->num_rbs; i++)
|
||||
{
|
||||
if(!(push8(value->reported_symbol_list->rb_list->rb_snr, ppWritePackedMsg, end)
|
||||
))
|
||||
if (!push8(value->reported_symbol_list->rb_list[i].rb_snr, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
@@ -3179,32 +3188,36 @@ return 1;
|
||||
static uint8_t pack_nr_uci_pucch_0_1(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
|
||||
nfapi_nr_uci_pucch_pdu_format_0_1_t* value = (nfapi_nr_uci_pucch_pdu_format_0_1_t*)tlv;
|
||||
|
||||
if(!(push8(value->pduBitmap, ppWritePackedMsg, end) &&
|
||||
push32(value->handle, ppWritePackedMsg, end) &&
|
||||
push16(value->rnti, ppWritePackedMsg, end) &&
|
||||
push8(value->pucch_format, ppWritePackedMsg, end) &&
|
||||
push8(value->ul_cqi, ppWritePackedMsg, end) &&
|
||||
push16(value->timing_advance, ppWritePackedMsg, end) &&
|
||||
push16(value->rssi, ppWritePackedMsg, end)
|
||||
))
|
||||
return 0;
|
||||
if (!push8(value->pduBitmap, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push32(value->handle, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->rnti, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push8(value->pucch_format, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push8(value->ul_cqi, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->timing_advance, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->rssi, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (value->pduBitmap & 0x01) { //SR
|
||||
if (!(push8(value->sr->sr_indication, ppWritePackedMsg, end) &&
|
||||
push8(value->sr->sr_confidence_level, ppWritePackedMsg, end)
|
||||
))
|
||||
return 0;
|
||||
if (!push8(value->sr->sr_indication, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push8(value->sr->sr_confidence_level, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
|
||||
if (!(push8(value->harq->num_harq, ppWritePackedMsg, end) &&
|
||||
push8(value->harq->harq_confidence_level, ppWritePackedMsg, end)
|
||||
))
|
||||
if (!push8(value->harq->num_harq, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push8(value->harq->harq_confidence_level, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
for (int i = 0; i < value->harq->num_harq; i++)
|
||||
{
|
||||
if (!(push8(value->harq->harq_list[i].harq_value, ppWritePackedMsg, end)
|
||||
))
|
||||
return 0;
|
||||
if (!push8(value->harq->harq_list[i].harq_value, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3214,57 +3227,79 @@ static uint8_t pack_nr_uci_pucch_0_1(void* tlv, uint8_t **ppWritePackedMsg, uint
|
||||
static uint8_t pack_nr_uci_pucch_2_3_4(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
|
||||
nfapi_nr_uci_pucch_pdu_format_2_3_4_t* value = (nfapi_nr_uci_pucch_pdu_format_2_3_4_t*) tlv;
|
||||
|
||||
if(!(push8(value->pduBitmap, ppWritePackedMsg, end) &&
|
||||
push32(value->handle, ppWritePackedMsg, end) &&
|
||||
push16(value->rnti, ppWritePackedMsg, end) &&
|
||||
push8(value->pucch_format, ppWritePackedMsg, end) &&
|
||||
push8(value->ul_cqi, ppWritePackedMsg, end) &&
|
||||
push16(value->timing_advance, ppWritePackedMsg, end) &&
|
||||
push16(value->rssi, ppWritePackedMsg, end)
|
||||
))
|
||||
return 0;
|
||||
if (!push8(value->pduBitmap, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push32(value->handle, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->rnti, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push8(value->pucch_format, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push8(value->ul_cqi, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->timing_advance, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->rssi, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
|
||||
if (value->pduBitmap & 0x01) { //SR
|
||||
if(!(push8(value->sr.sr_bit_len, ppWritePackedMsg, end) &&
|
||||
pusharray8(value->sr.sr_payload, (int)(value->sr.sr_bit_len / 8) + 1, (int)(value->sr.sr_bit_len / 8) + 1, ppWritePackedMsg, end)
|
||||
))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
|
||||
if(!(push8(value->harq.harq_crc, ppWritePackedMsg, end) &&
|
||||
push8(value->harq.harq_bit_len, ppWritePackedMsg, end) &&
|
||||
pusharray8(value->harq.harq_payload, (int)(value->harq.harq_bit_len / 8) + 1, (int)(value->harq.harq_bit_len / 8) + 1, ppWritePackedMsg, end)
|
||||
))
|
||||
if (!push16(value->sr.sr_bit_len, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!pusharray8(value->sr.sr_payload,
|
||||
(int)((value->sr.sr_bit_len / 8) + 1),
|
||||
(int)((value->sr.sr_bit_len / 8) + 1),
|
||||
ppWritePackedMsg,
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (((value->pduBitmap >> 2) & 0x01)) { //CSI-1
|
||||
if(!(push8(value->csi_part1.csi_part1_crc, ppWritePackedMsg, end) &&
|
||||
push8(value->csi_part1.csi_part1_bit_len, ppWritePackedMsg, end) &&
|
||||
pusharray8(value->csi_part1.csi_part1_payload, (int)(value->csi_part1.csi_part1_bit_len / 8) + 1, (int)(value->csi_part1.csi_part1_bit_len / 8) + 1, ppWritePackedMsg, end)
|
||||
))
|
||||
if ((value->pduBitmap >> 1) & 0x01) { //HARQ
|
||||
if (!push8(value->harq.harq_crc, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->harq.harq_bit_len, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!pusharray8(value->harq.harq_payload,
|
||||
(int)((value->harq.harq_bit_len / 8) + 1),
|
||||
(int)((value->harq.harq_bit_len / 8) + 1),
|
||||
ppWritePackedMsg,
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (((value->pduBitmap >> 3) & 0x01)) { //CSI-2
|
||||
if(!(push8(value->csi_part2.csi_part2_crc, ppWritePackedMsg, end) &&
|
||||
push8(value->csi_part2.csi_part2_bit_len, ppWritePackedMsg, end) &&
|
||||
pusharray8(value->csi_part2.csi_part2_payload, (int)(value->csi_part2.csi_part2_bit_len / 8) + 1, (int)(value->csi_part2.csi_part2_bit_len / 8) + 1, ppWritePackedMsg, end)
|
||||
))
|
||||
if ((value->pduBitmap >> 2) & 0x01) { //CSI-1
|
||||
if (!push8(value->csi_part1.csi_part1_crc, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->csi_part1.csi_part1_bit_len, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!pusharray8(value->csi_part1.csi_part1_payload,
|
||||
(int)((value->csi_part1.csi_part1_bit_len / 8) + 1),
|
||||
(int)((value->csi_part1.csi_part1_bit_len / 8) + 1),
|
||||
ppWritePackedMsg,
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((value->pduBitmap >> 3) & 0x01) { //CSI-2
|
||||
if (!push8(value->csi_part2.csi_part2_crc, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->csi_part2.csi_part2_bit_len, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!pusharray8(value->csi_part2.csi_part2_payload,
|
||||
(int)((value->csi_part2.csi_part2_bit_len / 8) + 1),
|
||||
(int)((value->csi_part2.csi_part2_bit_len / 8) + 1),
|
||||
ppWritePackedMsg,
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t pack_nr_uci_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
|
||||
static uint8_t pack_nr_uci_indication_body(nfapi_nr_uci_t* value, uint8_t **ppWritePackedMsg, uint8_t *end)
|
||||
{
|
||||
nfapi_nr_uci_t* value = (nfapi_nr_uci_t*)tlv;
|
||||
|
||||
if(!(push16(value->pdu_type, ppWritePackedMsg, end) &&
|
||||
push16(value->pdu_size, ppWritePackedMsg, end)
|
||||
))
|
||||
if (!push16(value->pdu_type, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->pdu_size, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
|
||||
switch (value->pdu_type) {
|
||||
@@ -3288,13 +3323,14 @@ static uint8_t pack_nr_uci_indication(void *msg, uint8_t **ppWritePackedMsg, uin
|
||||
{
|
||||
nfapi_nr_uci_indication_t *pNfapiMsg = (nfapi_nr_uci_indication_t*)msg;
|
||||
|
||||
if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
|
||||
push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
|
||||
push16(pNfapiMsg->num_ucis, ppWritePackedMsg, end)
|
||||
))
|
||||
if (!push16(pNfapiMsg->sfn , ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(pNfapiMsg->slot , ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(pNfapiMsg->num_ucis, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
|
||||
for(int i=0; i<pNfapiMsg->num_ucis;i++)
|
||||
for (int i = 0; i < pNfapiMsg->num_ucis; i++)
|
||||
{
|
||||
if (!pack_nr_uci_indication_body(&pNfapiMsg->uci_list[i], ppWritePackedMsg, end))
|
||||
return 0;
|
||||
@@ -4616,14 +4652,19 @@ static uint8_t unpack_ul_tti_groups_list_value(uint8_t **ppReadPackedMsg, uint8_
|
||||
static uint8_t unpack_ul_tti_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t *config) {
|
||||
nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t *)msg;
|
||||
|
||||
if (!(
|
||||
pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) &&
|
||||
pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) &&
|
||||
pull8(ppReadPackedMsg, &pNfapiMsg->n_pdus, end) &&
|
||||
pull8(ppReadPackedMsg, &pNfapiMsg->n_group, end) &&
|
||||
pull8(ppReadPackedMsg, &pNfapiMsg->rach_present, end) &&
|
||||
pull8(ppReadPackedMsg, &pNfapiMsg->n_ulcch, end) &&
|
||||
pull8(ppReadPackedMsg, &pNfapiMsg->n_ulsch, end) ))
|
||||
if (!pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end))
|
||||
return 0;
|
||||
if (!pull8(ppReadPackedMsg, &pNfapiMsg->n_pdus, end))
|
||||
return 0;
|
||||
if (!pull8(ppReadPackedMsg, &pNfapiMsg->n_group, end))
|
||||
return 0;
|
||||
if (!pull8(ppReadPackedMsg, &pNfapiMsg->rach_present, end))
|
||||
return 0;
|
||||
if (!pull8(ppReadPackedMsg, &pNfapiMsg->n_ulcch, end))
|
||||
return 0;
|
||||
if (!pull8(ppReadPackedMsg, &pNfapiMsg->n_ulsch, end))
|
||||
return 0;
|
||||
|
||||
for(int i=0; i< pNfapiMsg->n_pdus; i++) {
|
||||
@@ -5506,14 +5547,18 @@ static uint8_t unpack_tx_data_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t
|
||||
|
||||
switch(pNfapiMsg->TLVs[i].tag) {
|
||||
case 0: {
|
||||
if(!pullarray32(ppReadPackedMsg, pNfapiMsg->TLVs[i].value.direct, 16384, pNfapiMsg->TLVs[i].length, end))
|
||||
if (!pullarray32(ppReadPackedMsg, pNfapiMsg->TLVs[i].value.direct,
|
||||
sizeof(pNfapiMsg->TLVs[i].value.direct) / sizeof(uint32_t),
|
||||
pNfapiMsg->TLVs[i].length / sizeof(uint32_t), end))
|
||||
return 0;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 1: {
|
||||
if(!pullarray32(ppReadPackedMsg, pNfapiMsg->TLVs[i].value.ptr, pNfapiMsg->TLVs[i].length, pNfapiMsg->TLVs[i].length, end))
|
||||
if (!pullarray32(ppReadPackedMsg,pNfapiMsg->TLVs[i].value.ptr,
|
||||
pNfapiMsg->TLVs[i].length / sizeof(uint32_t),
|
||||
pNfapiMsg->TLVs[i].length / sizeof(uint32_t), end))
|
||||
return 0;
|
||||
|
||||
break;
|
||||
@@ -5667,7 +5712,7 @@ static uint8_t unpack_nr_rx_data_indication_body(nfapi_nr_rx_data_pdu_t* value,
|
||||
return 0;
|
||||
|
||||
uint16_t length = value->pdu_length;
|
||||
value->pdu = nfapi_p7_allocate(length, config);
|
||||
value->pdu = nfapi_p7_allocate(sizeof(*value->pdu) * length, config);
|
||||
|
||||
if (pullarray8(ppReadPackedMsg, value->pdu, length, length, end) == 0)
|
||||
{
|
||||
@@ -5748,10 +5793,8 @@ return 1;
|
||||
|
||||
//SRS INDICATION
|
||||
|
||||
static uint8_t unpack_nr_srs_indication_body(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
|
||||
static uint8_t unpack_nr_srs_indication_body(nfapi_nr_srs_indication_pdu_t* value, uint8_t **ppReadPackedMsg, uint8_t *end)
|
||||
{
|
||||
nfapi_nr_srs_indication_pdu_t* value = (nfapi_nr_srs_indication_pdu_t*)tlv;
|
||||
|
||||
if(!(pull32(ppReadPackedMsg, &value->handle, end) &&
|
||||
pull16(ppReadPackedMsg, &value->rnti, end) &&
|
||||
pull16(ppReadPackedMsg, &value->timing_advance, end) &&
|
||||
@@ -5763,17 +5806,14 @@ static uint8_t unpack_nr_srs_indication_body(void* tlv, uint8_t **ppReadPackedMs
|
||||
return 0;
|
||||
for(int i = 0; i < value->reported_symbol_list->num_rbs; i++)
|
||||
{
|
||||
if(!(pull8(ppReadPackedMsg, &value->reported_symbol_list->rb_list->rb_snr, end)
|
||||
))
|
||||
if (!pull8(ppReadPackedMsg, &value->reported_symbol_list->rb_list[i].rb_snr, end))
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t unpack_nr_srs_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
|
||||
static uint8_t unpack_nr_srs_indication(uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_nr_srs_indication_t *pNfapiMsg, nfapi_p7_codec_config_t* config)
|
||||
{
|
||||
nfapi_nr_srs_indication_t *pNfapiMsg = (nfapi_nr_srs_indication_t*)msg;
|
||||
|
||||
if (!(pull16(ppReadPackedMsg,&pNfapiMsg->sfn , end) &&
|
||||
pull16(ppReadPackedMsg,&pNfapiMsg->slot , end) &&
|
||||
pull8(ppReadPackedMsg,&pNfapiMsg->number_of_pdus, end)
|
||||
@@ -5782,7 +5822,7 @@ static uint8_t unpack_nr_srs_indication(uint8_t **ppReadPackedMsg, uint8_t *end,
|
||||
|
||||
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
|
||||
{
|
||||
if(!unpack_nr_srs_indication_body(&pNfapiMsg->pdu_list,ppReadPackedMsg,end))
|
||||
if (!unpack_nr_srs_indication_body(&pNfapiMsg->pdu_list[i], ppReadPackedMsg, end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5903,58 +5943,111 @@ static uint8_t unpack_nr_uci_pucch_0_1(nfapi_nr_uci_pucch_pdu_format_0_1_t *valu
|
||||
}
|
||||
|
||||
|
||||
static uint8_t unpack_nr_uci_pucch_2_3_4(nfapi_nr_uci_pucch_pdu_format_2_3_4_t* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
|
||||
nfapi_nr_uci_pucch_pdu_format_2_3_4_t* value = (nfapi_nr_uci_pucch_pdu_format_2_3_4_t*) tlv;
|
||||
static uint8_t unpack_nr_uci_pucch_2_3_4(nfapi_nr_uci_pucch_pdu_format_2_3_4_t* value,
|
||||
uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_p7_codec_config_t *config) {
|
||||
|
||||
if (!pull8(ppReadPackedMsg, &value->pduBitmap, end))
|
||||
return 0;
|
||||
if (!pull32(ppReadPackedMsg, &value->handle, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->rnti, end))
|
||||
return 0;
|
||||
if (!pull8(ppReadPackedMsg, &value->pucch_format, end))
|
||||
return 0;
|
||||
if (!pull8(ppReadPackedMsg, &value->ul_cqi, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->timing_advance, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->rssi, end))
|
||||
return 0;
|
||||
|
||||
if(!(pull8(ppReadPackedMsg, &value->pduBitmap, end) &&
|
||||
pull32(ppReadPackedMsg, &value->handle, end) &&
|
||||
pull16(ppReadPackedMsg, &value->rnti, end) &&
|
||||
pull8(ppReadPackedMsg, &value->pucch_format, end) &&
|
||||
pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
|
||||
pull16(ppReadPackedMsg, &value->timing_advance, end) &&
|
||||
pull16(ppReadPackedMsg, &value->rssi, end)
|
||||
))
|
||||
return 0;
|
||||
if (value->pduBitmap & 0x01) { //SR
|
||||
if(!(pull16(ppReadPackedMsg, &value->sr.sr_bit_len, end)))
|
||||
if (!pull16(ppReadPackedMsg, &value->sr.sr_bit_len, end))
|
||||
return 0;
|
||||
|
||||
value->sr.sr_payload = (uint8_t*) malloc(sizeof(uint8_t) * ((value->sr.sr_bit_len/8)));
|
||||
|
||||
if(!(pullarray8(ppReadPackedMsg, &value->sr.sr_payload[0], (int)(value->sr.sr_bit_len / 8), (int)(value->sr.sr_bit_len / 8), end)))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
|
||||
if(!(pull8(ppReadPackedMsg, &value->harq.harq_crc, end)) &&
|
||||
(pull16(ppReadPackedMsg, &value->harq.harq_bit_len, end)))
|
||||
value->sr.sr_payload = nfapi_p7_allocate(sizeof(*value->sr.sr_payload) *
|
||||
(int)((value->sr.sr_bit_len / 8) + 1),
|
||||
config);
|
||||
if (value->sr.sr_payload == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate value->sr.sr_payload\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
value->harq.harq_payload = (uint8_t*) malloc(sizeof(uint8_t) * ((value->harq.harq_bit_len/8 )));
|
||||
|
||||
if(!(pullarray8(ppReadPackedMsg, value->harq.harq_payload, (int)(value->harq.harq_bit_len / 8), (int)(value->harq.harq_bit_len / 8), end)))
|
||||
if (!pullarray8(ppReadPackedMsg, value->sr.sr_payload,
|
||||
(int)((value->sr.sr_bit_len / 8) + 1),
|
||||
(int)((value->sr.sr_bit_len / 8) + 1),
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (((value->pduBitmap >> 2) & 0x01)) { //CSI-1
|
||||
if(!(pull8(ppReadPackedMsg, &value->csi_part1.csi_part1_crc, end)) &&
|
||||
(pull16(ppReadPackedMsg, &value->csi_part1.csi_part1_bit_len, end)))
|
||||
if ((value->pduBitmap >> 1) & 0x01) { //HARQ
|
||||
if (!pull8(ppReadPackedMsg, &value->harq.harq_crc, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->harq.harq_bit_len, end))
|
||||
return 0;
|
||||
|
||||
value->csi_part1.csi_part1_payload = (uint8_t*) malloc(sizeof(uint8_t) * ((value->csi_part1.csi_part1_bit_len/8)));
|
||||
value->harq.harq_payload = nfapi_p7_allocate(sizeof(*value->harq.harq_payload) *
|
||||
(int)((value->harq.harq_bit_len / 8) + 1),
|
||||
config);
|
||||
if (value->harq.harq_payload == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate value->harq.harq_payload\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// if(!(pullarray8(ppReadPackedMsg, value->csi_part1.csi_part1_payload, (int)(value->csi_part1.csi_part1_bit_len / 8), (int)(value->csi_part1.csi_part1_bit_len / 8), end)))
|
||||
// return 0;
|
||||
if (!pullarray8(ppReadPackedMsg, value->harq.harq_payload,
|
||||
(int)((value->harq.harq_bit_len / 8) + 1),
|
||||
(int)((value->harq.harq_bit_len / 8) + 1),
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (((value->pduBitmap >> 3) & 0x01)) { //CSI-2
|
||||
if(!(pull8(ppReadPackedMsg, &value->csi_part2.csi_part2_crc, end)) &&
|
||||
(pull16(ppReadPackedMsg, &value->csi_part2.csi_part2_bit_len, end)))
|
||||
if ((value->pduBitmap >> 2) & 0x01) { //CSI-1
|
||||
if (!pull8(ppReadPackedMsg, &value->csi_part1.csi_part1_crc, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->csi_part1.csi_part1_bit_len, end))
|
||||
return 0;
|
||||
|
||||
value->csi_part2.csi_part2_payload = (uint8_t*) malloc(sizeof(uint8_t) * ((value->csi_part2.csi_part2_bit_len/8 )));
|
||||
value->csi_part1.csi_part1_payload = nfapi_p7_allocate(sizeof(*value->csi_part1.csi_part1_payload) *
|
||||
(int)((value->csi_part1.csi_part1_bit_len / 8) + 1),
|
||||
config);
|
||||
if (value->csi_part1.csi_part1_payload == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate value->csi_part1.csi_part1_payload\n",
|
||||
__FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!(pullarray8(ppReadPackedMsg, value->csi_part2.csi_part2_payload, (int)(value->csi_part2.csi_part2_bit_len / 8) , (int)(value->csi_part2.csi_part2_bit_len / 8) , end)))
|
||||
if (!pullarray8(ppReadPackedMsg, value->csi_part1.csi_part1_payload,
|
||||
(int)((value->csi_part1.csi_part1_bit_len / 8) + 1),
|
||||
(int)((value->csi_part1.csi_part1_bit_len / 8) + 1),
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((value->pduBitmap >> 3) & 0x01) { //CSI-2
|
||||
if (!pull8(ppReadPackedMsg, &value->csi_part2.csi_part2_crc, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->csi_part2.csi_part2_bit_len, end))
|
||||
return 0;
|
||||
|
||||
value->csi_part2.csi_part2_payload = nfapi_p7_allocate(sizeof(*value->csi_part2.csi_part2_payload) *
|
||||
(int)((value->csi_part2.csi_part2_bit_len / 8) + 1),
|
||||
config);
|
||||
if (value->csi_part2.csi_part2_payload == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate value->csi_part2.csi_part2_payload\n",
|
||||
__FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!pullarray8(ppReadPackedMsg, value->csi_part2.csi_part2_payload,
|
||||
(int)((value->csi_part2.csi_part2_bit_len / 8) + 1),
|
||||
(int)((value->csi_part2.csi_part2_bit_len / 8) + 1),
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5966,9 +6059,9 @@ static uint8_t unpack_nr_uci_indication_body(nfapi_nr_uci_t *value,
|
||||
uint8_t *end,
|
||||
nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
if(!(pull16(ppReadPackedMsg, &value->pdu_type, end) &&
|
||||
pull16(ppReadPackedMsg, &value->pdu_size, end)
|
||||
))
|
||||
if (!pull16(ppReadPackedMsg, &value->pdu_type, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->pdu_size, end))
|
||||
return 0;
|
||||
|
||||
switch (value->pdu_type) {
|
||||
@@ -5984,7 +6077,7 @@ static uint8_t unpack_nr_uci_indication_body(nfapi_nr_uci_t *value,
|
||||
}
|
||||
case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: {
|
||||
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu = &value->pucch_pdu_format_2_3_4;
|
||||
if (!unpack_nr_uci_pucch_2_3_4(uci_pdu, ppReadPackedMsg, end))
|
||||
if (!unpack_nr_uci_pucch_2_3_4(uci_pdu, ppReadPackedMsg, end, config))
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
@@ -6000,17 +6093,18 @@ static uint8_t unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end,
|
||||
{
|
||||
nfapi_nr_uci_indication_t *pNfapiMsg = (nfapi_nr_uci_indication_t*)msg;
|
||||
|
||||
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
|
||||
pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
|
||||
pull16(ppReadPackedMsg, &pNfapiMsg->num_ucis, end)
|
||||
))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &pNfapiMsg->slot , end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &pNfapiMsg->num_ucis, end))
|
||||
return 0;
|
||||
|
||||
pNfapiMsg->uci_list = nfapi_p7_allocate(sizeof(*pNfapiMsg->uci_list) * pNfapiMsg->num_ucis, config);
|
||||
for (int i = 0; i < pNfapiMsg->num_ucis; i++)
|
||||
{
|
||||
if(!unpack_nr_uci_indication_body(&pNfapiMsg->uci_list[i], ppReadPackedMsg, end, config))
|
||||
return 0;
|
||||
if (!unpack_nr_uci_indication_body(&pNfapiMsg->uci_list[i], ppReadPackedMsg, end, config))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -1473,7 +1473,7 @@ void vnf_handle_nr_slot_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling NR SLOT Indication\n", __FUNCTION__);
|
||||
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "%s: Handling NR SLOT Indication\n", __FUNCTION__);
|
||||
if(vnf_p7->_public.nr_slot_indication)
|
||||
{
|
||||
(vnf_p7->_public.nr_slot_indication)(&ind);
|
||||
@@ -2574,32 +2574,28 @@ int vnf_p7_read_dispatch_message(vnf_p7_t* vnf_p7)
|
||||
// resize the buffer if we have a large segment
|
||||
if(header.message_length > vnf_p7->rx_message_buffer_size)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "reallocing rx buffer %d\n", header.message_length);
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "reallocing rx buffer %d\n", header.message_length);
|
||||
vnf_p7->rx_message_buffer = realloc(vnf_p7->rx_message_buffer, header.message_length);
|
||||
vnf_p7->rx_message_buffer_size = header.message_length;
|
||||
}
|
||||
|
||||
// read the segment
|
||||
recvfrom_result = recvfrom(vnf_p7->socket, vnf_p7->rx_message_buffer, header.message_length, MSG_WAITALL, (struct sockaddr*)&remote_addr, &remote_addr_size);
|
||||
recvfrom_result = recvfrom(vnf_p7->socket, vnf_p7->rx_message_buffer, header.message_length, MSG_WAITALL | MSG_TRUNC, (struct sockaddr*)&remote_addr, &remote_addr_size);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "recvfrom_result = %d from %s():%d\n", recvfrom_result, __FUNCTION__, __LINE__);
|
||||
|
||||
// todo : how to handle incomplete readfroms, need some sort of buffer/select
|
||||
|
||||
if(recvfrom_result == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "recvfrom returned 0\n");
|
||||
}
|
||||
else if(recvfrom_result != -1 && recvfrom_result != header.message_length)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Received unexpected number of bytes %d %d\n", recvfrom_result, header.message_length);
|
||||
|
||||
recvfrom_result += recvfrom(vnf_p7->socket, &vnf_p7->rx_message_buffer[recvfrom_result], header.message_length - recvfrom_result, MSG_WAITALL, (struct sockaddr*)&remote_addr, &remote_addr_size);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(recvfrom_result > 0)
|
||||
if (recvfrom_result > 0)
|
||||
{
|
||||
if (recvfrom_result != header.message_length)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "(%d) Received unexpected number of bytes. %d != %d",
|
||||
__LINE__, recvfrom_result, header.message_length);
|
||||
break;
|
||||
}
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Calling vnf_nr_handle_p7_message from %d\n", __LINE__);
|
||||
vnf_handle_p7_message(vnf_p7->rx_message_buffer, recvfrom_result, vnf_p7);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user