Revert "hoc-clk: add live vdd2, live boost clock and basic pwm dimming"

This reverts commit 15b7df8ef1.
This commit is contained in:
souldbminersmwc
2025-11-09 16:14:52 -05:00
parent 22ec140738
commit 21a3f953d7
3804 changed files with 435 additions and 570162 deletions

View File

@@ -1,31 +0,0 @@
/*
* Copyright (c) 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 <http://www.gnu.org/licenses/>.
*/
#include <stratosphere.hpp>
#include "gpio_server_manager_impl.hpp"
namespace ams::gpio::server {
namespace {
ams::sf::UnmanagedServiceObject<gpio::sf::IManager, gpio::server::ManagerImpl> g_manager_impl;
}
ams::sf::SharedPointer<gpio::sf::IManager> GetServiceObject() {
return g_manager_impl.GetShared();
}
}

View File

@@ -1,100 +0,0 @@
/*
* Copyright (c) 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 <http://www.gnu.org/licenses/>.
*/
#include <stratosphere.hpp>
#include "gpio_server_manager_impl.hpp"
namespace ams::gpio::server {
ManagerImpl::ManagerImpl() {
m_heap_handle = lmem::CreateExpHeap(m_heap_buffer, sizeof(m_heap_buffer), lmem::CreateOption_None);
m_pad_allocator.Attach(m_heap_handle);
}
ManagerImpl::~ManagerImpl() {
lmem::DestroyExpHeap(m_heap_handle);
}
Result ManagerImpl::OpenSessionForDev(ams::sf::Out<ams::sf::SharedPointer<gpio::sf::IPadSession>> out, s32 pad_descriptor) {
/* TODO */
AMS_UNUSED(out, pad_descriptor);
AMS_ABORT();
}
Result ManagerImpl::OpenSession(ams::sf::Out<ams::sf::SharedPointer<gpio::sf::IPadSession>> out, gpio::GpioPadName pad_name) {
R_RETURN(this->OpenSession2(out, ConvertToDeviceCode(pad_name), ddsf::AccessMode_ReadWrite));
}
Result ManagerImpl::OpenSessionForTest(ams::sf::Out<ams::sf::SharedPointer<gpio::sf::IPadSession>> out, gpio::GpioPadName pad_name) {
/* TODO */
AMS_UNUSED(out, pad_name);
AMS_ABORT();
}
Result ManagerImpl::IsWakeEventActive(ams::sf::Out<bool> out, gpio::GpioPadName pad_name) {
/* TODO */
AMS_UNUSED(out, pad_name);
AMS_ABORT();
}
Result ManagerImpl::GetWakeEventActiveFlagSet(ams::sf::Out<gpio::WakeBitFlag> out) {
/* TODO */
AMS_UNUSED(out);
AMS_ABORT();
}
Result ManagerImpl::SetWakeEventActiveFlagSetForDebug(gpio::GpioPadName pad_name, bool is_enabled) {
/* TODO */
AMS_UNUSED(pad_name, is_enabled);
AMS_ABORT();
}
Result ManagerImpl::SetWakePinDebugMode(s32 mode) {
/* TODO */
AMS_UNUSED(mode);
AMS_ABORT();
}
Result ManagerImpl::OpenSession2(ams::sf::Out<ams::sf::SharedPointer<gpio::sf::IPadSession>> out, DeviceCode device_code, ddsf::AccessMode access_mode) {
/* Allocate a session. */
auto session = Factory::CreateSharedEmplaced<gpio::sf::IPadSession, PadSessionImpl>(std::addressof(m_pad_allocator), this);
/* Open the session. */
R_TRY(session.GetImpl().OpenSession(device_code, access_mode));
/* We succeeded. */
*out = std::move(session);
R_SUCCEED();
}
Result ManagerImpl::IsWakeEventActive2(ams::sf::Out<bool> out, DeviceCode device_code) {
/* TODO */
AMS_UNUSED(out, device_code);
AMS_ABORT();
}
Result ManagerImpl::SetWakeEventActiveFlagSetForDebug2(DeviceCode device_code, bool is_enabled) {
/* TODO */
AMS_UNUSED(device_code, is_enabled);
AMS_ABORT();
}
Result ManagerImpl::SetRetryValues(u32 arg0, u32 arg1) {
/* TODO */
AMS_UNUSED(arg0, arg1);
AMS_ABORT();
}
}

View File

@@ -1,51 +0,0 @@
/*
* Copyright (c) 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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <stratosphere.hpp>
#include "gpio_server_pad_session_impl.hpp"
namespace ams::gpio::server {
class ManagerImpl : public ams::sf::ISharedObject {
private:
using Allocator = ams::sf::ExpHeapAllocator;
using Factory = ams::sf::ObjectFactory<Allocator::Policy>;
private:
lmem::HeapHandle m_heap_handle;
Allocator m_pad_allocator;
u8 m_heap_buffer[12_KB];
public:
ManagerImpl();
~ManagerImpl();
public:
/* Actual commands. */
Result OpenSessionForDev(ams::sf::Out<ams::sf::SharedPointer<gpio::sf::IPadSession>> out, s32 pad_descriptor);
Result OpenSession(ams::sf::Out<ams::sf::SharedPointer<gpio::sf::IPadSession>> out, gpio::GpioPadName pad_name);
Result OpenSessionForTest(ams::sf::Out<ams::sf::SharedPointer<gpio::sf::IPadSession>> out, gpio::GpioPadName pad_name);
Result IsWakeEventActive(ams::sf::Out<bool> out, gpio::GpioPadName pad_name);
Result GetWakeEventActiveFlagSet(ams::sf::Out<gpio::WakeBitFlag> out);
Result SetWakeEventActiveFlagSetForDebug(gpio::GpioPadName pad_name, bool is_enabled);
Result SetWakePinDebugMode(s32 mode);
Result OpenSession2(ams::sf::Out<ams::sf::SharedPointer<gpio::sf::IPadSession>> out, DeviceCode device_code, ddsf::AccessMode access_mode);
Result IsWakeEventActive2(ams::sf::Out<bool> out, DeviceCode device_code);
Result SetWakeEventActiveFlagSetForDebug2(DeviceCode device_code, bool is_enabled);
Result SetRetryValues(u32 arg0, u32 arg1);
};
static_assert(gpio::sf::IsIManager<ManagerImpl>);
}

View File

@@ -1,219 +0,0 @@
/*
* Copyright (c) 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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <stratosphere.hpp>
namespace ams::gpio::server {
class ManagerImpl;
class PadSessionImpl {
private:
ManagerImpl *m_parent; /* NOTE: this is an sf::SharedPointer<> in Nintendo's code. */
gpio::driver::GpioPadSession m_internal_pad_session;
bool m_has_session;
os::SystemEvent m_system_event;
public:
explicit PadSessionImpl(ManagerImpl *p) : m_parent(p), m_has_session(false) { /* ... */ }
~PadSessionImpl() {
if (m_has_session) {
gpio::driver::CloseSession(std::addressof(m_internal_pad_session));
}
}
Result OpenSession(DeviceCode device_code, ddsf::AccessMode access_mode) {
AMS_ABORT_UNLESS(!m_has_session);
R_TRY(gpio::driver::OpenSession(std::addressof(m_internal_pad_session), device_code, access_mode));
m_has_session = true;
R_SUCCEED();
}
public:
/* Actual commands. */
Result SetDirection(gpio::Direction direction) {
/* Validate our state. */
AMS_ASSERT(m_has_session);
/* Validate the direction. */
R_UNLESS((direction == Direction_Input || direction == Direction_Output), gpio::ResultInvalidArgument());
/* Invoke the driver library. */
R_TRY(gpio::driver::SetDirection(std::addressof(m_internal_pad_session), direction));
R_SUCCEED();
}
Result GetDirection(ams::sf::Out<gpio::Direction> out) {
/* Validate our state. */
AMS_ASSERT(m_has_session);
/* Invoke the driver library. */
R_TRY(gpio::driver::GetDirection(out.GetPointer(), std::addressof(m_internal_pad_session)));
R_SUCCEED();
}
Result SetInterruptMode(gpio::InterruptMode mode) {
/* Validate our state. */
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(mode);
AMS_ABORT();
}
Result GetInterruptMode(ams::sf::Out<gpio::InterruptMode> out) {
/* Validate our state. */
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(out);
AMS_ABORT();
}
Result SetInterruptEnable(bool enable) {
/* Validate our state. */
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(enable);
AMS_ABORT();
}
Result GetInterruptEnable(ams::sf::Out<bool> out) {
/* Validate our state. */
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(out);
AMS_ABORT();
}
Result GetInterruptStatus(ams::sf::Out<gpio::InterruptStatus> out) {
/* Validate our state. */
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(out);
AMS_ABORT();
}
Result ClearInterruptStatus() {
/* Validate our state. */
AMS_ASSERT(m_has_session);
/* TODO */
AMS_ABORT();
}
Result SetValue(gpio::GpioValue value) {
/* Validate our state. */
AMS_ASSERT(m_has_session);
/* Validate the value. */
R_UNLESS((value == GpioValue_Low || value == GpioValue_High), gpio::ResultInvalidArgument());
/* Invoke the driver library. */
R_TRY(gpio::driver::SetValue(std::addressof(m_internal_pad_session), value));
R_SUCCEED();
}
Result GetValue(ams::sf::Out<gpio::GpioValue> out) {
/* Validate our state. */
AMS_ASSERT(m_has_session);
/* Invoke the driver library. */
R_TRY(gpio::driver::GetValue(out.GetPointer(), std::addressof(m_internal_pad_session)));
R_SUCCEED();
}
Result BindInterrupt(ams::sf::OutCopyHandle out) {
/* Validate our state. */
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(out);
AMS_ABORT();
}
Result UnbindInterrupt() {
/* Validate our state. */
AMS_ASSERT(m_has_session);
/* TODO */
AMS_ABORT();
}
Result SetDebounceEnabled(bool enable) {
/* Validate our state. */
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(enable);
AMS_ABORT();
}
Result GetDebounceEnabled(ams::sf::Out<bool> out) {
/* Validate our state. */
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(out);
AMS_ABORT();
}
Result SetDebounceTime(s32 ms) {
/* Validate our state. */
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(ms);
AMS_ABORT();
}
Result GetDebounceTime(ams::sf::Out<s32> out) {
/* Validate our state. */
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(out);
AMS_ABORT();
}
Result SetValueForSleepState(gpio::GpioValue value) {
/* Validate our state. */
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(value);
AMS_ABORT();
}
Result GetValueForSleepState(ams::sf::Out<gpio::GpioValue> out) {
/* Validate our state. */
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(out);
AMS_ABORT();
}
};
static_assert(gpio::sf::IsIPadSession<PadSessionImpl>);
}