htc: skeleton much of the type hierarchy for htclow manager
This commit is contained in:
39
libraries/libstratosphere/source/htclow/mux/htclow_mux.hpp
Normal file
39
libraries/libstratosphere/source/htclow/mux/htclow_mux.hpp
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2020 Adubbz, 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 "htclow_mux_task_manager.hpp"
|
||||
#include "htclow_mux_channel_impl_map.hpp"
|
||||
#include "htclow_mux_global_send_buffer.hpp"
|
||||
|
||||
namespace ams::htclow::mux {
|
||||
|
||||
class Mux {
|
||||
private:
|
||||
PacketFactory *m_packet_factory;
|
||||
ctrl::HtcctrlStateMachine *m_state_machine;
|
||||
TaskManager m_task_manager;
|
||||
os::EventType m_wake_event;
|
||||
ChannelImplMap m_channel_impl_map;
|
||||
GlobalSendBuffer m_global_send_buffer;
|
||||
os::SdkMutex m_mutex;
|
||||
bool m_is_sleeping;
|
||||
u16 m_version;
|
||||
public:
|
||||
Mux(PacketFactory *pf, ctrl::HtcctrlStateMachine *sm);
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2020 Adubbz, 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 "htclow_mux_task_manager.hpp"
|
||||
|
||||
namespace ams::htclow {
|
||||
|
||||
class PacketFactory;
|
||||
|
||||
namespace ctrl {
|
||||
|
||||
class HtcctrlStateMachine;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace ams::htclow::mux {
|
||||
|
||||
class ChannelImplMap {
|
||||
NON_COPYABLE(ChannelImplMap);
|
||||
NON_MOVEABLE(ChannelImplMap);
|
||||
public:
|
||||
static constexpr int MaxChannelCount = 64;
|
||||
|
||||
using MapType = util::FixedMap<impl::ChannelInternalType, int>;
|
||||
|
||||
static constexpr size_t MapRequiredMemorySize = MapType::GetRequiredMemorySize(MaxChannelCount);
|
||||
private:
|
||||
PacketFactory *m_packet_factory;
|
||||
ctrl::HtcctrlStateMachine *m_state_machine;
|
||||
TaskManager *m_task_manager;
|
||||
os::EventType *m_event;
|
||||
u8 m_map_buffer[MapRequiredMemorySize];
|
||||
MapType m_map;
|
||||
u8 m_storage[0x5200]; /* TODO */
|
||||
bool m_storage_valid[MaxChannelCount];
|
||||
public:
|
||||
ChannelImplMap(PacketFactory *pf, ctrl::HtcctrlStateMachine *sm, TaskManager *tm, os::EventType *ev);
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2020 Adubbz, 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 "../htclow_packet.hpp"
|
||||
|
||||
namespace ams::htclow {
|
||||
|
||||
class PacketFactory;
|
||||
|
||||
}
|
||||
|
||||
namespace ams::htclow::mux {
|
||||
|
||||
class GlobalSendBuffer {
|
||||
private:
|
||||
using PacketList = util::IntrusiveListBaseTraits<Packet>::ListType;
|
||||
private:
|
||||
PacketFactory *m_packet_factory;
|
||||
PacketList m_packet_list;
|
||||
public:
|
||||
GlobalSendBuffer(PacketFactory *pf) : m_packet_factory(pf), m_packet_list() { /* ... */ }
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2020 Adubbz, 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::htclow::mux {
|
||||
|
||||
constexpr inline int MaxTaskCount = 0x80;
|
||||
|
||||
class TaskManager {
|
||||
private:
|
||||
struct Task {
|
||||
impl::ChannelInternalType channel;
|
||||
os::EventType event;
|
||||
u8 _30;
|
||||
u8 _31;
|
||||
u8 _32;
|
||||
u64 _38;
|
||||
};
|
||||
private:
|
||||
bool m_valid[MaxTaskCount];
|
||||
Task m_tasks[MaxTaskCount];
|
||||
public:
|
||||
TaskManager() : m_valid() { /* ... */ }
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user