X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fphy_stub%2Fphy_stub_thread_hdl.c;h=29a4b0100fe8a99287ba67e96146e6f67ea1f01f;hb=f191979f3454e08cc049af12d6323819730260ef;hp=e76c067ef8ecb9476e159c394141fb5da97e0f04;hpb=aa4e78164447b8cad6f38791047377640fd0c6f2;p=o-du%2Fl2.git diff --git a/src/phy_stub/phy_stub_thread_hdl.c b/src/phy_stub/phy_stub_thread_hdl.c index e76c067ef..29a4b0100 100644 --- a/src/phy_stub/phy_stub_thread_hdl.c +++ b/src/phy_stub/phy_stub_thread_hdl.c @@ -19,10 +19,15 @@ /* This file handles slot indication */ #include "common_def.h" -#include "lphy_stub.h" -#include "du_log.h" +#include "phy_stub_utils.h" +#ifdef INTEL_FAPI +#include "fapi.h" +#include "fapi_vendor_extension.h" +#endif +#include "phy_stub.h" uint8_t l1SendUlUserData(); +uint8_t l1SendStatusPdu(); uint16_t l1BuildAndSendSlotIndication(); pthread_t thread = 0; @@ -41,22 +46,45 @@ pthread_t thread = 0; * RFAILED - failure * * ****************************************************************/ -void *GenerateTicks(void *arg) +void GenerateTicks() { - int milisec = 1; /* 1ms */ +#ifdef NR_TDD + int milisec = 0.5; /* 0.5ms */ +#else + int milisec = 1; /* 1ms */ +#endif struct timespec req = {0}; + slotIndicationStarted = true; req.tv_sec = 0; req.tv_nsec = milisec * 1000000L; - while(1) + DU_LOG("\nPHY_STUB : GenerateTicks : Starting to generate slot indications"); + + while(slotIndicationStarted) { - nanosleep(&req, (struct timespec *)NULL); - + clock_nanosleep(CLOCK_REALTIME, 0, &req, NULL); /* Send Slot indication indication to lower mac */ l1BuildAndSendSlotIndication(); } - return((void *)NULLP); + + DU_LOG("\nINFO --> PHY_STUB : Slot indication stopped"); + + /* Initialize all global variables */ + sfnValue = 0; + slotValue = 0; + rachIndSent = false; + msg3Sent = false; + msg5ShortBsrSent = false; + msg5Sent = false; + dlDedMsg = false; + msgSecurityModeComp = false; + msgRrcReconfiguration = false; + msgRegistrationComp = false; + + /* Send Stop indication to MAC */ + sleep(1); + l1BuildAndSendStopInd(); } /******************************************************************* @@ -76,23 +104,21 @@ void *GenerateTicks(void *arg) * ****************************************************************/ void l1HdlSlotIndicaion(bool stopSlotInd) { + Pst pst; int ret; + Buffer *mBuf = NULLP; if(!stopSlotInd) { - ret = pthread_create(&thread, NULL, GenerateTicks, NULL); - if(ret) - { - DU_LOG("\nERROR --> PHY_STUB: Unable to create thread"); - } + DU_LOG("\nPHY_STUB: Sending start slot indication event to self"); + memset(&pst, 0, sizeof(Pst)); + FILL_PST_PHY_TO_PHY(pst, EVT_PHY_START_SLOT_IND); + ODU_GET_MSG_BUF(pst.region, pst.pool, &mBuf); + ODU_POST_TASK(&pst, mBuf); } else { - ret = pthread_cancel(thread); - if(ret) - { - DU_LOG("\nERROR --> PHY_STUB: Unable to stop thread"); - } + slotIndicationStarted = false; } } @@ -123,6 +149,12 @@ void *l1ConsoleHandler(void *args) DU_LOG("\nDEBUG --> PHY STUB: Sending UL User Data"); l1SendUlUserData(); } + else if((ch = getchar()) == 'c') + { + /* Send Control PDU from PHY stub to DU */ + DU_LOG("\nDEBUG --> PHY STUB: Sending Status PDU"); + l1SendStatusPdu(); + } } }