Commit ff819c4a authored by David Kim's avatar David Kim

Code cleanup and RRC message exchange via ITTI message.

parent c606cb32
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#define NR_MAX_OFDM_SYMBOL_SIZE 4096 #define NR_MAX_OFDM_SYMBOL_SIZE 4096
#define NR_SYMBOLS_PER_SLOT 14 #define NR_SYMBOLS_PER_SLOT 14
#define NR_FRAMES_PER_SSSB_PERIOD 16
#define ONE_OVER_SQRT2_Q15 23170 #define ONE_OVER_SQRT2_Q15 23170
#define ONE_OVER_TWO_Q15 16384 #define ONE_OVER_TWO_Q15 16384
......
...@@ -50,6 +50,8 @@ MESSAGE_DEF(RRC_MAC_PCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcMacPcchDat ...@@ -50,6 +50,8 @@ MESSAGE_DEF(RRC_MAC_PCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcMacPcchDat
MESSAGE_DEF(NR_RRC_MAC_RA_IND, MESSAGE_PRIORITY_MED_PLUS, NRRrcMacRaInd, nr_rrc_mac_ra_ind) MESSAGE_DEF(NR_RRC_MAC_RA_IND, MESSAGE_PRIORITY_MED_PLUS, NRRrcMacRaInd, nr_rrc_mac_ra_ind)
MESSAGE_DEF(NR_RRC_MAC_SBCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, NRRrcMacSbchDataInd, nr_rrc_mac_sbcch_data_ind)
/* RRC configures DRX context (MAC timers) of a UE */ /* RRC configures DRX context (MAC timers) of a UE */
MESSAGE_DEF(RRC_MAC_DRX_CONFIG_REQ, MESSAGE_PRIORITY_MED, rrc_mac_drx_config_req_t, rrc_mac_drx_config_req) MESSAGE_DEF(RRC_MAC_DRX_CONFIG_REQ, MESSAGE_PRIORITY_MED, rrc_mac_drx_config_req_t, rrc_mac_drx_config_req)
......
...@@ -58,12 +58,15 @@ ...@@ -58,12 +58,15 @@
#define RRC_MAC_DRX_CONFIG_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_drx_config_req #define RRC_MAC_DRX_CONFIG_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_drx_config_req
#define NR_RRC_MAC_SBCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.nr_rrc_mac_sbcch_data_ind
// Some constants from "LAYER2/MAC/defs.h" // Some constants from "LAYER2/MAC/defs.h"
#define BCCH_SDU_SIZE (512) #define BCCH_SDU_SIZE (512)
#define BCCH_SDU_MBMS_SIZE (512) #define BCCH_SDU_MBMS_SIZE (512)
#define CCCH_SDU_SIZE (1024) #define CCCH_SDU_SIZE (1024)
#define MCCH_SDU_SIZE (512) #define MCCH_SDU_SIZE (512)
#define PCCH_SDU_SIZE (512) #define PCCH_SDU_SIZE (512)
#define SBCH_SDU_SIZE (512)
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
// Messages between RRC and MAC layers // Messages between RRC and MAC layers
...@@ -188,6 +191,24 @@ typedef struct RrcMacPcchDataReq_s { ...@@ -188,6 +191,24 @@ typedef struct RrcMacPcchDataReq_s {
uint8_t enb_index; uint8_t enb_index;
} RrcMacPcchDataReq; } RrcMacPcchDataReq;
typedef struct NRRrcMacSbcchDataReq_s {
uint32_t frame;
uint8_t slot;
uint32_t sdu_size;
uint8_t sdu[SBCH_SDU_SIZE];
uint8_t syncref_index;
} NRRrcMacSbchDataReq;
typedef struct NRRrcMacSbcchDataInd_s {
uint32_t frame;
uint8_t slot;
uint32_t sdu_size;
uint8_t sdu[SBCH_SDU_SIZE];
uint8_t syncref_index;
uint8_t rsrq;
uint8_t rsrp;
} NRRrcMacSbchDataInd;
/* RRC configures DRX context (MAC timers) of a UE */ /* RRC configures DRX context (MAC timers) of a UE */
typedef struct rrc_mac_drx_config_req_s { typedef struct rrc_mac_drx_config_req_s {
/* UE RNTI to configure */ /* UE RNTI to configure */
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
// Definitions for MAC control and data // Definitions for MAC control and data
#define NR_BCCH_DL_SCH 3 // SI #define NR_BCCH_DL_SCH 3 // SI
#define NR_BCCH_BCH 5 // MIB #define NR_BCCH_BCH 5 // MIB
#define NR_SBCCH_SLBCH 6 // MIB-SL
#define CCCH_PAYLOAD_SIZE_MAX 512 #define CCCH_PAYLOAD_SIZE_MAX 512
#define RAR_PAYLOAD_SIZE_MAX 128 #define RAR_PAYLOAD_SIZE_MAX 128
#define MAX_CSI_REPORTCONFIG 48 #define MAX_CSI_REPORTCONFIG 48
......
...@@ -819,14 +819,9 @@ void nr_rrc_mac_config_req_scg(module_id_t module_id, ...@@ -819,14 +819,9 @@ void nr_rrc_mac_config_req_scg(module_id_t module_id,
build_ssb_to_ro_map(mac); build_ssb_to_ro_map(mac);
} }
int nr_rrc_mac_config_req_ue_sl(module_id_t module_id, int nr_rrc_mac_config_req_mib_sl(module_id_t module_id,
int cc_idP, int cc_idP,
const uint32_t *const sourceL2Id, NR_SL_PreconfigurationNR_r16_t *SL_Preconfiguration_r16)
const uint32_t *const destinationL2Id,
const uint32_t *const groupL2Id,
NR_SL_PreconfigurationNR_r16_t *SL_Preconfiguration_r16,
uint32_t directFrameNumber_r16,
long slotIndex_r16)
{ {
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
...@@ -856,6 +851,5 @@ int nr_rrc_mac_config_req_ue_sl(module_id_t module_id, ...@@ -856,6 +851,5 @@ int nr_rrc_mac_config_req_ue_sl(module_id_t module_id,
mac->SL_Preconfiguration->sidelinkPreconfigNR_r16.sl_PreconfigFreqInfoList_r16->list.array[0]->sl_SyncConfigList_r16; mac->SL_Preconfiguration->sidelinkPreconfigNR_r16.sl_PreconfigFreqInfoList_r16->list.array[0]->sl_SyncConfigList_r16;
// TO-DO:: Add discovery mode // TO-DO:: Add discovery mode
} }
mac->directFrameNumber_r16 = directFrameNumber_r16;
return 0; return 0;
} }
...@@ -65,7 +65,6 @@ ...@@ -65,7 +65,6 @@
#include "NR_ServingCellConfigCommonSIB.h" #include "NR_ServingCellConfigCommonSIB.h"
/* PHY */ /* PHY */
#include "openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
// ========== // ==========
// NR UE defs // NR UE defs
...@@ -501,8 +500,6 @@ typedef struct { ...@@ -501,8 +500,6 @@ typedef struct {
uint32_t sourceL2Id; uint32_t sourceL2Id;
uint32_t groupL2Id; uint32_t groupL2Id;
uint32_t destinationL2Id; uint32_t destinationL2Id;
uint32_t directFrameNumber_r16;
int slotIndex_r16;
NR_SLSS_t slss; NR_SLSS_t slss;
} NR_UE_MAC_INST_t; } NR_UE_MAC_INST_t;
......
...@@ -112,14 +112,9 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id, ...@@ -112,14 +112,9 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id,
int cc_idP, int cc_idP,
NR_ServingCellConfigCommonSIB_t *scc); NR_ServingCellConfigCommonSIB_t *scc);
int nr_rrc_mac_config_req_ue_sl(module_id_t module_id, int nr_rrc_mac_config_req_mib_sl(module_id_t module_id,
int cc_idP, int cc_idP,
const uint32_t *const sourceL2Id, NR_SL_PreconfigurationNR_r16_t *SL_Preconfiguration_r16);
const uint32_t *const destinationL2Id,
const uint32_t *const groupL2Id,
NR_SL_PreconfigurationNR_r16_t *SL_Preconfiguration_r16,
uint32_t directFrameNumber_r16,
long slotIndex_r16);
NR_SLSS_t *nr_ue_get_slss(module_id_t Mod_id, int CC_id, frame_t frame_tx, int slot_tx); NR_SLSS_t *nr_ue_get_slss(module_id_t Mod_id, int CC_id, frame_t frame_tx, int slot_tx);
......
...@@ -242,22 +242,20 @@ int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti) ...@@ -242,22 +242,20 @@ int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti)
return rnti_type; return rnti_type;
} }
void nr_ue_decode_si(module_id_t module_idP, void nr_ue_decode_mib_sl(module_id_t module_idP,
int CC_id, int CC_id,
frame_t frameP, frame_t frameP,
uint8_t gNB_index, uint8_t SyncRef_index,
void *pdu, void *pdu,
uint16_t len, uint16_t len,
NR_SLSS_t *slss, NR_SLSS_t *slss,
int *frame, int *frame,
int *slot) int *slot)
{ {
NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP);
if (slss == NULL) { // this is not MIB-SL if (slss == NULL) { // this is not MIB-SL
LOG_D(NR_MAC, "[UE %d] Frame %d Sending SI to RRC (LCID Id %d, len %d)\n", module_idP, frameP, NR_BCCH_BCH, len); LOG_D(NR_MAC, "[UE %d] Frame %d Sending SI to RRC (LCID Id %d, len %d)\n", module_idP, frameP, NR_BCCH_BCH, len);
nr_mac_rrc_data_ind_ue(module_idP, CC_id, gNB_index, frameP, 0, SI_RNTI, NR_BCCH_BCH, (uint8_t *)pdu, len); nr_mac_rrc_data_ind_ue(module_idP, CC_id, SyncRef_index, frameP, 0, SI_RNTI, NR_BCCH_BCH, (uint8_t *)pdu, len);
} else { } else {
LOG_D(NR_MAC, LOG_D(NR_MAC,
"[UE %d] Frame %d Sending MIBSL to RRC (LCID Id %d, len %zu) : %x.%x.%x.%x.%x\n", "[UE %d] Frame %d Sending MIBSL to RRC (LCID Id %d, len %zu) : %x.%x.%x.%x.%x\n",
...@@ -273,15 +271,13 @@ void nr_ue_decode_si(module_id_t module_idP, ...@@ -273,15 +271,13 @@ void nr_ue_decode_si(module_id_t module_idP,
nr_mac_rrc_data_ind_ue(module_idP, nr_mac_rrc_data_ind_ue(module_idP,
CC_id, CC_id,
gNB_index, SyncRef_index,
frameP, frameP,
0, 0,
SI_RNTI, SI_RNTI,
MIBSLCH, MIBSLCH,
(uint8_t *)slss->sl_mib, (uint8_t *)slss->sl_mib,
sizeof(slss->sl_mib)); sizeof(slss->sl_mib));
LOG_D(NR_MAC, "SL: Resetting SFN.SLOT to %d.%d\n", mac->directFrameNumber_r16, mac->slotIndex_r16);
} }
} }
...@@ -4245,11 +4241,12 @@ NR_SLSS_t *nr_ue_get_slss(module_id_t Mod_id, int CC_id, frame_t frame_tx, int s ...@@ -4245,11 +4241,12 @@ NR_SLSS_t *nr_ue_get_slss(module_id_t Mod_id, int CC_id, frame_t frame_tx, int s
{ {
NR_UE_MAC_INST_t *mac = get_mac_inst(Mod_id); NR_UE_MAC_INST_t *mac = get_mac_inst(Mod_id);
NR_SLSS_t *slss = &(mac->slss); NR_SLSS_t *slss = &(mac->slss);
int slots = ((20 * frame_tx) + slot_tx); uint8_t scs_ssb = get_softmodem_params()->numerology;
if ((slots % 40) != slss->sl_timeoffsetssb_r16) { int abs_slots = ((nr_slots_per_frame[scs_ssb] * frame_tx) + slot_tx);
if ((abs_slots % (NR_FRAMES_PER_SSSB_PERIOD * nr_slots_per_frame[scs_ssb])) != slss->sl_timeoffsetssb_r16) {
slss->sl_mib_length = 0; slss->sl_mib_length = 0;
} else } else
slss->sl_mib_length = nr_mac_rrc_data_req_ue(Mod_id, CC_id, 0, slots, MIBCH, slss->sl_mib); // call RRC get check for SL-MIB slss->sl_mib_length = nr_mac_rrc_data_req_ue(Mod_id, CC_id, 0, abs_slots, NR_SBCCH_SLBCH, slss->sl_mib); // call RRC get check for SL-MIB
if (slss->sl_mib_length > 0) { if (slss->sl_mib_length > 0) {
LOG_D(NR_MAC, LOG_D(NR_MAC,
......
...@@ -198,11 +198,9 @@ int xer_nr_sprint (char *string, size_t string_size, asn_TYPE_descriptor_t *td, ...@@ -198,11 +198,9 @@ int xer_nr_sprint (char *string, size_t string_size, asn_TYPE_descriptor_t *td,
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// TTN for D2D // TTN for D2D
// NR : 3GPP 38.331 (Section 5.8.5.3) // NR : 3GPP 38.331 (Section 5.8.5.3)
uint8_t do_MIB_SL_NR(int abs_slot, NR_UE_RRC_INST_t *UE) uint8_t do_MIB_SL_NR(uint16_t frame, uint8_t slot, NR_UE_RRC_INST_t *UE)
{ {
asn_enc_rval_t enc_rval; asn_enc_rval_t enc_rval;
uint16_t frame = abs_slot / 20;
uint8_t slot = abs_slot % 20;
NR_SBCCH_SL_BCH_MessageType_t *sl_mib = &UE->SL_mib_tx; NR_SBCCH_SL_BCH_MessageType_t *sl_mib = &UE->SL_mib_tx;
sl_mib->present = NR_SBCCH_SL_BCH_MessageType_PR_c1; sl_mib->present = NR_SBCCH_SL_BCH_MessageType_PR_c1;
...@@ -210,25 +208,23 @@ uint8_t do_MIB_SL_NR(int abs_slot, NR_UE_RRC_INST_t *UE) ...@@ -210,25 +208,23 @@ uint8_t do_MIB_SL_NR(int abs_slot, NR_UE_RRC_INST_t *UE)
sl_mib->choice.c1->present = NR_SBCCH_SL_BCH_MessageType__c1_PR_masterInformationBlockSidelink; sl_mib->choice.c1->present = NR_SBCCH_SL_BCH_MessageType__c1_PR_masterInformationBlockSidelink;
sl_mib->choice.c1->choice.masterInformationBlockSidelink = CALLOC(1, sizeof(NR_MasterInformationBlockSidelink_t)); sl_mib->choice.c1->choice.masterInformationBlockSidelink = CALLOC(1, sizeof(NR_MasterInformationBlockSidelink_t));
NR_MasterInformationBlockSidelink_t *nr_sl_mib = sl_mib->choice.c1->choice.masterInformationBlockSidelink; NR_MasterInformationBlockSidelink_t *nr_sl_mib = sl_mib->choice.c1->choice.masterInformationBlockSidelink;
if (get_softmodem_params()->sl_mode != 2) {
nr_sl_mib->inCoverage_r16 = 1; if (get_softmodem_params()->sl_mode == 2) {
AssertFatal(1 == 0, "Needs development for in %s %d.\n", __FUNCTION__, __LINE__);
} else {
nr_sl_mib->inCoverage_r16 = 0; nr_sl_mib->inCoverage_r16 = 0;
nr_sl_mib->sl_TDD_Config_r16.size = 2; nr_sl_mib->sl_TDD_Config_r16.size = 12;
nr_sl_mib->sl_TDD_Config_r16.buf = CALLOC(1, nr_sl_mib->sl_TDD_Config_r16.size); nr_sl_mib->sl_TDD_Config_r16.buf = CALLOC(1, nr_sl_mib->sl_TDD_Config_r16.size);
nr_sl_mib->sl_TDD_Config_r16.bits_unused = 4; nr_sl_mib->sl_TDD_Config_r16.bits_unused = 4;
nr_sl_mib->reservedBits_r16.size = 1; nr_sl_mib->reservedBits_r16.size = 2;
nr_sl_mib->reservedBits_r16.buf = CALLOC(1, nr_sl_mib->reservedBits_r16.size); nr_sl_mib->reservedBits_r16.buf = CALLOC(1, nr_sl_mib->reservedBits_r16.size);
nr_sl_mib->reservedBits_r16.bits_unused = 6; nr_sl_mib->reservedBits_r16.bits_unused = 6;
} }
nr_sl_mib->directFrameNumber_r16.size = 2; nr_sl_mib->directFrameNumber_r16.size = 10;
nr_sl_mib->directFrameNumber_r16.buf = CALLOC(1, nr_sl_mib->directFrameNumber_r16.size); nr_sl_mib->directFrameNumber_r16.buf = CALLOC(1, nr_sl_mib->directFrameNumber_r16.size);
nr_sl_mib->directFrameNumber_r16.buf[0] = frame & 255; nr_sl_mib->directFrameNumber_r16.buf[0] = frame & 255;
nr_sl_mib->directFrameNumber_r16.buf[1] = (frame >> 8) & 3; nr_sl_mib->directFrameNumber_r16.buf[1] = (frame >> 8) & 3;
nr_sl_mib->directFrameNumber_r16.bits_unused = 6; nr_sl_mib->directFrameNumber_r16.bits_unused = 6;
nr_sl_mib->slotIndex_r16.size = 1; nr_sl_mib->slotIndex_r16.size = 7;
nr_sl_mib->slotIndex_r16.buf = CALLOC(1, nr_sl_mib->slotIndex_r16.size); nr_sl_mib->slotIndex_r16.buf = CALLOC(1, nr_sl_mib->slotIndex_r16.size);
nr_sl_mib->slotIndex_r16.buf[0] = slot; nr_sl_mib->slotIndex_r16.buf[0] = slot;
nr_sl_mib->slotIndex_r16.bits_unused = 1; nr_sl_mib->slotIndex_r16.bits_unused = 1;
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
*/ */
int xer_sprint_NR(char *string, size_t string_size, struct asn_TYPE_descriptor_s *td, void *sptr); int xer_sprint_NR(char *string, size_t string_size, struct asn_TYPE_descriptor_s *td, void *sptr);
uint8_t do_MIB_SL_NR(int abs_SF, NR_UE_RRC_INST_t *UE); uint8_t do_MIB_SL_NR(uint16_t frame, uint8_t slot, NR_UE_RRC_INST_t *UE);
uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier, uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier,
gNB_RrcConfigurationReq *configuration); gNB_RrcConfigurationReq *configuration);
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "NR_MAC_UE/mac_defs.h" #include "NR_MAC_UE/mac_defs.h"
#include "../NR/MESSAGES/asn1_msg.h" #include "../NR/MESSAGES/asn1_msg.h"
#include "LAYER2/NR_MAC_COMMON/nr_mac.h" #include "LAYER2/NR_MAC_COMMON/nr_mac.h"
#include "executables/softmodem-common.h"
typedef uint32_t channel_t; typedef uint32_t channel_t;
...@@ -120,12 +121,29 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, ...@@ -120,12 +121,29 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
} }
break; break;
case MIBSLCH: case NR_SBCCH_SLBCH:
LOG_D(NR_RRC, "[UE %d] Received SDU for MIBSL\n", module_id); if (pdu_len>0) {
if (decode_MIB_SL_NR(module_id, (uint8_t *const)pduP, 5, frame) >= 0) LOG_T(NR_RRC, "[UE %d] Received SDU for MIBSL\n", module_id);
LOG_D(NR_RRC, "Received MIB_SL: %x.%x.%x.%x.%x\n", pduP[0], pduP[1], pduP[2], pduP[3], pduP[4]);
else MessageDef *message_p;
LOG_E(NR_RRC, "Received bogus MIB_SL\n"); int msg_sdu_size = SBCH_SDU_SIZE;
if (pdu_len > msg_sdu_size) {
LOG_E(NR_RRC, "SDU larger than SBCH 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, 0, NR_RRC_MAC_SBCCH_DATA_IND);
memset(NR_RRC_MAC_SBCCH_DATA_IND (message_p).sdu, 0, SBCH_SDU_SIZE);
memcpy(NR_RRC_MAC_SBCCH_DATA_IND (message_p).sdu, pduP, sdu_size);
NR_RRC_MAC_SBCCH_DATA_IND (message_p).frame = frame;
NR_RRC_MAC_SBCCH_DATA_IND (message_p).slot = slot;
NR_RRC_MAC_SBCCH_DATA_IND (message_p).sdu_size = sdu_size;
NR_RRC_MAC_SBCCH_DATA_IND (message_p).syncref_index = gNB_index;
itti_send_msg_to_task(TASK_RRC_NRUE, UE_MODULE_ID_TO_INSTANCE(module_id), message_p);
}
break; break;
default: default:
...@@ -155,19 +173,24 @@ int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP, ...@@ -155,19 +173,24 @@ int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP,
return NR_UE_rrc_inst[Mod_idP].Srb0[gNB_id].Tx_buffer.payload_size; return NR_UE_rrc_inst[Mod_idP].Srb0[gNB_id].Tx_buffer.payload_size;
case MIBCH: case NR_SBCCH_SLBCH:
ret_size = do_MIB_SL_NR(frameP, &NR_UE_rrc_inst[Mod_idP]); {
uint8_t scs_ssb = get_softmodem_params()->numerology;
uint16_t frame = frameP / nr_slots_per_frame[scs_ssb];
uint8_t slot = frameP % nr_slots_per_frame[scs_ssb];
ret_size = do_MIB_SL_NR(frame, slot, &NR_UE_rrc_inst[Mod_idP]);
memcpy((void *)buffer_pP, (void *)NR_UE_rrc_inst[Mod_idP].SL_MIB, ret_size); memcpy((void *)buffer_pP, (void *)NR_UE_rrc_inst[Mod_idP].SL_MIB, ret_size);
LOG_D(NR_RRC, LOG_D(NR_RRC,
"MIB-SL for %d.%d: %x.%x.%x.%x.%x\n", "MIB-SL for %d.%d: %x.%x.%x.%x.%x\n",
frameP / 10, frame,
frameP % 10, slot,
buffer_pP[0], buffer_pP[0],
buffer_pP[1], buffer_pP[1],
buffer_pP[2], buffer_pP[2],
buffer_pP[3], buffer_pP[3],
buffer_pP[4]); buffer_pP[4]);
return (ret_size); return (ret_size);
}
case DCCH: case DCCH:
AssertFatal(1==0, "SRB1 not implemented yet!\n"); AssertFatal(1==0, "SRB1 not implemented yet!\n");
......
...@@ -74,7 +74,6 @@ ...@@ -74,7 +74,6 @@
#include "SIMULATION/TOOLS/sim.h" // for taus #include "SIMULATION/TOOLS/sim.h" // for taus
#include "nr_nas_msg_sim.h" #include "nr_nas_msg_sim.h"
#include <openair2/RRC/NR/nr_rrc_proto.h>
#include "NR_SL-SyncConfig-r16.h" #include "NR_SL-SyncConfig-r16.h"
#include "NR_SL-ResourcePool-r16.h" #include "NR_SL-ResourcePool-r16.h"
#include "NR_SL-BWP-Config-r16.h" #include "NR_SL-BWP-Config-r16.h"
...@@ -446,6 +445,10 @@ void init_SL_preconfig_NR(NR_UE_RRC_INST_t *UE, const uint8_t SyncRef_index) ...@@ -446,6 +445,10 @@ void init_SL_preconfig_NR(NR_UE_RRC_INST_t *UE, const uint8_t SyncRef_index)
asn1cCalloc(PreconfigGeneral->sl_TDD_Configuration_r16, TDD_Config); asn1cCalloc(PreconfigGeneral->sl_TDD_Configuration_r16, TDD_Config);
TDD_Config->referenceSubcarrierSpacing = NR_SubcarrierSpacing_kHz30; TDD_Config->referenceSubcarrierSpacing = NR_SubcarrierSpacing_kHz30;
TDD_Config->pattern1.dl_UL_TransmissionPeriodicity = NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5; TDD_Config->pattern1.dl_UL_TransmissionPeriodicity = NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5;
TDD_Config->pattern1.nrofDownlinkSlots = 7;
TDD_Config->pattern1.nrofDownlinkSymbols = 6;
TDD_Config->pattern1.nrofUplinkSlots = 2;
TDD_Config->pattern1.nrofUplinkSymbols = 4;
NR_SL_BWP_ConfigCommon_r16_t *sl_bwp_conf_cmn = malloc16_clear(sizeof(NR_SL_BWP_ConfigCommon_r16_t)); NR_SL_BWP_ConfigCommon_r16_t *sl_bwp_conf_cmn = malloc16_clear(sizeof(NR_SL_BWP_ConfigCommon_r16_t));
...@@ -2407,6 +2410,15 @@ void *rrc_nrue_task(void *args_p) ...@@ -2407,6 +2410,15 @@ void *rrc_nrue_task(void *args_p)
NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrp); NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrp);
break; break;
case NR_RRC_MAC_SBCCH_DATA_IND:
LOG_D(NR_RRC, "[UE %d] Received %s: frameP %d, SyncRef UE %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p),
NR_RRC_MAC_SBCCH_DATA_IND (msg_p).frame, NR_RRC_MAC_SBCCH_DATA_IND (msg_p).syncref_index);
nr_rrc_ue_decode_MIB_SL(ue_mod_id,
NR_RRC_MAC_SBCCH_DATA_IND (msg_p).sdu,
NR_RRC_MAC_SBCCH_DATA_IND (msg_p).sdu_size,
NR_RRC_MAC_SBCCH_DATA_IND (msg_p).frame);
break;
case NR_RRC_MAC_CCCH_DATA_IND: case NR_RRC_MAC_CCCH_DATA_IND:
LOG_D(NR_RRC, "[UE %d] RNTI %x Received %s: frameP %d, gNB %d\n", LOG_D(NR_RRC, "[UE %d] RNTI %x Received %s: frameP %d, gNB %d\n",
ue_mod_id, ue_mod_id,
...@@ -2869,7 +2881,7 @@ void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len) ...@@ -2869,7 +2881,7 @@ void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len)
} }
} }
int decode_MIB_SL_NR(const module_id_t mod_id, uint8_t *const sdu, const uint8_t sdu_len, const frame_t frame) int nr_rrc_ue_decode_MIB_SL(const module_id_t mod_id, uint8_t *const sdu, const uint8_t sdu_len, const frame_t frame)
{ {
memcpy((void *)&NR_UE_rrc_inst[mod_id].SL_MIB, (void *)sdu, sdu_len); memcpy((void *)&NR_UE_rrc_inst[mod_id].SL_MIB, (void *)sdu, sdu_len);
...@@ -2885,16 +2897,14 @@ int decode_MIB_SL_NR(const module_id_t mod_id, uint8_t *const sdu, const uint8_t ...@@ -2885,16 +2897,14 @@ int decode_MIB_SL_NR(const module_id_t mod_id, uint8_t *const sdu, const uint8_t
} }
NR_SBCCH_SL_BCH_MessageType_t *mib_sl = NR_UE_rrc_inst[mod_id].mib_sl[0]; NR_SBCCH_SL_BCH_MessageType_t *mib_sl = NR_UE_rrc_inst[mod_id].mib_sl[0];
struct NR_MasterInformationBlockSidelink *mib_sl_buf = mib_sl->choice.c1->choice.masterInformationBlockSidelink; struct NR_MasterInformationBlockSidelink *mib_sl_buf = mib_sl->choice.c1->choice.masterInformationBlockSidelink;
struct NR_MasterInformationBlockSidelink *mib_sl_rrc_buf =
NR_UE_rrc_inst[mod_id].mib_sl[0]->choice.c1->choice.masterInformationBlockSidelink;
LOG_D(NR_RRC, LOG_D(NR_RRC,
"Decoded MIBSL SFN.SLOT %d.%d, InCoverage %d\n", "Decoded MIBSL SFN.SLOT %d.%d, InCoverage %d\n",
*mib_sl_buf->directFrameNumber_r16.buf, *mib_sl_buf->directFrameNumber_r16.buf,
*mib_sl_buf->slotIndex_r16.buf, *mib_sl_buf->slotIndex_r16.buf,
(int)mib_sl_rrc_buf->inCoverage_r16); (int)mib_sl_buf->inCoverage_r16);
nr_rrc_mac_config_req_ue_sl(mod_id, 0, 0, 0, 0, NULL, *mib_sl_buf->directFrameNumber_r16.buf, *mib_sl_buf->slotIndex_r16.buf); nr_rrc_mac_config_req_mib_sl(mod_id, 0, NULL);
return (0); return (0);
} }
......
...@@ -159,7 +159,7 @@ void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len); ...@@ -159,7 +159,7 @@ void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len);
int get_from_lte_ue_fd(); int get_from_lte_ue_fd();
int decode_MIB_SL_NR(const module_id_t mod_id, uint8_t *const sdu, const uint8_t sdu_len, const frame_t frame); int nr_rrc_ue_decode_MIB_SL(const module_id_t mod_id, uint8_t *const sdu, const uint8_t sdu_len, const frame_t frame);
void nr_ue_rrc_timer_trigger(int module_id, int frame, int slot); void nr_ue_rrc_timer_trigger(int module_id, int frame, int slot);
void configure_spcell(NR_UE_RRC_INST_t *rrc, NR_SpCellConfig_t *spcell_config); void configure_spcell(NR_UE_RRC_INST_t *rrc, NR_SpCellConfig_t *spcell_config);
......
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