htc: implement htcfs protocol bringup

This commit is contained in:
Michael Scire
2021-02-12 22:07:34 -08:00
committed by SciresM
parent 99a38dce32
commit 5c97469348
10 changed files with 316 additions and 7 deletions

View File

@@ -114,7 +114,7 @@ namespace ams::htclow {
return ResultSuccess();
}
Result Channel::Send(s64 *out, const void *src, s64 size, ReceiveOption option) {
Result Channel::Send(s64 *out, const void *src, s64 size) {
/* Check pre-conditions. */
AMS_ASSERT(util::IsIntValueRepresentable<size_t>(size));

View File

@@ -40,7 +40,7 @@ namespace ams::htclow {
void Shutdown();
Result Receive(s64 *out, void *dst, s64 size, ReceiveOption option);
Result Send(s64 *out, const void *src, s64 size, ReceiveOption option);
Result Send(s64 *out, const void *src, s64 size);
void SetConfig(const ChannelConfig &config);
void SetReceiveBuffer(void *buf, size_t size);

View File

@@ -67,7 +67,7 @@ namespace ams::htclow::mux {
/* Determine position and copy sizes. */
const size_t pos = (m_data_size + m_offset) % m_buffer_size;
const size_t left = m_buffer_size - pos;
const size_t left = std::min(m_buffer_size - pos, size);
const size_t over = size - left;
/* Copy. */

View File

@@ -82,7 +82,7 @@ namespace ams::htclow::mux {
/* Check that we have data. */
const auto ring_buffer_data_size = m_ring_buffer.GetDataSize();
if (ring_buffer_data_size > 0) {
if (ring_buffer_data_size == 0) {
return false;
}
@@ -102,7 +102,7 @@ namespace ams::htclow::mux {
const auto data_size = std::min(sendable_size, m_max_packet_size);
/* Make data packet header. */
this->MakeDataPacketHeader(header, data_size, m_version, max_data, share);
this->MakeDataPacketHeader(header, data_size, m_version, max_data, offset);
/* Copy the data. */
R_ABORT_UNLESS(m_ring_buffer.Copy(body, data_size));