Commit 270c540c authored by luis_pereira87's avatar luis_pereira87

Minor clean up in function mac_rrc_nr_data_req

parent 3c4ba502
...@@ -219,78 +219,75 @@ uint16_t mac_rrc_nr_data_req(const module_id_t Mod_idP, ...@@ -219,78 +219,75 @@ uint16_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%ld\n",Mod_idP,Srb_id); LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%ld\n",Mod_idP,Srb_id);
#endif #endif
// MIBCH // MIBCH
if ((Srb_id & RAB_OFFSET) == MIBCH) { if ((Srb_id & RAB_OFFSET) == MIBCH) {
asn_enc_rval_t enc_rval; asn_enc_rval_t enc_rval;
uint8_t sfn_msb = (uint8_t)((frameP>>4)&0x3f); uint8_t sfn_msb = (uint8_t)((frameP>>4)&0x3f);
rrc_gNB_carrier_data_t *carrier = &RC.nrrrc[Mod_idP]->carrier; rrc_gNB_carrier_data_t *carrier = &RC.nrrrc[Mod_idP]->carrier;
NR_BCCH_BCH_Message_t *mib = &carrier->mib; NR_BCCH_BCH_Message_t *mib = &carrier->mib;
// Currently we are getting the pdcch_ConfigSIB1 from the configuration file. // Currently we are getting the pdcch_ConfigSIB1 from the configuration file.
// Uncomment this function for a dynamic pdcch_ConfigSIB1. // Uncomment this function for a dynamic pdcch_ConfigSIB1.
//channel_bandwidth_t min_channel_bw = bw_10MHz; // Must be obtained based on TS 38.101-1 Table 5.3.5-1 //channel_bandwidth_t min_channel_bw = bw_10MHz; // Must be obtained based on TS 38.101-1 Table 5.3.5-1
//generate_pdcch_ConfigSIB1(carrier->pdcch_ConfigSIB1, //generate_pdcch_ConfigSIB1(carrier->pdcch_ConfigSIB1,
// *carrier->servingcellconfigcommon->ssbSubcarrierSpacing, // *carrier->servingcellconfigcommon->ssbSubcarrierSpacing,
// carrier->mib.message.choice.mib->subCarrierSpacingCommon, // carrier->mib.message.choice.mib->subCarrierSpacingCommon,
// min_channel_bw); // min_channel_bw);
mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = carrier->pdcch_ConfigSIB1->controlResourceSetZero; mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = carrier->pdcch_ConfigSIB1->controlResourceSetZero;
mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = carrier->pdcch_ConfigSIB1->searchSpaceZero; mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = carrier->pdcch_ConfigSIB1->searchSpaceZero;
mib->message.choice.mib->systemFrameNumber.buf[0] = sfn_msb << 2; mib->message.choice.mib->systemFrameNumber.buf[0] = sfn_msb << 2;
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_BCH_Message, enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_BCH_Message,
NULL, NULL,
(void *) mib, (void *) mib,
carrier->MIB, carrier->MIB,
24); 24);
LOG_D(NR_RRC, "Encoded MIB for frame %d sfn_msb %d (%p), bits %lu\n", frameP, sfn_msb, carrier->MIB, LOG_D(NR_RRC, "Encoded MIB for frame %d sfn_msb %d (%p), bits %lu\n", frameP, sfn_msb, carrier->MIB,
enc_rval.encoded); enc_rval.encoded);
buffer_pP[0] = carrier->MIB[0]; buffer_pP[0] = carrier->MIB[0];
buffer_pP[1] = carrier->MIB[1]; buffer_pP[1] = carrier->MIB[1];
buffer_pP[2] = carrier->MIB[2]; buffer_pP[2] = carrier->MIB[2];
LOG_D(NR_RRC, "MIB PDU buffer_pP[0]=%x , buffer_pP[1]=%x, buffer_pP[2]=%x\n", buffer_pP[0], buffer_pP[1], LOG_D(NR_RRC, "MIB PDU buffer_pP[0]=%x , buffer_pP[1]=%x, buffer_pP[2]=%x\n", buffer_pP[0], buffer_pP[1],
buffer_pP[2]); buffer_pP[2]);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded); enc_rval.failed_type->name, enc_rval.encoded);
return (3); return 3;
} }
// TODO BCCH SIB1 SIBs // TODO BCCH SIB1 SIBs
if ((Srb_id & RAB_OFFSET ) == BCCH) { if ((Srb_id & RAB_OFFSET) == BCCH) {
memcpy(&buffer_pP[0], memcpy(&buffer_pP[0], RC.nrrrc[Mod_idP]->carrier.SIB1, RC.nrrrc[Mod_idP]->carrier.sizeof_SIB1);
RC.nrrrc[Mod_idP]->carrier.SIB1,
RC.nrrrc[Mod_idP]->carrier.sizeof_SIB1);
return RC.nrrrc[Mod_idP]->carrier.sizeof_SIB1; return RC.nrrrc[Mod_idP]->carrier.sizeof_SIB1;
} }
// CCCH // CCCH
if( (Srb_id & RAB_OFFSET ) == CCCH) { if ((Srb_id & RAB_OFFSET) == CCCH) {
LOG_D(NR_RRC,"[gNB %d] Frame %d CCCH request (Srb_id %ld)\n", Mod_idP, frameP, Srb_id);
char *payload_pP; char *payload_pP;
uint16_t Sdu_size = 0;
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[Mod_idP], rnti); struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[Mod_idP], rnti);
LOG_D(NR_RRC,"[gNB %d] Frame %d CCCH request (Srb_id %ld)\n", Mod_idP, frameP, Srb_id); LOG_D(NR_RRC,"[gNB %d] Frame %d CCCH request (Srb_id %ld)\n", Mod_idP, frameP, Srb_id);
if (ue_context_p == NULL) {
LOG_E(NR_RRC,"[gNB %d] Frame %d CCCH request but no ue_context\n", Mod_idP, frameP);
return 0;
}
AssertFatal(ue_context_p!=NULL,"failed to get ue_context, rnti %x\n",rnti);
uint16_t payload_size = ue_context_p->ue_context.Srb0.Tx_buffer.payload_size; uint16_t payload_size = ue_context_p->ue_context.Srb0.Tx_buffer.payload_size;
// check if data is there for MAC // check if data is there for MAC
if (payload_size > 0) { if (payload_size > 0) {
payload_pP = ue_context_p->ue_context.Srb0.Tx_buffer.Payload; payload_pP = ue_context_p->ue_context.Srb0.Tx_buffer.Payload;
LOG_D(NR_RRC,"[gNB %d] CCCH has %d bytes (dest: %p, src %p)\n", Mod_idP, payload_size, buffer_pP, payload_pP); LOG_D(NR_RRC,"[gNB %d] CCCH has %d bytes (dest: %p, src %p)\n", Mod_idP, payload_size, buffer_pP, payload_pP);
// Fill buffer // Fill buffer
memcpy((void *)buffer_pP, (void*)payload_pP, payload_size); memcpy((void *)buffer_pP, (void*)payload_pP, payload_size);
Sdu_size = payload_size;
ue_context_p->ue_context.Srb0.Tx_buffer.payload_size = 0; ue_context_p->ue_context.Srb0.Tx_buffer.payload_size = 0;
} }
return Sdu_size; return payload_size;
} }
return(0); return 0;
} }
int8_t nr_mac_rrc_bwp_switch_req(const module_id_t module_idP, int8_t nr_mac_rrc_bwp_switch_req(const module_id_t module_idP,
......
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