2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
2017-10-21 20:31:20 -07:00
|
|
|
|
2018-04-29 23:33:19 -07:00
|
|
|
#include "wpi/timestamp.h"
|
2016-09-25 17:23:39 -07:00
|
|
|
|
2017-11-19 11:47:06 -08:00
|
|
|
#include <atomic>
|
2023-12-08 23:22:59 -08:00
|
|
|
#include <optional>
|
2017-11-19 11:47:06 -08:00
|
|
|
|
2023-07-24 23:03:28 -07:00
|
|
|
#ifdef __FRC_ROBORIO__
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#pragma GCC diagnostic push
|
|
|
|
|
#pragma GCC diagnostic ignored "-Wpedantic"
|
|
|
|
|
#pragma GCC diagnostic ignored "-Wignored-qualifiers"
|
|
|
|
|
#include <FRC_FPGA_ChipObject/RoboRIO_FRC_ChipObject_Aliases.h>
|
2023-08-03 23:46:55 -07:00
|
|
|
#include <FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tHMB.h>
|
2023-07-24 23:03:28 -07:00
|
|
|
#pragma GCC diagnostic pop
|
|
|
|
|
namespace fpga {
|
|
|
|
|
using namespace nFPGA;
|
|
|
|
|
using namespace nRoboRIO_FPGANamespace;
|
|
|
|
|
} // namespace fpga
|
|
|
|
|
#include <memory>
|
2023-08-03 23:46:55 -07:00
|
|
|
|
|
|
|
|
#include "dlfcn.h"
|
2023-07-24 23:03:28 -07:00
|
|
|
#endif
|
|
|
|
|
|
2016-09-25 17:23:39 -07:00
|
|
|
#ifdef _WIN32
|
2017-10-21 20:31:20 -07:00
|
|
|
#include <windows.h>
|
|
|
|
|
|
2016-09-25 17:23:39 -07:00
|
|
|
#include <cassert>
|
|
|
|
|
#include <exception>
|
|
|
|
|
#else
|
|
|
|
|
#include <chrono>
|
|
|
|
|
#endif
|
|
|
|
|
|
2023-07-24 23:03:28 -07:00
|
|
|
#include <cstdio>
|
|
|
|
|
|
2023-08-28 15:13:34 -07:00
|
|
|
#include <fmt/format.h>
|
2023-07-24 23:03:28 -07:00
|
|
|
|
|
|
|
|
#ifdef __FRC_ROBORIO__
|
2023-08-03 23:46:55 -07:00
|
|
|
namespace {
|
|
|
|
|
static constexpr const char hmbName[] = "HMB_0_RAM";
|
|
|
|
|
static constexpr int timestampLowerOffset = 0xF0;
|
|
|
|
|
static constexpr int timestampUpperOffset = 0xF1;
|
|
|
|
|
static constexpr int hmbTimestampOffset = 5; // 5 us offset
|
|
|
|
|
using NiFpga_CloseHmbFunc = NiFpga_Status (*)(const NiFpga_Session session,
|
|
|
|
|
const char* memoryName);
|
|
|
|
|
using NiFpga_OpenHmbFunc = NiFpga_Status (*)(const NiFpga_Session session,
|
|
|
|
|
const char* memoryName,
|
|
|
|
|
size_t* memorySize,
|
|
|
|
|
void** virtualAddress);
|
2023-12-08 23:22:59 -08:00
|
|
|
using NiFpga_FindRegisterFunc = NiFpga_Status (*)(NiFpga_Session session,
|
|
|
|
|
const char* registerName,
|
|
|
|
|
uint32_t* registerOffset);
|
|
|
|
|
using NiFpga_ReadU32Func = NiFpga_Status (*)(NiFpga_Session session,
|
|
|
|
|
uint32_t indicator,
|
|
|
|
|
uint32_t* value);
|
|
|
|
|
using NiFpga_WriteU32Func = NiFpga_Status (*)(NiFpga_Session session,
|
|
|
|
|
uint32_t control, uint32_t value);
|
|
|
|
|
static void dlcloseWrapper(void* handle) {
|
|
|
|
|
dlclose(handle);
|
|
|
|
|
}
|
2023-11-15 21:58:51 -08:00
|
|
|
static std::atomic_flag hmbInitialized = ATOMIC_FLAG_INIT;
|
2023-12-08 23:22:59 -08:00
|
|
|
static std::atomic_flag nowUseDefaultOnFailure = ATOMIC_FLAG_INIT;
|
|
|
|
|
struct HMBLowLevel {
|
|
|
|
|
~HMBLowLevel() { Reset(); }
|
|
|
|
|
bool Configure(const NiFpga_Session session) {
|
2023-08-03 23:46:55 -07:00
|
|
|
int32_t status = 0;
|
2023-12-08 23:22:59 -08:00
|
|
|
niFpga.reset(dlopen("libNiFpga.so", RTLD_LAZY));
|
2023-08-03 23:46:55 -07:00
|
|
|
if (!niFpga) {
|
2023-11-29 10:10:07 -08:00
|
|
|
fmt::print(stderr, "Could not open libNiFpga.so\n");
|
2023-12-08 23:22:59 -08:00
|
|
|
return false;
|
2023-08-03 23:46:55 -07:00
|
|
|
}
|
|
|
|
|
NiFpga_OpenHmbFunc openHmb = reinterpret_cast<NiFpga_OpenHmbFunc>(
|
2023-12-08 23:22:59 -08:00
|
|
|
dlsym(niFpga.get(), "NiFpgaDll_OpenHmb"));
|
2023-08-03 23:46:55 -07:00
|
|
|
closeHmb = reinterpret_cast<NiFpga_CloseHmbFunc>(
|
2023-12-08 23:22:59 -08:00
|
|
|
dlsym(niFpga.get(), "NiFpgaDll_CloseHmb"));
|
|
|
|
|
NiFpga_FindRegisterFunc findRegister =
|
|
|
|
|
reinterpret_cast<NiFpga_FindRegisterFunc>(
|
|
|
|
|
dlsym(niFpga.get(), "NiFpgaDll_FindRegister"));
|
|
|
|
|
NiFpga_ReadU32Func readU32 = reinterpret_cast<NiFpga_ReadU32Func>(
|
|
|
|
|
dlsym(niFpga.get(), "NiFpgaDll_ReadU32"));
|
|
|
|
|
NiFpga_WriteU32Func writeU32 = reinterpret_cast<NiFpga_WriteU32Func>(
|
|
|
|
|
dlsym(niFpga.get(), "NiFpgaDll_WriteU32"));
|
|
|
|
|
if (openHmb == nullptr || closeHmb == nullptr || findRegister == nullptr ||
|
|
|
|
|
writeU32 == nullptr || readU32 == nullptr) {
|
2023-11-29 10:10:07 -08:00
|
|
|
fmt::print(stderr, "Could not find HMB symbols in libNiFpga.so\n");
|
2023-12-08 23:22:59 -08:00
|
|
|
niFpga = nullptr;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
uint32_t hmbConfigRegister = 0;
|
|
|
|
|
status = findRegister(session, "HMB.Config", &hmbConfigRegister);
|
|
|
|
|
if (status != 0) {
|
|
|
|
|
fmt::print(stderr, "Failed to find HMB.Config register, status code {}\n",
|
|
|
|
|
status);
|
2023-08-03 23:46:55 -07:00
|
|
|
closeHmb = nullptr;
|
2023-12-08 23:22:59 -08:00
|
|
|
niFpga = nullptr;
|
|
|
|
|
return false;
|
2023-08-03 23:46:55 -07:00
|
|
|
}
|
|
|
|
|
size_t hmbBufferSize = 0;
|
|
|
|
|
status =
|
2023-12-08 23:22:59 -08:00
|
|
|
openHmb(session, hmbName, &hmbBufferSize,
|
2023-08-03 23:46:55 -07:00
|
|
|
reinterpret_cast<void**>(const_cast<uint32_t**>(&hmbBuffer)));
|
|
|
|
|
if (status != 0) {
|
2023-11-29 10:10:07 -08:00
|
|
|
fmt::print(stderr, "Failed to open HMB, status code {}\n", status);
|
2023-08-03 23:46:55 -07:00
|
|
|
closeHmb = nullptr;
|
2023-12-08 23:22:59 -08:00
|
|
|
niFpga = nullptr;
|
|
|
|
|
return false;
|
2023-08-03 23:46:55 -07:00
|
|
|
}
|
2023-12-08 23:22:59 -08:00
|
|
|
fpga::tHMB::tConfig cfg;
|
|
|
|
|
uint32_t read = 0;
|
|
|
|
|
status = readU32(session, hmbConfigRegister, &read);
|
|
|
|
|
cfg.value = read;
|
2023-08-03 23:46:55 -07:00
|
|
|
cfg.Enables_Timestamp = 1;
|
2023-12-08 23:22:59 -08:00
|
|
|
status = writeU32(session, hmbConfigRegister, cfg.value);
|
|
|
|
|
hmbSession.emplace(session);
|
2023-11-15 21:58:51 -08:00
|
|
|
hmbInitialized.test_and_set();
|
2023-12-08 23:22:59 -08:00
|
|
|
return true;
|
2023-08-03 23:46:55 -07:00
|
|
|
}
|
2023-09-07 09:59:39 -07:00
|
|
|
void Reset() {
|
2023-11-15 21:58:51 -08:00
|
|
|
hmbInitialized.clear();
|
2023-12-08 23:22:59 -08:00
|
|
|
std::optional<NiFpga_Session> oldSesh;
|
|
|
|
|
hmbSession.swap(oldSesh);
|
|
|
|
|
if (oldSesh.has_value()) {
|
|
|
|
|
closeHmb(oldSesh.value(), hmbName);
|
2023-09-07 09:59:39 -07:00
|
|
|
niFpga = nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-12-08 23:22:59 -08:00
|
|
|
std::optional<NiFpga_Session> hmbSession;
|
2023-08-03 23:46:55 -07:00
|
|
|
NiFpga_CloseHmbFunc closeHmb = nullptr;
|
|
|
|
|
volatile uint32_t* hmbBuffer = nullptr;
|
2023-12-08 23:22:59 -08:00
|
|
|
std::unique_ptr<void, decltype(&dlcloseWrapper)> niFpga{nullptr,
|
|
|
|
|
dlcloseWrapper};
|
|
|
|
|
};
|
|
|
|
|
struct HMBHolder {
|
2024-02-15 22:57:06 -08:00
|
|
|
bool Configure(void* col, std::unique_ptr<fpga::tHMB> hmbObject) {
|
2023-12-08 23:22:59 -08:00
|
|
|
hmb = std::move(hmbObject);
|
|
|
|
|
chipObjectLibrary.reset(col);
|
|
|
|
|
if (!lowLevel.Configure(hmb->getSystemInterface()->getHandle())) {
|
|
|
|
|
hmb = nullptr;
|
|
|
|
|
chipObjectLibrary = nullptr;
|
2024-02-15 22:57:06 -08:00
|
|
|
return false;
|
2023-12-08 23:22:59 -08:00
|
|
|
}
|
2024-02-15 22:57:06 -08:00
|
|
|
return true;
|
2023-12-08 23:22:59 -08:00
|
|
|
}
|
|
|
|
|
void Reset() {
|
|
|
|
|
lowLevel.Reset();
|
|
|
|
|
hmb = nullptr;
|
|
|
|
|
chipObjectLibrary = nullptr;
|
|
|
|
|
}
|
|
|
|
|
HMBLowLevel lowLevel;
|
|
|
|
|
std::unique_ptr<fpga::tHMB> hmb;
|
|
|
|
|
std::unique_ptr<void, decltype(&dlcloseWrapper)> chipObjectLibrary{
|
|
|
|
|
nullptr, dlcloseWrapper};
|
2023-08-03 23:46:55 -07:00
|
|
|
};
|
|
|
|
|
static HMBHolder hmb;
|
|
|
|
|
} // namespace
|
2023-07-24 23:03:28 -07:00
|
|
|
#endif
|
|
|
|
|
|
2016-09-25 17:23:39 -07:00
|
|
|
// offset in microseconds
|
2021-12-28 01:06:31 -06:00
|
|
|
static uint64_t time_since_epoch() noexcept {
|
2016-09-25 17:23:39 -07:00
|
|
|
#ifdef _WIN32
|
|
|
|
|
FILETIME ft;
|
2017-11-19 11:47:06 -08:00
|
|
|
uint64_t tmpres = 0;
|
2016-09-25 17:23:39 -07:00
|
|
|
// 100-nanosecond intervals since January 1, 1601 (UTC)
|
|
|
|
|
// which means 0.1 us
|
2023-10-03 20:38:48 -07:00
|
|
|
GetSystemTimePreciseAsFileTime(&ft);
|
2016-09-25 17:23:39 -07:00
|
|
|
tmpres |= ft.dwHighDateTime;
|
|
|
|
|
tmpres <<= 32;
|
|
|
|
|
tmpres |= ft.dwLowDateTime;
|
2017-11-19 11:47:06 -08:00
|
|
|
tmpres /= 10u; // convert to us
|
2016-09-25 17:23:39 -07:00
|
|
|
// January 1st, 1970 - January 1st, 1601 UTC ~ 369 years
|
2017-11-19 11:47:06 -08:00
|
|
|
// or 11644473600000000 us
|
|
|
|
|
static const uint64_t deltaepoch = 11644473600000000ull;
|
2016-09-25 17:23:39 -07:00
|
|
|
tmpres -= deltaepoch;
|
|
|
|
|
return tmpres;
|
|
|
|
|
#else
|
2017-10-21 20:31:20 -07:00
|
|
|
// 1-us intervals
|
|
|
|
|
return std::chrono::duration_cast<std::chrono::microseconds>(
|
2021-12-28 01:06:31 -06:00
|
|
|
std::chrono::system_clock::now().time_since_epoch())
|
2017-11-19 11:47:06 -08:00
|
|
|
.count();
|
2016-09-25 17:23:39 -07:00
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-28 17:12:51 -08:00
|
|
|
static uint64_t timestamp() noexcept {
|
2016-09-25 17:23:39 -07:00
|
|
|
#ifdef _WIN32
|
|
|
|
|
LARGE_INTEGER li;
|
|
|
|
|
QueryPerformanceCounter(&li);
|
|
|
|
|
// there is an imprecision with the initial value,
|
|
|
|
|
// but what matters is that timestamps are monotonic and consistent
|
2017-11-19 11:47:06 -08:00
|
|
|
return static_cast<uint64_t>(li.QuadPart);
|
2016-09-25 17:23:39 -07:00
|
|
|
#else
|
2017-11-19 11:47:06 -08:00
|
|
|
// 1-us intervals
|
2017-10-21 20:31:20 -07:00
|
|
|
return std::chrono::duration_cast<std::chrono::microseconds>(
|
|
|
|
|
std::chrono::steady_clock::now().time_since_epoch())
|
2017-11-19 11:47:06 -08:00
|
|
|
.count();
|
2016-09-25 17:23:39 -07:00
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
2017-11-19 11:47:06 -08:00
|
|
|
static uint64_t update_frequency() {
|
2016-09-25 17:23:39 -07:00
|
|
|
LARGE_INTEGER li;
|
|
|
|
|
if (!QueryPerformanceFrequency(&li) || !li.QuadPart) {
|
|
|
|
|
// log something
|
|
|
|
|
std::terminate();
|
|
|
|
|
}
|
2017-11-19 11:47:06 -08:00
|
|
|
return static_cast<uint64_t>(li.QuadPart);
|
2016-09-25 17:23:39 -07:00
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-12-28 01:06:31 -06:00
|
|
|
static const uint64_t zerotime_val = time_since_epoch();
|
2017-11-19 11:47:06 -08:00
|
|
|
static const uint64_t offset_val = timestamp();
|
2016-09-25 17:23:39 -07:00
|
|
|
#ifdef _WIN32
|
2017-11-19 11:47:06 -08:00
|
|
|
static const uint64_t frequency_val = update_frequency();
|
2016-09-25 17:23:39 -07:00
|
|
|
#endif
|
|
|
|
|
|
2017-11-19 11:47:06 -08:00
|
|
|
uint64_t wpi::NowDefault() {
|
2016-09-25 17:23:39 -07:00
|
|
|
#ifdef _WIN32
|
|
|
|
|
assert(offset_val > 0u);
|
|
|
|
|
assert(frequency_val > 0u);
|
2017-11-19 11:47:06 -08:00
|
|
|
uint64_t delta = timestamp() - offset_val;
|
2016-09-25 17:23:39 -07:00
|
|
|
// because the frequency is in update per seconds, we have to multiply the
|
2017-11-19 11:47:06 -08:00
|
|
|
// delta by 1,000,000
|
|
|
|
|
uint64_t delta_in_us = delta * 1000000ull / frequency_val;
|
2016-09-25 17:23:39 -07:00
|
|
|
return delta_in_us + zerotime_val;
|
|
|
|
|
#else
|
|
|
|
|
return zerotime_val + timestamp() - offset_val;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-19 11:47:06 -08:00
|
|
|
static std::atomic<uint64_t (*)()> now_impl{wpi::NowDefault};
|
|
|
|
|
|
2023-12-08 23:22:59 -08:00
|
|
|
void wpi::impl::SetupNowDefaultOnRio() {
|
|
|
|
|
#ifdef __FRC_ROBORIO__
|
|
|
|
|
nowUseDefaultOnFailure.test_and_set();
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-24 23:03:28 -07:00
|
|
|
#ifdef __FRC_ROBORIO__
|
2023-12-08 23:22:59 -08:00
|
|
|
template <>
|
2024-02-15 22:57:06 -08:00
|
|
|
bool wpi::impl::SetupNowRio(void* chipObjectLibrary,
|
2023-12-08 23:22:59 -08:00
|
|
|
std::unique_ptr<fpga::tHMB> hmbObject) {
|
2023-11-15 21:58:51 -08:00
|
|
|
if (!hmbInitialized.test()) {
|
2024-02-15 22:57:06 -08:00
|
|
|
return hmb.Configure(chipObjectLibrary, std::move(hmbObject));
|
2023-12-08 23:22:59 -08:00
|
|
|
}
|
2024-02-15 22:57:06 -08:00
|
|
|
return true;
|
2023-12-08 23:22:59 -08:00
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2024-02-15 22:57:06 -08:00
|
|
|
bool wpi::impl::SetupNowRio(uint32_t session) {
|
2023-12-08 23:22:59 -08:00
|
|
|
#ifdef __FRC_ROBORIO__
|
|
|
|
|
if (!hmbInitialized.test()) {
|
2024-02-15 22:57:06 -08:00
|
|
|
return hmb.lowLevel.Configure(session);
|
2023-07-24 23:03:28 -07:00
|
|
|
}
|
|
|
|
|
#endif
|
2024-02-15 22:57:06 -08:00
|
|
|
return true;
|
2023-07-24 23:03:28 -07:00
|
|
|
}
|
|
|
|
|
|
2023-09-07 09:59:39 -07:00
|
|
|
void wpi::impl::ShutdownNowRio() {
|
|
|
|
|
#ifdef __FRC_ROBORIO__
|
|
|
|
|
hmb.Reset();
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-19 11:47:06 -08:00
|
|
|
void wpi::SetNowImpl(uint64_t (*func)(void)) {
|
|
|
|
|
now_impl = func ? func : NowDefault;
|
2016-09-25 17:23:39 -07:00
|
|
|
}
|
2017-11-19 11:47:06 -08:00
|
|
|
|
2020-12-28 12:58:06 -08:00
|
|
|
uint64_t wpi::Now() {
|
2023-07-24 23:03:28 -07:00
|
|
|
#ifdef __FRC_ROBORIO__
|
|
|
|
|
// Same code as HAL_GetFPGATime()
|
2023-11-15 21:58:51 -08:00
|
|
|
if (!hmbInitialized.test()) {
|
2023-12-08 23:22:59 -08:00
|
|
|
if (nowUseDefaultOnFailure.test()) {
|
2023-12-13 15:20:24 -08:00
|
|
|
return timestamp() - offset_val;
|
2023-12-08 23:22:59 -08:00
|
|
|
} else {
|
2024-02-25 11:25:46 -08:00
|
|
|
static uint64_t last = 0;
|
|
|
|
|
uint64_t cur = timestamp();
|
|
|
|
|
if ((cur - last) > 100000) {
|
|
|
|
|
last = cur;
|
|
|
|
|
fmt::print(stderr,
|
|
|
|
|
"FPGA not yet configured in wpi::Now(). Time will not be "
|
|
|
|
|
"correct.\n");
|
|
|
|
|
std::fflush(stderr);
|
|
|
|
|
}
|
2023-12-08 23:22:59 -08:00
|
|
|
return 1;
|
|
|
|
|
}
|
2023-07-24 23:03:28 -07:00
|
|
|
}
|
2023-08-03 23:46:55 -07:00
|
|
|
|
|
|
|
|
asm("dmb");
|
2023-12-08 23:22:59 -08:00
|
|
|
uint64_t upper1 = hmb.lowLevel.hmbBuffer[timestampUpperOffset];
|
2023-08-03 23:46:55 -07:00
|
|
|
asm("dmb");
|
2023-12-08 23:22:59 -08:00
|
|
|
uint32_t lower = hmb.lowLevel.hmbBuffer[timestampLowerOffset];
|
2023-08-03 23:46:55 -07:00
|
|
|
asm("dmb");
|
2023-12-08 23:22:59 -08:00
|
|
|
uint64_t upper2 = hmb.lowLevel.hmbBuffer[timestampUpperOffset];
|
2023-08-03 23:46:55 -07:00
|
|
|
|
2023-07-24 23:03:28 -07:00
|
|
|
if (upper1 != upper2) {
|
|
|
|
|
// Rolled over between the lower call, reread lower
|
2023-08-03 23:46:55 -07:00
|
|
|
asm("dmb");
|
2023-12-08 23:22:59 -08:00
|
|
|
lower = hmb.lowLevel.hmbBuffer[timestampLowerOffset];
|
2023-07-24 23:03:28 -07:00
|
|
|
}
|
2023-08-03 23:46:55 -07:00
|
|
|
// 5 is added here because the time to write from the FPGA
|
|
|
|
|
// to the HMB buffer is longer then the time to read
|
|
|
|
|
// from the time register. This would cause register based
|
|
|
|
|
// timestamps to be ahead of HMB timestamps, which could
|
|
|
|
|
// be very bad.
|
|
|
|
|
return (upper2 << 32) + lower + hmbTimestampOffset;
|
2023-07-24 23:03:28 -07:00
|
|
|
#else
|
2020-12-28 12:58:06 -08:00
|
|
|
return (now_impl.load())();
|
2023-07-24 23:03:28 -07:00
|
|
|
#endif
|
2020-12-28 12:58:06 -08:00
|
|
|
}
|
2017-11-19 11:47:06 -08:00
|
|
|
|
2021-12-28 01:06:31 -06:00
|
|
|
uint64_t wpi::GetSystemTime() {
|
|
|
|
|
return time_since_epoch();
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-19 11:47:06 -08:00
|
|
|
extern "C" {
|
|
|
|
|
|
2023-12-08 23:22:59 -08:00
|
|
|
void WPI_Impl_SetupNowUseDefaultOnRio(void) {
|
|
|
|
|
return wpi::impl::SetupNowDefaultOnRio();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WPI_Impl_SetupNowRioWithSession(uint32_t session) {
|
2024-02-15 22:57:06 -08:00
|
|
|
wpi::impl::SetupNowRio(session);
|
2023-07-24 23:03:28 -07:00
|
|
|
}
|
|
|
|
|
|
2023-09-07 09:59:39 -07:00
|
|
|
void WPI_Impl_ShutdownNowRio(void) {
|
|
|
|
|
return wpi::impl::ShutdownNowRio();
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-28 12:58:06 -08:00
|
|
|
uint64_t WPI_NowDefault(void) {
|
|
|
|
|
return wpi::NowDefault();
|
|
|
|
|
}
|
2017-11-19 11:47:06 -08:00
|
|
|
|
2020-12-28 12:58:06 -08:00
|
|
|
void WPI_SetNowImpl(uint64_t (*func)(void)) {
|
|
|
|
|
wpi::SetNowImpl(func);
|
|
|
|
|
}
|
2017-11-19 11:47:06 -08:00
|
|
|
|
2020-12-28 12:58:06 -08:00
|
|
|
uint64_t WPI_Now(void) {
|
|
|
|
|
return wpi::Now();
|
|
|
|
|
}
|
2017-11-19 11:47:06 -08:00
|
|
|
|
2021-12-28 01:06:31 -06:00
|
|
|
uint64_t WPI_GetSystemTime(void) {
|
|
|
|
|
return wpi::GetSystemTime();
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-19 11:47:06 -08:00
|
|
|
} // extern "C"
|