Commit 0befeb2c authored by masayuki.harada's avatar masayuki.harada

Fix rach procedure for SA.

parent abd05012
......@@ -105,7 +105,7 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
{
first_time = 0;
ue->time_sync_cell = 1;
if (get_softmodem_params()->do_ra) {
if (get_softmodem_params()->do_ra || get_softmodem_params()->sa) {
LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id);
//mac_resynch();
//dl_phy_sync_success(ue->Mod_id,frame,0,1);//ue->common_vars.eNb_id);
......
......@@ -56,7 +56,7 @@ int16_t get_nr_PL(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_index){
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
int16_t pathloss;
if (get_softmodem_params()->do_ra){
if (get_softmodem_params()->do_ra || get_softmodem_params()->sa){
long referenceSignalPower = ue->nrUE_config.ssb_config.ss_pbch_power;
double rsrp_dBm = 10*log10(ue->measurements.rsrp[gNB_index]) + 30 - ue->rx_total_gain_dB;
......
......@@ -384,7 +384,7 @@ void nr_ue_pbch_procedures(uint8_t gNB_id,
// Switch to PRACH state if it is first PBCH after initial synch and no timing correction is performed
if (ue->UE_mode[gNB_id] == NOT_SYNCHED && ue->no_timing_correction == 1){
if (get_softmodem_params()->do_ra) {
if (get_softmodem_params()->do_ra || get_softmodem_params()->sa) {
ue->UE_mode[gNB_id] = PRACH;
ue->prach_resources[gNB_id]->sync_frame = frame_rx;
ue->prach_resources[gNB_id]->init_msg1 = 0;
......
......@@ -539,7 +539,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
// initialisation by RRC
// TODO: To be removed after RA procedures fully implemented
if(get_softmodem_params()->do_ra) {
if(get_softmodem_params()->do_ra || get_softmodem_params()->sa) {
nr_rrc_ue_generate_RRCSetupRequest(mod_id,gNB_id);
}
......
......@@ -1818,6 +1818,13 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
case DL_SCH_LCID_CCCH:
// MSG4 RRC Setup 38.331
// variable length
if((ra->ra_state == WAIT_CONTENTION_RESOLUTION)&&(get_softmodem_params()->sa==1)) {
LOG_I(MAC, "[UE %d][RAPROC] Frame %d : received Msg3\n",module_idP, frameP);
if (ra->RA_active == 1){
nr_ra_succeeded(module_idP, frameP, slot);
}
}
if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pduP)->L1 & 0x7f) << 8)
| ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pduP)->L2 & 0xff);
......
......@@ -1127,7 +1127,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
// Bytes to be transmitted
uint8_t *buf = (uint8_t *) harq->tb;
uint16_t mac_pdu_length = nr_write_ce_dlsch_pdu(module_idP, nr_mac->sched_ctrlCommon, buf, 255, ra->cont_res_id);
uint16_t mac_pdu_length = 0;//nr_write_ce_dlsch_pdu(module_idP, nr_mac->sched_ctrlCommon, buf, 255, ra->cont_res_id);
LOG_D(NR_MAC,"Encoded contention resolution mac_pdu_length %d\n",mac_pdu_length);
uint16_t mac_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, CCCH, ra->rnti, 1, &buf[mac_pdu_length+2]);
((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->R = 0;
......
......@@ -90,7 +90,7 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
ret = nr_ue_scheduler(NULL, ul_info);
if (is_nr_UL_slot(mac->scc, ul_info->slot_tx, mac->frame_type) && get_softmodem_params()->do_ra)
if (is_nr_UL_slot(mac->scc, ul_info->slot_tx, mac->frame_type) && (get_softmodem_params()->do_ra || get_softmodem_params()->sa) )
nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id);
switch(ret){
......
......@@ -1707,11 +1707,12 @@ nr_rrc_ue_process_securityModeCommand(
//-----------------------------------------------------------------------------
void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index) {
uint8_t i=0,rv[6];
protocol_ctxt_t ctxt;
if(IS_SOFTMODEM_NOS1) {
AMF_MODE_ENABLED = 1;
}
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_id, GNB_FLAG_NO, NOT_A_RNTI, 0, 0,gNB_index);
if(NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size ==0) {
// Get RRCConnectionRequest, fill random for now
// Generate random byte stream for contention resolution
......@@ -1745,7 +1746,7 @@ void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB
log_dump(RRC,NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload,NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size,
LOG_DUMP_CHAR,"RRCSetupRequest :\n");
rrc_data_req_ue (
NULL,//ctxt_pP
&ctxt,
DCCH,
nr_rrc_mui++,
SDU_CONFIRM_NO,
......
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