Commit ad2da99d authored by William Johnson's avatar William Johnson

testing of Discovery transmission/reception

parent ccdc09c8
......@@ -939,8 +939,7 @@ typedef struct {
typedef struct {
/// payload length
int payload_length;
/// pointer to payload
uint8_t *payload;
uint8_t payload[100];
} SLDCH_t;
#define TTI_SYNC 0
......
......@@ -42,14 +42,13 @@ void generate_sldch(PHY_VARS_UE *ue,SLDCH_t *sldch,int frame_tx,int subframe_tx)
pdu.header.packet_type = SLDCH;
pdu.header.absSF = (frame_tx*10)+subframe_tx;
memcpy((void*)&pdu.sldch,(void*)sldch,sizeof(SLDCH_t)-sizeof(uint8_t*));
AssertFatal(sldch->payload_length <=1500-sldch_header_len - sizeof(SLDCH_t) + sizeof(uint8_t*),
"SLDCH payload length > %d\n",
1500-sldch_header_len - sizeof(SLDCH_t) + sizeof(uint8_t*));
memcpy((void*)&pdu.payload[0],
(void*)sldch->payload,
sldch->payload_length);
memcpy((void*)&pdu.sldch,
(void*)sldch,
sizeof(SLDCH_t));
LOG_I(PHY,"SLDCH configuration %d bytes, TBS payload %d bytes => %d bytes\n",
sizeof(SLDCH_t)-sizeof(uint8_t*),
......@@ -58,7 +57,7 @@ void generate_sldch(PHY_VARS_UE *ue,SLDCH_t *sldch,int frame_tx,int subframe_tx)
multicast_link_write_sock(0,
&pdu,
sldch_header_len+sizeof(SLDCH_t)-sizeof(uint8_t*)+sldch->payload_length);
sldch_header_len+sizeof(SLDCH_t));
}
......
......@@ -1378,7 +1378,6 @@ typedef struct {
int sltx_active;
SLSCH_t slsch;
SLDCH_t sldch;
ULDCH_PDU sldch_pdu;
ULSCH_PDU slsch_pdu;
int slsch_lcid;
#endif
......@@ -1498,6 +1497,3 @@ typedef struct {
#include "proto.h"
/*@}*/
#endif /*__LAYER2_MAC_DEFS_H__ */
......@@ -2748,24 +2748,27 @@ SLSS_t *ue_get_slss(module_id_t Mod_id,int CC_id,frame_t frame_tx,sub_frame_t su
}
SLDCH_t *ue_get_sldch(module_id_t Mod_id,int CC_id,frame_t frame_tx,sub_frame_t subframe_tx) {
/* int sdu_length;
UE_MAC_INST *ue = &UE_mac_inst[Mod_id];
SLDCH_t *sldch = &UE_mac_inst[Mod_id].sldch;
LOG_I(MAC, "[ue_get_sldch]");
int sdu_length = mac_rrc_data_req(Mod_id,
sldch->payload_length = mac_rrc_data_req(Mod_id,
CC_id,
frame_tx,
SL_DISCOVERY,
1,
(char*)(ue->sldch_pdu.payload), //&UE_mac_inst[Mod_id].SL_Discovery[0].Tx_buffer.Payload[0],
(char*)(sldch->payload), //&UE_mac_inst[Mod_id].SL_Discovery[0].Tx_buffer.Payload[0],
0,
0, //eNB_indexP
0);
if (sdu_length >0 ) return (&ue->sldch);
if (sldch->payload_length >0 ) {
LOG_I(MAC,"Got %d bytes from RRC for SLDCH @ %p\n",sldch->payload_length,sldch);
return (sldch);
}
else
*/
return((SLDCH_t*)NULL);
}
......
......@@ -329,10 +329,11 @@ mac_rrc_data_req(
LOG_D(RRC,"[UE %d] Frame %d buffer_pP status %d,\n",Mod_idP,frameP, UE_rrc_inst[Mod_idP].SL_Discovery[eNB_index].Tx_buffer.payload_size);
//TTN (for D2D)
if ((Srb_id & RAB_OFFSET) == SL_DISCOVERY){
if (Srb_id == SL_DISCOVERY && UE_rrc_inst[Mod_idP].SL_Discovery[eNB_index].Tx_buffer.payload_size > 0){
memcpy(&buffer_pP[0],&UE_rrc_inst[Mod_idP].SL_Discovery[eNB_index].Tx_buffer.Payload[0],UE_rrc_inst[Mod_idP].SL_Discovery[eNB_index].Tx_buffer.payload_size);
uint8_t Ret_size=UE_rrc_inst[Mod_idP].SL_Discovery[eNB_index].Tx_buffer.payload_size;
// msg("[RRC][UE %d] Sending SL_Discovery\n",Mod_id);
LOG_I(RRC,"[UE %d] Sending SL_Discovery, size %d bytes\n",Mod_idP,Ret_size);
UE_rrc_inst[Mod_idP].SL_Discovery[eNB_index].Tx_buffer.payload_size = 0;
return(Ret_size);
}
#endif
......@@ -513,7 +514,7 @@ mac_rrc_data_ind(
}
//TTN (for D2D)
if((srb_idP & RAB_OFFSET) == SL_DISCOVERY) {
if(srb_idP == SL_DISCOVERY) {
decode_SL_Discovery_Message(&ctxt, eNB_indexP, sduP, sdu_lenP);
}
......
......@@ -134,11 +134,9 @@ struct PC5SEstablishRsp{
//example of PC5_DSICOVERY ANNOUNCEMENT (for testing only)
typedef struct {
uint8_t msg_type;
uint32_t discoveryGroupId;
//AnnouncerInfo
uint32_t proSeUEId;
} __attribute__((__packed__)) PC5DiscoveryAnnouncement;
unsigned char bytes[29];
} __attribute__((__packed__)) PC5DiscoveryAnnouncement ;
struct sidelink_ctrl_element {
unsigned short type;
......
......@@ -90,7 +90,7 @@ rrc_ue_decode_dcch(
);
#ifdef Rel14
int decode_SL_DISCOVERY_Message(
int decode_SL_Discovery_Message(
const protocol_ctxt_t* const ctxt_pP,
const uint8_t eNB_index,
uint8_t* const Sdu,
......
......@@ -5806,14 +5806,16 @@ void *rrc_control_socket_thread_fct(void *arg)
#ifdef DEBUG_CTRL_SOCKET
LOG_I(RRC,"[PC5DiscoveryAnnouncement] Received on socket from ProSe App (msg type: %d)\n",sl_ctrl_msg_recv->type);
LOG_I(RRC,"[PC5DiscoveryAnnouncement] type: %d\n",sl_ctrl_msg_recv->sidelinkPrimitive.pc5_discovery_announcement.msg_type);
LOG_I(RRC,"[PC5DiscoveryAnnouncement] discoveryGroupId: 0x%08x\n",sl_ctrl_msg_recv->sidelinkPrimitive.pc5_discovery_announcement.discoveryGroupId);
LOG_I(RRC,"[PC5DiscoveryAnnouncement] proSeUEId: 0x%08x\n",sl_ctrl_msg_recv->sidelinkPrimitive.pc5_discovery_announcement.proSeUEId);
// LOG_I(RRC,"[PC5DiscoveryAnnouncement] type: %d\n",sl_ctrl_msg_recv->sidelinkPrimitive.pc5_discovery_announcement.msg_type);
// LOG_D(RRC,"[PC5DiscoveryAnnouncement] discoveryGroupId: 0x%08x\n",sl_ctrl_msg_recv->sidelinkPrimitive.pc5_discovery_announcement.discoveryGroupId);
// LOG_D(RRC,"[PC5DiscoveryAnnouncement] proSeUEId: 0x%08x\n",sl_ctrl_msg_recv->sidelinkPrimitive.pc5_discovery_announcement.proSeUEId);
#endif
//prepare SL_Discovery buffer
if (UE_rrc_inst) {
memcpy((void*)&UE_rrc_inst[module_id].SL_Discovery[0].Tx_buffer.Payload[0], (void*)receive_buf, n);
UE_rrc_inst[module_id].SL_Discovery[0].Tx_buffer.payload_size = n;
LOG_I(RRC,"[PC5DiscoveryAnnouncement] Copied %d bytes\n",n);
}
break;
default:
break;
......@@ -5825,7 +5827,7 @@ void *rrc_control_socket_thread_fct(void *arg)
//-----------------------------------------------------------------------------
int decode_SL_DISCOVERY_Message(
int decode_SL_Discovery_Message(
const protocol_ctxt_t* const ctxt_pP,
const uint8_t eNB_index,
uint8_t* const Sdu,
......
......@@ -1640,11 +1640,3 @@ int init_timer_thread(void) {
pthread_create(&phy_stub_ticking->pthread_timer, NULL, &timer_thread, NULL);
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