Commit 7abf1227 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

generate/process SidelinkUEInformation

parent afa442bb
...@@ -1359,6 +1359,116 @@ uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) ...@@ -1359,6 +1359,116 @@ uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv)
} }
//TTN for D2D - 3GPP TS 36.331 (Section 5.10.2.3)
uint8_t do_SidelinkUEInformation(uint8_t Mod_id, uint8_t *buffer, SL_DestinationInfoList_r12_t *destinationInfoList, long *discTxResourceReq, uint8_t mode)
{
asn_enc_rval_t enc_rval;
UL_DCCH_Message_t ul_dcch_msg;
SidelinkUEInformation_r12_t *sidelinkUEInformation;
ARFCN_ValueEUTRA_r9_t commRxInterestedFreq[] = {2565000000.0}; //sidelink communication frequency
ARFCN_ValueEUTRA_r9_t carrierFreq[] = {2565000000.0};
memset((void *)&ul_dcch_msg,0,sizeof(UL_DCCH_Message_t));
ul_dcch_msg.message.present = UL_DCCH_MessageType_PR_messageClassExtension;
ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__messageClassExtension__c2_PR_sidelinkUEInformation_r12;
sidelinkUEInformation = &ul_dcch_msg.message.choice.messageClassExtension.choice.c2.choice.sidelinkUEInformation_r12;
//3GPP TS 36.331 (Section 5.10.2.3)
sidelinkUEInformation->criticalExtensions.choice.c1.present = SidelinkUEInformation_r12__criticalExtensions__c1_PR_sidelinkUEInformation_r12;
switch(mode) {
//if SIB18 is available case 1,2,3,4
case 1: // to receive sidelink communication
sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commRxInterestedFreq_r12 = &commRxInterestedFreq[0];
break;
case 2: //to transmit non-relay related one-to-many sidelink communication
//commTxResourceReq
sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12->carrierFreq_r12 = &carrierFreq[0];
sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12->destinationInfoList_r12 = *destinationInfoList;
break;
case 3://transmit non-relay related one-to-one sidelink communication
//if commTxResourceUC-ReqAllowed is included in SIB18
sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13->carrierFreq_r12 = &carrierFreq[0];
sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13->destinationInfoList_r12 = *destinationInfoList;
break;
case 4: //transmit relay related one-to-one sidelink communication
//if SIB19 includes discConfigRelay and UE acts a relay or UE has a selected relay
sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelayUC_r13->destinationInfoList_r12 = *destinationInfoList;
//set ue-type to relayUE or remoteUE
sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->ue_Type_r13 =SidelinkUEInformation_v1310_IEs__commTxResourceInfoReqRelay_r13__ue_Type_r13_relayUE;
//sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12->nonCriticalExtension->commTxResourceInfoReqRelay_r13->ue_Type_r13 =SidelinkUEInformation_v1310_IEs__commTxResourceInfoReqRelay_r13__ue_Type_r13_remoteUE;
break;
case 5: //transmit relay related one-to-many sidelink communication
//if SIB19 includes discConfigRelay and UE acts a relay
//set ue-type to relayUE
sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->ue_Type_r13 =SidelinkUEInformation_v1310_IEs__commTxResourceInfoReqRelay_r13__ue_Type_r13_relayUE;
sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelay_r13->destinationInfoList_r12 = *destinationInfoList;
break;
//if SIB19 is available
//TTN - for case 6,7, and 8, we consider only one frequency - a serving frequency
case 6: //receive sidelink discovery announcements
sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.discRxInterest_r12 = SidelinkUEInformation_r12_IEs__discRxInterest_r12_true;
break;
case 7://to transmit non-PS related sidelink discovery announcements
//for the first frequency
sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.discTxResourceReq_r12 = discTxResourceReq;
//for additional frequency
break;
case 8://to transmit PS related sidelink discovery announcements
//if to transmit non-relay PS related discovery announcements and SIB19 includes discConfigPS
//if UE is acting as relay UE and SIB includes discConfigRelay (relay threshold condition)
//if relay UE/has a selected relay UE and if SIB19 includes discConfigRelay
sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->discTxResourceReqPS_r13->discTxResourceReq_r13 = discTxResourceReq;
//sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12->nonCriticalExtension->discTxResourceReqPS_r13->carrierFreqDiscTx_r13
break;
//TODO: SIB21
//TODO: request sidelink discovery transmission/reception gaps
//TODO: report the system information parameters related to sidelink discovery of carriers other than the primary
default:
break;
}
enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message,
(void*)&ul_dcch_msg,
buffer,
100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
{
char message_string[20000];
size_t message_string_size;
if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) {
MessageDef *msg_p;
msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText));
msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size;
memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, NB_eNB_INST + Mod_id, msg_p);
}
}
# endif
#endif
#ifdef USER_MODE
LOG_D(RRC,"SidelinkUEInformation Encoded %d bits (%d bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
#endif
return((enc_rval.encoded+7)/8);
}
uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Transaction_id, const int dedicatedInfoNASLength, const char *dedicatedInfoNAS) uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Transaction_id, const int dedicatedInfoNASLength, const char *dedicatedInfoNAS)
{ {
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <asn_internal.h> /* for _ASN_DEFAULT_STACK_MAX */ #include <asn_internal.h> /* for _ASN_DEFAULT_STACK_MAX */
#include "RRC/LITE/defs.h" #include "RRC/LITE/defs.h"
#include "SL-DestinationInfoList-r12.h"
/* /*
* The variant of the above function which dumps the BASIC-XER (XER_F_BASIC) * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC)
...@@ -107,6 +108,14 @@ routine only generates an mo-data establishment cause. ...@@ -107,6 +108,14 @@ routine only generates an mo-data establishment cause.
uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv); 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
@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);
/** \brief Generate an RRCConnectionSetupComplete UL-DCCH-Message (UE) /** \brief Generate an RRCConnectionSetupComplete UL-DCCH-Message (UE)
@param buffer Pointer to PER-encoded ASN.1 description of UL-DCCH-Message PDU @param buffer Pointer to PER-encoded ASN.1 description of UL-DCCH-Message PDU
@returns Size of encoded bit stream in bytes*/ @returns Size of encoded bit stream in bytes*/
......
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
#include "AS-Context.h" #include "AS-Context.h"
#include "UE-EUTRA-Capability.h" #include "UE-EUTRA-Capability.h"
#include "MeasResults.h" #include "MeasResults.h"
#include "SidelinkUEInformation-r12.h"
/* correct Rel(8|10)/Rel14 differences /* correct Rel(8|10)/Rel14 differences
* the code is in favor of Rel14, those defines do the translation * the code is in favor of Rel14, those defines do the translation
......
...@@ -287,6 +287,27 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( ...@@ -287,6 +287,27 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover(
const uint32_t nas_length const uint32_t nas_length
); );
/**\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*/
int
rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(
const protocol_ctxt_t* const ctxt_pP,
rrc_eNB_ue_context_t* const ue_context_pP
);
/** \brief process the received SidelinkUEInformation message at UE
\param ctxt_pP Running context
\param *rrcConnectionReconfiguration pointer to the sturcture
\param eNB_index Index of corresponding eNB/CH*/
void
rrc_eNB_process_SidelinkUEInformation(
const protocol_ctxt_t* const ctxt_pP,
rrc_eNB_ue_context_t* ue_context_pP,
SidelinkUEInformation_r12_t * sidelinkUEInformation
);
//L2_interface.c //L2_interface.c
int8_t int8_t
mac_rrc_data_req( mac_rrc_data_req(
......
...@@ -4864,3 +4864,18 @@ rrc_top_cleanup_ue( ...@@ -4864,3 +4864,18 @@ 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 )
{
uint8_t size;
uint8_t buffer[100];
//Generate SidelinkUEInformation
size = do_SidelinkUEInformation(ctxt_pP->module_id, buffer, destinationInfoList, 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);
}
...@@ -5193,3 +5193,44 @@ rrc_top_cleanup_eNB( ...@@ -5193,3 +5193,44 @@ rrc_top_cleanup_eNB(
free(RC.rrc); free(RC.rrc);
} }
//-----------------------------------------------------------------------------
//TTN - for D2D
void
rrc_eNB_process_SidelinkUEInformation(
const protocol_ctxt_t* const ctxt_pP,
rrc_eNB_ue_context_t* ue_context_pP,
SidelinkUEInformation_r12_t * sidelinkUEInformation
)
//-----------------------------------------------------------------------------
{
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing SidelinkUEInformation from UE (SRB1 Active)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
//generate RRC Reconfiguration
rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(ctxt_pP, ue_context_pP);
}
//-----------------------------------------------------------------------------
int
rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(
const protocol_ctxt_t* const ctxt_pP,
rrc_eNB_ue_context_t* const ue_context_pP
)
//-----------------------------------------------------------------------------
{
uint8_t size;
uint8_t buffer[100];
//size = do_RRCConnectionReconfiguration(ctxt_pP, buffer );
LOG_I(RRC,"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration_Sidelink (bytes %d, UE id %x)\n",
ctxt_pP->module_id,ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
// rrc_data_req();
return(0);
}
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