Commit 34f5368c authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

add function to fill MIB_SL

parent 7e77fb67
This diff is collapsed.
......@@ -112,9 +112,9 @@ uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv);
\brief Generate an SidelinkUEInformation UL-DCCH-Message (UE).
@param destinationInfoList Pointer to a list of destination for which UE requests E-UTRAN to assign dedicated resources
@param discTxResourceReq Pointer to number of discovery messages for discovery announcements for which UE requests E-UTRAN to assign dedicated resources
@param mode Indicates different requests from UE
@param mode Indicates different requests from upper layers
@returns Size of encoded bit stream in bytes*/
uint8_t do_SidelinkUEInformation(uint8_t Mod_id, uint8_t *buffer, SL_DestinationInfoList_r12_t *destinationInfoList, long *discTxResourceReq, uint8_t mode);
uint8_t do_SidelinkUEInformation(uint8_t Mod_id, uint8_t *buffer, SL_DestinationInfoList_r12_t *destinationInfoList, long *discTxResourceReq, SL_TRIGGER_t mode);
/** \brief Generate an RRCConnectionSetupComplete UL-DCCH-Message (UE)
@param buffer Pointer to PER-encoded ASN.1 description of UL-DCCH-Message PDU
......
......@@ -61,6 +61,7 @@
#include "RRCConnectionRequest.h"
#include "RRCConnectionReestablishmentRequest.h"
#include "BCCH-DL-SCH-Message.h"
#include "SBCCH-SL-BCH-MessageType.h"
#include "BCCH-BCH-Message.h"
#if defined(Rel10) || defined(Rel14)
#include "MCCH-Message.h"
......@@ -224,6 +225,21 @@ typedef enum HO_STATE_e {
HO_COMPLETE // initiated by the target eNB
} HO_STATE_t;
typedef enum SL_TRIGGER_e {
SL_RECEIVE_COMMUNICATION=0,
SL_TRANSMIT_RELAY_ONE_TO_ONE,
SL_TRANSMIT_RELAY_ONE_TO_MANY,
SL_TRANSMIT_NON_RELAY_ONE_TO_ONE,
SL_TRANSMIT_NON_RELAY_ONE_TO_MANY,
SL_RECEIVE_DISCOVERY,
SL_TRANSMIT_NON_PS_DISCOVERY,
SL_TRANSMIT_PS_DISCOVERY,
SL_RECEIVE_V2X,
SL_TRANSMIT_V2X,
SL_REQUEST_DISCOVERY_TRANSMISSION_GAPS,
SL_REQUEST_DISCOVERY_RECEPTION_GAPS
} SL_TRIGGER_t;
//#define NUMBER_OF_UE_MAX MAX_MOBILES_PER_RG
#define RRM_FREE(p) if ( (p) != NULL) { free(p) ; p=NULL ; }
#define RRM_MALLOC(t,n) (t *) malloc16( sizeof(t) * n )
......@@ -593,6 +609,8 @@ typedef struct UE_RRC_INST_s {
//TTN - SIB18
SystemInformationBlockType18_r12_t *sib18[NB_CNX_UE];
SystemInformationBlockType19_r12_t *sib19[NB_CNX_UE];
uint8_t *MIB;
SBCCH_SL_BCH_MessageType_t mib_sl[NB_CNX_UE];
#if defined(Rel10) || defined(Rel14)
uint8_t MBMS_flag;
......
......@@ -288,29 +288,38 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover(
);
/**\brief Generate/decode the RRCConnectionReconfiguration for Sidelink at eNB
\param module_idP Instance ID for eNB/CH
\param frame Frame index
\param ue_module_idP Index of UE transmitting the messages*/
\param ctxt_pP Running context
\param ue_context_pP RRC UE context
\param destinationInfoList List of the destinations
\param n_discoveryMessages Number of discovery messages*/
int
rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(
const protocol_ctxt_t* const ctxt_pP,
rrc_eNB_ue_context_t* const ue_context_pP,
SL_DestinationIdentity_r12_t* SL_DestinationIdentity,
int n_destinations,
SL_DestinationInfoList_r12_t *destinationInfoList,
int n_discoveryMessages
);
/** \brief process the received SidelinkUEInformation message at UE
/** \brief process the received SidelinkUEInformation message at eNB
\param ctxt_pP Running context
\param *rrcConnectionReconfiguration pointer to the sturcture
\param eNB_index Index of corresponding eNB/CH*/
void
\param sidelinkUEInformation sidelinkUEInformation message from UE*/
uint8_t
rrc_eNB_process_SidelinkUEInformation(
const protocol_ctxt_t* const ctxt_pP,
rrc_eNB_ue_context_t* ue_context_pP,
SidelinkUEInformation_r12_t* sidelinkUEInformation
);
/** \brief Get a Resource Pool for TX
\param ctxt_pP Running context
\param ue_context_pP UE context
\param destinationInfoList Pointer to the list of SL destinations*/
SL_CommConfig_r12_t rrc_eNB_get_sidelink_commTXPool(
const protocol_ctxt_t* const ctxt_pP,
rrc_eNB_ue_context_t* const ue_context_pP,
SL_DestinationInfoList_r12_t *destinationInfoList
);
//L2_interface.c
int8_t
mac_rrc_data_req(
......
......@@ -4880,24 +4880,70 @@ rrc_top_cleanup_ue(
//-----------------------------------------------------------------------------
void rrc_ue_generate_SidelinkUEInformation( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,SL_DestinationInfoList_r12_t *destinationInfoList, long *discTxResourceReq, uint8_t mode )
void rrc_ue_generate_SidelinkUEInformation( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,SL_DestinationInfoList_r12_t *destinationInfoList, long *discTxResourceReq, SL_TRIGGER_t mode)
{
uint8_t size;
uint8_t buffer[100];
//Generate SidelinkUEInformation
if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&8192) != 0) {//if SIB18 is available
if (((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&8192) > 0) && (destinationInfoList != NULL)) {//if SIB18 is available
size = do_SidelinkUEInformation(ctxt_pP->module_id, buffer, destinationInfoList, NULL, mode);
LOG_I(RRC,"[UE %d][RRC_UE] Frame %d : Logical Channel UL-DCCH, Generating SidelinkUEInformation (bytes%d, eNB %d)\n",
ctxt_pP->module_id,ctxt_pP->frame, size, eNB_index);
}
if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&16384) != 0) {//if SIB19 is available
if (((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&16384) > 0) && (discTxResourceReq != NULL)) {//if SIB19 is available
size = do_SidelinkUEInformation(ctxt_pP->module_id, buffer, NULL, discTxResourceReq, mode);
LOG_I(RRC,"[UE %d][RRC_UE] Frame %d : Logical Channel UL-DCCH, Generating SidelinkUEInformation (bytes%d, eNB %d)\n",
ctxt_pP->module_id,ctxt_pP->frame, size, eNB_index);
}
}
// 3GPP 36.331 (Section 5.10.7.3)
uint8_t fill_SLSS(const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, SLSSID_r12_t *slss_id, uint8_t *subframe, uint8_t mode)
{
long syncOffsetIndicator = 0;
switch(mode) {
case 1: //if triggered by SL discovery announcement and in-coverage
//discSyncConfig_r12 contains only one element
*slss_id = UE_rrc_inst[ctxt_pP->module_id].sib19[eNB_index]->discConfig_r12->discSyncConfig_r12->list.array[0]->slssid_r12;
syncOffsetIndicator = UE_rrc_inst[ctxt_pP->module_id].sib19[eNB_index]->discConfig_r12->discSyncConfig_r12->list.array[0]->syncOffsetIndicator_r12;
//select subframe for SLSS
break;
case 2: //if triggered by SL communication and in-coverage
if (UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index]->commConfig_r12->commSyncConfig_r12->list.array[0]->txParameters_r12) {
*slss_id = UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index]->commConfig_r12->commSyncConfig_r12->list.array[0]->slssid_r12;
syncOffsetIndicator = UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index]->commConfig_r12->commSyncConfig_r12->list.array[0]->syncOffsetIndicator_r12;
//if RRC_CONNECTED (Todo: and if networkControlledSyncTx is configured and set to On)
if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State == RRC_CONNECTED){
//select subframe(s) indicated by syncOffsetIndicator
subframe = syncOffsetIndicator;
} else {
//select subframe(s) indicated by syncOffsetIndicator within SC period
}
break;
case 3: //if triggered by V2X communication and in coverage
break;
case 4: //if triggered by V2X communication and out-of-coverage
break;
case 5: //if triggered by V2X communication and UE has GNSS as the synchronization reference
default:
//if UE has a selected SyncRefUE
//TODO
//else (no SyncRefUE Selected)
//Todo if trigger by V2X
//else randomly select an SLSSID from the set defined for out-of-coverage
*slss_id = 170;//hardcoded
//select the subframe according to syncOffsetIndicator1/2 from the preconfigured parameters
break;
}
}
return 0;
}
This diff is collapsed.
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