Commit 693b137e authored by Mahesh's avatar Mahesh

Bugfix - UL_ind struct filled

parent 926acf7a
...@@ -1020,6 +1020,98 @@ int phy_nrach_indication(struct nfapi_vnf_p7_config *config, nfapi_nrach_indicat ...@@ -1020,6 +1020,98 @@ int phy_nrach_indication(struct nfapi_vnf_p7_config *config, nfapi_nrach_indicat
return 1; return 1;
} }
//NR phy indication
int phy_nr_crc_indication(nfapi_nr_crc_indication_t *ind) {
struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
pthread_mutex_lock(&gNB->UL_INFO_mutex);
ind->number_crcs = 1;
if (ind->number_crcs > 0)
gNB->UL_INFO.crc_ind.crc_list = malloc(sizeof(nfapi_nr_crc_t)*ind->number_crcs);
for (int i=0; i<ind->number_crcs; i++)
memcpy(&gNB->UL_INFO.crc_ind.crc_list[i], &ind->crc_list[i], sizeof(ind->crc_list[0]));
pthread_mutex_unlock(&gNB->UL_INFO_mutex);
return 1;
}
int phy_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) {
struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
pthread_mutex_lock(&gNB->UL_INFO_mutex);
if (ind->number_of_pdus > 0)
gNB->UL_INFO.rx_ind.pdu_list = malloc(sizeof(nfapi_nr_rx_data_pdu_t)*ind->number_of_pdus);
for (int i=0; i<ind->number_of_pdus; i++)
memcpy(&gNB->UL_INFO.rx_ind.pdu_list[i], &ind->pdu_list[i], sizeof(ind->pdu_list[0]));
pthread_mutex_unlock(&gNB->UL_INFO_mutex);
return 1;
}
int phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind) {
struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
pthread_mutex_lock(&gNB->UL_INFO_mutex);
if (ind->num_ucis > 0)
gNB->UL_INFO.uci_ind.uci_list = malloc(sizeof(nfapi_nr_uci_t)*ind->num_ucis);
for (int i=0; i<ind->num_ucis; i++)
memcpy(&gNB->UL_INFO.uci_ind.uci_list[i], &ind->uci_list[i], sizeof(ind->uci_list[0]));
pthread_mutex_unlock(&gNB->UL_INFO_mutex);
return 1;
}
int phy_nr_srs_indication(nfapi_nr_srs_indication_t *ind) {
struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
pthread_mutex_lock(&gNB->UL_INFO_mutex);
if (ind->number_of_pdus > 0)
gNB->UL_INFO.srs_ind.pdu_list = malloc(sizeof(nfapi_nr_srs_indication_pdu_t)*ind->number_of_pdus);
for (int i=0; i<ind->number_of_pdus; i++) {
memcpy(&gNB->UL_INFO.srs_ind.pdu_list[i], &ind->pdu_list[i], sizeof(ind->pdu_list[0]));
LOG_D(MAC, "%s() NFAPI SFN/Slot:%d.%d SRS_IND:number_of_pdus:%d UL_INFO:pdus:%d\n",
__FUNCTION__,
ind->sfn,ind->slot, ind->number_of_pdus, gNB->UL_INFO.srs_ind.number_of_pdus
);
}
pthread_mutex_unlock(&gNB->UL_INFO_mutex);
return 1;
}
int phy_nr_rach_indication(nfapi_nr_rach_indication_t *ind) {
struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
pthread_mutex_lock(&gNB->UL_INFO_mutex);
if (ind->number_of_pdus > 0)
gNB->UL_INFO.rach_ind.pdu_list = malloc(sizeof(nfapi_nr_prach_indication_pdu_t)*ind->number_of_pdus);
for (int i=0; i<ind->number_of_pdus; i++) {
memcpy(&gNB->UL_INFO.rach_ind.pdu_list[i], &ind->pdu_list[i], sizeof(ind->pdu_list[0]));
LOG_D(MAC, "%s() NFAPI SFN/Slot:%d.%d RACH_IND:number_of_pdus:%d UL_INFO:pdus:%d\n",
__FUNCTION__,
ind->sfn,ind->slot, ind->number_of_pdus, gNB->UL_INFO.rach_ind.number_of_pdus
);
}
pthread_mutex_unlock(&gNB->UL_INFO_mutex);
return 1;
}
//end NR phy indication
void *vnf_allocate(size_t size) { void *vnf_allocate(size_t size) {
//return (void*)memory_pool::allocate(size); //return (void*)memory_pool::allocate(size);
return (void *)malloc(size); return (void *)malloc(size);
...@@ -1157,16 +1249,12 @@ void *vnf_nr_p7_thread_start(void *ptr) { ...@@ -1157,16 +1249,12 @@ void *vnf_nr_p7_thread_start(void *ptr) {
p7_vnf->config->sync_indication = &phy_sync_indication; p7_vnf->config->sync_indication = &phy_sync_indication;
p7_vnf->config->slot_indication = &phy_slot_indication; p7_vnf->config->slot_indication = &phy_slot_indication;
p7_vnf->config->harq_indication = &phy_harq_indication; p7_vnf->config->nr_crc_indication = &phy_nr_crc_indication;
p7_vnf->config->crc_indication = &phy_crc_indication; p7_vnf->config->nr_rx_data_indication = &phy_nr_rx_data_indication;
p7_vnf->config->rx_indication = &phy_rx_indication; p7_vnf->config->nr_uci_indication = &phy_nr_uci_indication;
p7_vnf->config->rach_indication = &phy_rach_indication; p7_vnf->config->nr_rach_indication = &phy_nr_rach_indication;
p7_vnf->config->srs_indication = &phy_srs_indication; p7_vnf->config->nr_srs_indication = &phy_nr_srs_indication;
p7_vnf->config->sr_indication = &phy_sr_indication;
p7_vnf->config->cqi_indication = &phy_cqi_indication;
p7_vnf->config->lbt_dl_indication = &phy_lbt_dl_indication;
p7_vnf->config->nb_harq_indication = &phy_nb_harq_indication;
p7_vnf->config->nrach_indication = &phy_nrach_indication;
p7_vnf->config->malloc = &vnf_allocate; p7_vnf->config->malloc = &vnf_allocate;
p7_vnf->config->free = &vnf_deallocate; p7_vnf->config->free = &vnf_deallocate;
p7_vnf->config->trace = &vnf_trace; p7_vnf->config->trace = &vnf_trace;
......
...@@ -361,7 +361,7 @@ static uint8_t pack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppWritePac ...@@ -361,7 +361,7 @@ static uint8_t pack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppWritePac
static uint8_t pack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) static uint8_t pack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
{ {
printf("Packing ssb. \n"); //printf("Packing ssb. \n");
nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv; nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv;
return( return(
...@@ -3625,7 +3625,7 @@ static uint8_t pack_nr_uci_indication_body(void* tlv, uint8_t **ppWritePackedMsg ...@@ -3625,7 +3625,7 @@ static uint8_t pack_nr_uci_indication_body(void* tlv, uint8_t **ppWritePackedMsg
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: { 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; 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); pack_nr_uci_pucch_0_1(&value->pucch_pdu_format_0_1, ppWritePackedMsg, end);
break; break;
} }
case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: { case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: {
...@@ -3650,7 +3650,7 @@ static uint8_t pack_nr_uci_indication(void *msg, uint8_t **ppWritePackedMsg, uin ...@@ -3650,7 +3650,7 @@ static uint8_t pack_nr_uci_indication(void *msg, uint8_t **ppWritePackedMsg, uin
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)) if(!pack_nr_uci_indication_body(pNfapiMsg->uci_list,ppWritePackedMsg,end))
return 0; return 0;
} }
...@@ -3700,7 +3700,7 @@ int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packe ...@@ -3700,7 +3700,7 @@ int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packe
{ {
case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST: case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
result = pack_dl_tti_request(pMessageHeader, &pWritePackedMessage, end, config); result = pack_dl_tti_request(pMessageHeader, &pWritePackedMessage, end, config);
printf("result of pack dl_tti_req is %d. \n",result); //printf("result of pack dl_tti_req is %d. \n",result);
break; break;
case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST: case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
...@@ -6370,15 +6370,8 @@ static uint8_t unpack_nr_rx_data_indication_body(void* tlv, uint8_t **ppReadPack ...@@ -6370,15 +6370,8 @@ static uint8_t unpack_nr_rx_data_indication_body(void* tlv, uint8_t **ppReadPack
} }
static uint8_t unpack_nr_rx_data_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) static uint8_t unpack_nr_rx_data_indication(uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_nr_rx_data_indication_t *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; nfapi_nr_rx_data_indication_t *pNfapiMsg = (nfapi_nr_rx_data_indication_t*)msg;
printf("\n"); printf("\n");
...@@ -6390,7 +6383,7 @@ static uint8_t unpack_nr_rx_data_indication(uint8_t **ppReadPackedMsg, uint8_t * ...@@ -6390,7 +6383,7 @@ static uint8_t unpack_nr_rx_data_indication(uint8_t **ppReadPackedMsg, uint8_t *
for(int i=0; i<pNfapiMsg->number_of_pdus;i++) for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
{ {
if(!unpack_nr_rx_data_indication_body(&pNfapiMsg->pdu_list, ppReadPackedMsg, end)) if(!unpack_nr_rx_data_indication_body(pNfapiMsg->pdu_list, ppReadPackedMsg, end))
return 0; return 0;
} }
...@@ -6399,10 +6392,8 @@ return 1; ...@@ -6399,10 +6392,8 @@ return 1;
//NR CRC INDICATION //NR CRC INDICATION
static uint8_t unpack_nr_crc_indication_body(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) static uint8_t unpack_nr_crc_indication_body(nfapi_nr_crc_t* value, uint8_t **ppReadPackedMsg, uint8_t *end)
{ {
nfapi_nr_crc_t* value = (nfapi_nr_crc_t*)tlv;
if(!(pull32(ppReadPackedMsg, &value->handle, end) && if(!(pull32(ppReadPackedMsg, &value->handle, end) &&
pull16(ppReadPackedMsg, &value->rnti, end) && pull16(ppReadPackedMsg, &value->rnti, end) &&
pull8(ppReadPackedMsg, &value->harq_id, end) && pull8(ppReadPackedMsg, &value->harq_id, end) &&
...@@ -6415,32 +6406,31 @@ static uint8_t unpack_nr_crc_indication_body(void* tlv, uint8_t **ppReadPackedMs ...@@ -6415,32 +6406,31 @@ static uint8_t unpack_nr_crc_indication_body(void* tlv, uint8_t **ppReadPackedMs
)) ))
return 0; return 0;
//memcpy((nfapi_nr_crc_t *)tlv,value,sizeof(nfapi_nr_crc_t));
return 1; return 1;
} }
static uint8_t unpack_nr_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) static uint8_t unpack_nr_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_nr_crc_indication_t *msg, nfapi_p7_codec_config_t* config)
{ {
uint8_t *ptr = *ppReadPackedMsg; nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t *) msg;
// printf("\n Read P7 message indication unpack: "); // pNfapiMsg = (nfapi_nr_crc_indication_t *) malloc(sizeof(nfapi_nr_crc_indication_t));
// while(ptr < end){ // pNfapiMsg->crc_list = (nfapi_nr_crc_t *) malloc(sizeof(nfapi_nr_crc_t));
// printf(" %d ", *ptr);
// ptr++;
// }
// printf("\n");
nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t*)msg;
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) && if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn, end) &&
pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) && pull16(ppReadPackedMsg, &pNfapiMsg->slot, end) &&
pull16(ppReadPackedMsg, &pNfapiMsg->number_crcs, end) pull16(ppReadPackedMsg, &pNfapiMsg->number_crcs, end)
)) ))
return 0; return 0;
for(int i=0; i<pNfapiMsg->number_crcs;i++) for(int i=0; i<pNfapiMsg->number_crcs;i++)
{ {
if(!unpack_nr_crc_indication_body(&pNfapiMsg->crc_list,ppReadPackedMsg,end)) if(!unpack_nr_crc_indication_body(pNfapiMsg->crc_list,ppReadPackedMsg,end))
//if(!unpack_nr_crc_indication_body(value,ppReadPackedMsg,end))
return 0; return 0;
} }
printf("Done \n");
return 1; return 1;
} }
...@@ -6489,7 +6479,7 @@ return 1; ...@@ -6489,7 +6479,7 @@ return 1;
//NR RACH //NR RACH
static uint8_t unpack_nr_rach_indication_body(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) static uint8_t unpack_nr_rach_indication_body(nfapi_nr_prach_indication_pdu_t* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
{ {
nfapi_nr_prach_indication_pdu_t* value = (nfapi_nr_prach_indication_pdu_t*)tlv; nfapi_nr_prach_indication_pdu_t* value = (nfapi_nr_prach_indication_pdu_t*)tlv;
...@@ -6502,6 +6492,7 @@ static uint8_t unpack_nr_rach_indication_body(void* tlv, uint8_t **ppReadPackedM ...@@ -6502,6 +6492,7 @@ static uint8_t unpack_nr_rach_indication_body(void* tlv, uint8_t **ppReadPackedM
pull8(ppReadPackedMsg, &value->num_preamble, end) pull8(ppReadPackedMsg, &value->num_preamble, end)
)) ))
return 0; return 0;
value->preamble_list = (nfapi_nr_prach_indication_preamble_t*) malloc(sizeof(nfapi_nr_prach_indication_preamble_t) * value->num_preamble);
for(int i = 0; i < value->num_preamble; i++) for(int i = 0; i < value->num_preamble; i++)
{ {
if(!(pull8(ppReadPackedMsg, &value->preamble_list->preamble_index, end) && if(!(pull8(ppReadPackedMsg, &value->preamble_list->preamble_index, end) &&
...@@ -6513,7 +6504,7 @@ static uint8_t unpack_nr_rach_indication_body(void* tlv, uint8_t **ppReadPackedM ...@@ -6513,7 +6504,7 @@ static uint8_t unpack_nr_rach_indication_body(void* tlv, uint8_t **ppReadPackedM
return 1; return 1;
} }
static uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) { static uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_nr_rach_indication_t* msg, nfapi_p7_codec_config_t* config) {
nfapi_nr_rach_indication_t *pNfapiMsg = (nfapi_nr_rach_indication_t*)msg; nfapi_nr_rach_indication_t *pNfapiMsg = (nfapi_nr_rach_indication_t*)msg;
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) && if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
...@@ -6521,10 +6512,10 @@ static uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end ...@@ -6521,10 +6512,10 @@ static uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end
pull8(ppReadPackedMsg, &pNfapiMsg->number_of_pdus, end) pull8(ppReadPackedMsg, &pNfapiMsg->number_of_pdus, end)
)) ))
return 0; return 0;
pNfapiMsg->pdu_list = (nfapi_nr_prach_indication_pdu_t*) malloc(sizeof(nfapi_nr_prach_indication_pdu_t) * pNfapiMsg->number_of_pdus);
for(int i=0; i< pNfapiMsg->number_of_pdus;i++) for(int i=0; i< pNfapiMsg->number_of_pdus;i++)
{ {
if(!unpack_nr_rach_indication_body(&pNfapiMsg->pdu_list,ppReadPackedMsg,end)) if(!unpack_nr_rach_indication_body(pNfapiMsg->pdu_list,ppReadPackedMsg,end))
return 0; return 0;
} }
...@@ -6533,16 +6524,16 @@ return 1; ...@@ -6533,16 +6524,16 @@ return 1;
//NR UCI //NR UCI
static uint8_t unpack_nr_uci_pucch_0_1(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) { static uint8_t unpack_nr_uci_pucch_0_1(nfapi_nr_uci_pucch_pdu_format_0_1_t* 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; nfapi_nr_uci_pucch_pdu_format_0_1_t* value = (nfapi_nr_uci_pucch_pdu_format_0_1_t*)tlv;
uint8_t *ptr = *ppReadPackedMsg; uint8_t *ptr = *ppReadPackedMsg;
printf("\n Read P7 message uci_0_1 indication unpack: "); // printf("\n Read P7 message uci_0_1 indication unpack: ");
while(ptr < end){ // while(ptr < end){
printf(" %d ", *ptr); // printf(" %d ", *ptr);
ptr++; // ptr++;
} // }
printf("\n"); // printf("\n");
if(!(pull8(ppReadPackedMsg, &value->pduBitmap, end) && if(!(pull8(ppReadPackedMsg, &value->pduBitmap, end) &&
pull32(ppReadPackedMsg, &value->handle, end) && pull32(ppReadPackedMsg, &value->handle, end) &&
...@@ -6554,34 +6545,33 @@ static uint8_t unpack_nr_uci_pucch_0_1(void* tlv, uint8_t **ppReadPackedMsg, uin ...@@ -6554,34 +6545,33 @@ static uint8_t unpack_nr_uci_pucch_0_1(void* tlv, uint8_t **ppReadPackedMsg, uin
)) ))
return 0; return 0;
if (value->pduBitmap & 0x01) { //SR if (value->pduBitmap & 0x01) { //SR
value->sr = (nfapi_nr_sr_pdu_0_1_t*) malloc(sizeof(nfapi_nr_sr_pdu_0_1_t));
if(!(pull8(ppReadPackedMsg, &value->sr->sr_indication, end) && if(!(pull8(ppReadPackedMsg, &value->sr->sr_indication, end) &&
pull8(ppReadPackedMsg, &value->sr->sr_confidence_level, end) pull8(ppReadPackedMsg, &value->sr->sr_confidence_level, end)
)) ))
return 0; return 0;
} }
// if (((value->pduBitmap >> 1) & 0x01)) { //HARQ 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 value->harq = (nfapi_nr_harq_pdu_0_1_t*) malloc(sizeof(nfapi_nr_harq_pdu_0_1_t));
// temp = (uint8_t*) malloc(sizeof(uint8_t)); if(!(pull8(ppReadPackedMsg, &value->harq->num_harq, end) &&
// //printf("value->harq->num_harq = %d \n", value->harq->num_harq); pull8(ppReadPackedMsg, &value->harq->harq_confidence_level, end)
// // if(!(pull8(ppReadPackedMsg, temp, end) && ))
// // pull8(ppReadPackedMsg, temp, end) return 0;
// // )) value->harq->harq_list = (nfapi_nr_harq_t*) malloc(sizeof(nfapi_nr_harq_t*) * value->harq->num_harq);
// // return 0; for(int i=0; i<value->harq->num_harq;i++)
{
// // for(int i=0; i<1;i++) if(!(pull8(ppReadPackedMsg, &value->harq->harq_list->harq_value, end)
// // { ))
// // if(!(pull8(ppReadPackedMsg, temp, end) //review - gokul return 0;
// // )) }
// // return 0; }
// // }
// }
return 1; return 1;
} }
static uint8_t unpack_nr_uci_pucch_2_3_4(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) { 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; 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) && if(!(pull8(ppReadPackedMsg, &value->pduBitmap, end) &&
...@@ -6594,43 +6584,53 @@ static uint8_t unpack_nr_uci_pucch_2_3_4(void* tlv, uint8_t **ppReadPackedMsg, u ...@@ -6594,43 +6584,53 @@ static uint8_t unpack_nr_uci_pucch_2_3_4(void* tlv, uint8_t **ppReadPackedMsg, u
)) ))
return 0; return 0;
if (value->pduBitmap & 0x01) { //SR if (value->pduBitmap & 0x01) { //SR
if(!(pull16(ppReadPackedMsg, &value->sr.sr_bit_len, end) && 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;
))
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; return 0;
} }
if (((value->pduBitmap >> 1) & 0x01)) { //HARQ if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
if(!(pull8(ppReadPackedMsg, &value->harq.harq_crc, end) && if(!(pull8(ppReadPackedMsg, &value->harq.harq_crc, end)) &&
pull16(ppReadPackedMsg, &value->harq.harq_bit_len, 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;
))
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)))
return 0; return 0;
} }
if (((value->pduBitmap >> 2) & 0x01)) { //CSI-1 if (((value->pduBitmap >> 2) & 0x01)) { //CSI-1
if(!(pull8(ppReadPackedMsg, &value->csi_part1.csi_part1_crc, end) && if(!(pull8(ppReadPackedMsg, &value->csi_part1.csi_part1_crc, end)) &&
pull16(ppReadPackedMsg, &value->csi_part1.csi_part1_bit_len, 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; return 0;
value->csi_part1.csi_part1_payload = (uint8_t*) malloc(sizeof(uint8_t) * ((value->csi_part1.csi_part1_bit_len/8)));
// 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 (((value->pduBitmap >> 3) & 0x01)) { //CSI-2 if (((value->pduBitmap >> 3) & 0x01)) { //CSI-2
if(!(pull8(ppReadPackedMsg, &value->csi_part2.csi_part2_crc, end) && if(!(pull8(ppReadPackedMsg, &value->csi_part2.csi_part2_crc, end)) &&
pull16(ppReadPackedMsg, &value->csi_part2.csi_part2_bit_len, 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;
))
value->csi_part2.csi_part2_payload = (uint8_t*) malloc(sizeof(uint8_t) * ((value->csi_part2.csi_part2_bit_len/8 )));
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)))
return 0; return 0;
} }
return 1; return 1;
} }
static uint8_t unpack_nr_uci_indication_body(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) static uint8_t unpack_nr_uci_indication_body(nfapi_nr_uci_t* value, uint8_t **ppReadPackedMsg, uint8_t *end)
{ {
nfapi_nr_uci_t* value = (nfapi_nr_uci_t*)tlv;
if(!(pull16(ppReadPackedMsg, &value->pdu_type, end) && if(!(pull16(ppReadPackedMsg, &value->pdu_type, end) &&
pull16(ppReadPackedMsg, &value->pdu_size, end) pull16(ppReadPackedMsg, &value->pdu_size, end)
)) ))
...@@ -6643,12 +6643,12 @@ static uint8_t unpack_nr_uci_indication_body(void* tlv, uint8_t **ppReadPackedMs ...@@ -6643,12 +6643,12 @@ static uint8_t unpack_nr_uci_indication_body(void* tlv, uint8_t **ppReadPackedMs
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: { 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; 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); unpack_nr_uci_pucch_0_1(uci_pdu, ppReadPackedMsg, end);
break; break;
} }
case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: { 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; 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); unpack_nr_uci_pucch_2_3_4(uci_pdu, ppReadPackedMsg, end);
break; break;
} }
} }
...@@ -6668,7 +6668,7 @@ static uint8_t unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end, ...@@ -6668,7 +6668,7 @@ static uint8_t unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end,
for(int i=0; i<pNfapiMsg->num_ucis;i++) for(int i=0; i<pNfapiMsg->num_ucis;i++)
{ {
if(!unpack_nr_uci_indication_body(&pNfapiMsg->uci_list,ppReadPackedMsg,end)) if(!unpack_nr_uci_indication_body(pNfapiMsg->uci_list,ppReadPackedMsg,end))
return 0; return 0;
} }
...@@ -8711,36 +8711,52 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void * ...@@ -8711,36 +8711,52 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *
break; break;
case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION, unpackedBufLen)) if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION, unpackedBufLen)){
result = unpack_nr_rx_data_indication(&pReadPackedMessage, end, pMessageHeader, config); nfapi_nr_rx_data_indication_t* msg = (nfapi_nr_rx_data_indication_t*) pMessageHeader;
msg->pdu_list = (nfapi_nr_rx_data_pdu_t*) malloc(sizeof(nfapi_nr_rx_data_pdu_t));
msg->pdu_list->pdu = (uint8_t *) malloc(sizeof(uint8_t));
result = unpack_nr_rx_data_indication(&pReadPackedMessage, end, msg, config);
}
else else
return -1; return -1;
break; break;
case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION, unpackedBufLen)) if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION, unpackedBufLen)){
result = unpack_nr_crc_indication(&pReadPackedMessage,end , pMessageHeader, config);
nfapi_nr_crc_indication_t* msg = (nfapi_nr_crc_indication_t*) pMessageHeader;
msg->crc_list = (nfapi_nr_crc_t*) malloc(sizeof(nfapi_nr_crc_t));
result = unpack_nr_crc_indication(&pReadPackedMessage,end , msg, config);
}
else else
return -1; return -1;
break; break;
case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION, unpackedBufLen)) if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION, unpackedBufLen)){
result = unpack_nr_uci_indication(&pReadPackedMessage, end, pMessageHeader, config); nfapi_nr_uci_indication_t* msg = (nfapi_nr_uci_indication_t*) pMessageHeader;
msg->uci_list = (nfapi_nr_uci_t*) malloc(sizeof(nfapi_nr_uci_t));
result = unpack_nr_uci_indication(&pReadPackedMessage, end, msg, config);
}
else else
return -1; return -1;
break; break;
case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION, unpackedBufLen)) if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION, unpackedBufLen)){
result = unpack_nr_srs_indication(&pReadPackedMessage, end, pMessageHeader, config); nfapi_nr_srs_indication_t* msg = (nfapi_nr_srs_indication_t*) pMessageHeader;
msg->pdu_list = (nfapi_nr_srs_indication_pdu_t*) malloc(sizeof(nfapi_nr_srs_indication_pdu_t));
result = unpack_nr_srs_indication(&pReadPackedMessage, end, msg, config);
}
else else
return -1; return -1;
break; break;
case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION, unpackedBufLen)) if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION, unpackedBufLen)){
result = unpack_nr_rach_indication(&pReadPackedMessage, end, pMessageHeader, config); nfapi_nr_rach_indication_t* msg = (nfapi_nr_rach_indication_t*) pMessageHeader;
result = unpack_nr_rach_indication(&pReadPackedMessage, end, msg, config);
}
else else
return -1; return -1;
break; break;
......
...@@ -853,6 +853,14 @@ typedef struct nfapi_vnf_p7_config ...@@ -853,6 +853,14 @@ typedef struct nfapi_vnf_p7_config
*/ */
int (*nrach_indication)(struct nfapi_vnf_p7_config* config, nfapi_nrach_indication_t* ind); int (*nrach_indication)(struct nfapi_vnf_p7_config* config, nfapi_nrach_indication_t* ind);
//The NR indication functions below copy uplink information received at the VNF into the UL info struct
int (*nr_crc_indication)(nfapi_nr_crc_indication_t* ind);
int (*nr_rx_data_indication)(nfapi_nr_rx_data_indication_t* ind);
int (*nr_uci_indication)(nfapi_nr_uci_indication_t* ind);
int (*nr_rach_indication)(nfapi_nr_rach_indication_t* ind);
int (*nr_srs_indication)(nfapi_nr_srs_indication_t* ind);
/*! A callback for any vendor extension messages /*! A callback for any vendor extension messages
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param msg A data structure for the decoded vendor extention message allocated * \param msg A data structure for the decoded vendor extention message allocated
......
...@@ -1472,7 +1472,13 @@ void vnf_handle_nr_rx_data_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* ...@@ -1472,7 +1472,13 @@ void vnf_handle_nr_rx_data_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t*
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
} }
else
{
if(vnf_p7->_public.nr_rx_data_indication)
{
(vnf_p7->_public.nr_rx_data_indication)(&ind);
}
}
} }
} }
...@@ -1491,7 +1497,15 @@ void vnf_handle_nr_crc_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_ ...@@ -1491,7 +1497,15 @@ void vnf_handle_nr_crc_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
} }
else
{
if(vnf_p7->_public.nr_crc_indication)
{
//nfapi_nr_crc_indication_t temp = {};
//memset(&temp,1,sizeof(temp)); memset(temp.crc_list,1,sizeof(temp.crc_list[0]));
(vnf_p7->_public.nr_crc_indication)(&ind);
}
}
} }
} }
...@@ -1510,7 +1524,13 @@ void vnf_handle_nr_srs_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_ ...@@ -1510,7 +1524,13 @@ void vnf_handle_nr_srs_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
} }
else
{
if(vnf_p7->_public.nr_srs_indication)
{
(vnf_p7->_public.nr_srs_indication)(&ind);
}
}
} }
} }
...@@ -1529,6 +1549,13 @@ void vnf_handle_nr_uci_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_ ...@@ -1529,6 +1549,13 @@ void vnf_handle_nr_uci_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
} }
else
{
if(vnf_p7->_public.nr_uci_indication)
{
(vnf_p7->_public.nr_uci_indication)(&ind);
}
}
} }
} }
...@@ -1547,7 +1574,13 @@ void vnf_handle_nr_rach_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf ...@@ -1547,7 +1574,13 @@ void vnf_handle_nr_rach_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
} }
else
{
if(vnf_p7->_public.nr_rach_indication)
{
(vnf_p7->_public.nr_rach_indication)(&ind);
}
}
} }
} }
......
...@@ -90,7 +90,7 @@ void handle_nr_uci(NR_UL_IND_t *UL_info) ...@@ -90,7 +90,7 @@ void handle_nr_uci(NR_UL_IND_t *UL_info)
if(NFAPI_MODE == NFAPI_MODE_PNF) { if(NFAPI_MODE == NFAPI_MODE_PNF) {
if (UL_info->uci_ind.num_ucis>0) { 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)); //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); oai_nfapi_nr_uci_indication(&UL_info->uci_ind);
UL_info->uci_ind.num_ucis = 0; UL_info->uci_ind.num_ucis = 0;
} }
} }
......
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