Commit ad2da99d authored by William Johnson's avatar William Johnson

testing of Discovery transmission/reception

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