Commit 58864d2b authored by Raymond Knopp's avatar Raymond Knopp

addition of continuous reception of MIB-SL

parent e3c7e40b
......@@ -51,14 +51,31 @@ int initial_syncSL(PHY_VARS_UE *ue) {
&avglevel);
printf("index %d, psslevel %lld dB avglevel %lld dB => %d sample offset\n",
index,dB_fixed(psslevel),dB_fixed(avglevel),ue->rx_offsetSL);
int32_t sss_metric;
int32_t phase_max;
rx_slsss(ue,&sss_metric,&phase_max,index);
generate_sl_grouphop(ue);
if (rx_psbch(ue) == -1)
ue->slbch_errors++;
else {
if (ue->rx_offsetSL >= 0) {
int32_t sss_metric;
int32_t phase_max;
rx_slsss(ue,&sss_metric,&phase_max,index);
generate_sl_grouphop(ue);
if (rx_psbch(ue) == -1) {
ue->slbch_errors++;
return(-1);
}
else {
// send payload to RRC
LOG_I(PHY,"Synchronization with SyncREF UE found, sending MIB-SL to RRC\n");
ue_decode_si(ue->Mod_id,
0, // CC_id
0, // frame
0, // eNB_index
NULL, // pdu, NULL for MIB-SL
0, // len, 0 for MIB-SL
&ue->slss_rx,
&frame,
&subframe);
LOG_I(PHY,"RRC returns MIB-SL for frame %d, subframe %d\n");
return(-1);
}
}
}
......@@ -3866,7 +3866,9 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue,
frame_rx,
eNB_id,
ue->dlsch_SI[eNB_id]->harq_processes[0]->b,
ue->dlsch_SI[eNB_id]->harq_processes[0]->TBS>>3);
ue->dlsch_SI[eNB_id]->harq_processes[0]->TBS>>3,
NULL,NULL,NULL);
break;
case P_PDSCH:
// Panos: Substitute call with call to fill_dlsch_indication()
......
......@@ -443,7 +443,9 @@ typedef struct {
/*!\brief LCID of Carrier component activation/deactivation */
#define CC_ACT_DEACT 27
//TTN (for D2D)
#define SL_DISCOVERY 8 //LCID (fake)
/*!\brief Value of MIB-SL / SRB0 logical channel */
#define MIBSLCH 8 // (fake)
#define SL_DISCOVERY 9 //LCID (fake)
#define MAX_NUM_DEST 10
#endif
......
......@@ -507,7 +507,8 @@ void mac_out_of_sync_ind(module_id_t module_idP, frame_t frameP,
uint16_t CH_index);
void ue_decode_si(module_id_t module_idP, int CC_id, frame_t frame,
uint8_t CH_index, void *pdu, uint16_t len);
uint8_t CH_index, void *pdu, uint16_t len,
SLSS_t *slss, int *rxframe, int *rxsubframe);
void ue_decode_p(module_id_t module_idP, int CC_id, frame_t frame,
uint8_t CH_index, void *pdu, uint16_t len);
......
......@@ -590,7 +590,8 @@ ue_send_sdu(module_id_t module_idP,
void
ue_decode_si(module_id_t module_idP, int CC_id, frame_t frameP,
uint8_t eNB_index, void *pdu, uint16_t len)
uint8_t eNB_index, void *pdu, uint16_t len,
SLSS_t *slss,int *frame,int *subframe)
{
#if UE_TIMING_TRACE
start_meas(&UE_mac_inst[module_idP].rx_si);
......@@ -600,11 +601,18 @@ ue_decode_si(module_id_t module_idP, int CC_id, frame_t frameP,
LOG_D(MAC, "[UE %d] Frame %d Sending SI to RRC (LCID Id %d,len %d)\n",
module_idP, frameP, BCCH, len);
mac_rrc_data_ind_ue(module_idP, CC_id, frameP, 0, // unknown subframe
SI_RNTI,
BCCH, (uint8_t *) pdu, len, eNB_index,
0);
if (slss == NULL) { // this is not MIB-SL
mac_rrc_data_ind_ue(module_idP, CC_id, frameP, 0, // unknown subframe
SI_RNTI,
BCCH, (uint8_t *) pdu, len, eNB_index,
0);
}
else {
mac_rrc_data_ind_ue(module_idP, CC_id, frameP, 0, // unknown subframe
SI_RNTI,
MIBSLCH, (uint8_t *) pdu, len, eNB_index,
0);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_SI, VCD_FUNCTION_OUT);
#if UE_TIMING_TRACE
......
......@@ -272,6 +272,17 @@ mac_rrc_data_ind_ue(
#endif // Rel10 || Rel14
#ifdef Rel14
if (srb_idP == MIBSLCH) {
LOG_I(RRC,"[UE %d] Received SDU for MIBSL\n");
if (decode_MIB_SL(&ctxt,sduP,5)>=0) {
// rrc_mac_config_request();
}
else {
}
}
//TTN (for D2D)
if(srb_idP == SL_DISCOVERY) {
LOG_I(RRC,"[UE %d] Received SDU (%d bytes) for SL_DISCOVERY on SRB %d from eNB %d\n",module_idP, sdu_lenP, srb_idP,eNB_indexP);
......
......@@ -290,7 +290,6 @@ uint8_t do_MIB_SL(const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
AssertFatal(eNB_index==0,"eNB_index needs to be 0\n");
if (UE->SL_MIB == NULL) UE->SL_MIB = (uint8_t*) CALLOC(1,5);
if (in_coverage > 0 ){
//in coverage
......
......@@ -758,8 +758,8 @@ typedef struct UE_RRC_INST_s {
SystemInformationBlockType18_r12_t *sib18[NB_CNX_UE];
SystemInformationBlockType19_r12_t *sib19[NB_CNX_UE];
SBCCH_SL_BCH_Message_t SL_mib[NB_CNX_UE];
uint8_t *SL_MIB;
SBCCH_SL_BCH_Message_t *SL_mib[NB_CNX_UE];
uint8_t SL_MIB[5];
/// Preconfiguration for Sidelink
struct SL_Preconfiguration_r12 *SL_Preconfiguration[NB_CNX_UE];
//source L2 Id
......
......@@ -6212,7 +6212,24 @@ void *rrc_control_socket_thread_fct(void *arg)
return 0;
}
int decode_MIB_SL( const protocol_ctxt_t* const ctxt_pP,
uint8_t* const Sdu,
const uint8_t Sdu_len) {
memcpy((void*)&UE_rrc_inst[ctxt_pP->module_id].SL_MIB, (void*)Sdu, Sdu_len);
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
&asn_DEF_SBCCH_SL_BCH_Message,
(void **)&UE_rrc_inst[ctxt_pP->module_id].SL_mib[0],
(const void *)Sdu,
Sdu_len );
if ((dec_rval.code != RC_OK) && (dec_rval.consumed==0)) {
LOG_E(RRC,"[UE %d] Frame %d : Failed to decode SBCCH_SL_BCH_Message (%zu bytes)\n",ctxt_pP->module_id,ctxt_pP->frame,dec_rval.consumed);
return -1;
}
return(0);
}
//-----------------------------------------------------------------------------
int decode_SL_Discovery_Message(
const protocol_ctxt_t* const ctxt_pP,
......
......@@ -704,19 +704,7 @@ static void *UE_thread_synchSL(void *arg)
AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synchSL), "");
// Do initial synch here
LOG_I(PHY,"Running PSS timing estimation first\n");
int MLind;
int64_t maxlev;
int64_t avglev;
int rxoffset = lte_sync_timeSL(UE,
&MLind,
&maxlev,
&avglev);
if (rxoffset>=0) LOG_I(PHY,"Most likely Nid_SL/168 = %d with rxoffset %d, lev %d dB, avg %d dB\n", MLind,rxoffset,dB_fixed(maxlev),dB_fixed(avglev));
int32_t sss_metric;
int32_t phase_max;
rx_slsss(UE,&sss_metric,&phase_max,MLind,0);
if (initial_synchSL(UE) >= 0)
AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synchSL), "");
UE->proc.instance_cnt_synchSL--;
......
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