htc: skeleton HtcsManagerImpl, implement HtcsMonitor

This commit is contained in:
Michael Scire
2021-02-10 18:54:40 -08:00
committed by SciresM
parent cb5a706659
commit 10255f7f51
20 changed files with 652 additions and 17 deletions

View File

@@ -20,6 +20,8 @@
namespace ams::htclow {
enum class ModuleId : u8 {
Unknown = 0,
Htcfs = 1,
Htcmisc = 3,
@@ -31,4 +33,34 @@ namespace ams::htclow {
ModuleId _id;
};
constexpr void InitializeModule(ModuleType *out, ModuleId id) {
*out = {
._is_initialized = true,
._id = id,
};
}
constexpr void FinalizeModule(ModuleType *out) {
*out = {
._is_initialized = false,
._id = ModuleId::Unknown,
};
}
class Module final {
private:
ModuleType m_impl;
public:
constexpr explicit Module(ModuleId id) : m_impl() {
InitializeModule(std::addressof(m_impl), id);
}
constexpr ~Module() {
FinalizeModule(std::addressof(m_impl));
}
ModuleType *GetBase() { return std::addressof(m_impl); }
const ModuleType *GetBase() const { return std::addressof(m_impl); }
};
}

View File

@@ -16,3 +16,5 @@
#pragma once
#include <stratosphere/htcs/htcs_types.hpp>
#include <stratosphere/htcs/impl/htcs_manager_holder.hpp>
#include <stratosphere/htcs/impl/htcs_channel_ids.hpp>

View File

@@ -0,0 +1,24 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <vapours.hpp>
#include <stratosphere/htclow/htclow_channel_types.hpp>
namespace ams::htcs::impl {
constexpr inline htclow::ChannelId HtcsClientChannelId = 0;
}

View File

@@ -0,0 +1,33 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <vapours.hpp>
#include <stratosphere/htcs/htcs_types.hpp>
namespace ams::htcs::impl {
class HtcsManager;
namespace HtcsManagerHolder {
void AddReference();
void Release();
HtcsManager *GetHtcsManager();
}
}