diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7.c b/nfapi/open-nFAPI/pnf/src/pnf_p7.c index 3325d2106b..8b1f9be3be 100644 --- a/nfapi/open-nFAPI/pnf/src/pnf_p7.c +++ b/nfapi/open-nFAPI/pnf/src/pnf_p7.c @@ -30,6 +30,8 @@ #include "pnf_p7.h" #include "nr_fapi_p7_utils.h" // for 5G/NR message utils +#include "common/ran_context.h" +#include #define FAPI2_IP_DSCP 0 extern int sf_ahead; @@ -1325,6 +1327,30 @@ bool is_nr_p7_request_in_window(const uint16_t sfn, const uint16_t slot, const c return true; } +/*! \brief Checks if the slot a message is intended to configure is of the appropriate type ( DL or UL slot ) + * \param sfn The SFN from a P7 message + * \param slot The Slot from a P7 message + * \param name A string with the message name (e.g. DL_TTI.request) for the warning + * \param type The slot type intended for the message ( NR_DOWNLINK_SLOT or NR_UPLINK_SLOT ) + * \return true if the slot type is correct, false if not + * + * The function will take a SFN and Slot and check if it is of the intended type ( DL or UL ), indicated by parameter type + * Will print a warning if the check fails and return false + * returns true on success + */ +bool check_nr_nfapi_p7_slot_type(const uint16_t sfn, const uint16_t slot, const char* name, int type) +{ + DevAssert(RC.gNB != NULL && RC.gNB[0] != NULL); + PHY_VARS_gNB *gNB = RC.gNB[0]; + nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; + const int slot_type = nr_slot_select(cfg, sfn, slot); + if(slot_type != type && slot_type != NR_MIXED_SLOT) { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%4d.%2d Slot type is not appropriate for %s\n", sfn, slot, name); + return false; + } + return true; +} + uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy) { uint32_t recv_sfn_sf_dec = NFAPI_SFNSF2DEC(sfnsf);