ams: support building unit test programs on windows/linux/macos
This commit is contained in:
@@ -303,11 +303,11 @@ namespace ams::htclow::driver {
|
||||
R_ABORT_UNLESS(g_ds_client.GetState(std::addressof(usb_state)));
|
||||
|
||||
switch (usb_state) {
|
||||
case UsbState_Detached:
|
||||
case UsbState_Suspended:
|
||||
case usb::UsbState_Detached:
|
||||
case usb::UsbState_Suspended:
|
||||
InvokeAvailabilityChangeCallback(UsbAvailability_Unavailable);
|
||||
break;
|
||||
case UsbState_Configured:
|
||||
case usb::UsbState_Configured:
|
||||
InvokeAvailabilityChangeCallback(UsbAvailability_Available);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace ams::htclow {
|
||||
const auto channel = impl::ConvertChannelType(m_channel);
|
||||
|
||||
/* Begin the flush. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_manager->ConnectBegin(std::addressof(task_id), channel));
|
||||
|
||||
/* Wait for the task to finish. */
|
||||
@@ -61,7 +61,7 @@ namespace ams::htclow {
|
||||
|
||||
Result Channel::Flush() {
|
||||
/* Begin the flush. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_manager->FlushBegin(std::addressof(task_id), impl::ConvertChannelType(m_channel)));
|
||||
|
||||
/* Wait for the task to finish. */
|
||||
@@ -128,7 +128,7 @@ namespace ams::htclow {
|
||||
AMS_ASSERT(util::IsIntValueRepresentable<size_t>(size - total_sent));
|
||||
|
||||
/* Begin the send. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
const auto begin_result = m_manager->SendBegin(std::addressof(task_id), std::addressof(cur_sent), static_cast<const u8 *>(src) + total_sent, size - total_sent, channel);
|
||||
if (R_FAILED(begin_result)) {
|
||||
if (total_sent != 0) {
|
||||
@@ -192,7 +192,7 @@ namespace ams::htclow {
|
||||
const bool blocking = option != ReceiveOption_NonBlocking;
|
||||
|
||||
/* Begin the receive. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_manager->ReceiveBegin(std::addressof(task_id), channel, blocking ? 1 : 0));
|
||||
|
||||
/* Wait for the task to finish. */
|
||||
@@ -214,7 +214,7 @@ namespace ams::htclow {
|
||||
const auto channel = impl::ConvertChannelType(m_channel);
|
||||
|
||||
/* Begin the wait. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_manager->WaitReceiveBegin(std::addressof(task_id), channel, size));
|
||||
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace ams::htclow::mux {
|
||||
m_state_machine->SetConnecting(m_channel);
|
||||
|
||||
/* Allocate a task. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_task_manager->AllocateTask(std::addressof(task_id), m_channel));
|
||||
|
||||
/* Configure the task. */
|
||||
@@ -295,7 +295,7 @@ namespace ams::htclow::mux {
|
||||
R_TRY(this->CheckState({ChannelState_Connected}));
|
||||
|
||||
/* Allocate a task. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_task_manager->AllocateTask(std::addressof(task_id), m_channel));
|
||||
|
||||
/* Configure the task. */
|
||||
@@ -316,7 +316,7 @@ namespace ams::htclow::mux {
|
||||
R_TRY(this->CheckState({ChannelState_Connected, ChannelState_Disconnected}));
|
||||
|
||||
/* Allocate a task. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_task_manager->AllocateTask(std::addressof(task_id), m_channel));
|
||||
|
||||
/* Configure the task. */
|
||||
@@ -389,7 +389,7 @@ namespace ams::htclow::mux {
|
||||
R_TRY(this->CheckState({ChannelState_Connected}));
|
||||
|
||||
/* Allocate a task. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_task_manager->AllocateTask(std::addressof(task_id), m_channel));
|
||||
|
||||
/* Send the data. */
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace ams::htclow::mux {
|
||||
|
||||
/* Determine the sendable size. */
|
||||
const auto offset = total_send_size - ring_buffer_data_size;
|
||||
const auto sendable_size = m_flow_control_enabled ? std::min(share - offset, ring_buffer_data_size) : ring_buffer_data_size;
|
||||
const auto sendable_size = m_flow_control_enabled ? std::min<size_t>(share - offset, ring_buffer_data_size) : ring_buffer_data_size;
|
||||
if (sendable_size == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace ams::htclow::mux {
|
||||
|
||||
os::EventType *TaskManager::GetTaskEvent(u32 task_id) {
|
||||
/* Check pre-conditions. */
|
||||
AMS_ASSERT(0 <= task_id && task_id < MaxTaskCount);
|
||||
AMS_ASSERT(task_id < MaxTaskCount);
|
||||
AMS_ASSERT(m_valid[task_id]);
|
||||
|
||||
return std::addressof(m_tasks[task_id].event);
|
||||
@@ -28,7 +28,7 @@ namespace ams::htclow::mux {
|
||||
|
||||
EventTrigger TaskManager::GetTrigger(u32 task_id) {
|
||||
/* Check pre-conditions. */
|
||||
AMS_ASSERT(0 <= task_id && task_id < MaxTaskCount);
|
||||
AMS_ASSERT(task_id < MaxTaskCount);
|
||||
AMS_ASSERT(m_valid[task_id]);
|
||||
|
||||
return m_tasks[task_id].event_trigger;
|
||||
@@ -61,7 +61,7 @@ namespace ams::htclow::mux {
|
||||
|
||||
void TaskManager::FreeTask(u32 task_id) {
|
||||
/* Check pre-conditions. */
|
||||
AMS_ASSERT(0 <= task_id && task_id < MaxTaskCount);
|
||||
AMS_ASSERT(task_id < MaxTaskCount);
|
||||
|
||||
/* Invalidate the task. */
|
||||
if (m_valid[task_id]) {
|
||||
@@ -72,7 +72,7 @@ namespace ams::htclow::mux {
|
||||
|
||||
void TaskManager::ConfigureConnectTask(u32 task_id) {
|
||||
/* Check pre-conditions. */
|
||||
AMS_ASSERT(0 <= task_id && task_id < MaxTaskCount);
|
||||
AMS_ASSERT(task_id < MaxTaskCount);
|
||||
AMS_ASSERT(m_valid[task_id]);
|
||||
|
||||
/* Set the task type. */
|
||||
@@ -81,7 +81,7 @@ namespace ams::htclow::mux {
|
||||
|
||||
void TaskManager::ConfigureFlushTask(u32 task_id) {
|
||||
/* Check pre-conditions. */
|
||||
AMS_ASSERT(0 <= task_id && task_id < MaxTaskCount);
|
||||
AMS_ASSERT(task_id < MaxTaskCount);
|
||||
AMS_ASSERT(m_valid[task_id]);
|
||||
|
||||
/* Set the task type. */
|
||||
@@ -90,7 +90,7 @@ namespace ams::htclow::mux {
|
||||
|
||||
void TaskManager::ConfigureReceiveTask(u32 task_id, size_t size) {
|
||||
/* Check pre-conditions. */
|
||||
AMS_ASSERT(0 <= task_id && task_id < MaxTaskCount);
|
||||
AMS_ASSERT(task_id < MaxTaskCount);
|
||||
AMS_ASSERT(m_valid[task_id]);
|
||||
|
||||
/* Set the task type. */
|
||||
@@ -102,7 +102,7 @@ namespace ams::htclow::mux {
|
||||
|
||||
void TaskManager::ConfigureSendTask(u32 task_id) {
|
||||
/* Check pre-conditions. */
|
||||
AMS_ASSERT(0 <= task_id && task_id < MaxTaskCount);
|
||||
AMS_ASSERT(task_id < MaxTaskCount);
|
||||
AMS_ASSERT(m_valid[task_id]);
|
||||
|
||||
/* Set the task type. */
|
||||
|
||||
Reference in New Issue
Block a user