native_simulator: Get latest from upstream

Align with native_simulator's upstream main
880eea00abf0191f3d986559876359a5422c9618

Which includes:
* 880eea0 HW scheduler: Minor optimization
* 37c0d86 Minor: Comment fix: Remove out of date reference

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2024-01-12 15:50:35 +01:00 committed by Fabio Baltieri
commit 1fc6550a25
3 changed files with 12 additions and 16 deletions

View file

@ -16,7 +16,11 @@ extern "C" {
#define NSI_NEVER UINT64_MAX #define NSI_NEVER UINT64_MAX
/* API intended for the native simulator specific embedded drivers: */ /* API intended for the native simulator specific embedded drivers: */
uint64_t nsi_hws_get_time(void); static inline uint64_t nsi_hws_get_time(void)
{
extern uint64_t nsi_simu_time;
return nsi_simu_time;
}
/* Internal APIs to the native_simulator and its HW models: */ /* Internal APIs to the native_simulator and its HW models: */
void nsi_hws_init(void); void nsi_hws_init(void);

View file

@ -50,7 +50,7 @@ NSI_FUNC_NORETURN void nsi_exit(int exit_code)
} }
/** /**
* Run all early native_posix initialization steps, including command * Run all early native simulator initialization steps, including command
* line parsing and CPU start, until we are ready to let the HW models * line parsing and CPU start, until we are ready to let the HW models
* run via hwm_one_event() * run via hwm_one_event()
*/ */

View file

@ -21,7 +21,7 @@
#include "nsi_hw_scheduler.h" #include "nsi_hw_scheduler.h"
#include "nsi_hws_models_if.h" #include "nsi_hws_models_if.h"
static uint64_t simu_time; /* The actual time as known by the HW models */ uint64_t nsi_simu_time; /* The actual time as known by the HW models */
static uint64_t end_of_time = NSI_NEVER; /* When will this device stop */ static uint64_t end_of_time = NSI_NEVER; /* When will this device stop */
extern struct nsi_hw_event_st __nsi_hw_events_start[]; extern struct nsi_hw_event_st __nsi_hw_events_start[];
@ -74,21 +74,21 @@ static void nsi_hws_set_sig_handler(void)
static void nsi_hws_sleep_until_next_event(void) static void nsi_hws_sleep_until_next_event(void)
{ {
if (next_timer_time >= simu_time) { /* LCOV_EXCL_BR_LINE */ if (next_timer_time >= nsi_simu_time) { /* LCOV_EXCL_BR_LINE */
simu_time = next_timer_time; nsi_simu_time = next_timer_time;
} else { } else {
/* LCOV_EXCL_START */ /* LCOV_EXCL_START */
nsi_print_warning("next_timer_time corrupted (%"PRIu64"<= %" nsi_print_warning("next_timer_time corrupted (%"PRIu64"<= %"
PRIu64", timer idx=%i)\n", PRIu64", timer idx=%i)\n",
(uint64_t)next_timer_time, (uint64_t)next_timer_time,
(uint64_t)simu_time, (uint64_t)nsi_simu_time,
next_timer_index); next_timer_index);
/* LCOV_EXCL_STOP */ /* LCOV_EXCL_STOP */
} }
if (signaled_end || (simu_time > end_of_time)) { if (signaled_end || (nsi_simu_time > end_of_time)) {
nsi_print_trace("\nStopped at %.3Lfs\n", nsi_print_trace("\nStopped at %.3Lfs\n",
((long double)simu_time)/1.0e6L); ((long double)nsi_simu_time)/1.0e6L);
nsi_exit(0); nsi_exit(0);
} }
} }
@ -141,14 +141,6 @@ void nsi_hws_set_end_of_time(uint64_t new_end_of_time)
end_of_time = new_end_of_time; end_of_time = new_end_of_time;
} }
/**
* Return the current simulated time as known by the device
*/
uint64_t nsi_hws_get_time(void)
{
return simu_time;
}
/** /**
* Function to initialize the HW scheduler * Function to initialize the HW scheduler
* *