Commit 9c00f4b7 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

update RRC_UE to support PC5-S

parent 952ec555
......@@ -1049,7 +1049,8 @@ rrc_mac_config_req_ue(
#endif
#if defined(Rel14)
,uint32_t *sourceL2Id,
uint32_t *groupL2Id
uint32_t *groupL2Id,
uint32_t *destinationL2Id
#endif
)
......@@ -1369,12 +1370,20 @@ rrc_mac_config_req_ue(
// Panos: Call to the phy_config_request_ue() function of the interface to copy the UE_PHY_Config_t interface
// configuration to the PHY common and dedicated configuration originating from RRC.
//for D2D
#if defined(Rel10) || defined(Rel14)
if ( sourceL2Id && groupL2Id) {
UE_mac_inst[Mod_idP].sourceL2Id = *sourceL2Id;
UE_mac_inst[Mod_idP].groupL2Id = *groupL2Id;
} else if (sourceL2Id) { //reset groupL2Id
UE_mac_inst[Mod_idP].groupL2Id = 0x00000000;
}
if ( sourceL2Id && destinationL2Id) {
UE_mac_inst[Mod_idP].sourceL2Id = *sourceL2Id;
UE_mac_inst[Mod_idP].destinationL2Id = *destinationL2Id;
}
#endif
return(0);
......
......@@ -932,7 +932,8 @@ int rrc_mac_config_req_ue(module_id_t module_idP,
#if defined(Rel14)
,
uint32_t *sourceL2Id,
uint32_t *groupL2Id
uint32_t *groupL2Id,
uint32_t *destinationL2Id
#endif
);
......
......@@ -2740,6 +2740,7 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_
UE_MAC_INST *ue = &UE_mac_inst[module_idP];
int rvtab[4] = {0,2,3,1};
int sdu_length;
uint32_t destL2Id; //groupL2Id/destinationL2Id
// Note: this is hard-coded for now for the default SL configuration (4 SF PSCCH, 36 SF PSSCH)
SLSCH_t *slsch = &UE_mac_inst[module_idP].slsch;
......@@ -2776,11 +2777,13 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_
int req;
if (ue->slsch_lcid == 10) {
if (TBS<=rlc_status.bytes_in_buffer) req=TBS;
else req = rlc_status.bytes_in_buffer;
if (TBS<=rlc_status.bytes_in_buffer) req=TBS;
else req = rlc_status.bytes_in_buffer;
destL2Id = ue->destinationL2Id;
} else if (ue->slsch_lcid == 3){
if (TBS<=rlc_status_data.bytes_in_buffer) req=TBS;
else req = rlc_status_data.bytes_in_buffer;
destL2Id = ue->groupL2Id;
}
if (req>0) {
......@@ -2800,8 +2803,8 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_
if (sdu_length > 0) {
LOG_I(MAC,"SFN.SF %d.%d : got %d bytes from Sidelink buffer (%d requested)\n",frameP,subframeP,sdu_length,req);
LOG_I(MAC,"sourceL2Id: %d \n",ue->sourceL2Id);
LOG_I(MAC,"groupL2Id: %d \n",ue->groupL2Id);
LOG_I(MAC,"sourceL2Id: 0x%08x \n",ue->sourceL2Id);
LOG_I(MAC,"groupL2Id/destinationL2Id: 0x%08x \n",destL2Id);
slsch->payload = (unsigned char*)ue->slsch_pdu.payload;
if (sdu_length < 128) {
......@@ -2814,9 +2817,9 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_
shorth->SRC07 = (ue->sourceL2Id>>16) & 0x000000ff;
shorth->SRC815 = (ue->sourceL2Id>>8) & 0x000000ff;
shorth->SRC1623 = ue->sourceL2Id & 0x000000ff;
shorth->DST07 = (ue->groupL2Id >>16) & 0x000000ff;
shorth->DST815 = (ue->groupL2Id>>8) & 0x000000ff;
shorth->DST1623 = ue->groupL2Id & 0x000000ff;
shorth->DST07 = (destL2Id >>16) & 0x000000ff;
shorth->DST815 = (destL2Id>>8) & 0x000000ff;
shorth->DST1623 = destL2Id & 0x000000ff;
shorth->V=0x1;
}
......@@ -2830,9 +2833,9 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_
longh->SRC07 = (ue->sourceL2Id >>16) & 0x000000ff;
longh->SRC815 = (ue->sourceL2Id>>8) & 0x000000ff;
longh->SRC1623 = ue->sourceL2Id & 0x000000ff;
longh->DST07 = (ue->groupL2Id >>16) & 0x000000ff;
longh->DST815 = (ue->groupL2Id>>8) & 0x000000ff;
longh->DST1623 = ue->groupL2Id & 0x000000ff;
longh->DST07 = (destL2Id >>16) & 0x000000ff;
longh->DST815 = (destL2Id>>8) & 0x000000ff;
longh->DST1623 = destL2Id & 0x000000ff;
longh->V=0x1;
}
......
......@@ -85,6 +85,9 @@
#define DIRECT_COMMUNICATION_ESTABLISH_RSP 6
#define GROUP_COMMUNICATION_RELEASE_REQ 7
#define GROUP_COMMUNICATION_RELEASE_RSP 8
#define PC5S_ESTABLISH_REQ 9
#define PC5S_ESTABLISH_RSP 10
typedef enum {
UE_STATE_OFF_NETWORK,
......@@ -116,6 +119,16 @@ struct DirectCommunicationEstablishReq {
uint32_t pppp;
};
struct PC5SEstablishReq{
uint32_t sourceL2Id;
uint32_t destinationL2Id;
};
struct PC5SEstablishRsp{
uint32_t sourceL2Id;
uint32_t destinationL2Id;
uint8_t status;
};
struct sidelink_ctrl_element {
unsigned short type;
......@@ -127,7 +140,8 @@ struct sidelink_ctrl_element {
SL_UE_STATE_t ue_state;
//struct GroupCommunicationReleaseReq group_comm_release_req;
int slrb_id;
struct PC5SEstablishReq pc5s_establish_req;
struct PC5SEstablishRsp pc5s_establish_rsp;
} sidelinkPrimitive;
};
......
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