ams: support building unit test programs on windows/linux/macos

This commit is contained in:
Michael Scire
2022-03-06 12:08:20 -08:00
committed by SciresM
parent 9a38be201a
commit 64a97576d0
756 changed files with 33359 additions and 9372 deletions

View File

@@ -138,7 +138,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
/* Get the value. */
double percent;
double percent{};
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().GetChargePercentage(std::addressof(percent)));
/* Set output. */
@@ -152,7 +152,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
/* Get the value. */
double percent;
double percent{};
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().GetVoltageFuelGaugePercentage(std::addressof(percent)));
/* Set output. */
@@ -166,7 +166,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
/* Get the value. */
double mah;
double mah{};
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().GetFullCapacity(std::addressof(mah), SenseResistorValue));
/* Set output. */
@@ -180,7 +180,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
/* Get the value. */
double mah;
double mah{};
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().GetRemainingCapacity(std::addressof(mah), SenseResistorValue));
/* Set output. */
@@ -239,7 +239,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
/* Get the value. */
double ma;
double ma{};
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().GetAverageCurrent(std::addressof(ma), SenseResistorValue));
/* Set output. */
@@ -253,7 +253,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
/* Get the value. */
double ma;
double ma{};
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().GetCurrent(std::addressof(ma), SenseResistorValue));
/* Set output. */
@@ -350,7 +350,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
/* Get the battery cycles. */
u16 cycles;
u16 cycles{};
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().GetCycles(std::addressof(cycles)));
/* Set output. */
@@ -373,7 +373,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
/* Get the value. */
double percent;
double percent{};
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().GetAge(std::addressof(percent)));
/* Set output. */
@@ -387,7 +387,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
/* Get the value. */
double temp;
double temp{};
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().GetTemperature(std::addressof(temp)));
/* Set output. */
@@ -401,7 +401,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
/* Get the value. */
u8 max_temp;
u8 max_temp{};
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().GetMaximumTemperature(std::addressof(max_temp)));
/* Set output. */
@@ -455,7 +455,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
/* Get the value. */
double ms;
double ms{};
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().GetAverageVCellTime(std::addressof(ms)));
/* Set output. */

View File

@@ -137,7 +137,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
*out = ChargeCurrentState_NotCharging;
} else {
/* Get force 20 percent charge state. */
bool force_20_percent;
bool force_20_percent = false;
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().GetForce20PercentChargeCurrent(std::addressof(force_20_percent)));
/* Set output appropriately. */
@@ -277,7 +277,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Validate arguments. */
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
bq24193::ChargerStatus bq_status;
bq24193::ChargerStatus bq_status = static_cast<bq24193::ChargerStatus>(~0);
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().GetChargerStatus(std::addressof(bq_status)));
switch (bq_status) {

View File

@@ -20,7 +20,7 @@ namespace ams::powctl::impl {
namespace {
constinit os::ThreadType g_interrupt_thread;
constinit os::ThreadType g_interrupt_thread = {};
constexpr inline size_t InterruptThreadStackSize = os::MemoryPageSize;
alignas(os::MemoryPageSize) u8 g_interrupt_thread_stack[InterruptThreadStackSize];

View File

@@ -27,6 +27,18 @@
#else
#error "Unknown board for ams::powctl::impl"
// TODO #error "Unknown board for ams::powctl::impl"
namespace ams::powctl::impl::board {
inline void Initialize(bool) {
AMS_ABORT("TODO");
}
inline void Finalize() {
AMS_ABORT("TODO");
}
}
#endif