ams: mark ams::Result [[nodiscard]] (partially complete).
NOTE: This work is not yet fully complete; kernel is done, but it was taking an exceedingly long time to get through libstratosphere. Thus, I've temporarily added -Wno-error=unused-result for libstratosphere/stratosphere. All warnings should be fixed to do the same thing Nintendo does as relevant, but this is taking a phenomenally long time and is not actually the most important work to do, so it can be put off for some time to prioritize other tasks for 21.0.0 support.
This commit is contained in:
@@ -432,7 +432,7 @@ namespace ams::sdmmc::impl {
|
||||
/* If the mmc is manufactured by toshiba, try to enable bkops auto. */
|
||||
if (is_toshiba && !IsBkopAutoEnable(static_cast<const u8 *>(wb))) {
|
||||
/* NOTE: Nintendo does not check the result of this. */
|
||||
this->EnableBkopsAuto();
|
||||
static_cast<void>(this->EnableBkopsAuto());
|
||||
}
|
||||
|
||||
/* Extend the bus speed to as fast as we can. */
|
||||
@@ -689,7 +689,7 @@ namespace ams::sdmmc::impl {
|
||||
m_mmc_device.GetCid(cid, sizeof(cid));
|
||||
if (IsToshibaMmc(cid)) {
|
||||
/* NOTE: Nintendo does not check the result of this operation. */
|
||||
this->CancelToshibaMmcModel();
|
||||
static_cast<void>(this->CancelToshibaMmcModel());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -558,11 +558,11 @@ namespace ams::sdmmc::impl {
|
||||
/* NOTE: Nintendo accepts a failure. */
|
||||
if (R_SUCCEEDED(this->IssueCommandAppCmd(DeviceState_Tran))) {
|
||||
/* NOTE: Nintendo does not check the result of this. */
|
||||
this->IssueCommandClearCardDetect();
|
||||
static_cast<void>(this->IssueCommandClearCardDetect());
|
||||
}
|
||||
|
||||
/* NOTE: Nintendo does not check the result of this. */
|
||||
BaseDeviceAccessor::IssueCommandSendStatus();
|
||||
static_cast<void>(BaseDeviceAccessor::IssueCommandSendStatus());
|
||||
}
|
||||
|
||||
Result SdCardDeviceAccessor::StartupSdCardDevice(BusWidth max_bw, SpeedMode max_sm, void *wb, size_t wb_size) {
|
||||
|
||||
@@ -369,7 +369,7 @@ namespace ams::sdmmc::impl {
|
||||
|
||||
/* Otherwise, check if we've timed out. */
|
||||
if (!timer.Update()) {
|
||||
this->AbortTransaction();
|
||||
static_cast<void>(this->AbortTransaction());
|
||||
R_THROW(sdmmc::ResultCommandInhibitCmdSoftwareTimeout());
|
||||
}
|
||||
}
|
||||
@@ -389,7 +389,7 @@ namespace ams::sdmmc::impl {
|
||||
|
||||
/* Otherwise, check if we've timed out. */
|
||||
if (!timer.Update()) {
|
||||
this->AbortTransaction();
|
||||
static_cast<void>(this->AbortTransaction());
|
||||
R_THROW(sdmmc::ResultCommandInhibitDatSoftwareTimeout());
|
||||
}
|
||||
}
|
||||
@@ -458,7 +458,7 @@ namespace ams::sdmmc::impl {
|
||||
this->ClearInterrupt();
|
||||
|
||||
if (R_FAILED(result)) {
|
||||
this->AbortTransaction();
|
||||
static_cast<void>(this->AbortTransaction());
|
||||
}
|
||||
|
||||
R_RETURN(result);
|
||||
@@ -467,7 +467,7 @@ namespace ams::sdmmc::impl {
|
||||
R_RETURN(result);
|
||||
} else {
|
||||
/* If the device wasn't removed, cancel our transaction. */
|
||||
this->AbortTransaction();
|
||||
static_cast<void>(this->AbortTransaction());
|
||||
R_THROW(sdmmc::ResultCommandCompleteSoftwareTimeout());
|
||||
}
|
||||
}
|
||||
@@ -489,12 +489,12 @@ namespace ams::sdmmc::impl {
|
||||
} else if (sdmmc::ResultNoWaitedInterrupt::Includes(result)) {
|
||||
/* Otherwise, if the wait for the interrupt isn't done, update the timer and check for timeout. */
|
||||
if (!timer.Update()) {
|
||||
this->AbortTransaction();
|
||||
static_cast<void>(this->AbortTransaction());
|
||||
R_THROW(sdmmc::ResultCommandCompleteSoftwareTimeout());
|
||||
}
|
||||
} else {
|
||||
/* Otherwise, we have a generic failure. */
|
||||
this->AbortTransaction();
|
||||
static_cast<void>(this->AbortTransaction());
|
||||
R_RETURN(result);
|
||||
}
|
||||
}
|
||||
@@ -537,7 +537,7 @@ namespace ams::sdmmc::impl {
|
||||
}
|
||||
} else {
|
||||
/* Abort the transaction. */
|
||||
this->AbortTransaction();
|
||||
static_cast<void>(this->AbortTransaction());
|
||||
R_RETURN(result);
|
||||
}
|
||||
|
||||
@@ -548,7 +548,7 @@ namespace ams::sdmmc::impl {
|
||||
} else {
|
||||
/* Otherwise, timeout if the transfer hasn't advanced. */
|
||||
if (last_block_count != reg::Read(m_registers->block_count)) {
|
||||
this->AbortTransaction();
|
||||
static_cast<void>(this->AbortTransaction());
|
||||
R_THROW(sdmmc::ResultTransferCompleteSoftwareTimeout());
|
||||
}
|
||||
}
|
||||
@@ -589,14 +589,14 @@ namespace ams::sdmmc::impl {
|
||||
if (!timer.Update()) {
|
||||
/* Only timeout if the transfer hasn't advanced. */
|
||||
if (last_block_count != reg::Read(m_registers->block_count)) {
|
||||
this->AbortTransaction();
|
||||
static_cast<void>(this->AbortTransaction());
|
||||
R_THROW(sdmmc::ResultTransferCompleteSoftwareTimeout());
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* Otherwise, we have a generic failure. */
|
||||
this->AbortTransaction();
|
||||
static_cast<void>(this->AbortTransaction());
|
||||
R_RETURN(result);
|
||||
}
|
||||
}
|
||||
@@ -624,7 +624,7 @@ namespace ams::sdmmc::impl {
|
||||
|
||||
/* Otherwise, check if we're timed out. */
|
||||
if (!timer.Update()) {
|
||||
this->AbortTransaction();
|
||||
static_cast<void>(this->AbortTransaction());
|
||||
R_THROW(sdmmc::ResultBusySoftwareTimeout());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,7 +471,7 @@ namespace ams::sdmmc::impl {
|
||||
|
||||
SdHostStandardController::EnsureControl();
|
||||
WaitMicroSeconds(1);
|
||||
SdHostStandardController::AbortTransaction();
|
||||
static_cast<void>(SdHostStandardController::AbortTransaction());
|
||||
}
|
||||
reg::ReadWrite(m_sdmmc_registers->sd_host_standard_registers.clock_control, SD_REG_BITS_ENUM(CLOCK_CONTROL_SD_CLOCK_ENABLE, ENABLE));
|
||||
|
||||
@@ -520,7 +520,7 @@ namespace ams::sdmmc::impl {
|
||||
|
||||
/* Otherwise, check if we timed out. */
|
||||
if (!timer.Update()) {
|
||||
SdHostStandardController::AbortTransaction();
|
||||
static_cast<void>(SdHostStandardController::AbortTransaction());
|
||||
R_THROW(sdmmc::ResultIssueTuningCommandSoftwareTimeout());
|
||||
}
|
||||
}
|
||||
@@ -857,7 +857,8 @@ namespace ams::sdmmc::impl {
|
||||
R_TRY(this->CheckRemoved());
|
||||
|
||||
/* Issue the command. */
|
||||
this->IssueTuningCommand(command_index);
|
||||
/* NOTE: Nintendo does not check the result of this call. */
|
||||
static_cast<void>(this->IssueTuningCommand(command_index));
|
||||
|
||||
/* Check if tuning is done. */
|
||||
if (i >= num_tries) {
|
||||
@@ -902,7 +903,8 @@ namespace ams::sdmmc::impl {
|
||||
/* If we're at 3.3V, lower to 1.8V. */
|
||||
if (m_current_bus_power == BusPower_3_3V) {
|
||||
/* pcv::ChangeVoltage(pcv::PowerControlTarget_SdCard, 1800000); */
|
||||
m_power_controller->LowerBusPower();
|
||||
/* NOTE: Nintendo does not check the result of this call. */
|
||||
static_cast<void>(m_power_controller->LowerBusPower());
|
||||
|
||||
/* Set our bus power. */
|
||||
m_current_bus_power = BusPower_1_8V;
|
||||
@@ -913,7 +915,8 @@ namespace ams::sdmmc::impl {
|
||||
|
||||
|
||||
/* pcv::PowerOff(pcv::PowerControlTarget_SdCard); */
|
||||
m_power_controller->PowerOff();
|
||||
/* NOTE: Nintendo does not check the result of this call. */
|
||||
static_cast<void>(m_power_controller->PowerOff());
|
||||
|
||||
/* Set our bus power. */
|
||||
m_current_bus_power = BusPower_Off;
|
||||
@@ -1276,7 +1279,8 @@ namespace ams::sdmmc::impl {
|
||||
R_UNLESS(m_current_bus_power == BusPower_1_8V, pcv::ResultIllegalRequest());
|
||||
|
||||
/* Disable vddio, and wait 4 ms. */
|
||||
this->ControlVddioSdmmc1(BusPower_Off);
|
||||
/* NOTE: Nintendo does not check the result of this call. */
|
||||
static_cast<void>(this->ControlVddioSdmmc1(BusPower_Off));
|
||||
WaitMicroSeconds(4000);
|
||||
|
||||
/* Set the SD power GPIO to low. */
|
||||
|
||||
Reference in New Issue
Block a user