Commit 0dde97b5 authored by Chenyu's avatar Chenyu

yihz

parent 5f1164e9
...@@ -307,6 +307,21 @@ void get_num_re_dmrs(nfapi_nr_ue_pusch_pdu_t *pusch_pdu, ...@@ -307,6 +307,21 @@ void get_num_re_dmrs(nfapi_nr_ue_pusch_pdu_t *pusch_pdu,
void build_ssb_to_ro_map(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired); void build_ssb_to_ro_map(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired);
/**\brief
\param module_id module id
\param CC_id component carrier id
\param frame_t frameP
\param rb_id_t SRB id
\param buffer_pP pointer to buffer*/
int8_t mac_rrc_nr_data_req_ue(
const module_id_t Mod_idP,
const int CC_id,
const frame_t frameP,
const rb_id_t Srb_id,
const uint8_t Nb_tb,
uint8_t *const buffer_pP,
const uint8_t gNB_index,
const uint8_t mbsfn_sync_area);
#endif #endif
/** @}*/ /** @}*/
...@@ -962,7 +962,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id, ...@@ -962,7 +962,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index, NR_BCCH_BCH, (uint8_t *) pduP, 3 ); // fixed 3 bytes MIB PDU nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index, 0, 0, 0, NR_BCCH_BCH, (uint8_t *) pduP, 3 ); // fixed 3 bytes MIB PDU
AssertFatal(mac->mib != NULL, "nr_ue_decode_mib() mac->mib == NULL\n"); AssertFatal(mac->mib != NULL, "nr_ue_decode_mib() mac->mib == NULL\n");
//if(mac->mib != NULL){ //if(mac->mib != NULL){
...@@ -1660,32 +1660,79 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in ...@@ -1660,32 +1660,79 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
fapi_nr_ul_config_request_pdu_t *ul_config_list = &ul_config->ul_config_list[ul_config->number_pdus]; fapi_nr_ul_config_request_pdu_t *ul_config_list = &ul_config->ul_config_list[ul_config->number_pdus];
uint16_t TBS_bytes = ul_config_list->pusch_config_pdu.pusch_data.tb_size; uint16_t TBS_bytes = ul_config_list->pusch_config_pdu.pusch_data.tb_size;
//if (IS_SOFTMODEM_NOS1){ uint16_t size_sdu = 0;
// // Getting IP traffic to be transmitted int CC_id;
// data_existing = nr_ue_get_sdu(mod_id, uint8_t mac_sdus[MAX_NR_ULSCH_PAYLOAD_BYTES];
// cc_id, uint8_t sdu_lcids[NB_RB_MAX] = {0};
// frame_tx, uint16_t sdu_lengths[NB_RB_MAX] = {0};
// slot_tx, uint8_t lcid = UL_SCH_LCID_CCCH;
// 0, // uint8_t *payload;
// ulsch_input_buffer, // payload = (uint8_t*) &mac->CCCH_pdu.payload;
// TBS_bytes, // int TBS_bytes_new = 848;
// &access_mode); int mac_ce_len = 0;
//} int header_length_total = 0;
int num_sdus = 1;
unsigned short post_padding = 1;
int offset;
// //if (IS_SOFTMODEM_NOS1){
// // // Getting IP traffic to be transmitted
// // data_existing = nr_ue_get_sdu(mod_id,
// // cc_id,
// // frame_tx,
// // slot_tx,
// // 0,
// // ulsch_input_buffer,
// // TBS_bytes,
// // &access_mode);
// //}
// //Random traffic to be transmitted if there is no IP traffic available for this Tx opportunity
// //if (!IS_SOFTMODEM_NOS1 || !data_existing) {
// //Use zeros for the header bytes in noS1 mode, in order to make sure that the LCID is not valid
// //and block this traffic from being forwarded to the upper layers at the gNB
// LOG_D(MAC, "Random data to be tranmsitted (TBS_bytes %d): \n", TBS_bytes);
// //Give the first byte a dummy value (a value not corresponding to any valid LCID based on 38.321, Table 6.2.1-2)
// //in order to distinguish the PHY random packets at the MAC layer of the gNB receiver from the normal packets that should
// //have a valid LCID (nr_process_mac_pdu function)
// ulsch_input_buffer[0] = 0x31;
// for (int i = 1; i < TBS_bytes; i++) {
// ulsch_input_buffer[i] = (unsigned char) rand();
// //printf(" input encoder a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
// }
// //}
//Random traffic to be transmitted if there is no IP traffic available for this Tx opportunity size_sdu = (uint16_t) mac_rrc_nr_data_req_ue(ul_info->module_id,
//if (!IS_SOFTMODEM_NOS1 || !data_existing) { ul_info->cc_id,
//Use zeros for the header bytes in noS1 mode, in order to make sure that the LCID is not valid ul_info->frame_rx,
//and block this traffic from being forwarded to the upper layers at the gNB CCCH,
LOG_D(MAC, "Random data to be tranmsitted (TBS_bytes %d): \n", TBS_bytes); 1,
//Give the first byte a dummy value (a value not corresponding to any valid LCID based on 38.321, Table 6.2.1-2) mac_sdus,
//in order to distinguish the PHY random packets at the MAC layer of the gNB receiver from the normal packets that should ul_info->gNB_index,
//have a valid LCID (nr_process_mac_pdu function) 0);
ulsch_input_buffer[0] = 0x31; sdu_lcids[0] = lcid;
for (int i = 1; i < TBS_bytes; i++) { sdu_lengths[0] = TBS_bytes - 3 - post_padding - mac_ce_len;
ulsch_input_buffer[i] = (unsigned char) rand(); header_length_total += 2 + (sdu_lengths[0] >= 128);
//printf(" input encoder a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]); size_sdu += sdu_lengths[0];
offset = nr_generate_ulsch_pdu((uint8_t *) mac_sdus, // sdus buffer
(uint8_t *) ulsch_input_buffer, // UL MAC pdu pointer
num_sdus, // num sdus
sdu_lengths, // sdu length
sdu_lcids, // sdu lcid
0, // power headroom
0, // crnti
0, // truncated bsr
0, // short bsr
0, // long_bsr
post_padding,
0);
// Padding: fill remainder with 0
if (post_padding > 0){
for (int j = 0; j < (TBS_bytes - offset); j++)
ulsch_input_buffer[offset + j] = 0; // mac_pdu[offset + j] = 0;
} }
//}
LOG_D(MAC, "[UE %d] Frame %d, Subframe %d Adding Msg3 UL Config Request for rnti: %x\n", LOG_D(MAC, "[UE %d] Frame %d, Subframe %d Adding Msg3 UL Config Request for rnti: %x\n",
ul_info->module_id, ul_info->module_id,
...@@ -4711,6 +4758,7 @@ void nr_ue_process_mac_pdu(module_id_t module_idP, ...@@ -4711,6 +4758,7 @@ void nr_ue_process_mac_pdu(module_id_t module_idP,
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8; mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
mac_subheader_len = 3; mac_subheader_len = 3;
} }
nr_mac_rrc_data_ind_ue(module_idP, CC_id, gNB_index, frameP, 0, mac->crnti, CCCH, pdu_ptr+2, pdu_len-2);
break; break;
...@@ -4823,7 +4871,7 @@ void nr_ue_process_mac_pdu(module_id_t module_idP, ...@@ -4823,7 +4871,7 @@ void nr_ue_process_mac_pdu(module_id_t module_idP,
// WIP todo: handle CCCH_pdu // WIP todo: handle CCCH_pdu
mac_ce_len = 6; mac_ce_len = 6;
LOG_I(MAC, "[UE %d][RAPROC] Frame %d : received contention resolution msg: %x.%x.%x.%x.%x.%x, Terminating RA procedure\n", module_idP, frameP, pdu_ptr[0], pdu_ptr[1], pdu_ptr[2], pdu_ptr[3], pdu_ptr[4], pdu_ptr[5]); LOG_I(MAC, "[UE %d][RAPROC] Frame %d : received contention resolution msg: %x.%x.%x.%x.%x.%x, Terminating RA procedure\n", module_idP, frameP, pdu_ptr[1], pdu_ptr[2], pdu_ptr[3], pdu_ptr[4], pdu_ptr[5], pdu_ptr[6]);
if (mac->RA_active == 1) { if (mac->RA_active == 1) {
LOG_I(MAC, "[UE %d][RAPROC] Frame %d : Clearing RA_active flag\n", module_idP, frameP); LOG_I(MAC, "[UE %d][RAPROC] Frame %d : Clearing RA_active flag\n", module_idP, frameP);
...@@ -4967,7 +5015,10 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, ...@@ -4967,7 +5015,10 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload,
} }
} else { // UL CCCH SDU } else { // UL CCCH SDU
mac_pdu_ptr->R = 0; mac_pdu_ptr->R = 0;
((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->F = 0;
mac_pdu_ptr->LCID = sdu_lcids[i]; mac_pdu_ptr->LCID = sdu_lcids[i];
((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->L = (unsigned char) sdu_lengths[i];
last_size = 2;
} }
mac_pdu_ptr += last_size; mac_pdu_ptr += last_size;
......
...@@ -1241,7 +1241,7 @@ nr_generate_Msg4(module_id_t module_id, ...@@ -1241,7 +1241,7 @@ nr_generate_Msg4(module_id_t module_id,
uint16_t sdu_lengths[NB_RB_MAX] = {0}; uint16_t sdu_lengths[NB_RB_MAX] = {0};
uint8_t mac_sdus[MAX_NR_DLSCH_PAYLOAD_BYTES]; uint8_t mac_sdus[MAX_NR_DLSCH_PAYLOAD_BYTES];
unsigned char sdu_lcids[NB_RB_MAX] = {0}; unsigned char sdu_lcids[NB_RB_MAX] = {0};
const int lcid = DL_SCH_LCID_DTCH; const int lcid = DL_SCH_LCID_CCCH;
if (sched_ctrl->num_total_bytes > 0) { if (sched_ctrl->num_total_bytes > 0) {
LOG_I(MAC, LOG_I(MAC,
"[gNB %d][USER-PLANE DEFAULT DRB] Frame %d : DTCH->DLSCH, Requesting " "[gNB %d][USER-PLANE DEFAULT DRB] Frame %d : DTCH->DLSCH, Requesting "
...@@ -1252,11 +1252,12 @@ nr_generate_Msg4(module_id_t module_id, ...@@ -1252,11 +1252,12 @@ nr_generate_Msg4(module_id_t module_id,
lcid, lcid,
header_length_total, header_length_total,
TBS); TBS);
#if 0 #if 1
sdu_lengths[num_sdus] = mac_rrc_data_req(module_id, CC_idP, frameP, CCCH, // sdu_lengths[num_sdus] = mac_rrc_data_req(module_id, CC_idP, frameP, CCCH,
UE_RNTI(module_idP,UE_id),1, // 1 transport block // UE_RNTI(module_idP,UE_id),1, // 1 transport block
&cc[CC_idP].CCCH_pdu.payload[0], 1); // &cc[CC_idP].CCCH_pdu.payload[0], 1);
sdu_lengths[num_sdus] = mac_rrc_nr_data_req(module_id, CC_id, frame, CCCH, ra->rnti, 1, // 1 transport block
mac_sdus);
LOG_D(MAC, LOG_D(MAC,
"[gNB %d][USER-PLANE DEFAULT DRB] Got %d bytes for DTCH %d \n", "[gNB %d][USER-PLANE DEFAULT DRB] Got %d bytes for DTCH %d \n",
......
...@@ -114,7 +114,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, ...@@ -114,7 +114,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP,
dl_tti_request = &gNB->DL_req[CC_id]; dl_tti_request = &gNB->DL_req[CC_id];
dl_req = &dl_tti_request->dl_tti_request_body; dl_req = &dl_tti_request->dl_tti_request_body;
mib_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, MIBCH, 1, &cc->MIB_pdu.payload[0]); mib_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, MIBCH, 0, 1, &cc->MIB_pdu.payload[0]);
LOG_D(MAC, "Frame %d, slot %d: BCH PDU length %d\n", frameP, slotP, mib_sdu_length); LOG_D(MAC, "Frame %d, slot %d: BCH PDU length %d\n", frameP, slotP, mib_sdu_length);
......
...@@ -191,6 +191,17 @@ void nr_process_mac_pdu( ...@@ -191,6 +191,17 @@ void nr_process_mac_pdu(
case UL_SCH_LCID_CCCH: case UL_SCH_LCID_CCCH:
// todo // todo
mac_subheader_len = 2; mac_subheader_len = 2;
nr_mac_rrc_data_ind(module_idP,
CC_id,
frameP, 0,
0,
rnti,
CCCH,
pdu_ptr+2,
pdu_len-2,
0,0
);
break; break;
// MAC SDUs // MAC SDUs
...@@ -407,6 +418,8 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, ...@@ -407,6 +418,8 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
// re-initialize ta update variables afrer RA procedure completion // re-initialize ta update variables afrer RA procedure completion
UE_info->UE_sched_ctrl[UE_id].ta_frame = frameP; UE_info->UE_sched_ctrl[UE_id].ta_frame = frameP;
nr_process_mac_pdu(gnb_mod_idP, current_rnti, CC_idP, frameP, sduP, sdu_lenP);
free(ra->preambles.preamble_list); free(ra->preambles.preamble_list);
//ra->state = RA_IDLE; //ra->state = RA_IDLE;
// LOG_I(MAC, // LOG_I(MAC,
......
...@@ -118,6 +118,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, ...@@ -118,6 +118,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
const int CC_id, const int CC_id,
const frame_t frameP, const frame_t frameP,
const rb_id_t Srb_id, const rb_id_t Srb_id,
const rnti_t rnti,
const uint8_t Nb_tb, const uint8_t Nb_tb,
uint8_t *const buffer_pP ){ uint8_t *const buffer_pP ){
...@@ -167,24 +168,27 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, ...@@ -167,24 +168,27 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
} }
/* CCCH */ /* CCCH */
struct rrc_gNB_ue_context_s *ue_context_p = NULL;
if( (Srb_id & RAB_OFFSET ) == CCCH) { if( (Srb_id & RAB_OFFSET ) == CCCH) {
//struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP],rnti); //struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP],rnti);
//if (ue_context_p == NULL) return(0); //if (ue_context_p == NULL) return(0);
//eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; //eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context;
LOG_D(RRC,"[gNB %d] Frame %d CCCH request (Srb_id %ld)\n", Mod_idP, frameP, Srb_id); ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[Mod_idP], rnti);
// LOG_I(NR_RRC,"3333 Returning new UE context at %p\n",RC.nrrrc[Mod_idP]);
// LOG_I(NR_RRC,"4444 Returning new UE context at %p\n",ue_context_p);
LOG_I(RRC,"[gNB %d] Frame %d CCCH request (Srb_id %ld), ue_context_p %p \n", Mod_idP, frameP, Srb_id, ue_context_p );
// srb_info=&ue_p->Srb0; // srb_info=&ue_p->Srb0;
payload_size = srb_info->Tx_buffer.payload_size; 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 = srb_info->Tx_buffer.Payload; payload_pP = ue_context_p->ue_context.Srb0.Tx_buffer.Payload;
LOG_D(RRC,"[gNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n", Mod_idP, srb_info, payload_size, buffer_pP, payload_pP); LOG_D(RRC,"[gNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n", Mod_idP, srb_info, 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; Sdu_size = payload_size;
srb_info->Tx_buffer.payload_size = 0; ue_context_p->ue_context.Srb0.Tx_buffer.payload_size = 0;
} }
return Sdu_size; return Sdu_size;
} }
...@@ -192,3 +196,60 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, ...@@ -192,3 +196,60 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
return(0); return(0);
} }
//------------------------------------------------------------------------------
int8_t
nr_mac_rrc_data_ind(
const module_id_t module_idP,
const int CC_id,
const frame_t frameP,
const sub_frame_t sub_frameP,
const int UE_id,
const rnti_t rntiP,
const rb_id_t srb_idP,
const uint8_t *sduP,
const sdu_size_t sdu_lenP,
const uint8_t mbsfn_sync_areaP,
const boolean_t brOption
)
//--------------------------------------------------------------------------
{
// if (NODE_IS_DU(RC.nrrrc[module_idP]->node_type)) {
// LOG_W(RRC,"[DU %d][RAPROC] Received SDU for CCCH on SRB %ld length %d for UE id %d RNTI %x \n",
// module_idP, srb_idP, sdu_lenP, UE_id, rntiP);
// /* do ITTI message */
// DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(
// module_idP,
// CC_id,
// UE_id,
// rntiP,
// sduP,
// sdu_lenP
// );
// return(0);
// }
//SRB_INFO *Srb_info;
protocol_ctxt_t ctxt;
sdu_size_t sdu_size = 0;
/* for no gcc warnings */
(void)sdu_size;
/*
int si_window;
*/
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, GNB_FLAG_YES, rntiP, frameP, sub_frameP,0);
if((srb_idP & RAB_OFFSET) == CCCH) {
LOG_D(RRC, "[eNB %d] Received SDU for CCCH on SRB %ld\n", module_idP, srb_idP);
ctxt.brOption = brOption;
/*Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0;
if (sdu_lenP > 0) {
memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP);
Srb_info->Rx_buffer.payload_size = sdu_lenP;
rrc_eNB_decode_ccch(&ctxt, Srb_info, CC_id);
}*/
if (sdu_lenP > 0) nr_rrc_gNB_decode_ccch(&ctxt, sduP, sdu_lenP, CC_id);
}
return(0);
}
...@@ -50,6 +50,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, ...@@ -50,6 +50,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
const int CC_id, const int CC_id,
const frame_t frameP, const frame_t frameP,
const rb_id_t Srb_id, const rb_id_t Srb_id,
const rnti_t rnti,
const uint8_t Nb_tb, const uint8_t Nb_tb,
uint8_t *const buffer_pP ); uint8_t *const buffer_pP );
...@@ -64,7 +65,7 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge( ...@@ -64,7 +65,7 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge(
); );
struct rrc_gNB_ue_context_s *rrc_gNB_allocate_new_UE_context(gNB_RRC_INST *rrc_instance_pP); struct rrc_gNB_ue_context_s *rrc_gNB_allocate_new_UE_context(gNB_RRC_INST *rrc_instance_pP);
struct rrc_gNB_ue_context_s *rrc_gNB_get_ue_context(gNB_RRC_INST *rrc_instance_pP,rnti_t rntiP);
void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc,LTE_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList, x2ap_ENDC_sgnb_addition_req_t *m, NR_CG_ConfigInfo_IEs_t * cg_config_info); void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc,LTE_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList, x2ap_ENDC_sgnb_addition_req_t *m, NR_CG_ConfigInfo_IEs_t * cg_config_info);
void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_p, x2ap_ENDC_sgnb_addition_req_t *m); void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_p, x2ap_ENDC_sgnb_addition_req_t *m);
...@@ -134,3 +135,21 @@ int ...@@ -134,3 +135,21 @@ int
nr_rrc_mac_remove_ue(module_id_t mod_idP, nr_rrc_mac_remove_ue(module_id_t mod_idP,
rnti_t rntiP); rnti_t rntiP);
int8_t nr_mac_rrc_data_ind(
const module_id_t module_idP,
const int CC_id,
const frame_t frameP,
const sub_frame_t sub_frameP,
const int UE_id,
const rnti_t rntiP,
const rb_id_t srb_idP,
const uint8_t *sduP,
const sdu_size_t sdu_lenP,
const uint8_t mbsfn_sync_areaP,
const boolean_t brOption
);
int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
const uint8_t *buffer,
int buffer_length,
const int CC_id);
\ No newline at end of file
...@@ -406,13 +406,14 @@ rrc_gNB_generate_RRCSetup( ...@@ -406,13 +406,14 @@ rrc_gNB_generate_RRCSetup(
// ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0; // ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0;
log_dump(NR_RRC, ue_p->Srb0.Tx_buffer.Payload, 16, LOG_DUMP_CHAR,"RRCSetup size: "); log_dump(NR_RRC, ue_p->Srb0.Tx_buffer.Payload, 16, LOG_DUMP_CHAR,"RRCSetup size: ");
nr_rrc_data_req(ctxt_pP, // nr_rrc_data_req(ctxt_pP,
DCCH, // DCCH,
rrc_gNB_mui++, // rrc_gNB_mui++,
SDU_CONFIRM_NO, // SDU_CONFIRM_NO,
ue_p->Srb0.Tx_buffer.payload_size, // ue_p->Srb0.Tx_buffer.payload_size,
ue_p->Srb0.Tx_buffer.Payload, // ue_p->Srb0.Tx_buffer.Payload,
PDCP_TRANSMISSION_MODE_CONTROL); // PDCP_TRANSMISSION_MODE_CONTROL);
#ifdef ITTI_SIM #ifdef ITTI_SIM
MessageDef *message_p; MessageDef *message_p;
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "rrc_defs.h" #include "rrc_defs.h"
#include "rrc_proto.h" #include "rrc_proto.h"
#include "assertions.h" #include "assertions.h"
#include "rrc_vars.h"
typedef uint32_t channel_t; typedef uint32_t channel_t;
...@@ -41,14 +42,44 @@ nr_mac_rrc_data_ind_ue( ...@@ -41,14 +42,44 @@ nr_mac_rrc_data_ind_ue(
const module_id_t module_id, const module_id_t module_id,
const int CC_id, const int CC_id,
const uint8_t gNB_index, const uint8_t gNB_index,
const frame_t frame,
const sub_frame_t sub_frame,
const rnti_t rnti,
const channel_t channel, const channel_t channel,
const uint8_t* pduP, const uint8_t* pduP,
const sdu_size_t pdu_len){ const sdu_size_t pdu_len){
sdu_size_t sdu_size = 0;
protocol_ctxt_t ctxt;
switch(channel){ switch(channel){
case NR_BCCH_BCH: case NR_BCCH_BCH:
AssertFatal( nr_rrc_ue_decode_NR_BCCH_BCH_Message( module_id, gNB_index, (uint8_t*)pduP, pdu_len) == 0, "UE decode BCCH-BCH error!\n"); AssertFatal( nr_rrc_ue_decode_NR_BCCH_BCH_Message( module_id, gNB_index, (uint8_t*)pduP, pdu_len) == 0, "UE decode BCCH-BCH error!\n");
break; break;
case CCCH:
if (pdu_len>0) {
LOG_T(RRC,"[UE %d] Received SDU for CCCH on SRB %ld from gNB %d\n",module_id,channel & RAB_OFFSET,gNB_index);
{
MessageDef *message_p;
int msg_sdu_size = CCCH_SDU_SIZE;
if (pdu_len > msg_sdu_size) {
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
sdu_size = msg_sdu_size;
} else {
sdu_size = pdu_len;
}
message_p = itti_alloc_new_message (TASK_MAC_UE, NR_RRC_MAC_CCCH_DATA_IND);
memset (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
memcpy (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, pduP, sdu_size);
NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = frame; //frameP
NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frame; //sub_frameP
NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size;
NR_RRC_MAC_CCCH_DATA_IND (message_p).gnb_index = gNB_index;
NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; //rntiP
itti_send_msg_to_task (TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE( module_id ), message_p);
}
}
default: default:
break; break;
} }
...@@ -58,13 +89,49 @@ nr_mac_rrc_data_ind_ue( ...@@ -58,13 +89,49 @@ nr_mac_rrc_data_ind_ue(
} }
int8_t mac_rrc_nr_data_req_ue(const module_id_t Mod_idP, int8_t mac_rrc_nr_data_req_ue(
const module_id_t Mod_idP,
const int CC_id, const int CC_id,
const frame_t frameP, const frame_t frameP,
const rb_id_t Srb_id, const rb_id_t Srb_id,
uint8_t *const buffer_pP ){ const uint8_t Nb_tb,
uint8_t *const buffer_pP,
const uint8_t gNB_index,
const uint8_t mbsfn_sync_area
){
// todo // todo
if( (NR_UE_rrc_inst[Mod_idP].Srb0[gNB_index].Tx_buffer.payload_size > 0) ) {
// MessageDef *message_p;
// int ccch_size = NR_UE_rrc_inst[Mod_idP].Srb0[gNB_index].Tx_buffer.payload_size;
// int sdu_size = sizeof(RRC_MAC_CCCH_DATA_REQ (message_p).sdu);
// if (ccch_size > sdu_size) {
// LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", ccch_size, sdu_size);
// ccch_size = sdu_size;
// }
// message_p = itti_alloc_new_message (TASK_RRC_UE, RRC_MAC_CCCH_DATA_REQ);
// RRC_MAC_CCCH_DATA_REQ (message_p).frame = frameP;
// RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size;
// memset (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, 0, CCCH_SDU_SIZE);
// memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, NR_UE_rrc_inst[Mod_idP].Srb0[gNB_index].Tx_buffer.Payload, ccch_size);
// RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = gNB_index;
// itti_send_msg_to_task (TASK_MAC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
// }
memset (buffer_pP, 0,sizeof(buffer_pP));
memcpy(&buffer_pP[0],&NR_UE_rrc_inst[Mod_idP].Srb0[gNB_index].Tx_buffer.Payload[0],NR_UE_rrc_inst[Mod_idP].Srb0[gNB_index].Tx_buffer.payload_size);
uint8_t Ret_size=NR_UE_rrc_inst[Mod_idP].Srb0[gNB_index].Tx_buffer.payload_size;
// NR_UE_rrc_inst[Mod_id].Srb0[eNB_index].Tx_buffer.payload_size=0;
NR_UE_rrc_inst[Mod_idP].Info[gNB_index].T300_active = 1;
NR_UE_rrc_inst[Mod_idP].Info[gNB_index].T300_cnt = 0;
// msg("[RRC][UE %d] Sending rach\n",Mod_id);
return(Ret_size);
} else {
return 0;
}
return 0; return 0;
} }
...@@ -107,3 +174,4 @@ rrc_data_req_ue( ...@@ -107,3 +174,4 @@ rrc_data_req_ue(
return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
} }
...@@ -100,7 +100,14 @@ int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(const module_id_t module_id, const ui ...@@ -100,7 +100,14 @@ int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(const module_id_t module_id, const ui
\param channel indicator for channel of the pdu \param channel indicator for channel of the pdu
\param pduP pointer to pdu \param pduP pointer to pdu
\param pdu_len data length of pdu*/ \param pdu_len data length of pdu*/
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, const channel_t channel, const uint8_t* pduP, const sdu_size_t pdu_len); int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const int CC_id, const uint8_t gNB_index,
const frame_t frame,
const sub_frame_t sub_frame,
const rnti_t rnti,
const channel_t channel,
const uint8_t* pduP,
const sdu_size_t pdu_len);
/**\brief /**\brief
\param module_id module id \param module_id module id
...@@ -108,11 +115,15 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, cons ...@@ -108,11 +115,15 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, cons
\param frame_t frameP \param frame_t frameP
\param rb_id_t SRB id \param rb_id_t SRB id
\param buffer_pP pointer to buffer*/ \param buffer_pP pointer to buffer*/
int8_t mac_rrc_nr_data_req_ue(const module_id_t Mod_idP, int8_t mac_rrc_nr_data_req_ue(
const module_id_t Mod_idP,
const int CC_id, const int CC_id,
const frame_t frameP, const frame_t frameP,
const rb_id_t Srb_id, const rb_id_t Srb_id,
uint8_t *const buffer_pP); const uint8_t Nb_tb,
uint8_t *const buffer_pP,
const uint8_t gNB_index,
const uint8_t mbsfn_sync_area);
/**\brief RRC UE task. /**\brief RRC UE task.
......
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