Commit 6e4787a5 authored by francescomani's avatar francescomani

Merge remote-tracking branch 'origin/NR_reworking_timers' into integration_2024_w04

parents 2f0c302e 65a8f073
...@@ -865,3 +865,44 @@ void nr_est_delay(int ofdm_symbol_size, const c16_t *ls_est, c16_t *ch_estimates ...@@ -865,3 +865,44 @@ void nr_est_delay(int ofdm_symbol_size, const c16_t *ls_est, c16_t *ch_estimates
delay->delay_max_val = max_val; delay->delay_max_val = max_val;
delay->est_delay = max_pos - sync_pos; delay->est_delay = max_pos - sync_pos;
} }
void nr_timer_start(NR_timer_t *timer)
{
timer->active = true;
timer->counter = 0;
}
void nr_timer_stop(NR_timer_t *timer)
{
timer->active = false;
timer->counter = 0;
}
bool is_nr_timer_active(NR_timer_t timer)
{
return timer.active;
}
bool nr_timer_tick(NR_timer_t *timer)
{
bool expired = false;
if (timer->active) {
timer->counter += timer->step;
expired = nr_timer_expired(*timer);
if (expired)
timer->active = false;
}
return expired;
}
bool nr_timer_expired(NR_timer_t timer)
{
return (timer.counter >= timer.target);
}
void nr_timer_setup(NR_timer_t *timer, const uint32_t target, const uint32_t step)
{
timer->target = target;
timer->step = step;
nr_timer_stop(timer);
}
...@@ -116,6 +116,49 @@ typedef struct { ...@@ -116,6 +116,49 @@ typedef struct {
int delay_max_val; int delay_max_val;
} delay_t; } delay_t;
typedef struct {
bool active;
uint32_t counter;
uint32_t target;
uint32_t step;
} NR_timer_t;
/**
* @brief To start a timer
* @param timer Timer to be started
*/
void nr_timer_start(NR_timer_t *timer);
/**
* @brief To stop a timer
* @param timer Timer to stopped
*/
void nr_timer_stop(NR_timer_t *timer);
/**
* @brief If active, it increases timer counter by an amout of units equal to step. It stops timer if expired
* @param timer Timer to be handled
* @return Indication if the timer is expired or not
*/
bool nr_timer_tick(NR_timer_t *timer);
/**
* @brief To setup a timer
* @param timer Timer to setup
* @param target Target value for timer (when reached, timer is considered expired)
* @param step Amount of units to add to timer counter every tick
*/
void nr_timer_setup(NR_timer_t *timer, const uint32_t target, const uint32_t step);
/**
* @brief To check if a timer is expired
* @param timer Timer to be checked
* @return Indication if the timer is expired or not
*/
bool nr_timer_expired(NR_timer_t timer);
/**
* @brief To check if a timer is active
* @param timer Timer to be checked
* @return Indication if the timer is active or not
*/
bool is_nr_timer_active(NR_timer_t timer);
extern const nr_bandentry_t nr_bandtable[]; extern const nr_bandentry_t nr_bandtable[];
static inline int get_num_dmrs(uint16_t dmrs_mask ) { static inline int get_num_dmrs(uint16_t dmrs_mask ) {
......
This diff is collapsed.
...@@ -114,74 +114,53 @@ typedef enum RA_trigger_e { ...@@ -114,74 +114,53 @@ typedef enum RA_trigger_e {
typedef struct UE_RRC_SI_INFO_NR_s { typedef struct UE_RRC_SI_INFO_NR_s {
uint32_t default_otherSI_map; uint32_t default_otherSI_map;
NR_SIB1_t *sib1; NR_SIB1_t *sib1;
int sib1_timer; NR_timer_t sib1_timer;
NR_SIB2_t *sib2; NR_SIB2_t *sib2;
int sib2_timer; NR_timer_t sib2_timer;
NR_SIB3_t *sib3; NR_SIB3_t *sib3;
int sib3_timer; NR_timer_t sib3_timer;
NR_SIB4_t *sib4; NR_SIB4_t *sib4;
int sib4_timer; NR_timer_t sib4_timer;
NR_SIB5_t *sib5; NR_SIB5_t *sib5;
int sib5_timer; NR_timer_t sib5_timer;
NR_SIB6_t *sib6; NR_SIB6_t *sib6;
int sib6_timer; NR_timer_t sib6_timer;
NR_SIB7_t *sib7; NR_SIB7_t *sib7;
int sib7_timer; NR_timer_t sib7_timer;
NR_SIB8_t *sib8; NR_SIB8_t *sib8;
int sib8_timer; NR_timer_t sib8_timer;
NR_SIB9_t *sib9; NR_SIB9_t *sib9;
int sib9_timer; NR_timer_t sib9_timer;
NR_SIB10_r16_t *sib10; NR_SIB10_r16_t *sib10;
int sib10_timer; NR_timer_t sib10_timer;
NR_SIB11_r16_t *sib11; NR_SIB11_r16_t *sib11;
int sib11_timer; NR_timer_t sib11_timer;
NR_SIB12_r16_t *sib12; NR_SIB12_r16_t *sib12;
int sib12_timer; NR_timer_t sib12_timer;
NR_SIB13_r16_t *sib13; NR_SIB13_r16_t *sib13;
int sib13_timer; NR_timer_t sib13_timer;
NR_SIB14_r16_t *sib14; NR_SIB14_r16_t *sib14;
int sib14_timer; NR_timer_t sib14_timer;
} __attribute__ ((__packed__)) NR_UE_RRC_SI_INFO; } NR_UE_RRC_SI_INFO;
typedef struct NR_UE_Timers_Constants_s { typedef struct NR_UE_Timers_Constants_s {
// timers status
bool T300_active;
bool T301_active;
bool T302_active;
bool T304_active;
bool T310_active;
bool T311_active;
bool T319_active;
bool T320_active;
bool T325_active;
bool T390_active;
// timers // timers
uint32_t T300_cnt; NR_timer_t T300;
uint32_t T301_cnt; NR_timer_t T301;
uint32_t T302_cnt; NR_timer_t T302;
uint32_t T304_cnt; NR_timer_t T304;
uint32_t T310_cnt; NR_timer_t T310;
uint32_t T311_cnt; NR_timer_t T311;
uint32_t T319_cnt; NR_timer_t T319;
uint32_t T320_cnt; NR_timer_t T320;
uint32_t T325_cnt; NR_timer_t T325;
uint32_t T390_cnt; NR_timer_t T390;
// counters // counters
uint32_t N310_cnt; uint32_t N310_cnt;
uint32_t N311_cnt; uint32_t N311_cnt;
// constants (limits configured by the network) // constants (limits configured by the network)
uint32_t N310_k; uint32_t N310_k;
uint32_t N311_k; uint32_t N311_k;
uint32_t T300_k;
uint32_t T301_k;
uint32_t T302_k;
uint32_t T304_k;
uint32_t T310_k;
uint32_t T311_k;
uint32_t T319_k;
uint32_t T320_k;
uint32_t T325_k;
uint32_t T390_k;
} NR_UE_Timers_Constants_t; } NR_UE_Timers_Constants_t;
typedef enum { typedef enum {
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#ifndef _RRC_PROTO_H_ #ifndef _RRC_PROTO_H_
#define _RRC_PROTO_H_ #define _RRC_PROTO_H_
#include "oai_asn1.h"
#include "rrc_defs.h" #include "rrc_defs.h"
#include "NR_RRCReconfiguration.h" #include "NR_RRCReconfiguration.h"
#include "NR_MeasConfig.h" #include "NR_MeasConfig.h"
...@@ -108,6 +108,7 @@ extern void start_oai_nrue_threads(void); ...@@ -108,6 +108,7 @@ extern void start_oai_nrue_threads(void);
int get_from_lte_ue_fd(); int get_from_lte_ue_fd();
void nr_rrc_SI_timers(NR_UE_RRC_SI_INFO *SInfo); void nr_rrc_SI_timers(NR_UE_RRC_SI_INFO *SInfo);
void init_SI_timers(NR_UE_RRC_SI_INFO *SInfo);
void nr_ue_rrc_timer_trigger(int module_id, int frame, int gnb_id); void nr_ue_rrc_timer_trigger(int module_id, int frame, int gnb_id);
void handle_t300_expiry(NR_UE_RRC_INST_t *rrc); void handle_t300_expiry(NR_UE_RRC_INST_t *rrc);
...@@ -115,9 +116,8 @@ void handle_t300_expiry(NR_UE_RRC_INST_t *rrc); ...@@ -115,9 +116,8 @@ void handle_t300_expiry(NR_UE_RRC_INST_t *rrc);
void reset_rlf_timers_and_constants(NR_UE_Timers_Constants_t *tac); void reset_rlf_timers_and_constants(NR_UE_Timers_Constants_t *tac);
void set_default_timers_and_constants(NR_UE_Timers_Constants_t *tac); void set_default_timers_and_constants(NR_UE_Timers_Constants_t *tac);
void nr_rrc_set_sib1_timers_and_constants(NR_UE_Timers_Constants_t *tac, NR_SIB1_t *sib1); void nr_rrc_set_sib1_timers_and_constants(NR_UE_Timers_Constants_t *tac, NR_SIB1_t *sib1);
void nr_rrc_set_T304(NR_UE_Timers_Constants_t *tac, NR_ReconfigurationWithSync_t *reconfigurationWithSync); int nr_rrc_get_T304(long t304);
void handle_rlf_sync(NR_UE_Timers_Constants_t *tac, void handle_rlf_sync(NR_UE_Timers_Constants_t *tac, nr_sync_msg_t sync_msg);
nr_sync_msg_t sync_msg);
void nr_rrc_handle_SetupRelease_RLF_TimersAndConstants(NR_UE_RRC_INST_t *rrc, void nr_rrc_handle_SetupRelease_RLF_TimersAndConstants(NR_UE_RRC_INST_t *rrc,
struct NR_SetupRelease_RLF_TimersAndConstants *rlf_TimersAndConstants); struct NR_SetupRelease_RLF_TimersAndConstants *rlf_TimersAndConstants);
......
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