diff --git a/libraries/libstratosphere/include/stratosphere/spl/spl_types.hpp b/libraries/libstratosphere/include/stratosphere/spl/spl_types.hpp index 50b6f33bc..7b1ca0bc3 100644 --- a/libraries/libstratosphere/include/stratosphere/spl/spl_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/spl/spl_types.hpp @@ -107,10 +107,11 @@ namespace ams::spl { } enum class HardwareType { - Icosa = 0, - Copper = 1, - Hoag = 2, - Iowa = 3, + Icosa = 0, + Copper = 1, + Hoag = 2, + Iowa = 3, + Calcio = 4, }; enum MemoryArrangement { diff --git a/stratosphere/boot/source/boot_battery_icon_charging.inc b/stratosphere/boot/source/boot_battery_icon_charging.inc index 8a65d061a..4e41e9f49 100644 --- a/stratosphere/boot/source/boot_battery_icon_charging.inc +++ b/stratosphere/boot/source/boot_battery_icon_charging.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, diff --git a/stratosphere/boot/source/boot_battery_icon_charging_red.inc b/stratosphere/boot/source/boot_battery_icon_charging_red.inc index 7db585004..77e697354 100644 --- a/stratosphere/boot/source/boot_battery_icon_charging_red.inc +++ b/stratosphere/boot/source/boot_battery_icon_charging_red.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, diff --git a/stratosphere/boot/source/boot_battery_icon_low.inc b/stratosphere/boot/source/boot_battery_icon_low.inc index 9963a03d7..8b78331e6 100644 --- a/stratosphere/boot/source/boot_battery_icon_low.inc +++ b/stratosphere/boot/source/boot_battery_icon_low.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, diff --git a/stratosphere/boot/source/boot_battery_parameters.inc b/stratosphere/boot/source/boot_battery_parameters.inc index 516ff74d9..fd7ca3586 100644 --- a/stratosphere/boot/source/boot_battery_parameters.inc +++ b/stratosphere/boot/source/boot_battery_parameters.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, diff --git a/stratosphere/boot/source/boot_display_config.inc b/stratosphere/boot/source/boot_display_config.inc index de0ed33f5..246b8eea8 100644 --- a/stratosphere/boot/source/boot_display_config.inc +++ b/stratosphere/boot/source/boot_display_config.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, diff --git a/stratosphere/boot/source/boot_main.cpp b/stratosphere/boot/source/boot_main.cpp index d14059023..6494f8857 100644 --- a/stratosphere/boot/source/boot_main.cpp +++ b/stratosphere/boot/source/boot_main.cpp @@ -121,7 +121,7 @@ int main(int argc, char **argv) boot::DetectBootReason(); const auto hw_type = spl::GetHardwareType(); - if (hw_type != spl::HardwareType::Copper) { + if (hw_type != spl::HardwareType::Copper && hw_type != spl::HardwareType::Calcio) { /* Display splash screen for two seconds. */ boot::ShowSplashScreen(); @@ -136,7 +136,7 @@ int main(int argc, char **argv) boot::SetInitialWakePinConfiguration(); /* Configure output clock. */ - if (hw_type != spl::HardwareType::Copper) { + if (hw_type != spl::HardwareType::Copper && hw_type != spl::HardwareType::Calcio) { boot::SetInitialClockConfiguration(); } diff --git a/stratosphere/boot/source/boot_pmic_driver.cpp b/stratosphere/boot/source/boot_pmic_driver.cpp index 4b390301b..846bc09c1 100644 --- a/stratosphere/boot/source/boot_pmic_driver.cpp +++ b/stratosphere/boot/source/boot_pmic_driver.cpp @@ -74,8 +74,8 @@ namespace ams::boot { R_ABORT_UNLESS(ReadI2cRegister(this->i2c_session, &on_off_1_val, sizeof(on_off_1_val), &on_off_1_addr, sizeof(on_off_1_addr))); on_off_1_val |= 0x80; - /* Finalize the battery. */ - { + /* Finalize the battery on non-Calcio. */ + if (spl::GetHardwareType() != spl::HardwareType::Calcio) { BatteryDriver battery_driver; this->FinalizeBattery(&battery_driver); } @@ -98,6 +98,15 @@ namespace ams::boot { return; } + /* On Hoag, we don't want to use the desired shutdown value when battery charged. */ + bool use_desired_shutdown = true; + if (spl::GetHardwareType() == spl::HardwareType::Hoag) { + double battery_charge; + if (R_FAILED(battery_driver->GetSocRep(&battery_charge)) || battery_charge >= 80.0) { + use_desired_shutdown = false; + } + } + bool ac_ok; bool desired_shutdown_enabled; if (R_FAILED(this->GetAcOk(&ac_ok)) || ac_ok) { @@ -106,6 +115,8 @@ namespace ams::boot { desired_shutdown_enabled = true; } + desired_shutdown_enabled &= use_desired_shutdown; + if (shutdown_enabled != desired_shutdown_enabled) { battery_driver->SetShutdownEnabled(desired_shutdown_enabled); } diff --git a/stratosphere/boot/source/boot_splash_screen_notext.inc b/stratosphere/boot/source/boot_splash_screen_notext.inc index f0b87d59e..007073856 100644 --- a/stratosphere/boot/source/boot_splash_screen_notext.inc +++ b/stratosphere/boot/source/boot_splash_screen_notext.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, diff --git a/stratosphere/boot/source/boot_splash_screen_text.inc b/stratosphere/boot/source/boot_splash_screen_text.inc index ed9e84f27..01eba1e6f 100644 --- a/stratosphere/boot/source/boot_splash_screen_text.inc +++ b/stratosphere/boot/source/boot_splash_screen_text.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, diff --git a/stratosphere/boot/source/boot_wake_control_configs.inc b/stratosphere/boot/source/boot_wake_control_configs.inc index 0761002c1..8bf77fa9e 100644 --- a/stratosphere/boot/source/boot_wake_control_configs.inc +++ b/stratosphere/boot/source/boot_wake_control_configs.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -32,4 +32,4 @@ constexpr WakeControlConfig WakeControlConfigs[] = { {APBDEV_PMC_CNTRL2, 0x0001, true}, }; -constexpr size_t NumWakeControlConfigs = sizeof(WakeControlConfigs) / sizeof(WakeControlConfigs[0]); +constexpr size_t NumWakeControlConfigs = util::size(WakeControlConfigs); diff --git a/stratosphere/boot/source/boot_wake_pin_configuration_calcio.inc b/stratosphere/boot/source/boot_wake_pin_configuration_calcio.inc new file mode 100644 index 000000000..2c5de654b --- /dev/null +++ b/stratosphere/boot/source/boot_wake_pin_configuration_calcio.inc @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2018-2020 Atmosphère-NX + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +static constexpr WakePinConfig WakePinConfigsCalcio[] = { + {0x00, false, 0x02}, + {0x01, false, 0x02}, + {0x02, false, 0x02}, + {0x03, false, 0x02}, + {0x04, false, 0x02}, + {0x05, false, 0x02}, + {0x06, false, 0x02}, + {0x07, false, 0x02}, + {0x08, true, 0x01}, + {0x0A, false, 0x02}, + {0x0B, false, 0x02}, + {0x0C, false, 0x02}, + {0x0D, false, 0x02}, + {0x0E, true, 0x00}, + {0x0F, false, 0x02}, + {0x11, false, 0x02}, + {0x12, false, 0x02}, + {0x13, false, 0x02}, + {0x14, false, 0x02}, + {0x15, false, 0x02}, + {0x16, false, 0x02}, + {0x17, false, 0x02}, + {0x18, false, 0x02}, + {0x19, false, 0x02}, + {0x1A, false, 0x02}, + {0x1B, false, 0x00}, + {0x1C, false, 0x02}, + {0x21, false, 0x02}, + {0x22, false, 0x00}, + {0x23, true, 0x02}, + {0x24, false, 0x02}, + {0x2D, false, 0x02}, + {0x2E, false, 0x02}, + {0x2F, false, 0x02}, + {0x30, false, 0x02}, + {0x31, false, 0x02}, + {0x32, false, 0x02}, + {0x33, true, 0x00}, + {0x34, true, 0x00}, + {0x35, false, 0x02}, + {0x36, false, 0x02}, + {0x37, false, 0x02}, + {0x38, false, 0x02}, + {0x39, false, 0x00}, + {0x3A, false, 0x02}, + {0x3B, false, 0x02}, + {0x3D, false, 0x02}, + {0x3E, false, 0x02}, + {0x3F, false, 0x02}, +}; + +static constexpr size_t WakePinConfigsCalcio = util::size(WakePinConfigsCalcio); diff --git a/stratosphere/boot/source/boot_wake_pin_configuration_copper.inc b/stratosphere/boot/source/boot_wake_pin_configuration_copper.inc index 346f963f1..7105cb052 100644 --- a/stratosphere/boot/source/boot_wake_pin_configuration_copper.inc +++ b/stratosphere/boot/source/boot_wake_pin_configuration_copper.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -66,4 +66,4 @@ static constexpr WakePinConfig WakePinConfigsCopper[] = { {0x3F, false, 0x02}, }; -static constexpr size_t NumWakePinConfigsCopper = sizeof(WakePinConfigsCopper) / sizeof(WakePinConfigsCopper[0]); +static constexpr size_t NumWakePinConfigsCopper = util::size(WakePinConfigsCopper); diff --git a/stratosphere/boot/source/boot_wake_pin_configuration_hoag.inc b/stratosphere/boot/source/boot_wake_pin_configuration_hoag.inc new file mode 100644 index 000000000..6f7353714 --- /dev/null +++ b/stratosphere/boot/source/boot_wake_pin_configuration_hoag.inc @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2018-2020 Atmosphère-NX + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +static constexpr WakePinConfig WakePinConfigsHoag[] = { + {0x00, false, 0x02}, + {0x01, false, 0x02}, + {0x02, false, 0x02}, + {0x03, false, 0x02}, + {0x04, true, 0x02}, + {0x05, true, 0x02}, + {0x06, false, 0x02}, + {0x07, true, 0x02}, + {0x08, true, 0x01}, + {0x0A, true, 0x02}, + {0x0B, false, 0x02}, + {0x0C, false, 0x02}, + {0x0D, false, 0x02}, + {0x0E, true, 0x00}, + {0x0F, false, 0x02}, + {0x11, false, 0x02}, + {0x12, false, 0x02}, + {0x13, false, 0x02}, + {0x14, false, 0x02}, + {0x15, false, 0x02}, + {0x16, false, 0x02}, + {0x17, false, 0x02}, + {0x18, false, 0x02}, + {0x19, false, 0x02}, + {0x1A, false, 0x02}, + {0x1B, true, 0x00}, + {0x1C, false, 0x02}, + {0x20, false, 0x02}, + {0x21, false, 0x02}, + {0x22, true, 0x00}, + {0x23, true, 0x02}, + {0x24, false, 0x02}, + {0x2D, false, 0x02}, + {0x2E, false, 0x02}, + {0x2F, false, 0x02}, + {0x30, true, 0x02}, + {0x31, false, 0x02}, + {0x32, false, 0x02}, + {0x33, true, 0x00}, + {0x34, true, 0x00}, + {0x35, false, 0x02}, + {0x36, false, 0x02}, + {0x37, false, 0x02}, + {0x38, false, 0x02}, + {0x39, true, 0x00}, + {0x3A, false, 0x02}, + {0x3B, false, 0x02}, + {0x3D, false, 0x02}, + {0x3E, false, 0x02}, + {0x3F, false, 0x02}, +}; + +static constexpr size_t WakePinConfigsHoag = util::size(WakePinConfigsHoag); diff --git a/stratosphere/boot/source/boot_wake_pin_configuration.inc b/stratosphere/boot/source/boot_wake_pin_configuration_icosa.inc similarity index 89% rename from stratosphere/boot/source/boot_wake_pin_configuration.inc rename to stratosphere/boot/source/boot_wake_pin_configuration_icosa.inc index 71c585f88..ddfb16a6f 100644 --- a/stratosphere/boot/source/boot_wake_pin_configuration.inc +++ b/stratosphere/boot/source/boot_wake_pin_configuration_icosa.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -static constexpr WakePinConfig WakePinConfigs[] = { +static constexpr WakePinConfig WakePinConfigsIcosa[] = { {0x00, false, 0x02}, {0x01, false, 0x02}, {0x02, false, 0x02}, @@ -23,7 +23,7 @@ static constexpr WakePinConfig WakePinConfigs[] = { {0x05, false, 0x02}, {0x06, true, 0x02}, {0x07, true, 0x02}, - {0x08, false, 0x01}, + {0x08, true, 0x01}, {0x0A, true, 0x02}, {0x0B, false, 0x02}, {0x0C, false, 0x02}, @@ -66,4 +66,4 @@ static constexpr WakePinConfig WakePinConfigs[] = { {0x3F, false, 0x02}, }; -static constexpr size_t NumWakePinConfigs = sizeof(WakePinConfigs) / sizeof(WakePinConfigs[0]); +static constexpr size_t NumWakePinConfigsIcosa = util::size(WakePinConfigsIcosa); diff --git a/stratosphere/boot/source/boot_wake_pin_configuration_iowa.inc b/stratosphere/boot/source/boot_wake_pin_configuration_iowa.inc new file mode 100644 index 000000000..88cf9c9fd --- /dev/null +++ b/stratosphere/boot/source/boot_wake_pin_configuration_iowa.inc @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2018-2020 Atmosphère-NX + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +static constexpr WakePinConfig WakePinConfigsIowa[] = { + {0x00, false, 0x02}, + {0x01, false, 0x02}, + {0x02, false, 0x02}, + {0x03, false, 0x02}, + {0x04, true, 0x02}, + {0x05, false, 0x02}, + {0x06, true, 0x02}, + {0x07, true, 0x02}, + {0x08, true, 0x01}, + {0x0A, true, 0x02}, + {0x0B, false, 0x02}, + {0x0C, false, 0x02}, + {0x0D, false, 0x02}, + {0x0E, true, 0x00}, + {0x0F, false, 0x02}, + {0x11, false, 0x02}, + {0x12, false, 0x02}, + {0x13, false, 0x02}, + {0x14, false, 0x02}, + {0x15, false, 0x02}, + {0x16, false, 0x02}, + {0x17, false, 0x02}, + {0x18, false, 0x02}, + {0x19, false, 0x02}, + {0x1A, false, 0x02}, + {0x1B, true, 0x00}, + {0x1C, false, 0x02}, + {0x21, false, 0x02}, + {0x22, true, 0x00}, + {0x23, true, 0x02}, + {0x24, false, 0x02}, + {0x2D, false, 0x02}, + {0x2E, false, 0x02}, + {0x2F, false, 0x02}, + {0x30, true, 0x02}, + {0x31, false, 0x02}, + {0x32, false, 0x02}, + {0x33, true, 0x00}, + {0x34, true, 0x00}, + {0x35, false, 0x02}, + {0x36, false, 0x02}, + {0x37, false, 0x02}, + {0x38, false, 0x02}, + {0x39, false, 0x02}, + {0x3A, false, 0x02}, + {0x3B, false, 0x02}, + {0x3D, false, 0x02}, + {0x3E, false, 0x02}, + {0x3F, false, 0x02}, +}; + +static constexpr size_t WakePinConfigsIowa = util::size(WakePinConfigsIowa); diff --git a/stratosphere/boot/source/boot_wake_pins.cpp b/stratosphere/boot/source/boot_wake_pins.cpp index 118d7682b..d7b441598 100644 --- a/stratosphere/boot/source/boot_wake_pins.cpp +++ b/stratosphere/boot/source/boot_wake_pins.cpp @@ -30,8 +30,11 @@ namespace ams::boot { }; #include "boot_wake_control_configs.inc" -#include "boot_wake_pin_configuration.inc" +#include "boot_wake_pin_configuration_icosa.inc" #include "boot_wake_pin_configuration_copper.inc" +#include "boot_wake_pin_configuration_hoag.inc" +#include "boot_wake_pin_configuration_iowa.inc" +#include "boot_wake_pin_configuration_calcio.inc" } @@ -91,16 +94,34 @@ namespace ams::boot { InitializePmcWakeConfiguration(false); /* Set wake event levels, wake event enables. */ - const WakePinConfig *configs; - size_t num_configs; - if (spl::GetHardwareType() == spl::HardwareType::Copper) { - configs = WakePinConfigsCopper; - num_configs = NumWakePinConfigsCopper; - } else { - configs = WakePinConfigs; - num_configs = NumWakePinConfigs; + const WakePinConfig *configs = nullptr; + size_t num_configs = 0; + + switch (spl::GetHardwareType()) { + case spl::HardwareType::Icosa: + configs = WakePinsIcosa; + num_configs = NumWakePinsIcosa; + break; + case spl::HardwareType::Copper: + configs = WakePinsCopper; + num_configs = NumWakePinsCopper; + break; + case spl::HardwareType::Hoag: + configs = WakePinsHoag; + num_configs = NumWakePinsHoag; + break; + case spl::HardwareType::Iowa: + configs = WakePinsIowa; + num_configs = NumWakePinsIowa; + case spl::HardwareType::Calcio: + configs = WakePinsCalcio; + num_configs = NumWakePinsCalcio; + break; + AMS_UNREACHABLE_DEFAULT_CASE(); } + AMS_ABORT_UNLESS(configs != nullptr); + for (size_t i = 0; i < num_configs; i++) { SetWakeEventLevel(configs[i].index, configs[i].level); SetWakeEventEnabled(configs[i].index, configs[i].enabled); diff --git a/stratosphere/boot/source/gpio/gpio_initial_configuration.cpp b/stratosphere/boot/source/gpio/gpio_initial_configuration.cpp index 60a2cc747..0c648b5e8 100644 --- a/stratosphere/boot/source/gpio/gpio_initial_configuration.cpp +++ b/stratosphere/boot/source/gpio/gpio_initial_configuration.cpp @@ -34,6 +34,7 @@ namespace ams::gpio { #include "gpio_initial_configuration_copper.inc" #include "gpio_initial_configuration_hoag.inc" #include "gpio_initial_configuration_iowa.inc" +#include "gpio_initial_configuration_calcio.inc" } @@ -49,32 +50,35 @@ namespace ams::gpio { case spl::HardwareType::Icosa: { if (hos_ver >= hos::Version_400) { - configs = InitialConfigsIcosa4x; + configs = InitialConfigsIcosa4x; num_configs = NumInitialConfigsIcosa4x; } else { - configs = InitialConfigsIcosa; + configs = InitialConfigsIcosa; num_configs = NumInitialConfigsIcosa; } } break; case spl::HardwareType::Copper: - configs = InitialConfigsCopper; + configs = InitialConfigsCopper; num_configs = NumInitialConfigsCopper; break; case spl::HardwareType::Hoag: - configs = InitialConfigsHoag; + configs = InitialConfigsHoag; num_configs = NumInitialConfigsHoag; break; case spl::HardwareType::Iowa: - configs = InitialConfigsIowa; + configs = InitialConfigsIowa; num_configs = NumInitialConfigsIowa; + case spl::HardwareType::Calcio: + configs = InitialConfigsCalcio; + num_configs = NumInitialConfigsCalcio; break; /* Unknown hardware type, we can't proceed. */ AMS_UNREACHABLE_DEFAULT_CASE(); } } else { /* Until 2.0.0, the GPIO map for Icosa was used for all hardware types. */ - configs = InitialConfigsIcosa; + configs = InitialConfigsIcosa; num_configs = NumInitialConfigsIcosa; } diff --git a/stratosphere/boot/source/gpio/gpio_initial_configuration_calcio.inc b/stratosphere/boot/source/gpio/gpio_initial_configuration_calcio.inc new file mode 100644 index 000000000..d3ff8581a --- /dev/null +++ b/stratosphere/boot/source/gpio/gpio_initial_configuration_calcio.inc @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2018-2020 Atmosphère-NX + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +constexpr InitialConfig InitialConfigsCalcio[] = { + {0x50, GpioDirection_Output, GpioValue_Low}, + {0x51, GpioDirection_Output, GpioValue_Low}, + {0x52, GpioDirection_Output, GpioValue_Low}, + {0x53, GpioDirection_Output, GpioValue_Low}, + {0x02, GpioDirection_Output, GpioValue_Low}, + {0x0B, GpioDirection_Input, GpioValue_Low}, + {0x14, GpioDirection_Input, GpioValue_High}, + {0x18, GpioDirection_Input, GpioValue_Low}, + {0x19, GpioDirection_Input, GpioValue_High}, + {0x1A, GpioDirection_Input, GpioValue_High}, + {0x1C, GpioDirection_Input, GpioValue_High}, + {0x20, GpioDirection_Output, GpioValue_Low}, + {0x38, GpioDirection_Input, GpioValue_High}, + {0x23, GpioDirection_Input, GpioValue_High}, + {0x25, GpioDirection_Input, GpioValue_Low}, + {0x26, GpioDirection_Input, GpioValue_Low}, + {0x27, GpioDirection_Input, GpioValue_Low}, + {0x28, GpioDirection_Input, GpioValue_High}, + {0x4F, GpioDirection_Input, GpioValue_High}, + {0x48, GpioDirection_Output, GpioValue_Low}, + {0x4C, GpioDirection_Input, GpioValue_High}, + {0x4A, GpioDirection_Output, GpioValue_Low}, + {0x2D, GpioDirection_Output, GpioValue_Low}, + {0x2E, GpioDirection_Output, GpioValue_Low}, + {0x37, GpioDirection_Input, GpioValue_Low}, + {0x2F, GpioDirection_Output, GpioValue_Low}, + {0x03, GpioDirection_Output, GpioValue_Low}, + {0x30, GpioDirection_Input, GpioValue_Low}, + {0x31, GpioDirection_Output, GpioValue_Low}, + {0x49, GpioDirection_Output, GpioValue_Low}, + {0x4E, GpioDirection_Input, GpioValue_Low}, +}; + +constexpr u32 NumInitialConfigsCopper = (sizeof(InitialConfigsCalcio) / sizeof(InitialConfigsCalcio[0])); diff --git a/stratosphere/boot/source/gpio/gpio_initial_configuration_copper.inc b/stratosphere/boot/source/gpio/gpio_initial_configuration_copper.inc index 8f4d8abc0..70771f22a 100644 --- a/stratosphere/boot/source/gpio/gpio_initial_configuration_copper.inc +++ b/stratosphere/boot/source/gpio/gpio_initial_configuration_copper.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -61,4 +61,4 @@ constexpr InitialConfig InitialConfigsCopper[] = { {0x4E, GpioDirection_Input, GpioValue_Low}, }; -constexpr u32 NumInitialConfigsCopper = (sizeof(InitialConfigsCopper) / sizeof(InitialConfigsCopper[0])); +constexpr u32 NumInitialConfigsCopper = util::size(InitialConfigsCopper); diff --git a/stratosphere/boot/source/gpio/gpio_initial_configuration_hoag.inc b/stratosphere/boot/source/gpio/gpio_initial_configuration_hoag.inc index 60ffdd364..8e18daf4b 100644 --- a/stratosphere/boot/source/gpio/gpio_initial_configuration_hoag.inc +++ b/stratosphere/boot/source/gpio/gpio_initial_configuration_hoag.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -15,64 +15,65 @@ */ constexpr InitialConfig InitialConfigsHoag[] = { - {0x04, GpioDirection_Input, GpioValue_High}, {0x05, GpioDirection_Output, GpioValue_Low}, - {0x06, GpioDirection_Input, GpioValue_Low}, + {0x06, GpioDirection_Input, GpioValue_Low}, + {0x50, GpioDirection_Output, GpioValue_Low}, + {0x51, GpioDirection_Output, GpioValue_Low}, + {0x52, GpioDirection_Output, GpioValue_Low}, + {0x53, GpioDirection_Output, GpioValue_Low}, {0x02, GpioDirection_Output, GpioValue_Low}, - {0x3C, GpioDirection_Input, GpioValue_Low}, - {0x0F, GpioDirection_Input, GpioValue_High}, - {0x08, GpioDirection_Input, GpioValue_Low}, - {0x09, GpioDirection_Input, GpioValue_Low}, + {0x3C, GpioDirection_Input, GpioValue_Low}, + {0x56, GpioDirection_Input, GpioValue_High}, + {0x0F, GpioDirection_Input, GpioValue_High}, + {0x09, GpioDirection_Input, GpioValue_Low}, {0x0A, GpioDirection_Output, GpioValue_Low}, - {0x0B, GpioDirection_Input, GpioValue_Low}, + {0x0B, GpioDirection_Input, GpioValue_Low}, + {0x57, GpioDirection_Output, GpioValue_Low}, + {0x58, GpioDirection_Output, GpioValue_Low}, {0x0D, GpioDirection_Output, GpioValue_Low}, - {0x0E, GpioDirection_Input, GpioValue_Low}, - {0x10, GpioDirection_Input, GpioValue_Low}, - {0x11, GpioDirection_Input, GpioValue_Low}, - {0x12, GpioDirection_Input, GpioValue_Low}, - {0x13, GpioDirection_Input, GpioValue_Low}, - {0x14, GpioDirection_Input, GpioValue_High}, - {0x16, GpioDirection_Input, GpioValue_Low}, - {0x15, GpioDirection_Input, GpioValue_Low}, - {0x17, GpioDirection_Input, GpioValue_High}, - {0x18, GpioDirection_Input, GpioValue_Low}, - {0x19, GpioDirection_Input, GpioValue_High}, - {0x1A, GpioDirection_Input, GpioValue_High}, - {0x1B, GpioDirection_Input, GpioValue_Low}, - {0x1C, GpioDirection_Input, GpioValue_Low}, + {0x59, GpioDirection_Output, GpioValue_Low}, + {0x14, GpioDirection_Input, GpioValue_High}, + {0x16, GpioDirection_Input, GpioValue_Low}, + {0x15, GpioDirection_Input, GpioValue_Low}, + {0x17, GpioDirection_Input, GpioValue_High}, + {0x18, GpioDirection_Input, GpioValue_Low}, + {0x19, GpioDirection_Input, GpioValue_High}, + {0x1A, GpioDirection_Input, GpioValue_High}, + {0x1B, GpioDirection_Input, GpioValue_Low}, + {0x1C, GpioDirection_Input, GpioValue_High}, {0x1D, GpioDirection_Output, GpioValue_Low}, {0x1E, GpioDirection_Output, GpioValue_Low}, + {0x5B, GpioDirection_Input, GpioValue_High}, {0x20, GpioDirection_Output, GpioValue_Low}, - {0x21, GpioDirection_Input, GpioValue_Low}, - {0x38, GpioDirection_Input, GpioValue_High}, - {0x22, GpioDirection_Input, GpioValue_Low}, - {0x23, GpioDirection_Input, GpioValue_High}, + {0x21, GpioDirection_Input, GpioValue_Low}, + {0x38, GpioDirection_Input, GpioValue_High}, + {0x23, GpioDirection_Input, GpioValue_High}, {0x01, GpioDirection_Output, GpioValue_Low}, - {0x39, GpioDirection_Output, GpioValue_Low}, + {0x5C, GpioDirection_Output, GpioValue_Low}, + {0x54, GpioDirection_Input, GpioValue_Low}, {0x24, GpioDirection_Output, GpioValue_Low}, - {0x34, GpioDirection_Input, GpioValue_Low}, - {0x25, GpioDirection_Input, GpioValue_Low}, - {0x26, GpioDirection_Input, GpioValue_Low}, - {0x27, GpioDirection_Input, GpioValue_Low}, - {0x2B, GpioDirection_Output, GpioValue_Low}, - {0x28, GpioDirection_Input, GpioValue_High}, + {0x25, GpioDirection_Input, GpioValue_Low}, + {0x26, GpioDirection_Input, GpioValue_Low}, + {0x27, GpioDirection_Input, GpioValue_Low}, + {0x28, GpioDirection_Input, GpioValue_High}, {0x1F, GpioDirection_Output, GpioValue_Low}, - {0x29, GpioDirection_Input, GpioValue_High}, - {0x3A, GpioDirection_Output, GpioValue_Low}, - {0x0C, GpioDirection_Input, GpioValue_Low}, + {0x4F, GpioDirection_Input, GpioValue_High}, + {0x55, GpioDirection_Output, GpioValue_Low}, + {0x5F, GpioDirection_Input, GpioValue_Low}, + {0x60, GpioDirection_Input, GpioValue_Low}, + {0x61, GpioDirection_Input, GpioValue_Low}, + {0x62, GpioDirection_Input, GpioValue_Low}, {0x2D, GpioDirection_Output, GpioValue_Low}, {0x2E, GpioDirection_Output, GpioValue_Low}, - {0x37, GpioDirection_Input, GpioValue_Low}, + {0x37, GpioDirection_Input, GpioValue_Low}, {0x2F, GpioDirection_Output, GpioValue_Low}, {0x03, GpioDirection_Output, GpioValue_Low}, - {0x30, GpioDirection_Input, GpioValue_Low}, - {0x3B, GpioDirection_Input, GpioValue_Low}, + {0x30, GpioDirection_Input, GpioValue_Low}, + {0x3B, GpioDirection_Input, GpioValue_Low}, {0x31, GpioDirection_Output, GpioValue_Low}, {0x32, GpioDirection_Output, GpioValue_Low}, {0x33, GpioDirection_Output, GpioValue_Low}, - {0x35, GpioDirection_Input, GpioValue_High}, - {0x2C, GpioDirection_Output, GpioValue_Low}, - {0x36, GpioDirection_Output, GpioValue_Low}, + {0x5A, GpioDirection_Output, GpioValue_Low}, }; -constexpr u32 NumInitialConfigsHoag = (sizeof(InitialConfigsHoag) / sizeof(InitialConfigsHoag[0])); +constexpr u32 NumInitialConfigsHoag = util::size(InitialConfigsHoag); diff --git a/stratosphere/boot/source/gpio/gpio_initial_configuration_icosa.inc b/stratosphere/boot/source/gpio/gpio_initial_configuration_icosa.inc index 44c348234..06a80f49e 100644 --- a/stratosphere/boot/source/gpio/gpio_initial_configuration_icosa.inc +++ b/stratosphere/boot/source/gpio/gpio_initial_configuration_icosa.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -77,7 +77,7 @@ constexpr InitialConfig InitialConfigsIcosa[] = { {0x36, GpioDirection_Output, GpioValue_Low}, }; -constexpr u32 NumInitialConfigsIcosa = (sizeof(InitialConfigsIcosa) / sizeof(InitialConfigsIcosa[0])); +constexpr u32 NumInitialConfigsIcosa = util::size(InitialConfigsIcosa); constexpr InitialConfig InitialConfigsIcosa4x[] = { {0x04, GpioDirection_Input, GpioValue_High}, @@ -142,4 +142,4 @@ constexpr InitialConfig InitialConfigsIcosa4x[] = { {0x36, GpioDirection_Output, GpioValue_Low}, }; -constexpr u32 NumInitialConfigsIcosa4x = (sizeof(InitialConfigsIcosa4x) / sizeof(InitialConfigsIcosa4x[0])); +constexpr u32 NumInitialConfigsIcosa4x = util::size(InitialConfigsIcosa4x); diff --git a/stratosphere/boot/source/gpio/gpio_initial_configuration_iowa.inc b/stratosphere/boot/source/gpio/gpio_initial_configuration_iowa.inc index e6c0d16f3..f0a017897 100644 --- a/stratosphere/boot/source/gpio/gpio_initial_configuration_iowa.inc +++ b/stratosphere/boot/source/gpio/gpio_initial_configuration_iowa.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -15,64 +15,65 @@ */ constexpr InitialConfig InitialConfigsIowa[] = { - {0x04, GpioDirection_Input, GpioValue_High}, + {0x04, GpioDirection_Input, GpioValue_High}, {0x05, GpioDirection_Output, GpioValue_Low}, - {0x06, GpioDirection_Input, GpioValue_Low}, + {0x06, GpioDirection_Input, GpioValue_Low}, {0x02, GpioDirection_Output, GpioValue_Low}, - {0x3C, GpioDirection_Input, GpioValue_Low}, - {0x0F, GpioDirection_Input, GpioValue_High}, - {0x08, GpioDirection_Input, GpioValue_Low}, - {0x09, GpioDirection_Input, GpioValue_Low}, + {0x3C, GpioDirection_Input, GpioValue_Low}, + {0x0F, GpioDirection_Input, GpioValue_High}, + {0x08, GpioDirection_Input, GpioValue_Low}, + {0x09, GpioDirection_Input, GpioValue_Low}, {0x0A, GpioDirection_Output, GpioValue_Low}, - {0x0B, GpioDirection_Input, GpioValue_Low}, + {0x0B, GpioDirection_Input, GpioValue_Low}, {0x0D, GpioDirection_Output, GpioValue_Low}, - {0x0E, GpioDirection_Input, GpioValue_Low}, - {0x10, GpioDirection_Input, GpioValue_Low}, - {0x11, GpioDirection_Input, GpioValue_Low}, - {0x12, GpioDirection_Input, GpioValue_Low}, - {0x13, GpioDirection_Input, GpioValue_Low}, - {0x14, GpioDirection_Input, GpioValue_High}, - {0x16, GpioDirection_Input, GpioValue_Low}, - {0x15, GpioDirection_Input, GpioValue_Low}, - {0x17, GpioDirection_Input, GpioValue_High}, - {0x18, GpioDirection_Input, GpioValue_Low}, - {0x19, GpioDirection_Input, GpioValue_High}, - {0x1A, GpioDirection_Input, GpioValue_High}, - {0x1B, GpioDirection_Input, GpioValue_Low}, - {0x1C, GpioDirection_Input, GpioValue_Low}, + {0x0E, GpioDirection_Input, GpioValue_Low}, + {0x10, GpioDirection_Input, GpioValue_Low}, + {0x11, GpioDirection_Input, GpioValue_Low}, + {0x12, GpioDirection_Input, GpioValue_Low}, + {0x13, GpioDirection_Input, GpioValue_Low}, + {0x59, GpioDirection_Output, GpioValue_Low}, + {0x14, GpioDirection_Input, GpioValue_High}, + {0x16, GpioDirection_Input, GpioValue_Low}, + {0x15, GpioDirection_Input, GpioValue_Low}, + {0x17, GpioDirection_Input, GpioValue_High}, + {0x18, GpioDirection_Input, GpioValue_Low}, + {0x19, GpioDirection_Input, GpioValue_High}, + {0x1A, GpioDirection_Input, GpioValue_High}, + {0x1B, GpioDirection_Input, GpioValue_Low}, + {0x1C, GpioDirection_Input, GpioValue_Low}, {0x1D, GpioDirection_Output, GpioValue_Low}, {0x1E, GpioDirection_Output, GpioValue_Low}, {0x20, GpioDirection_Output, GpioValue_Low}, - {0x21, GpioDirection_Input, GpioValue_Low}, - {0x38, GpioDirection_Input, GpioValue_High}, - {0x22, GpioDirection_Input, GpioValue_Low}, - {0x23, GpioDirection_Input, GpioValue_High}, + {0x21, GpioDirection_Input, GpioValue_Low}, + {0x38, GpioDirection_Input, GpioValue_High}, + {0x22, GpioDirection_Input, GpioValue_Low}, + {0x23, GpioDirection_Input, GpioValue_High}, {0x01, GpioDirection_Output, GpioValue_Low}, {0x39, GpioDirection_Output, GpioValue_Low}, {0x24, GpioDirection_Output, GpioValue_Low}, - {0x34, GpioDirection_Input, GpioValue_Low}, - {0x25, GpioDirection_Input, GpioValue_Low}, - {0x26, GpioDirection_Input, GpioValue_Low}, - {0x27, GpioDirection_Input, GpioValue_Low}, + {0x34, GpioDirection_Input, GpioValue_Low}, + {0x25, GpioDirection_Input, GpioValue_Low}, + {0x26, GpioDirection_Input, GpioValue_Low}, + {0x27, GpioDirection_Input, GpioValue_Low}, {0x2B, GpioDirection_Output, GpioValue_Low}, - {0x28, GpioDirection_Input, GpioValue_High}, + {0x28, GpioDirection_Input, GpioValue_High}, {0x1F, GpioDirection_Output, GpioValue_Low}, - {0x29, GpioDirection_Input, GpioValue_High}, + {0x4F, GpioDirection_Input, GpioValue_High}, {0x3A, GpioDirection_Output, GpioValue_Low}, - {0x0C, GpioDirection_Input, GpioValue_Low}, + {0x0C, GpioDirection_Input, GpioValue_Low}, {0x2D, GpioDirection_Output, GpioValue_Low}, {0x2E, GpioDirection_Output, GpioValue_Low}, - {0x37, GpioDirection_Input, GpioValue_Low}, + {0x37, GpioDirection_Input, GpioValue_Low}, {0x2F, GpioDirection_Output, GpioValue_Low}, {0x03, GpioDirection_Output, GpioValue_Low}, - {0x30, GpioDirection_Input, GpioValue_Low}, - {0x3B, GpioDirection_Input, GpioValue_Low}, + {0x30, GpioDirection_Input, GpioValue_Low}, + {0x3B, GpioDirection_Input, GpioValue_Low}, {0x31, GpioDirection_Output, GpioValue_Low}, {0x32, GpioDirection_Output, GpioValue_Low}, {0x33, GpioDirection_Output, GpioValue_Low}, - {0x35, GpioDirection_Input, GpioValue_High}, + {0x35, GpioDirection_Input, GpioValue_High}, {0x2C, GpioDirection_Output, GpioValue_Low}, {0x36, GpioDirection_Output, GpioValue_Low}, }; -constexpr u32 NumInitialConfigsIowa = (sizeof(InitialConfigsIowa) / sizeof(InitialConfigsIowa[0])); +constexpr u32 NumInitialConfigsIowa = util::size(InitialConfigsIowa); diff --git a/stratosphere/boot/source/gpio/gpio_map.inc b/stratosphere/boot/source/gpio/gpio_map.inc index c3527da50..7a76dcc5e 100644 --- a/stratosphere/boot/source/gpio/gpio_map.inc +++ b/stratosphere/boot/source/gpio/gpio_map.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -103,6 +103,30 @@ constexpr u32 Map[] = { /* 5.0.0+ Copper only (unused) */ 0x00000056, /* Port K, Pin 6 */ + + /* 6.0.0+ */ + 0x00000020, /* Port E, Pin 0 */ + 0x00000021, /* Port E, Pin 1 */ + 0x00000022, /* Port E, Pin 2 */ + 0x00000023, /* Port E, Pin 3 */ + 0x0000004C, /* Port J, Pin 4 */ + 0x00000057, /* Port K, Pin 7 */ + 0x00000027, /* Port S, Pin 4 */ + 0x00000098, /* Port T, Pin 0 */ + 0x00000099, /* Port T, Pin 1 */ + 0x000000BB, /* Port X, Pin 3 */ + 0x000000E5, /* Port CC, Pin 5 */ + 0x000000AB, /* Port V, Pin 3 */ + 0x0000004E, /* Port J, Pin 6 */ + + /* 7.0.0+ */ + 0x00000032, /* Port G, Pin 2 */ + 0x0000001B, /* Port D, Pin 3 */ + 0x00000017, /* Port C, Pin 7 */ + 0x00000018, /* Port D, Pin 0 */ + 0x00000015, /* Port C, Pin 5 */ + 0x00000016, /* Port C, Pin 6 */ + }; -static constexpr u32 PadNameMax = (sizeof(Map) / sizeof(Map[0])); +static constexpr u32 PadNameMax = util::size(Map); diff --git a/stratosphere/boot/source/pinmux/pinmux_initial_configuration.cpp b/stratosphere/boot/source/pinmux/pinmux_initial_configuration.cpp index 47964833d..9c484b616 100644 --- a/stratosphere/boot/source/pinmux/pinmux_initial_configuration.cpp +++ b/stratosphere/boot/source/pinmux/pinmux_initial_configuration.cpp @@ -31,7 +31,10 @@ namespace ams::pinmux { #include "pinmux_initial_configuration_copper.inc" #include "pinmux_initial_configuration_hoag.inc" #include "pinmux_initial_configuration_iowa.inc" +#include "pinmux_initial_configuration_calcio.inc" + #include "pinmux_initial_drive_pad_configuration.inc" +#include "pinmux_initial_drive_pad_configuration_hoag.inc" /* Configuration helpers. */ @@ -42,20 +45,23 @@ namespace ams::pinmux { switch (hw_type) { case spl::HardwareType::Icosa: - configs = InitialConfigsIcosa; + configs = InitialConfigsIcosa; num_configs = NumInitialConfigsIcosa; break; case spl::HardwareType::Copper: - configs = InitialConfigsCopper; + configs = InitialConfigsCopper; num_configs = NumInitialConfigsCopper; break; case spl::HardwareType::Hoag: - configs = InitialConfigsHoag; + configs = InitialConfigsHoag; num_configs = NumInitialConfigsHoag; break; case spl::HardwareType::Iowa: - configs = InitialConfigsIowa; + configs = InitialConfigsIowa; num_configs = NumInitialConfigsIowa; + case spl::HardwareType::Calcio: + configs = InitialConfigsCalcio; + num_configs = NumInitialConfigsCalcio; break; /* Unknown hardware type, we can't proceed. */ AMS_UNREACHABLE_DEFAULT_CASE(); @@ -68,20 +74,41 @@ namespace ams::pinmux { UpdatePad(configs[i].name, configs[i].val, configs[i].mask); } - /* Extra configs for iowa only. */ - if (hw_type == spl::HardwareType::Iowa) { - static constexpr u32 ExtraIowaPadNames[] = { + /* Extra configs for mariko only. */ + if (hw_type == spl::HardwareType::Hoag || hw_type == spl::HardwareType::Iowa || hw_type == spl::HardwareType::Calcio) { + static constexpr u32 ExtraMarikoPadNames[] = { 0xAA, 0xAC, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9 }; - for (size_t i = 0; i < util::size(ExtraIowaPadNames); i++) { - UpdatePad(ExtraIowaPadNames[i], 0x2000, 0x2000); + for (size_t i = 0; i < util::size(ExtraMarikoPadNames); i++) { + UpdatePad(ExtraMarikoPadNames[i], 0x2000, 0x2000); } } } void ConfigureInitialDrivePads() { - const InitialConfig *configs = InitialDrivePadConfigs; - for (size_t i = 0; i < NumInitialDrivePadConfigs; i++) { + const InitialConfig *configs = nullptr; + size_t num_configs = 0; + const auto hw_type = spl::GetHardwareType(); + + switch (hw_type) { + case spl::HardwareType::Icosa: + case spl::HardwareType::Copper: + case spl::HardwareType::Iowa: + case spl::HardwareType::Calcio: + configs = InitialDrivePadConfigs; + num_configs = NumInitialDrivePadConfigs; + case spl::HardwareType::Hoag: + configs = InitialDrivePadConfigsHoag; + num_configs = NumInitialDrivePadConfigsHoag; + break; + /* Unknown hardware type, we can't proceed. */ + AMS_UNREACHABLE_DEFAULT_CASE(); + } + + /* Ensure we found an appropriate config. */ + AMS_ABORT_UNLESS(configs != nullptr); + + for (size_t i = 0; i < num_configs; i++) { UpdateDrivePad(configs[i].name, configs[i].val, configs[i].mask); } } diff --git a/stratosphere/boot/source/pinmux/pinmux_initial_configuration_calcio.inc b/stratosphere/boot/source/pinmux/pinmux_initial_configuration_calcio.inc new file mode 100644 index 000000000..3dcb28611 --- /dev/null +++ b/stratosphere/boot/source/pinmux/pinmux_initial_configuration_calcio.inc @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2018-2020 Atmosphère-NX + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +constexpr InitialConfig InitialConfigsCalcio[] = { + {0x0D, 0x20, 0x27F}, + {0x0C, 0x00, 0x27F}, + {0x10, 0x40, 0x27F}, + {0x0F, 0x00, 0x27F}, + {0x0E, 0x20, 0x27F}, + {0x00, 0x40, 0x7F}, + {0x01, 0x50, 0x7F}, + {0x05, 0x50, 0x7F}, + {0x04, 0x50, 0x7F}, + {0x03, 0x50, 0x7F}, + {0x02, 0x50, 0x7F}, + {0x5B, 0x00, 0x78}, + {0x80, 0x01, 0x7F}, + {0x34, 0x40, 0x27F}, + {0x35, 0x40, 0x27F}, + {0x55, 0x20, 0x78}, + {0x56, 0x01, 0x7F}, + {0x5C, 0x00, 0x78}, + {0x5A, 0x20, 0x78}, + {0x2C, 0x40, 0x27F}, + {0x2D, 0x40, 0x27F}, + {0x36, 0x00, 0x7F}, + {0x37, 0x30, 0x7F}, + {0x38, 0x00, 0x7F}, + {0x39, 0x28, 0x7F}, + {0x54, 0x00, 0x67}, + {0x42, 0x00, 0x7F}, + {0x43, 0x28, 0x7F}, + {0x44, 0x00, 0x7F}, + {0x45, 0x28, 0x7F}, + {0x4B, 0x28, 0x7F}, + {0x4C, 0x00, 0x7F}, + {0x4A, 0x00, 0x7F}, + {0x4D, 0x00, 0x7F}, + {0x63, 0x240, 0x27F}, + {0x26, 0x04, 0x67}, + {0x27, 0x04, 0x67}, + {0x28, 0x04, 0x67}, + {0x29, 0x04, 0x67}, + {0x2A, 0x04, 0x67}, + {0x78, 0x24, 0x7F}, + {0x88, 0x34, 0x7F}, + {0x89, 0x24, 0x7F}, + {0x8A, 0x34, 0x7F}, + {0x8B, 0x34, 0x7F}, + {0x8D, 0x34, 0x7F}, + {0x81, 0x04, 0x67}, + {0x9D, 0x34, 0x7F}, + {0x9F, 0x34, 0x7F}, + {0x92, 0x4C, 0x7F}, + {0x93, 0x4C, 0x7F}, + {0x94, 0x44, 0x7F}, + {0x96, 0x34, 0x7F}, + {0x98, 0x34, 0x7F}, + {0x12, 0x0C, 0x7F}, + {0x13, 0x34, 0x7F}, + {0x14, 0x0C, 0x7F}, + {0x6A, 0x04, 0x67}, + {0x6B, 0x04, 0x67}, + {0x6C, 0x2C, 0x7F}, + {0x6D, 0x04, 0x67}, + {0x6E, 0x04, 0x67}, + {0x6F, 0x24, 0x7F}, + {0x70, 0x04, 0x7F}, + {0x69, 0x0C, 0x7F}, + {0x64, 0x24, 0x27F}, + {0x5D, 0x05, 0x07}, + {0x5E, 0x05, 0x07}, + {0x5F, 0x05, 0x07}, + {0x60, 0x05, 0x07}, + {0x61, 0x05, 0x07}, + {0x47, 0x05, 0x07}, + {0x48, 0x05, 0x07}, + {0x46, 0x05, 0x07}, + {0x49, 0x05, 0x07}, + {0x17, 0x05, 0x07}, + {0x18, 0x05, 0x07}, + {0x19, 0x05, 0x07}, + {0x1A, 0x05, 0x07}, + {0x1B, 0x05, 0x07}, + {0x2B, 0x05, 0x07}, + {0x8F, 0x05, 0x07}, + {0x90, 0x05, 0x07}, + {0x30, 0x05, 0x07}, + {0x31, 0x05, 0x07}, + {0x32, 0x05, 0x07}, + {0x33, 0x05, 0x07}, + {0x52, 0x05, 0x07}, + {0x53, 0x05, 0x07}, + {0x75, 0x05, 0x07}, + {0x76, 0x05, 0x07}, + {0x77, 0x05, 0x07}, + {0x79, 0x05, 0x07}, + {0x7A, 0x05, 0x07}, + {0x11, 0x05, 0x07}, + {0x8E, 0x05, 0x07}, + {0xAA, 0x05, 0x07}, + {0xAB, 0x05, 0x07}, + {0xAC, 0x05, 0x07}, + {0xA2, 0x05, 0x07}, + {0xA3, 0x05, 0x07}, + {0xA4, 0x05, 0x07}, + {0xA5, 0x05, 0x07}, + {0xA6, 0x05, 0x07}, + {0xA7, 0x05, 0x07}, + {0xA8, 0x05, 0x07}, + {0xA9, 0x05, 0x07}, + {0xAD, 0x05, 0x07}, + {0xAE, 0x05, 0x07}, + {0x06, 0x05, 0x07}, + {0x07, 0x05, 0x07}, + {0x08, 0x05, 0x07}, + {0x09, 0x05, 0x07}, + {0x0A, 0x05, 0x07}, + {0x0B, 0x05, 0x07}, + {0x87, 0x05, 0x07}, + {0x86, 0x05, 0x07}, + {0x82, 0x05, 0x07}, + {0x83, 0x05, 0x07}, + {0x85, 0x05, 0x07}, + {0x84, 0x05, 0x07}, + {0x8C, 0x05, 0x07}, + {0x7B, 0x05, 0x07}, + {0x7C, 0x05, 0x07}, + {0x7D, 0x05, 0x07}, + {0x7E, 0x05, 0x07}, + {0x7F, 0x05, 0x07}, + {0x9C, 0x05, 0x07}, + {0x9E, 0x05, 0x07}, + {0xA0, 0x05, 0x07}, + {0xA1, 0x05, 0x07}, + {0x58, 0x00, 0x18}, + {0x59, 0x00, 0x18}, + {0x4F, 0x05, 0x07}, + {0x50, 0x05, 0x07}, + {0x4E, 0x05, 0x07}, + {0x51, 0x05, 0x07}, + {0x2E, 0x05, 0x07}, + {0x2F, 0x05, 0x07}, + {0x3A, 0x05, 0x07}, + {0x3B, 0x05, 0x07}, + {0x3C, 0x05, 0x07}, + {0x3D, 0x05, 0x07}, + {0x95, 0x05, 0x07}, + {0x97, 0x05, 0x07}, + {0x99, 0x05, 0x07}, + {0x9A, 0x05, 0x07}, + {0x9B, 0x05, 0x07}, + {0x15, 0x05, 0x07}, + {0x16, 0x05, 0x07}, + {0x1C, 0x05, 0x07}, + {0x1D, 0x05, 0x07}, + {0x1E, 0x05, 0x07}, + {0x1F, 0x05, 0x07}, + {0x3E, 0x05, 0x07}, + {0x3F, 0x05, 0x07}, + {0x40, 0x05, 0x07}, + {0x41, 0x05, 0x07}, + {0x91, 0x05, 0x07}, + {0x71, 0x05, 0x07}, + {0x72, 0x05, 0x07}, + {0x73, 0x05, 0x07}, + {0x74, 0x05, 0x07}, + {0x22, 0x05, 0x07}, + {0x23, 0x05, 0x07}, + {0x20, 0x05, 0x07}, + {0x21, 0x05, 0x07}, + {0x24, 0x05, 0x07}, + {0x25, 0x05, 0x07}, + {0x62, 0x05, 0x07}, + {0x65, 0x05, 0x07}, + {0x66, 0x05, 0x07}, + {0x67, 0x05, 0x07}, + {0x68, 0x05, 0x07}, +}; + +constexpr u32 NumInitialConfigsCalcio = util::size(InitialConfigsCalcio); diff --git a/stratosphere/boot/source/pinmux/pinmux_initial_configuration_copper.inc b/stratosphere/boot/source/pinmux/pinmux_initial_configuration_copper.inc index 6e8aa2f37..a130e4d05 100644 --- a/stratosphere/boot/source/pinmux/pinmux_initial_configuration_copper.inc +++ b/stratosphere/boot/source/pinmux/pinmux_initial_configuration_copper.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -178,4 +178,4 @@ constexpr InitialConfig InitialConfigsCopper[] = { {0x68, 0x05, 0x07}, }; -constexpr u32 NumInitialConfigsCopper = (sizeof(InitialConfigsCopper) / sizeof(InitialConfigsCopper[0])); +constexpr u32 NumInitialConfigsCopper = util::size(InitialConfigsCopper); diff --git a/stratosphere/boot/source/pinmux/pinmux_initial_configuration_hoag.inc b/stratosphere/boot/source/pinmux/pinmux_initial_configuration_hoag.inc index e33e88049..5f1924c45 100644 --- a/stratosphere/boot/source/pinmux/pinmux_initial_configuration_hoag.inc +++ b/stratosphere/boot/source/pinmux/pinmux_initial_configuration_hoag.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -15,85 +15,83 @@ */ constexpr InitialConfig InitialConfigsHoag[] = { - {0x5D, 0x00, 0x67}, + {0x5D, 0x00, 0x7F}, {0x47, 0x28, 0x7F}, - {0x48, 0x00, 0x67}, - {0x46, 0x00, 0x67}, - {0x49, 0x00, 0x67}, + {0x48, 0x00, 0x7F}, + {0x46, 0x00, 0x7F}, + {0x49, 0x00, 0x7F}, {0x30, 0x40, 0x27F}, {0x31, 0x40, 0x27F}, {0x0D, 0x20, 0x27F}, - {0x0C, 0x00, 0x267}, - {0x10, 0x20, 0x27F}, - {0x0F, 0x00, 0x267}, + {0x0C, 0x00, 0x27F}, + {0x10, 0x40, 0x27F}, + {0x0F, 0x00, 0x27F}, {0x0E, 0x20, 0x27F}, - {0x00, 0x48, 0x7F}, + {0x00, 0x40, 0x7F}, {0x01, 0x50, 0x7F}, {0x05, 0x50, 0x7F}, {0x04, 0x50, 0x7F}, {0x03, 0x50, 0x7F}, {0x02, 0x50, 0x7F}, + {0xAA, 0x40, 0x7F}, + {0xAC, 0x40, 0x7F}, + {0xA2, 0x50, 0x7F}, + {0xA3, 0x50, 0x7F}, + {0xA4, 0x50, 0x7F}, + {0xA5, 0x50, 0x7F}, + {0xA6, 0x50, 0x7F}, + {0xA7, 0x50, 0x7F}, + {0xA8, 0x50, 0x7F}, + {0xA9, 0x50, 0x7F}, + {0x83, 0x00, 0x67}, {0x5B, 0x00, 0x78}, {0x7C, 0x01, 0x67}, {0x80, 0x01, 0x7F}, {0x34, 0x40, 0x27F}, {0x35, 0x40, 0x27F}, {0x55, 0x20, 0x78}, - {0x56, 0x20, 0x7F}, - {0xA1, 0x30, 0x7F}, + {0x56, 0x01, 0x7F}, {0x5C, 0x00, 0x78}, - {0x59, 0x00, 0x60}, - {0x5A, 0x30, 0x78}, + {0x5A, 0x20, 0x78}, {0x2C, 0x40, 0x27F}, {0x2D, 0x40, 0x27F}, {0x2E, 0x40, 0x27F}, {0x2F, 0x40, 0x27F}, - {0x3B, 0x20, 0x7F}, - {0x3C, 0x00, 0x67}, - {0x3D, 0x20, 0x7F}, - {0x36, 0x00, 0x67}, + {0x36, 0x00, 0x7F}, {0x37, 0x30, 0x7F}, - {0x38, 0x00, 0x67}, + {0x38, 0x00, 0x7F}, {0x39, 0x28, 0x7F}, {0x54, 0x00, 0x67}, {0x9B, 0x30, 0x7F}, - {0x1C, 0x00, 0x67}, - {0x1D, 0x30, 0x7F}, - {0x1E, 0x00, 0x67}, - {0x1F, 0x00, 0x67}, + {0x3E, 0x00, 0x7F}, {0x3F, 0x20, 0x7F}, - {0x40, 0x00, 0x67}, - {0x41, 0x20, 0x7F}, - {0x42, 0x00, 0x67}, + {0x40, 0x00, 0x7F}, + {0x41, 0x30, 0x7F}, + {0x42, 0x00, 0x7F}, {0x43, 0x28, 0x7F}, - {0x44, 0x00, 0x67}, + {0x44, 0x00, 0x7F}, {0x45, 0x28, 0x7F}, - {0x22, 0x00, 0x67}, - {0x23, 0x28, 0x7F}, - {0x20, 0x00, 0x67}, - {0x21, 0x00, 0x67}, {0x4B, 0x28, 0x7F}, - {0x4C, 0x00, 0x67}, - {0x4A, 0x00, 0x67}, - {0x4D, 0x00, 0x67}, - {0x64, 0x20, 0x27F}, - {0x5F, 0x34, 0x7F}, + {0x4C, 0x00, 0x7F}, + {0x4A, 0x00, 0x7F}, + {0x4D, 0x00, 0x7F}, {0x60, 0x04, 0x67}, {0x61, 0x2C, 0x7F}, + {0x26, 0x04, 0x67}, + {0x27, 0x04, 0x67}, + {0x28, 0x04, 0x67}, + {0x29, 0x04, 0x67}, {0x2A, 0x04, 0x67}, - {0x2B, 0x04, 0x67}, {0x8F, 0x24, 0x7F}, + {0x90, 0x34, 0x7F}, {0x33, 0x34, 0x27F}, - {0x52, 0x2C, 0x7F}, {0x53, 0x24, 0x7F}, {0x77, 0x04, 0x67}, - {0x78, 0x34, 0x7F}, + {0x78, 0x24, 0x7F}, + {0x79, 0x04, 0x67}, + {0x7A, 0x04, 0x67}, {0x11, 0x04, 0x67}, - {0x06, 0x2C, 0x7F}, - {0x08, 0x24, 0x7F}, - {0x09, 0x24, 0x7F}, - {0x0A, 0x24, 0x7F}, - {0x0B, 0x24, 0x7F}, + {0x87, 0x04, 0x67}, {0x88, 0x34, 0x7F}, {0x86, 0x2C, 0x7F}, {0x82, 0x24, 0x7F}, @@ -101,29 +99,30 @@ constexpr InitialConfig InitialConfigsHoag[] = { {0x89, 0x24, 0x7F}, {0x8A, 0x34, 0x7F}, {0x8B, 0x34, 0x7F}, - {0x8C, 0x34, 0x7F}, - {0x8D, 0x24, 0x7F}, + {0x8C, 0x24, 0x7F}, + {0x8D, 0x34, 0x7F}, {0x7D, 0x04, 0x67}, {0x7E, 0x04, 0x67}, + {0x7F, 0x34, 0x7F}, {0x81, 0x04, 0x67}, - {0x9C, 0x34, 0x7F}, + {0x9C, 0x24, 0x7F}, {0x9D, 0x34, 0x7F}, - {0x9E, 0x2C, 0x7F}, {0x9F, 0x34, 0x7F}, {0xA0, 0x04, 0x67}, - {0x4F, 0x04, 0x67}, + {0x50, 0x04, 0x67}, + {0x4E, 0x2C, 0x7F}, {0x51, 0x04, 0x67}, - {0x3A, 0x24, 0x7F}, {0x92, 0x4C, 0x7F}, {0x93, 0x4C, 0x7F}, {0x94, 0x44, 0x7F}, - {0x95, 0x04, 0x67}, {0x96, 0x34, 0x7F}, {0x97, 0x04, 0x67}, {0x98, 0x34, 0x7F}, - {0x99, 0x34, 0x7F}, - {0x9A, 0x04, 0x67}, - {0x3E, 0x24, 0x7F}, + {0x99, 0x04, 0x67}, + {0x1C, 0x24, 0x7F}, + {0x1D, 0x24, 0x7F}, + {0x1E, 0x24, 0x7F}, + {0x1F, 0x24, 0x7F}, {0x6A, 0x04, 0x67}, {0x6B, 0x04, 0x67}, {0x6C, 0x2C, 0x7F}, @@ -134,35 +133,42 @@ constexpr InitialConfig InitialConfigsHoag[] = { {0x70, 0x04, 0x7F}, {0x71, 0x04, 0x67}, {0x72, 0x04, 0x67}, - {0x65, 0x34, 0x7F}, - {0x66, 0x04, 0x67}, - {0x67, 0x04, 0x267}, + {0x68, 0x204, 0x267}, {0x5E, 0x05, 0x07}, + {0x5F, 0x05, 0x07}, {0x17, 0x05, 0x07}, {0x18, 0x05, 0x07}, {0x19, 0x05, 0x07}, {0x1A, 0x05, 0x07}, {0x1B, 0x05, 0x07}, - {0x26, 0x05, 0x07}, - {0x27, 0x05, 0x07}, - {0x28, 0x05, 0x07}, - {0x29, 0x05, 0x07}, - {0x90, 0x05, 0x07}, + {0x2B, 0x05, 0x07}, {0x32, 0x05, 0x07}, + {0x52, 0x05, 0x07}, {0x75, 0x05, 0x07}, {0x76, 0x05, 0x07}, - {0x79, 0x05, 0x07}, - {0x7A, 0x05, 0x07}, {0x8E, 0x05, 0x07}, + {0xAB, 0x05, 0x07}, + {0xAD, 0x05, 0x07}, + {0xAE, 0x05, 0x07}, + {0x06, 0x05, 0x07}, {0x07, 0x05, 0x07}, - {0x87, 0x05, 0x07}, - {0x83, 0x05, 0x07}, + {0x08, 0x05, 0x07}, + {0x09, 0x05, 0x07}, + {0x0A, 0x05, 0x07}, + {0x0B, 0x05, 0x07}, {0x84, 0x05, 0x07}, {0x7B, 0x05, 0x07}, - {0x7F, 0x05, 0x07}, + {0x9E, 0x05, 0x07}, + {0xA1, 0x05, 0x07}, {0x58, 0x00, 0x00}, - {0x50, 0x05, 0x07}, - {0x4E, 0x05, 0x07}, + {0x59, 0x00, 0x00}, + {0x4F, 0x05, 0x07}, + {0x3A, 0x05, 0x07}, + {0x3B, 0x05, 0x07}, + {0x3C, 0x05, 0x07}, + {0x3D, 0x05, 0x07}, + {0x95, 0x05, 0x07}, + {0x9A, 0x05, 0x07}, {0x12, 0x05, 0x07}, {0x13, 0x05, 0x07}, {0x14, 0x05, 0x07}, @@ -170,12 +176,19 @@ constexpr InitialConfig InitialConfigsHoag[] = { {0x16, 0x05, 0x07}, {0x73, 0x05, 0x07}, {0x74, 0x05, 0x07}, + {0x22, 0x05, 0x07}, + {0x23, 0x05, 0x07}, + {0x20, 0x05, 0x07}, + {0x21, 0x05, 0x07}, {0x24, 0x05, 0x07}, {0x25, 0x05, 0x07}, {0x62, 0x05, 0x07}, - {0x68, 0x05, 0x07}, + {0x65, 0x05, 0x07}, + {0x66, 0x05, 0x07}, + {0x67, 0x05, 0x07}, {0x69, 0x05, 0x07}, + {0x64, 0x05, 0x07}, {0x63, 0x05, 0x07}, }; -constexpr u32 NumInitialConfigsHoag = (sizeof(InitialConfigsHoag) / sizeof(InitialConfigsHoag[0])); +constexpr u32 NumInitialConfigsHoag = util::size(InitialConfigsHoag); diff --git a/stratosphere/boot/source/pinmux/pinmux_initial_configuration_icosa.inc b/stratosphere/boot/source/pinmux/pinmux_initial_configuration_icosa.inc index 17d9af09e..553f05dc2 100644 --- a/stratosphere/boot/source/pinmux/pinmux_initial_configuration_icosa.inc +++ b/stratosphere/boot/source/pinmux/pinmux_initial_configuration_icosa.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -98,7 +98,7 @@ constexpr InitialConfig InitialConfigsIcosa[] = { {0x86, 0x2C, 0x7F}, {0x82, 0x24, 0x7F}, {0x85, 0x34, 0x7F}, - {0x89, 0x24, 0x7F}, + {0x89, 0x34, 0x7F}, {0x8A, 0x34, 0x7F}, {0x8B, 0x34, 0x7F}, {0x8C, 0x34, 0x7F}, @@ -178,4 +178,4 @@ constexpr InitialConfig InitialConfigsIcosa[] = { {0x63, 0x05, 0x07}, }; -constexpr u32 NumInitialConfigsIcosa = (sizeof(InitialConfigsIcosa) / sizeof(InitialConfigsIcosa[0])); +constexpr u32 NumInitialConfigsIcosa = util::size(InitialConfigsIcosa); diff --git a/stratosphere/boot/source/pinmux/pinmux_initial_configuration_iowa.inc b/stratosphere/boot/source/pinmux/pinmux_initial_configuration_iowa.inc index 11e7b5722..471db0e55 100644 --- a/stratosphere/boot/source/pinmux/pinmux_initial_configuration_iowa.inc +++ b/stratosphere/boot/source/pinmux/pinmux_initial_configuration_iowa.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -98,6 +98,7 @@ constexpr InitialConfig InitialConfigsIowa[] = { {0x09, 0x24, 0x7F}, {0x0A, 0x24, 0x7F}, {0x0B, 0x24, 0x7F}, + {0x87, 0x04, 0x67}, {0x88, 0x34, 0x7F}, {0x86, 0x2C, 0x7F}, {0x82, 0x24, 0x7F}, @@ -162,7 +163,6 @@ constexpr InitialConfig InitialConfigsIowa[] = { {0xAD, 0x05, 0x07}, {0xAE, 0x05, 0x07}, {0x07, 0x05, 0x07}, - {0x87, 0x05, 0x07}, {0x83, 0x05, 0x07}, {0x84, 0x05, 0x07}, {0x7B, 0x05, 0x07}, @@ -191,4 +191,4 @@ constexpr InitialConfig InitialConfigsIowa[] = { {0x63, 0x05, 0x07}, }; -constexpr u32 NumInitialConfigsIowa = (sizeof(InitialConfigsIowa) / sizeof(InitialConfigsIowa[0])); +constexpr u32 NumInitialConfigsIowa = util::size(InitialConfigsIowa); diff --git a/stratosphere/boot/source/pinmux/pinmux_initial_drive_pad_configuration.inc b/stratosphere/boot/source/pinmux/pinmux_initial_drive_pad_configuration.inc index 8d5d2fe14..cef51f40f 100644 --- a/stratosphere/boot/source/pinmux/pinmux_initial_drive_pad_configuration.inc +++ b/stratosphere/boot/source/pinmux/pinmux_initial_drive_pad_configuration.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -64,4 +64,4 @@ constexpr InitialConfig InitialDrivePadConfigs[] = { {0x69, 0x51212000, 0xF1F1F000}, }; -constexpr u32 NumInitialDrivePadConfigs = (sizeof(InitialDrivePadConfigs) / sizeof(InitialDrivePadConfigs[0])); +constexpr u32 NumInitialDrivePadConfigs = util::size(InitialDrivePadConfigs); diff --git a/stratosphere/boot/source/pinmux/pinmux_initial_drive_pad_configuration_hoag.inc b/stratosphere/boot/source/pinmux/pinmux_initial_drive_pad_configuration_hoag.inc new file mode 100644 index 000000000..05458c682 --- /dev/null +++ b/stratosphere/boot/source/pinmux/pinmux_initial_drive_pad_configuration_hoag.inc @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2018-2020 Atmosphère-NX + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +constexpr InitialConfig InitialDrivePadConfigsHoag[] = { + {0x04, 0x01010000, 0x01F1F000}, + {0x0D, 0x01010000, 0x01F1F000}, + {0x10, 0x01010000, 0x01F1F000}, + {0x12, 0x01010000, 0x01F1F000}, + {0x13, 0x01010000, 0x01F1F000}, + {0x14, 0x0001F000, 0x01F1F000}, + {0x15, 0x0001F000, 0x01F1F000}, + {0x24, 0x01010000, 0x01F1F000}, + {0x25, 0x01010000, 0x01F1F000}, + {0x26, 0x01010000, 0x01F1F000}, + {0x27, 0x01010000, 0x01F1F000}, + {0x28, 0x01010000, 0x01F1F000}, + {0x29, 0x01010000, 0x01F1F000}, + {0x2A, 0x01010000, 0x01F1F000}, + {0x2B, 0x01010000, 0x01F1F000}, + {0x2C, 0x01F1F000, 0x01F1F000}, + {0x2D, 0x01F1F000, 0x01F1F000}, + {0x2F, 0x01F1F000, 0x01F1F000}, + {0x30, 0x01404000, 0x01F1F000}, + {0x31, 0x0001F000, 0x01F1F000}, + {0x32, 0x0001F000, 0x01F1F000}, + {0x33, 0x00004000, 0x01F1F000}, + {0x34, 0x00004000, 0x01F1F000}, + {0x35, 0x00007000, 0x01F1F000}, + {0x36, 0x00007000, 0x01F1F000}, + {0x46, 0x01010000, 0x01F1F000}, + {0x47, 0x01010000, 0x01F1F000}, + {0x4C, 0x01404000, 0x01F1F000}, + {0x4D, 0x01404000, 0x01F1F000}, + {0x62, 0x0001F000, 0x01F1F000}, + {0x63, 0x0001F000, 0x01F1F000}, + {0x7C, 0x01414000, 0x01F1F000}, + {0x87, 0x01404000, 0x01F1F000}, + {0x88, 0x01404000, 0x01F1F000}, + {0x89, 0x01404000, 0x01F1F000}, + {0x8A, 0x01404000, 0x01F1F000}, + {0x6D, 0x00000000, 0xF0000000}, + {0x6E, 0x00000000, 0xF0000000}, + {0x6F, 0x00000000, 0xF0000000}, + {0x70, 0x00000000, 0xF0000000}, + {0x71, 0x00000000, 0xF0000000}, + {0x72, 0x00000000, 0xF0000000}, + {0x73, 0x00000000, 0xF0000000}, + {0x74, 0x00000000, 0xF0000000}, + {0x75, 0x00000000, 0xF0000000}, + {0x76, 0x00000000, 0xF0000000}, + {0x69, 0x51212000, 0xF1F1F000}, +}; + +constexpr u32 NumInitialDrivePadConfigsHoag = util::size(InitialDrivePadConfigsHoag); diff --git a/stratosphere/boot/source/pinmux/pinmux_map.inc b/stratosphere/boot/source/pinmux/pinmux_map.inc index 9890dd9e7..f6a18c37f 100644 --- a/stratosphere/boot/source/pinmux/pinmux_map.inc +++ b/stratosphere/boot/source/pinmux/pinmux_map.inc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Atmosphère-NX + * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -205,7 +205,7 @@ constexpr Definition Map[] = { {0x000032C4, 0x1F2FF, 0x00}, /* Sdmmc2Dqsb */ }; -constexpr u32 PadNameMax = (sizeof(Map) / sizeof(Map[0])); +constexpr u32 PadNameMax = util::size(Map); constexpr DrivePadDefinition DrivePadMap[] = { {0x000008E4, 0x01F1F000}, /* AlsProxInt */ @@ -358,4 +358,4 @@ constexpr DrivePadDefinition DrivePadMap[] = { {0x00000B6C, 0x01F1F000}, /* WifiWakeAp */ }; -constexpr u32 DrivePadNameMax = (sizeof(DrivePadMap) / sizeof(DrivePadMap[0])); +constexpr u32 DrivePadNameMax = util::size(DrivePadMap);