From 6793cb300a9cf0dd99844b96a0ba4930659d536a Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Tue, 26 Mar 2024 12:51:45 +0100 Subject: [PATCH] Refactor NR_UE_L2_STATE_t enum definition using X-Macro - this change simplifies the enum definition and makes it easier to add, remove, or modify states in the future - the states are now defined in the NR_UE_L2_STATES macro, and the enum members are generated automatically from this macro --- openair2/LAYER2/NR_MAC_UE/mac_defs.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 4a79b6e38d..86ffb4ebdd 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -163,12 +163,18 @@ #define PRACH_MASK_INDEX 54 #define RESERVED_NR_DCI 55 +// Define the UE L2 states with X-Macro +#define NR_UE_L2_STATES \ + UE_STATE(UE_NOT_SYNC) \ + UE_STATE(UE_SYNC) \ + UE_STATE(UE_PERFORMING_RA) \ + UE_STATE(UE_CONNECTED) + /*!\brief UE layer 2 status */ typedef enum { - UE_NOT_SYNC = 0, - UE_SYNC, - UE_PERFORMING_RA, - UE_CONNECTED +#define UE_STATE(state) state, + NR_UE_L2_STATES +#undef UE_STATE } NR_UE_L2_STATE_t; typedef enum {