Commit ccdc09c8 authored by Rohit Gupta's avatar Rohit Gupta

final pieces for SLDCH emulation

parent a7f21281
......@@ -937,7 +937,10 @@ typedef struct {
} SLSCH_t;
typedef struct {
/// payload length
int payload_length;
/// pointer to payload
uint8_t *payload;
} SLDCH_t;
#define TTI_SYNC 0
......
......@@ -36,8 +36,31 @@
void generate_sldch(PHY_VARS_UE *ue,SLDCH_t *sldch,int frame_tx,int subframe_tx) {
AssertFatal(1==0,"Should get here yet for UE %d\n",ue->Mod_id);
UE_tport_t pdu;
size_t sldch_header_len = sizeof(UE_tport_header_t);
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);
LOG_I(PHY,"SLDCH configuration %d bytes, TBS payload %d bytes => %d bytes\n",
sizeof(SLDCH_t)-sizeof(uint8_t*),
sldch->payload_length,
sldch_header_len+sizeof(SLDCH_t)-sizeof(uint8_t*)+sldch->payload_length);
multicast_link_write_sock(0,
&pdu,
sldch_header_len+sizeof(SLDCH_t)-sizeof(uint8_t*)+sldch->payload_length);
}
#endif
......@@ -363,7 +363,7 @@ SL_DiscConfig_r12_t rrc_eNB_get_sidelink_discTXPool(
/** \brief Process request from control socket
* \param arg
*/
static void *rrc_control_socket_thread_fct(void *arg);
void *rrc_control_socket_thread_fct(void *arg);
//L2_interface.c
int8_t
......
......@@ -762,6 +762,7 @@ void ue_stub_rx_handler(unsigned int num_bytes, char *rx_buffer) {
UE_tport_t *pdu = (UE_tport_t*)rx_buffer;
SLSCH_t *slsch = (SLSCH_t*)&pdu->slsch;
SLDCH_t *sldch = (SLDCH_t*)&pdu->sldch;
switch (((UE_tport_header_t*)rx_buffer)->packet_type) {
case TTI_SYNC:
......@@ -788,6 +789,28 @@ void ue_stub_rx_handler(unsigned int num_bytes, char *rx_buffer) {
0,
SL_DISCOVERY_FLAG_NO);
break;
case SLDCH:
LOG_I(PHY,"Emulator SFN.SF %d.%d, Got SLDCH packet\n",emulator_absSF/10,emulator_absSF%10);
LOG_I(PHY,"Received %d bytes on UE-UE link for SFN.SF %d.%d, sending SLDCH payload (%d bytes) to MAC\n",num_bytes,
pdu->header.absSF/10,pdu->header.absSF%10,
sldch->payload_length);
printf("SLDCH:");
for (int i=0;i<sizeof(SLDCH_t);i++) printf("%x ",((uint8_t*)sldch)[i]);
printf("\n");
ue_send_sl_sdu(0,
0,
pdu->header.absSF/10,
pdu->header.absSF%10,
pdu->payload,
sldch->payload_length,
0,
SL_DISCOVERY_FLAG_YES);
break;
}
}
......
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