Commit 047b7b17 authored by Mahesh's avatar Mahesh

Uplink indication

parent 4454627b
...@@ -2406,3 +2406,36 @@ int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind) { ...@@ -2406,3 +2406,36 @@ int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind) {
//free(ind.rx_indication_body.rx_pdu_list); //free(ind.rx_indication_body.rx_pdu_list);
return retval; return retval;
} }
//NR UPLINK INDICATION
int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) {
ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION;
return nfapi_pnf_p7_nr_rx_data_ind(p7_config_g, ind);
}
int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) {
ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION;
return nfapi_pnf_p7_nr_crc_ind(p7_config_g, ind);
}
int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) {
ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION;
return nfapi_pnf_p7_nr_srs_ind(p7_config_g, ind);
}
int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) {
ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION;
return nfapi_pnf_p7_nr_uci_ind(p7_config_g, ind);
}
int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) {
ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION;
return nfapi_pnf_p7_nr_rach_ind(p7_config_g, ind);
}
...@@ -1516,10 +1516,11 @@ typedef struct ...@@ -1516,10 +1516,11 @@ typedef struct
typedef struct typedef struct
{ {
nfapi_p7_message_header_t header;
uint16_t sfn; uint16_t sfn;
uint16_t slot; uint16_t slot;
uint16_t number_of_pdus; uint16_t number_of_pdus;
nfapi_nr_rx_data_pdu_t* pdu_list; nfapi_nr_rx_data_pdu_t *pdu_list; //changed from pointer to struct - gokul
} nfapi_nr_rx_data_indication_t; } nfapi_nr_rx_data_indication_t;
...@@ -1542,6 +1543,7 @@ typedef struct ...@@ -1542,6 +1543,7 @@ typedef struct
typedef struct typedef struct
{ {
nfapi_p7_message_header_t header;
uint16_t sfn; uint16_t sfn;
uint16_t slot; uint16_t slot;
uint16_t number_crcs; uint16_t number_crcs;
...@@ -1679,6 +1681,7 @@ typedef struct ...@@ -1679,6 +1681,7 @@ typedef struct
typedef struct typedef struct
{ {
nfapi_p7_message_header_t header;
uint16_t sfn; uint16_t sfn;
uint16_t slot; uint16_t slot;
uint16_t num_ucis; uint16_t num_ucis;
...@@ -1715,6 +1718,7 @@ typedef struct ...@@ -1715,6 +1718,7 @@ typedef struct
typedef struct typedef struct
{ {
nfapi_p7_message_header_t header;
uint16_t sfn; uint16_t sfn;
uint16_t slot; uint16_t slot;
uint8_t number_of_pdus; uint8_t number_of_pdus;
...@@ -1747,6 +1751,7 @@ typedef struct{ ...@@ -1747,6 +1751,7 @@ typedef struct{
typedef struct typedef struct
{ {
nfapi_p7_message_header_t header;
uint16_t sfn; uint16_t sfn;
uint16_t slot; uint16_t slot;
uint8_t number_of_pdus; uint8_t number_of_pdus;
......
...@@ -3354,6 +3354,308 @@ static uint8_t pack_nr_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_ ...@@ -3354,6 +3354,308 @@ static uint8_t pack_nr_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_
} }
//NR UPLINK indication function packing
//RX DATA INDICATION
static uint8_t pack_nr_rx_data_indication_body(void* tlv, 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) &&
push16(value->pdu_length, ppWritePackedMsg, end) &&
push8(value->ul_cqi, ppWritePackedMsg, end) &&
push16(value->timing_advance, ppWritePackedMsg, end) &&
push16(value->rssi, ppWritePackedMsg, end)
))
return 0;
return 1;
}
static uint8_t pack_nr_rx_data_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
{
nfapi_nr_rx_data_indication_t *pNfapiMsg = (nfapi_nr_rx_data_indication_t*)msg;
if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
push16(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)
))
return 0;
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
{
if(!pack_nr_rx_data_indication_body(pNfapiMsg->pdu_list,ppWritePackedMsg,end))
return 0;
}
return 1;
}
//NR CRC INDICATION
static uint8_t pack_nr_crc_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
{
nfapi_nr_crc_t* value = (nfapi_nr_crc_t*)tlv;
if(!(push32(value->handle, ppWritePackedMsg, end) &&
push16(value->rnti, ppWritePackedMsg, end) &&
push8(value->harq_id, ppWritePackedMsg, end) &&
push8(value->tb_crc_status, ppWritePackedMsg, end) &&
push16(value->num_cb, ppWritePackedMsg, end) &&
//pusharray8(value->cb_crc_status, (int)(value->num_cb / 8) + 1, (int)(value->num_cb / 8) + 1, ppWritePackedMsg, end) && //length is ceil(NumCb/8)
push8(value->ul_cqi, ppWritePackedMsg, end) &&
push16(value->timing_advance, ppWritePackedMsg, end) &&
push16(value->rssi, ppWritePackedMsg, end)
))
return 0;
return 1;
}
static uint8_t pack_nr_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
{
nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t*)msg;
if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
push16(pNfapiMsg->number_crcs, ppWritePackedMsg, end)
))
return 0;
for(int i=0; i<pNfapiMsg->number_crcs;i++)
{
if(!pack_nr_crc_indication_body(pNfapiMsg->crc_list,ppWritePackedMsg,end))
return 0;
}
return 1;
}
//SRS INDICATION
static uint8_t pack_nr_srs_indication_body(void* tlv, 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) &&
push8(value->num_symbols, ppWritePackedMsg, end) &&
push8(value->wide_band_snr, ppWritePackedMsg, end) &&
push8(value->num_reported_symbols, ppWritePackedMsg, end) &&
push8(value->reported_symbol_list->num_rbs, ppWritePackedMsg, end)
))
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)
))
return 0;
}
return 1;
}
static uint8_t pack_nr_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
{
nfapi_nr_srs_indication_t *pNfapiMsg = (nfapi_nr_srs_indication_t*)msg;
if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
push16(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)
))
return 0;
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
{
if(!pack_nr_srs_indication_body(&(pNfapiMsg->pdu_list[i]),ppWritePackedMsg,end))
return 0;
}
return 1;
}
//RACH INDICATION
static uint8_t pack_nr_rach_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
{
nfapi_nr_prach_indication_pdu_t* value = (nfapi_nr_prach_indication_pdu_t*)tlv;
if(!(push16(value->phy_cell_id, ppWritePackedMsg, end) &&
push8(value->symbol_index, ppWritePackedMsg, end) &&
push8(value->slot_index, ppWritePackedMsg, end) &&
push8(value->freq_index, ppWritePackedMsg, end) &&
push8(value->avg_rssi, ppWritePackedMsg, end) &&
push8(value->avg_snr, ppWritePackedMsg, end) &&
push8(value->num_preamble, ppWritePackedMsg, end)
))
return 0;
for(int i = 0; i < value->num_preamble; i++)
{
if(!(push8(value->preamble_list->preamble_index, ppWritePackedMsg, end) &&
push16(value->preamble_list->timing_advance, ppWritePackedMsg, end) &&
push32(value->preamble_list->preamble_pwr, ppWritePackedMsg, end)
))
return 0;
}
return 1;
}
static uint8_t pack_nr_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
{
nfapi_nr_rach_indication_t *pNfapiMsg = (nfapi_nr_rach_indication_t*)msg;
if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
push16(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)
))
return 0;
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
{
if(!pack_nr_rach_indication_body(&(pNfapiMsg->pdu_list[i]),ppWritePackedMsg,end))
return 0;
}
return 1;
}
//UCI INDICATION
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 (value->pduBitmap & 0x01) { //SR
if(!(push8(value->sr->sr_indication, ppWritePackedMsg, end) &&
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)
))
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;
}
}
return 1;
}
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 (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)
))
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)
))
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)
))
return 0;
}
return 1;
}
static uint8_t pack_nr_uci_indication_body(void* tlv, 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)
))
return 0;
switch (value->pdu_type) {
case NFAPI_NR_UCI_PUSCH_PDU_TYPE:
printf("Unhandled NFAPI_NR_UCI_PUSCH_PDU_TYPE \n");
break;
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: {
nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu = &value->pucch_pdu_format_0_1;
pack_nr_uci_pucch_0_1(uci_pdu, ppWritePackedMsg, end);
break;
}
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;
pack_nr_uci_pucch_2_3_4(uci_pdu, ppWritePackedMsg, end);
break;
}
}
return 1;
}
static uint8_t pack_nr_uci_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
{
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)
))
return 0;
for(int i=0; i<pNfapiMsg->num_ucis;i++)
{
if(!pack_nr_uci_indication_body(&(pNfapiMsg->uci_list[i]),ppWritePackedMsg,end))
return 0;
}
return 1;
}
// Main pack function - public // Main pack function - public
...@@ -3419,49 +3721,24 @@ int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packe ...@@ -3419,49 +3721,24 @@ int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packe
result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config); result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config);
break; break;
case NFAPI_HARQ_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config); result = pack_nr_rx_data_indication(pMessageHeader, &pWritePackedMessage, end, config);
break;
case NFAPI_CRC_INDICATION:
result = pack_crc_indication(pMessageHeader, &pWritePackedMessage, end, config);
break;
case NFAPI_RX_ULSCH_INDICATION:
//printf("RX ULSCH\n");
result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config);
break;
case NFAPI_RACH_INDICATION:
result = pack_rach_indication(pMessageHeader, &pWritePackedMessage, end, config);
break;
case NFAPI_SRS_INDICATION:
result = pack_srs_indication(pMessageHeader, &pWritePackedMessage, end, config);
break;
case NFAPI_RX_SR_INDICATION:
result = pack_sr_indication(pMessageHeader, &pWritePackedMessage, end, config);
break; break;
case NFAPI_RX_CQI_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
result = pack_cqi_indication(pMessageHeader, &pWritePackedMessage, end, config); result = pack_nr_crc_indication(pMessageHeader, &pWritePackedMessage, end, config);
break; break;
case NFAPI_LBT_DL_CONFIG_REQUEST: case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
result = pack_lbt_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config); result = pack_nr_uci_indication(pMessageHeader, &pWritePackedMessage, end, config);
break; break;
case NFAPI_LBT_DL_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
result = pack_lbt_dl_indication(pMessageHeader, &pWritePackedMessage, end, config); result = pack_nr_rach_indication(pMessageHeader, &pWritePackedMessage, end, config);
break; break;
case NFAPI_NB_HARQ_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
result = pack_nb_harq_indication(pMessageHeader, &pWritePackedMessage, end, config); result = pack_nr_srs_indication(pMessageHeader, &pWritePackedMessage, end, config);
break;
case NFAPI_NRACH_INDICATION:
result = pack_nrach_indication(pMessageHeader, &pWritePackedMessage, end, config);
break; break;
case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC: case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
...@@ -3577,7 +3854,6 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu ...@@ -3577,7 +3854,6 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
switch (pMessageHeader->message_id) switch (pMessageHeader->message_id)
{ {
case NFAPI_DL_CONFIG_REQUEST: case NFAPI_DL_CONFIG_REQUEST:
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST\n", __FUNCTION__);
result = pack_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config); result = pack_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config);
break; break;
...@@ -3585,7 +3861,6 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu ...@@ -3585,7 +3861,6 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
result = pack_ul_config_request(pMessageHeader, &pWritePackedMessage, end, config); result = pack_ul_config_request(pMessageHeader, &pWritePackedMessage, end, config);
break; break;
case NFAPI_TX_REQUEST: case NFAPI_TX_REQUEST:
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_TX_REQUEST\n", __FUNCTION__);
result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config); result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config);
break; break;
case NFAPI_HI_DCI0_REQUEST: case NFAPI_HI_DCI0_REQUEST:
...@@ -3609,7 +3884,6 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu ...@@ -3609,7 +3884,6 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
break; break;
case NFAPI_RX_ULSCH_INDICATION: case NFAPI_RX_ULSCH_INDICATION:
//printf("RX ULSCH\n");
result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config); result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config);
break; break;
...@@ -6074,6 +6348,334 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void * ...@@ -6074,6 +6348,334 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *
return 1; return 1;
} }
//UNPACK NR UPLINK INDICATION FUNCTIONS
//RX DATA INDICATION
static uint8_t unpack_nr_rx_data_indication_body(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
{
nfapi_nr_rx_data_pdu_t* value = (nfapi_nr_rx_data_pdu_t*)tlv;
if(!(pull32(ppReadPackedMsg, &value->handle, end) &&
pull16(ppReadPackedMsg, &value->rnti, end) &&
pull8(ppReadPackedMsg, &value->harq_id, end) &&
pull16(ppReadPackedMsg, &value->pdu_length, end) &&
pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
pull16(ppReadPackedMsg, &value->timing_advance, end) &&
pull16(ppReadPackedMsg, &value->rssi, end)
))
return 0;
return 1;
}
static uint8_t unpack_nr_rx_data_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
{
// uint8_t *ptr = *ppReadPackedMsg;
// printf("\n Read P7 message rx data indication unpack: ");
// while(ptr < end){
// printf(" %d ", *ptr);
// ptr++;
// }
// printf("\n");
nfapi_nr_rx_data_indication_t *pNfapiMsg = (nfapi_nr_rx_data_indication_t*)msg;
printf("\n");
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
pull16(ppReadPackedMsg, &pNfapiMsg->number_of_pdus, end)
))
return 0;
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
{
if(!unpack_nr_rx_data_indication_body(&pNfapiMsg->pdu_list, ppReadPackedMsg, end))
return 0;
}
return 1;
}
//NR CRC INDICATION
static uint8_t unpack_nr_crc_indication_body(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
{
nfapi_nr_crc_t* value = (nfapi_nr_crc_t*)tlv;
if(!(pull32(ppReadPackedMsg, &value->handle, end) &&
pull16(ppReadPackedMsg, &value->rnti, end) &&
pull8(ppReadPackedMsg, &value->harq_id, end) &&
pull8(ppReadPackedMsg, &value->tb_crc_status, end) &&
pull16(ppReadPackedMsg, &value->num_cb, end) &&
//pullarray8(ppReadPackedMsg, value->cb_crc_status, (int)(value->num_cb / 8) + 1, (int)(value->num_cb / 8) + 1, end) && //length is ceil(NumCb/8)
pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
pull16(ppReadPackedMsg, &value->timing_advance, end) &&
pull16(ppReadPackedMsg, &value->rssi, end)
))
return 0;
return 1;
}
static uint8_t unpack_nr_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
{
uint8_t *ptr = *ppReadPackedMsg;
// printf("\n Read P7 message indication unpack: ");
// while(ptr < end){
// printf(" %d ", *ptr);
// ptr++;
// }
// printf("\n");
nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t*)msg;
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
pull16(ppReadPackedMsg, &pNfapiMsg->number_crcs, end)
))
return 0;
for(int i=0; i<pNfapiMsg->number_crcs;i++)
{
if(!unpack_nr_crc_indication_body(&pNfapiMsg->crc_list,ppReadPackedMsg,end))
return 0;
}
return 1;
}
//SRS INDICATION
static uint8_t unpack_nr_srs_indication_body(void* tlv, 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) &&
pull8(ppReadPackedMsg, &value->num_symbols, end) &&
pull8(ppReadPackedMsg, &value->wide_band_snr, end) &&
pull8(ppReadPackedMsg, &value->num_reported_symbols, end) &&
pull16(ppReadPackedMsg, &value->reported_symbol_list->num_rbs, end)
))
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)
))
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)
{
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)
))
return 0;
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
{
if(!unpack_nr_srs_indication_body(&pNfapiMsg->pdu_list,ppReadPackedMsg,end))
return 0;
}
return 1;
}
//NR RACH
static uint8_t unpack_nr_rach_indication_body(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
{
nfapi_nr_prach_indication_pdu_t* value = (nfapi_nr_prach_indication_pdu_t*)tlv;
if(!(pull16(ppReadPackedMsg, &value->phy_cell_id, end) &&
pull8(ppReadPackedMsg, &value->symbol_index, end) &&
pull8(ppReadPackedMsg, &value->slot_index, end) &&
pull8(ppReadPackedMsg, &value->freq_index, end) &&
pull8(ppReadPackedMsg, &value->avg_rssi, end) &&
pull8(ppReadPackedMsg, &value->avg_snr, end) &&
pull8(ppReadPackedMsg, &value->num_preamble, end)
))
return 0;
for(int i = 0; i < value->num_preamble; i++)
{
if(!(pull8(ppReadPackedMsg, &value->preamble_list->preamble_index, end) &&
pull16(ppReadPackedMsg, &value->preamble_list->timing_advance, end) &&
pull32(ppReadPackedMsg, &value->preamble_list->preamble_pwr, end)
))
return 0;
}
return 1;
}
static uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) {
nfapi_nr_rach_indication_t *pNfapiMsg = (nfapi_nr_rach_indication_t*)msg;
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
pull8(ppReadPackedMsg, &pNfapiMsg->number_of_pdus, end)
))
return 0;
for(int i=0; i< pNfapiMsg->number_of_pdus;i++)
{
if(!unpack_nr_rach_indication_body(&pNfapiMsg->pdu_list,ppReadPackedMsg,end))
return 0;
}
return 1;
}
//NR UCI
static uint8_t unpack_nr_uci_pucch_0_1(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_nr_uci_pucch_pdu_format_0_1_t* value = (nfapi_nr_uci_pucch_pdu_format_0_1_t*)tlv;
uint8_t *ptr = *ppReadPackedMsg;
printf("\n Read P7 message uci_0_1 indication unpack: ");
while(ptr < end){
printf(" %d ", *ptr);
ptr++;
}
printf("\n");
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(!(pull8(ppReadPackedMsg, &value->sr->sr_indication, end) &&
pull8(ppReadPackedMsg, &value->sr->sr_confidence_level, end)
))
return 0;
}
// if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
// uint8_t* temp; //&value->harq->num_harq &value->harq->harq_confidence_level &value->harq->harq_list[0].harq_value
// temp = (uint8_t*) malloc(sizeof(uint8_t));
// //printf("value->harq->num_harq = %d \n", value->harq->num_harq);
// // if(!(pull8(ppReadPackedMsg, temp, end) &&
// // pull8(ppReadPackedMsg, temp, end)
// // ))
// // return 0;
// // for(int i=0; i<1;i++)
// // {
// // if(!(pull8(ppReadPackedMsg, temp, end) //review - gokul
// // ))
// // return 0;
// // }
// }
return 1;
}
static uint8_t unpack_nr_uci_pucch_2_3_4(void* 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;
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) &&
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 >> 1) & 0x01)) { //HARQ
if(!(pull8(ppReadPackedMsg, &value->harq.harq_crc, end) &&
pull16(ppReadPackedMsg, &value->harq.harq_bit_len, end) &&
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 >> 2) & 0x01)) { //CSI-1
if(!(pull8(ppReadPackedMsg, &value->csi_part1.csi_part1_crc, end) &&
pull16(ppReadPackedMsg, &value->csi_part1.csi_part1_bit_len, end) &&
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) &&
pull16(ppReadPackedMsg, &value->csi_part2.csi_part2_bit_len, end) &&
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;
}
return 1;
}
static uint8_t unpack_nr_uci_indication_body(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
{
nfapi_nr_uci_t* value = (nfapi_nr_uci_t*)tlv;
if(!(pull16(ppReadPackedMsg, &value->pdu_type, end) &&
pull16(ppReadPackedMsg, &value->pdu_size, end)
))
return 0;
switch (value->pdu_type) {
case NFAPI_NR_UCI_PUSCH_PDU_TYPE:
printf("Unhandled NFAPI_NR_UCI_PUSCH_PDU_TYPE \n");
break;
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: {
nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu = &value->pucch_pdu_format_0_1;
unpack_nr_uci_pucch_0_1(&uci_pdu, ppReadPackedMsg, end);
break;
}
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;
unpack_nr_uci_pucch_2_3_4(&uci_pdu, ppReadPackedMsg, end);
break;
}
}
return 1;
}
static uint8_t unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
{
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;
for(int i=0; i<pNfapiMsg->num_ucis;i++)
{
if(!unpack_nr_uci_indication_body(&pNfapiMsg->uci_list,ppReadPackedMsg,end))
return 0;
}
return 1;
}
static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
{ {
uint8_t proceed = 1; uint8_t proceed = 1;
...@@ -7699,62 +8301,32 @@ static int check_nr_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBuf ...@@ -7699,62 +8301,32 @@ static int check_nr_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBuf
if (unpackedBufLen >= sizeof(nfapi_nr_tx_data_request_t)) if (unpackedBufLen >= sizeof(nfapi_nr_tx_data_request_t))
retLen = sizeof(nfapi_nr_tx_data_request_t); retLen = sizeof(nfapi_nr_tx_data_request_t);
break; break;
case NFAPI_HARQ_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
if (unpackedBufLen >= sizeof(nfapi_harq_indication_t)) if (unpackedBufLen >= sizeof(nfapi_nr_rx_data_indication_t))
retLen = sizeof(nfapi_harq_indication_t); retLen = sizeof(nfapi_nr_rx_data_indication_t);
break;
case NFAPI_CRC_INDICATION:
if (unpackedBufLen >= sizeof(nfapi_crc_indication_t))
retLen = sizeof(nfapi_crc_indication_t);
break;
case NFAPI_RX_ULSCH_INDICATION:
if (unpackedBufLen >= sizeof(nfapi_rx_indication_t))
retLen = sizeof(nfapi_rx_indication_t);
break;
case NFAPI_RACH_INDICATION:
if (unpackedBufLen >= sizeof(nfapi_rach_indication_t))
retLen = sizeof(nfapi_rach_indication_t);
break;
case NFAPI_SRS_INDICATION:
if (unpackedBufLen >= sizeof(nfapi_srs_indication_t))
retLen = sizeof(nfapi_srs_indication_t);
break;
case NFAPI_RX_SR_INDICATION:
if (unpackedBufLen >= sizeof(nfapi_sr_indication_t))
retLen = sizeof(nfapi_sr_indication_t);
break; break;
case NFAPI_RX_CQI_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
if (unpackedBufLen >= sizeof(nfapi_cqi_indication_t)) if (unpackedBufLen >= sizeof(nfapi_nr_crc_indication_t))
retLen = sizeof(nfapi_cqi_indication_t); retLen = sizeof(nfapi_nr_crc_indication_t);
break; break;
case NFAPI_LBT_DL_CONFIG_REQUEST: case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
if (unpackedBufLen >= sizeof(nfapi_lbt_dl_config_request_t)) if (unpackedBufLen >= sizeof(nfapi_nr_rach_indication_t))
retLen = sizeof(nfapi_lbt_dl_config_request_t); retLen = sizeof(nfapi_nr_rach_indication_t);
break; break;
case NFAPI_LBT_DL_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
if (unpackedBufLen >= sizeof(nfapi_lbt_dl_indication_t)) if (unpackedBufLen >= sizeof(nfapi_nr_uci_indication_t))
retLen = sizeof(nfapi_lbt_dl_indication_t); retLen = sizeof(nfapi_nr_uci_indication_t);
break; break;
case NFAPI_NB_HARQ_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
if (unpackedBufLen >= sizeof(nfapi_nb_harq_indication_t)) if (unpackedBufLen >= sizeof(nfapi_nr_srs_indication_t))
retLen = sizeof(nfapi_nb_harq_indication_t); retLen = sizeof(nfapi_nr_srs_indication_t);
break; break;
case NFAPI_NRACH_INDICATION:
if (unpackedBufLen >= sizeof(nfapi_nrach_indication_t))
retLen = sizeof(nfapi_nrach_indication_t);
break;
case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC: case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
if (unpackedBufLen >= sizeof(nfapi_nr_dl_node_sync_t)) if (unpackedBufLen >= sizeof(nfapi_nr_dl_node_sync_t))
retLen = sizeof(nfapi_nr_dl_node_sync_t); retLen = sizeof(nfapi_nr_dl_node_sync_t);
...@@ -8064,15 +8636,15 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void * ...@@ -8064,15 +8636,15 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen); NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
return -1; return -1;
} }
/*
uint8_t *ptr = pMessageBuf; // uint8_t *ptr = pMessageBuf;
printf("\n Read P7 message unpack: "); // printf("\n Read P7 message unpack: ");
while(ptr < end){ // while(ptr < end){
printf(" %d ", *ptr); // printf(" %d ", *ptr);
ptr++; // ptr++;
} // }
printf("\n"); // printf("\n");
*/
// clean the supplied buffer for - tag value blanking // clean the supplied buffer for - tag value blanking
(void)memset(pUnpackedBuf, 0, unpackedBufLen); (void)memset(pUnpackedBuf, 0, unpackedBufLen);
...@@ -8138,83 +8710,41 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void * ...@@ -8138,83 +8710,41 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *
return -1; return -1;
break; break;
case NFAPI_HARQ_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
if (check_nr_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen)) if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION, unpackedBufLen))
result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config); result = unpack_nr_rx_data_indication(&pReadPackedMessage, end, pMessageHeader, config);
else
return -1;
break;
case NFAPI_CRC_INDICATION:
if (check_nr_unpack_length(NFAPI_CRC_INDICATION, unpackedBufLen))
result = unpack_crc_indication(&pReadPackedMessage,end , pMessageHeader, config);
else
return -1;
break;
case NFAPI_RX_ULSCH_INDICATION:
if (check_nr_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen))
result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config);
else
return -1;
break;
case NFAPI_RACH_INDICATION:
if (check_nr_unpack_length(NFAPI_RACH_INDICATION, unpackedBufLen))
result = unpack_rach_indication(&pReadPackedMessage, end, pMessageHeader, config);
else else
return -1; return -1;
break; break;
case NFAPI_SRS_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
if (check_nr_unpack_length(NFAPI_SRS_INDICATION, unpackedBufLen)) if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION, unpackedBufLen))
result = unpack_srs_indication(&pReadPackedMessage, end, pMessageHeader, config); result = unpack_nr_crc_indication(&pReadPackedMessage,end , pMessageHeader, config);
else else
return -1; return -1;
break; break;
case NFAPI_RX_SR_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
if (check_nr_unpack_length(NFAPI_RX_SR_INDICATION, unpackedBufLen)) if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION, unpackedBufLen))
result = unpack_sr_indication(&pReadPackedMessage, end, pMessageHeader, config); result = unpack_nr_uci_indication(&pReadPackedMessage, end, pMessageHeader, config);
else else
return -1; return -1;
break; break;
case NFAPI_RX_CQI_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
if (check_nr_unpack_length(NFAPI_RX_CQI_INDICATION, unpackedBufLen)) if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION, unpackedBufLen))
result = unpack_cqi_indication(&pReadPackedMessage, end, pMessageHeader, config); result = unpack_nr_srs_indication(&pReadPackedMessage, end, pMessageHeader, config);
else else
return -1; return -1;
break; break;
case NFAPI_LBT_DL_CONFIG_REQUEST: case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
if (check_nr_unpack_length(NFAPI_LBT_DL_CONFIG_REQUEST, unpackedBufLen)) if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION, unpackedBufLen))
result = unpack_lbt_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config); result = unpack_nr_rach_indication(&pReadPackedMessage, end, pMessageHeader, config);
else else
return -1; return -1;
break; break;
case NFAPI_LBT_DL_INDICATION:
if (check_nr_unpack_length(NFAPI_LBT_DL_INDICATION, unpackedBufLen))
result = unpack_lbt_dl_indication(&pReadPackedMessage, end, pMessageHeader, config);
else
return -1;
break;
case NFAPI_NB_HARQ_INDICATION:
if (check_nr_unpack_length(NFAPI_NB_HARQ_INDICATION, unpackedBufLen))
result = unpack_nb_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
else
return -1;
break;
case NFAPI_NRACH_INDICATION:
if (check_nr_unpack_length(NFAPI_NRACH_INDICATION, unpackedBufLen))
result = unpack_nrach_indication(&pReadPackedMessage, end, pMessageHeader, config);
else
return -1;
break;
case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC: case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC, unpackedBufLen)) if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC, unpackedBufLen))
result = unpack_nr_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config); result = unpack_nr_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config);
......
...@@ -175,17 +175,7 @@ int nfapi_pnf_p7_rach_ind(nfapi_pnf_p7_config_t* config, nfapi_rach_indication_t ...@@ -175,17 +175,7 @@ int nfapi_pnf_p7_rach_ind(nfapi_pnf_p7_config_t* config, nfapi_rach_indication_t
pnf_p7_t* _this = (pnf_p7_t*)(config); pnf_p7_t* _this = (pnf_p7_t*)(config);
return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_rach_indication_t)); return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_rach_indication_t));
} }
int nfapi_pnf_p7_srs_ind(nfapi_pnf_p7_config_t* config, nfapi_srs_indication_t* ind)
{
if(config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1;
}
pnf_p7_t* _this = (pnf_p7_t*)(config);
return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_srs_indication_t));
}
int nfapi_pnf_p7_sr_ind(nfapi_pnf_p7_config_t* config, nfapi_sr_indication_t* ind) int nfapi_pnf_p7_sr_ind(nfapi_pnf_p7_config_t* config, nfapi_sr_indication_t* ind)
{ {
if(config == NULL || ind == NULL) if(config == NULL || ind == NULL)
...@@ -265,3 +255,65 @@ int nfapi_pnf_ue_release_resp(nfapi_pnf_p7_config_t* config, nfapi_ue_release_re ...@@ -265,3 +255,65 @@ int nfapi_pnf_ue_release_resp(nfapi_pnf_p7_config_t* config, nfapi_ue_release_re
return pnf_p7_pack_and_send_p7_message(_this, &(resp->header), sizeof(nfapi_ue_release_response_t)); return pnf_p7_pack_and_send_p7_message(_this, &(resp->header), sizeof(nfapi_ue_release_response_t));
} }
//NR UPLINK INDICATION
int nfapi_pnf_p7_nr_rx_data_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_rx_data_indication_t* ind)
{
if(config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1;
}
pnf_p7_t* _this = (pnf_p7_t*)(config);
return pnf_nr_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nr_rx_data_indication_t));
}
int nfapi_pnf_p7_nr_crc_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_crc_indication_t* ind)
{
if(config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1;
}
pnf_p7_t* _this = (pnf_p7_t*)(config);
return pnf_nr_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nr_crc_indication_t));
}
int nfapi_pnf_p7_nr_srs_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_srs_indication_t* ind)
{
if(config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1;
}
pnf_p7_t* _this = (pnf_p7_t*)(config);
return pnf_nr_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nr_srs_indication_t));
}
int nfapi_pnf_p7_nr_uci_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_uci_indication_t* ind)
{
if(config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1;
}
pnf_p7_t* _this = (pnf_p7_t*)(config);
return pnf_nr_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nr_uci_indication_t));
}
int nfapi_pnf_p7_nr_rach_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_rach_indication_t* ind)
{
if(config == NULL || ind == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1;
}
pnf_p7_t* _this = (pnf_p7_t*)(config);
return pnf_nr_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nr_rach_indication_t));
}
...@@ -1455,6 +1455,102 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) ...@@ -1455,6 +1455,102 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
} }
} }
//NR HANDLES FOR UPLINK MESSAGES
void vnf_handle_nr_rx_data_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
{
// ensure it's valid
if (pRecvMsg == NULL || vnf_p7 == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
}
else
{
nfapi_nr_rx_data_indication_t ind;
if(nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
}
}
}
void vnf_handle_nr_crc_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
{
// ensure it's valid
if (pRecvMsg == NULL || vnf_p7 == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
}
else
{
nfapi_nr_crc_indication_t ind;
if(nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
}
}
}
void vnf_handle_nr_srs_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
{
// ensure it's valid
if (pRecvMsg == NULL || vnf_p7 == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
}
else
{
nfapi_nr_srs_indication_t ind;
if(nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
}
}
}
void vnf_handle_nr_uci_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
{
// ensure it's valid
if (pRecvMsg == NULL || vnf_p7 == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
}
else
{
nfapi_nr_uci_indication_t ind;
if(nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
}
}
}
void vnf_handle_nr_rach_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
{
// ensure it's valid
if (pRecvMsg == NULL || vnf_p7 == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
}
else
{
nfapi_nr_rach_indication_t ind;
if(nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
}
}
}
void vnf_nr_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) void vnf_nr_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
{ {
//printf("received UL Node sync"); //printf("received UL Node sync");
...@@ -2035,46 +2131,26 @@ void vnf_nr_dispatch_p7_message(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7 ...@@ -2035,46 +2131,26 @@ void vnf_nr_dispatch_p7_message(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7
vnf_nr_handle_timing_info(pRecvMsg, recvMsgLen, vnf_p7); vnf_nr_handle_timing_info(pRecvMsg, recvMsgLen, vnf_p7);
break; break;
case NFAPI_HARQ_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
vnf_handle_harq_indication(pRecvMsg, recvMsgLen, vnf_p7); vnf_handle_nr_rx_data_indication(pRecvMsg, recvMsgLen, vnf_p7);
break; break;
case NFAPI_CRC_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
vnf_handle_crc_indication(pRecvMsg, recvMsgLen, vnf_p7); vnf_handle_nr_crc_indication(pRecvMsg, recvMsgLen, vnf_p7);
break; break;
case NFAPI_RX_ULSCH_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
vnf_handle_rx_ulsch_indication(pRecvMsg, recvMsgLen, vnf_p7); vnf_handle_nr_uci_indication(pRecvMsg, recvMsgLen, vnf_p7);
break; break;
case NFAPI_RACH_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
vnf_handle_rach_indication(pRecvMsg, recvMsgLen, vnf_p7); vnf_handle_nr_rach_indication(pRecvMsg, recvMsgLen, vnf_p7);
break; break;
case NFAPI_SRS_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
vnf_handle_srs_indication(pRecvMsg, recvMsgLen, vnf_p7); vnf_handle_nr_srs_indication(pRecvMsg, recvMsgLen, vnf_p7);
break; break;
case NFAPI_RX_SR_INDICATION:
vnf_handle_rx_sr_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
case NFAPI_RX_CQI_INDICATION:
vnf_handle_rx_cqi_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
case NFAPI_LBT_DL_INDICATION:
vnf_handle_lbt_dl_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
case NFAPI_NB_HARQ_INDICATION:
vnf_handle_nb_harq_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
case NFAPI_NRACH_INDICATION:
vnf_handle_nrach_indication(pRecvMsg, recvMsgLen, vnf_p7);
break;
case NFAPI_UE_RELEASE_RESPONSE: case NFAPI_UE_RELEASE_RESPONSE:
vnf_handle_ue_release_resp(pRecvMsg, recvMsgLen, vnf_p7); vnf_handle_ue_release_resp(pRecvMsg, recvMsgLen, vnf_p7);
break; break;
......
...@@ -54,7 +54,14 @@ extern uint16_t sf_ahead; ...@@ -54,7 +54,14 @@ extern uint16_t sf_ahead;
extern uint16_t sl_ahead; extern uint16_t sl_ahead;
void handle_nr_rach(NR_UL_IND_t *UL_info) { void handle_nr_rach(NR_UL_IND_t *UL_info) {
if(NFAPI_MODE == NFAPI_MODE_PNF) {
if (UL_info->rach_ind.number_of_pdus>0) {
//LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf));
oai_nfapi_nr_rach_indication(&UL_info->rach_ind);
UL_info->rach_ind.number_of_pdus = 0;
}
}
else {
if (UL_info->rach_ind.number_of_pdus>0) { if (UL_info->rach_ind.number_of_pdus>0) {
LOG_I(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",UL_info->frame,UL_info->slot, UL_info->rach_ind.sfn,UL_info->rach_ind.slot); LOG_I(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",UL_info->frame,UL_info->slot, UL_info->rach_ind.sfn,UL_info->rach_ind.slot);
int npdus = UL_info->rach_ind.number_of_pdus; int npdus = UL_info->rach_ind.number_of_pdus;
...@@ -75,10 +82,19 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) { ...@@ -75,10 +82,19 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) {
} }
} }
} }
}
void handle_nr_uci(NR_UL_IND_t *UL_info) void handle_nr_uci(NR_UL_IND_t *UL_info)
{ {
if(NFAPI_MODE == NFAPI_MODE_PNF) {
if (UL_info->uci_ind.num_ucis>0) {
//LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf));
//oai_nfapi_nr_uci_indication(&UL_info->uci_ind);
UL_info->uci_ind.num_ucis = 0;
}
}
else {
const module_id_t mod_id = UL_info->module_id; const module_id_t mod_id = UL_info->module_id;
const frame_t frame = UL_info->frame; const frame_t frame = UL_info->frame;
const sub_frame_t slot = UL_info->slot; const sub_frame_t slot = UL_info->slot;
...@@ -110,10 +126,24 @@ void handle_nr_uci(NR_UL_IND_t *UL_info) ...@@ -110,10 +126,24 @@ void handle_nr_uci(NR_UL_IND_t *UL_info)
// NOTE: we just assume it is BWP ID 1, to be revised for multiple BWPs // NOTE: we just assume it is BWP ID 1, to be revised for multiple BWPs
RC.nrmac[mod_id]->pucch_index_used[1][slot] = 0; RC.nrmac[mod_id]->pucch_index_used[1][slot] = 0;
} }
}
void handle_nr_ulsch(NR_UL_IND_t *UL_info) void handle_nr_ulsch(NR_UL_IND_t *UL_info)
{ {
if(NFAPI_MODE == NFAPI_MODE_PNF) {
if (UL_info->crc_ind.number_crcs>0) {
//LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf));
oai_nfapi_nr_crc_indication(&UL_info->crc_ind);
UL_info->crc_ind.number_crcs = 0;
}
if (UL_info->rx_ind.number_of_pdus>0) {
//LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf));
oai_nfapi_nr_rx_data_indication(&UL_info->rx_ind);
UL_info->rx_ind.number_of_pdus = 0;
}
}
else {
if (UL_info->rx_ind.number_of_pdus > 0 && UL_info->crc_ind.number_crcs > 0) { if (UL_info->rx_ind.number_of_pdus > 0 && UL_info->crc_ind.number_crcs > 0) {
for (int i = 0; i < UL_info->rx_ind.number_of_pdus; i++) { for (int i = 0; i < UL_info->rx_ind.number_of_pdus; i++) {
for (int j = 0; j < UL_info->crc_ind.number_crcs; j++) { for (int j = 0; j < UL_info->crc_ind.number_crcs; j++) {
...@@ -139,17 +169,16 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info) ...@@ -139,17 +169,16 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info)
crc->tb_crc_status); crc->tb_crc_status);
/* if CRC passes, pass PDU, otherwise pass NULL as error indication */ /* if CRC passes, pass PDU, otherwise pass NULL as error indication */
//Gokul nr_rx_sdu(UL_info->module_id,
// nr_rx_sdu(UL_info->module_id, UL_info->CC_id,
// UL_info->CC_id, UL_info->rx_ind.sfn,
// UL_info->rx_ind.sfn, UL_info->rx_ind.slot,
// UL_info->rx_ind.slot, rx->rnti,
// rx->rnti, crc->tb_crc_status ? NULL : rx->pdu,
// crc->tb_crc_status ? NULL : rx->pdu, rx->pdu_length,
// rx->pdu_length, rx->timing_advance,
// rx->timing_advance, rx->ul_cqi,
// rx->ul_cqi, rx->rssi);
// rx->rssi);
//handle_nr_ul_harq(UL_info->module_id, UL_info->frame, UL_info->slot, crc); //handle_nr_ul_harq(UL_info->module_id, UL_info->frame, UL_info->slot, crc);
break; break;
} // for (j=0;j<UL_info->crc_ind.number_crcs;j++) } // for (j=0;j<UL_info->crc_ind.number_crcs;j++)
...@@ -169,6 +198,7 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info) ...@@ -169,6 +198,7 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info)
UL_info->crc_ind.number_crcs, UL_info->crc_ind.number_crcs,
UL_info->rx_ind.sfn, UL_info->rx_ind.sfn,
UL_info->rx_ind.slot); UL_info->rx_ind.slot);
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment