From 7b387999b3edf262b99ccd95f0bb9817e85b23fe Mon Sep 17 00:00:00 2001 From: RS Date: Fri, 10 Jul 2020 15:05:02 -0700 Subject: [PATCH 1/2] Replaced usleep with semaphore for current_sfn_sf --- openair2/PHY_INTERFACE/phy_stub_UE.c | 7 +++++++ openair2/PHY_INTERFACE/phy_stub_UE.h | 3 +++ targets/RT/USER/lte-ue.c | 6 +++++- targets/RT/USER/lte-uesoftmodem.c | 8 ++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index aafc151077..e30f3b2196 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -49,6 +49,7 @@ queue_t ul_config_req_queue; queue_t hi_dci0_req_queue; int current_sfn_sf; +sem_t sfn_semaphore; static int ue_tx_sock_descriptor = -1; static int ue_rx_sock_descriptor = -1; @@ -1203,6 +1204,12 @@ void *ue_standalone_pnf_task(void *context) uint16_t sfn_sf = 0; memcpy((void *)&sfn_sf, buffer, sizeof(sfn_sf)); current_sfn_sf = sfn_sf; + + if (sem_post(&sfn_semaphore) != 0) + { + LOG_E(MAC, "sem_post() error\n"); + abort(); + } } else { diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.h b/openair2/PHY_INTERFACE/phy_stub_UE.h index 0ff3ce701b..c90dfe4429 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.h +++ b/openair2/PHY_INTERFACE/phy_stub_UE.h @@ -14,6 +14,7 @@ #include "nfapi_interface.h" #include "nfapi_pnf_interface.h" #include +#include #include "nfapi/oai_integration/vendor_ext.h" //#include "openair1/PHY/LTE_TRANSPORT/defs.h" //#include "openair1/PHY/defs.h" @@ -156,4 +157,6 @@ extern nfapi_hi_dci0_request_t* hi_dci0_req; extern int current_sfn_sf; +extern sem_t sfn_semaphore; + #endif /* PHY_STUB_UE_H_ */ diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 516823474b..8bc8e53fb8 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1043,7 +1043,11 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) bool sent_any = false; int sfn_sf = current_sfn_sf; if (sfn_sf == last_sfn_sf) { - usleep(100); + if (sem_wait(&sfn_semaphore) != 0) + { + LOG_E(MAC, "sem_wait() error\n"); + abort(); + } continue; } diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 55f167c3ac..3226d31660 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -733,7 +733,15 @@ int main( int argc, char **argv ) { init_queue(&tx_req_pdu_queue); init_queue(&hi_dci0_req_queue); init_queue(&ul_config_req_queue); + config_sync_var=0; + + if (sem_init(&sfn_semaphore, 0, 0) != 0) + { + LOG_E(MAC, "sem_init() error\n"); + abort(); + } + init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface); init_UE_standalone_thread(); } else { From f3d30dae159275c576e50a94394494ad8248e920 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Mon, 13 Jul 2020 10:59:48 -0700 Subject: [PATCH 2/2] Removed trailing white space and added subfram and frame log to CRC_IND --- openair2/PHY_INTERFACE/phy_stub_UE.c | 3 ++- targets/RT/USER/lte-uesoftmodem.c | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index e30f3b2196..a29ad7c1fd 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -1331,7 +1331,8 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len break; case NFAPI_CRC_INDICATION: encoded_size = nfapi_p7_message_pack(&UL->crc_ind, buffer, sizeof(buffer), NULL); - LOG_E(MAC, "CRC_IND sent to Proxy, Size: %d\n", encoded_size); + LOG_E(MAC, "CRC_IND sent to Proxy, Size: %d Frame %d Subframe %d\n", encoded_size, + NFAPI_SFNSF2SFN(UL->crc_ind.sfn_sf), NFAPI_SFNSF2SF(UL->crc_ind.sfn_sf)); break; case NFAPI_RX_ULSCH_INDICATION: // is this the right nfapi message_id? Ask Raymond encoded_size = nfapi_p7_message_pack(&UL->rx_ind, buffer, sizeof(buffer), NULL); diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 3226d31660..218a337fd5 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -735,13 +735,11 @@ int main( int argc, char **argv ) { init_queue(&ul_config_req_queue); config_sync_var=0; - if (sem_init(&sfn_semaphore, 0, 0) != 0) { LOG_E(MAC, "sem_init() error\n"); abort(); } - init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface); init_UE_standalone_thread(); } else {