Revert "hoc-clk: add live vdd2, live boost clock and basic pwm dimming"
This reverts commit 15b7df8ef1.
This commit is contained in:
@@ -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 "pwm_server_manager_impl.hpp"
|
||||
|
||||
namespace ams::pwm::server {
|
||||
|
||||
namespace {
|
||||
|
||||
ams::sf::UnmanagedServiceObject<pwm::sf::IManager, pwm::server::ManagerImpl> g_manager_impl;
|
||||
|
||||
}
|
||||
|
||||
ams::sf::SharedPointer<pwm::sf::IManager> GetServiceObject() {
|
||||
return g_manager_impl.GetShared();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,88 +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::pwm::server {
|
||||
|
||||
class ManagerImpl;
|
||||
|
||||
class ChannelSessionImpl {
|
||||
private:
|
||||
ManagerImpl *m_parent; /* NOTE: this is an sf::SharedPointer<> in Nintendo's code. */
|
||||
pwm::driver::ChannelSession m_internal_session;
|
||||
bool m_has_session;
|
||||
public:
|
||||
explicit ChannelSessionImpl(ManagerImpl *p) : m_parent(p), m_has_session(false) { /* ... */ }
|
||||
|
||||
~ChannelSessionImpl() {
|
||||
if (m_has_session) {
|
||||
pwm::driver::CloseSession(m_internal_session);
|
||||
}
|
||||
}
|
||||
|
||||
Result OpenSession(DeviceCode device_code) {
|
||||
AMS_ABORT_UNLESS(!m_has_session);
|
||||
|
||||
R_TRY(pwm::driver::OpenSession(std::addressof(m_internal_session), device_code));
|
||||
m_has_session = true;
|
||||
R_SUCCEED();
|
||||
}
|
||||
public:
|
||||
/* Actual commands. */
|
||||
Result SetPeriod(TimeSpanType period) {
|
||||
pwm::driver::SetPeriod(m_internal_session, period);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result GetPeriod(ams::sf::Out<TimeSpanType> out) {
|
||||
out.SetValue(pwm::driver::GetPeriod(m_internal_session));
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result SetDuty(int duty) {
|
||||
pwm::driver::SetDuty(m_internal_session, duty);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result GetDuty(ams::sf::Out<int> out) {
|
||||
out.SetValue(pwm::driver::GetDuty(m_internal_session));
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result SetEnabled(bool enabled) {
|
||||
pwm::driver::SetEnabled(m_internal_session, enabled);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result GetEnabled(ams::sf::Out<bool> out) {
|
||||
out.SetValue(pwm::driver::GetEnabled(m_internal_session));
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result SetScale(double scale) {
|
||||
pwm::driver::SetScale(m_internal_session, scale);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result GetScale(ams::sf::Out<double> out) {
|
||||
out.SetValue(pwm::driver::GetScale(m_internal_session));
|
||||
R_SUCCEED();
|
||||
}
|
||||
};
|
||||
static_assert(pwm::sf::IsIChannelSession<ChannelSessionImpl>);
|
||||
|
||||
}
|
||||
@@ -1,52 +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 "pwm_server_manager_impl.hpp"
|
||||
|
||||
namespace ams::pwm::server {
|
||||
|
||||
ManagerImpl::ManagerImpl() {
|
||||
m_heap_handle = lmem::CreateExpHeap(m_heap_buffer, sizeof(m_heap_buffer), lmem::CreateOption_None);
|
||||
m_allocator.Attach(m_heap_handle);
|
||||
}
|
||||
|
||||
ManagerImpl::~ManagerImpl() {
|
||||
lmem::DestroyExpHeap(m_heap_handle);
|
||||
}
|
||||
|
||||
Result ManagerImpl::OpenSessionForDev(ams::sf::Out<ams::sf::SharedPointer<pwm::sf::IChannelSession>> out, int channel) {
|
||||
/* TODO */
|
||||
AMS_UNUSED(out, channel);
|
||||
AMS_ABORT();
|
||||
}
|
||||
|
||||
Result ManagerImpl::OpenSession(ams::sf::Out<ams::sf::SharedPointer<pwm::sf::IChannelSession>> out, pwm::ChannelName channel_name) {
|
||||
R_RETURN(this->OpenSession2(out, ConvertToDeviceCode(channel_name)));
|
||||
}
|
||||
|
||||
Result ManagerImpl::OpenSession2(ams::sf::Out<ams::sf::SharedPointer<pwm::sf::IChannelSession>> out, DeviceCode device_code) {
|
||||
/* Allocate a session. */
|
||||
auto session = Factory::CreateSharedEmplaced<pwm::sf::IChannelSession, ChannelSessionImpl>(std::addressof(m_allocator), this);
|
||||
|
||||
/* Open the session. */
|
||||
R_TRY(session.GetImpl().OpenSession(device_code));
|
||||
|
||||
/* We succeeded. */
|
||||
*out = std::move(session);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,42 +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 "pwm_server_channel_session_impl.hpp"
|
||||
|
||||
namespace ams::pwm::server {
|
||||
|
||||
class ManagerImpl {
|
||||
private:
|
||||
using Allocator = ams::sf::ExpHeapAllocator;
|
||||
using Factory = ams::sf::ObjectFactory<Allocator::Policy>;
|
||||
private:
|
||||
lmem::HeapHandle m_heap_handle;
|
||||
Allocator m_allocator;
|
||||
u8 m_heap_buffer[4_KB];
|
||||
public:
|
||||
ManagerImpl();
|
||||
|
||||
~ManagerImpl();
|
||||
public:
|
||||
/* Actual commands. */
|
||||
Result OpenSessionForDev(ams::sf::Out<ams::sf::SharedPointer<pwm::sf::IChannelSession>> out, int channel);
|
||||
Result OpenSession(ams::sf::Out<ams::sf::SharedPointer<pwm::sf::IChannelSession>> out, pwm::ChannelName channel_name);
|
||||
Result OpenSession2(ams::sf::Out<ams::sf::SharedPointer<pwm::sf::IChannelSession>> out, DeviceCode device_code);
|
||||
};
|
||||
static_assert(pwm::sf::IsIManager<ManagerImpl>);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user