From db47a0c04196c13ffb81ba22df05188c589d877b Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Mon, 6 May 2019 23:14:06 -0700 Subject: [PATCH] boot: implement SetFanEnabled --- stratosphere/boot/source/boot_fan_enable.cpp | 26 ++++++++++++++++++++ stratosphere/boot/source/boot_functions.hpp | 1 + 2 files changed, 27 insertions(+) create mode 100644 stratosphere/boot/source/boot_fan_enable.cpp diff --git a/stratosphere/boot/source/boot_fan_enable.cpp b/stratosphere/boot/source/boot_fan_enable.cpp new file mode 100644 index 000000000..2dc80e23b --- /dev/null +++ b/stratosphere/boot/source/boot_fan_enable.cpp @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2018-2019 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 . + */ + +#include "boot_functions.hpp" + +static constexpr u32 GpioPadName_FanEnable = 0x4B; + +void Boot::SetFanEnabled() { + if (Boot::GetHardwareType() == HardwareType_Copper) { + Boot::GpioSetDirection(GpioPadName_FanEnable, GpioDirection_Output); + Boot::GpioSetValue(GpioPadName_FanEnable, GpioValue_High); + } +} diff --git a/stratosphere/boot/source/boot_functions.hpp b/stratosphere/boot/source/boot_functions.hpp index 87423b70a..a7be01861 100644 --- a/stratosphere/boot/source/boot_functions.hpp +++ b/stratosphere/boot/source/boot_functions.hpp @@ -36,6 +36,7 @@ class Boot { static void SetInitialClockConfiguration(); static void ConfigurePinmux(); static void SetInitialWakePinConfiguration(); + static void SetFanEnabled(); static void CheckAndRepairBootImages(); /* Power utilities. */