Commit 109d6bb7 authored by Raymond Knopp's avatar Raymond Knopp

uplink path tested.

parent 5b59872d
...@@ -1587,7 +1587,6 @@ static inline int wakeup_thread(pthread_mutex_t *mutex,pthread_cond_t *cond,int ...@@ -1587,7 +1587,6 @@ static inline int wakeup_thread(pthread_mutex_t *mutex,pthread_cond_t *cond,int
return(-1); return(-1);
} }
*instance_cnt = *instance_cnt + 1; *instance_cnt = *instance_cnt + 1;
// the thread can now be woken up // the thread can now be woken up
if (pthread_cond_signal(cond) != 0) { if (pthread_cond_signal(cond) != 0) {
LOG_E( PHY, "ERROR pthread_cond_signal\n"); LOG_E( PHY, "ERROR pthread_cond_signal\n");
......
...@@ -447,6 +447,14 @@ void ue_decode_p(module_id_t module_idP, int CC_id,frame_t frame, uint8_t CH_ind ...@@ -447,6 +447,14 @@ void ue_decode_p(module_id_t module_idP, int CC_id,frame_t frame, uint8_t CH_ind
void ue_send_sdu(module_id_t module_idP, uint8_t CC_id,frame_t frame, sub_frame_t subframe, uint8_t *sdu,uint16_t sdu_len,uint8_t CH_index); void ue_send_sdu(module_id_t module_idP, uint8_t CC_id,frame_t frame, sub_frame_t subframe, uint8_t *sdu,uint16_t sdu_len,uint8_t CH_index);
void ue_send_sl_sdu(module_id_t module_idP,
uint8_t CC_id,
frame_t frameP,
sub_frame_t subframeP,
uint8_t* sdu,
uint16_t sdu_len,
uint8_t eNB_index
);
#if defined(Rel10) || defined(Rel14) #if defined(Rel10) || defined(Rel14)
/* \brief Called by PHY to transfer MCH transport block to ue MAC. /* \brief Called by PHY to transfer MCH transport block to ue MAC.
......
...@@ -741,6 +741,31 @@ void ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP, uint ...@@ -741,6 +741,31 @@ void ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP, uint
#endif #endif
} }
void ue_send_sl_sdu(module_id_t module_idP,
uint8_t CC_id,
frame_t frameP,
sub_frame_t subframeP,
uint8_t* sdu,
uint16_t sdu_len,
uint8_t eNB_index
) {
mac_rlc_data_ind(
module_idP,
0x1234,
eNB_index,
frameP,
ENB_FLAG_NO,
MBMS_FLAG_NO,
3,
(char *)sdu,
sdu_len,
1,
NULL);
}
int8_t ue_get_mbsfn_sf_alloction (module_id_t module_idP, uint8_t mbsfn_sync_area, unsigned char eNB_index) int8_t ue_get_mbsfn_sf_alloction (module_id_t module_idP, uint8_t mbsfn_sync_area, unsigned char eNB_index)
{ {
// currently there is one-to-one mapping between sf allocation pattern and sync area // currently there is one-to-one mapping between sf allocation pattern and sync area
......
...@@ -760,7 +760,8 @@ void ue_stub_rx_handler(unsigned int num_bytes, char *rx_buffer) { ...@@ -760,7 +760,8 @@ void ue_stub_rx_handler(unsigned int num_bytes, char *rx_buffer) {
PHY_VARS_UE *UE; PHY_VARS_UE *UE;
UE = PHY_vars_UE_g[0][0]; UE = PHY_vars_UE_g[0][0];
LOG_I(PHY,"Received %d bytes on UE-UE link, packet type %d\n",num_bytes,((UE_tport_header_t*)rx_buffer)->packet_type); UE_tport_t *pdu = (UE_tport_t*)rx_buffer;
SLSCH_t *slsch = (SLSCH_t*)&pdu->slsch;
switch (((UE_tport_header_t*)rx_buffer)->packet_type) { switch (((UE_tport_header_t*)rx_buffer)->packet_type) {
case TTI_SYNC: case TTI_SYNC:
...@@ -768,6 +769,23 @@ void ue_stub_rx_handler(unsigned int num_bytes, char *rx_buffer) { ...@@ -768,6 +769,23 @@ void ue_stub_rx_handler(unsigned int num_bytes, char *rx_buffer) {
wakeup_thread(&UE->timer_mutex,&UE->timer_cond,&UE->instance_cnt_timer,"timer_thread"); wakeup_thread(&UE->timer_mutex,&UE->timer_cond,&UE->instance_cnt_timer,"timer_thread");
break; break;
case SLSCH: case SLSCH:
LOG_I(PHY,"Emulator SFN.SF %d.%d, Got SLSCH packet\n",emulator_absSF/10,emulator_absSF%10);
LOG_I(PHY,"Received %d bytes on UE-UE link for SFN.SF %d.%d, sending SLSCH payload (%d bytes) to MAC\n",num_bytes,
pdu->header.absSF/10,pdu->header.absSF%10,
slsch->payload_length);
printf("SLSCH:");
for (int i=0;i<sizeof(SLSCH_t);i++) printf("%x ",((uint8_t*)slsch)[i]);
printf("\n");
ue_send_sl_sdu(0,
0,
pdu->header.absSF/10,
pdu->header.absSF%10,
pdu->payload,
slsch->payload_length,
0);
break; break;
} }
} }
...@@ -1498,6 +1516,7 @@ static void* timer_thread( void* param ) { ...@@ -1498,6 +1516,7 @@ static void* timer_thread( void* param ) {
timer_subframe = absSFm1%10; timer_subframe = absSFm1%10;
pthread_mutex_lock(&UE->timer_mutex); pthread_mutex_lock(&UE->timer_mutex);
UE->instance_cnt_timer = -1; UE->instance_cnt_timer = -1;
pthread_mutex_unlock(&UE->timer_mutex);
LOG_I(PHY,"Running with external timer\n"); LOG_I(PHY,"Running with external timer\n");
} }
else LOG_I(PHY,"Running with internal timer\n"); else LOG_I(PHY,"Running with internal timer\n");
...@@ -1514,7 +1533,7 @@ static void* timer_thread( void* param ) { ...@@ -1514,7 +1533,7 @@ static void* timer_thread( void* param ) {
timer_subframe++; timer_subframe++;
} }
//printf("[timer_thread] Frame: %d, Subframe: %d \n", timer_frame, timer_subframe); //printf("[timer_thread] Frame: %d, Subframe: %d \n", timer_frame, timer_subframe);
LOG_D(MAC," Panos-D [timer_thread] Frame: %d, Subframe: %d \n", timer_frame, timer_subframe); //LOG_I(MAC," Panos-D [timer_thread] Frame: %d, Subframe: %d \n", timer_frame, timer_subframe);
//AssertFatal( 0 == pthread_cond_signal(&phy_stub_ticking->cond_ticking), ""); //AssertFatal( 0 == pthread_cond_signal(&phy_stub_ticking->cond_ticking), "");
AssertFatal(pthread_mutex_lock(&phy_stub_ticking->mutex_ticking) ==0,""); AssertFatal(pthread_mutex_lock(&phy_stub_ticking->mutex_ticking) ==0,"");
phy_stub_ticking->ticking_var++; phy_stub_ticking->ticking_var++;
...@@ -1544,7 +1563,7 @@ static void* timer_thread( void* param ) { ...@@ -1544,7 +1563,7 @@ static void* timer_thread( void* param ) {
sizeof(UE_tport_header_t)); sizeof(UE_tport_header_t));
} }
else { else {
wait_on_condition(&UE->timer_mutex,&UE->timer_cond,&UE->instance_cnt_timer,"timer_thread"); wait_on_condition(&UE->timer_mutex,&UE->timer_cond,&UE->instance_cnt_timer,"timer_thread");
release_thread(&UE->timer_mutex,&UE->instance_cnt_timer,"timer_thread"); release_thread(&UE->timer_mutex,&UE->instance_cnt_timer,"timer_thread");
} }
...@@ -1587,7 +1606,11 @@ static void* timer_thread( void* param ) { ...@@ -1587,7 +1606,11 @@ static void* timer_thread( void* param ) {
} }
int init_timer_thread(void) { int init_timer_thread(void) {
PHY_VARS_UE *UE=PHY_vars_UE_g[0];
phy_stub_ticking = (SF_ticking*)malloc(sizeof(SF_ticking)); phy_stub_ticking = (SF_ticking*)malloc(sizeof(SF_ticking));
pthread_mutex_init(&UE->timer_mutex,NULL);
pthread_mutex_init(&UE->timer_cond,NULL);
UE->instance_cnt_timer = -1;
pthread_mutex_init(&phy_stub_ticking->mutex_ticking,NULL); pthread_mutex_init(&phy_stub_ticking->mutex_ticking,NULL);
pthread_cond_init(&phy_stub_ticking->cond_ticking,NULL); pthread_cond_init(&phy_stub_ticking->cond_ticking,NULL);
pthread_create(&phy_stub_ticking->pthread_timer, NULL, &timer_thread, NULL); pthread_create(&phy_stub_ticking->pthread_timer, NULL, &timer_thread, NULL);
......
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