boot/powctl/i2c: more miscellaneous fixes
This commit is contained in:
@@ -42,6 +42,22 @@ namespace ams::powctl::impl::board::nintendo_nx {
|
||||
powctl::impl::RegisterDriver(std::addressof(*g_battery_driver));
|
||||
}
|
||||
|
||||
void FinalizeChargerDriver() {
|
||||
/* Unregister the driver. */
|
||||
powctl::impl::UnregisterDriver(std::addressof(*g_charger_driver));
|
||||
|
||||
/* Destroy the battery driver. */
|
||||
g_charger_driver = std::nullopt;
|
||||
}
|
||||
|
||||
void FinalizeBatteryDriver() {
|
||||
/* Unregister the driver. */
|
||||
powctl::impl::UnregisterDriver(std::addressof(*g_battery_driver));
|
||||
|
||||
/* Destroy the battery driver. */
|
||||
g_battery_driver = std::nullopt;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Initialize(bool use_event_handlers) {
|
||||
@@ -50,8 +66,8 @@ namespace ams::powctl::impl::board::nintendo_nx {
|
||||
}
|
||||
|
||||
void Finalize() {
|
||||
/* TODO */
|
||||
AMS_ABORT();
|
||||
FinalizeBatteryDriver();
|
||||
FinalizeChargerDriver();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -85,8 +85,16 @@ namespace ams::powctl::impl {
|
||||
os::WaitThread(std::addressof(g_interrupt_thread));
|
||||
os::DestroyThread(std::addressof(g_interrupt_thread));
|
||||
|
||||
/* TODO: What else? */
|
||||
AMS_ABORT();
|
||||
/* Reset all device code entries. */
|
||||
GetDeviceCodeEntryManager().Reset();
|
||||
|
||||
/* Finalize all registered drivers. */
|
||||
for (auto &driver : GetDriverList()) {
|
||||
driver.SafeCastTo<IPowerControlDriver>().FinalizeDriver();
|
||||
}
|
||||
|
||||
/* Finalize the interrupt handler manager. */
|
||||
GetInterruptHandlerManager().Finalize();
|
||||
}
|
||||
|
||||
void RegisterDriver(IPowerControlDriver *driver) {
|
||||
|
||||
Reference in New Issue
Block a user