mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[wpiutil] timestamp: Call FPGA functions directly (#5235)
This works around an exit race with wpi::Now() on Rio; it was overridden to call HAL_GetFPGATime(), which calls chipobject, but on exit, because there was not a library dependency, the chipobject could be destroyed prior to wpiutil/wpinet being shut down.
This commit is contained in:
@@ -11,6 +11,13 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Initialize the on-Rio Now() implementation to use the FPGA timestamp.
|
||||
* No effect on non-Rio platforms. This is called by HAL_Initialize() and
|
||||
* thus should generally not be called by user code.
|
||||
*/
|
||||
void WPI_Impl_SetupNowRio(void);
|
||||
|
||||
/**
|
||||
* The default implementation used for Now().
|
||||
* In general this is the time returned by the operating system.
|
||||
@@ -48,12 +55,21 @@ uint64_t WPI_GetSystemTime(void);
|
||||
#ifdef __cplusplus
|
||||
namespace wpi {
|
||||
|
||||
namespace impl {
|
||||
/**
|
||||
* Initialize the on-Rio Now() implementation to use the FPGA timestamp.
|
||||
* No effect on non-Rio platforms. This is called by HAL_Initialize() and
|
||||
* thus should generally not be called by user code.
|
||||
*/
|
||||
void SetupNowRio();
|
||||
} // namespace impl
|
||||
|
||||
/**
|
||||
* The default implementation used for Now().
|
||||
* In general this is the time returned by the operating system.
|
||||
* @return Time in microseconds.
|
||||
*/
|
||||
uint64_t NowDefault(void);
|
||||
uint64_t NowDefault();
|
||||
|
||||
/**
|
||||
* Set the implementation used by Now().
|
||||
@@ -68,7 +84,7 @@ void SetNowImpl(uint64_t (*func)());
|
||||
* This is a monotonic clock with an undefined epoch.
|
||||
* @return Time in microseconds.
|
||||
*/
|
||||
uint64_t Now(void);
|
||||
uint64_t Now();
|
||||
|
||||
/**
|
||||
* Return the current system time in microseconds since the Unix epoch
|
||||
|
||||
Reference in New Issue
Block a user