diff options
Diffstat (limited to 'src/DSi_SD.cpp')
-rw-r--r-- | src/DSi_SD.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/DSi_SD.cpp b/src/DSi_SD.cpp index 54f03ce..4cbf595 100644 --- a/src/DSi_SD.cpp +++ b/src/DSi_SD.cpp @@ -57,13 +57,13 @@ enum }; -DSi_SDHost::DSi_SDHost(u32 num) +DSi_SDHost::DSi_SDHost(melonDS::DSi& dsi, u32 num) : DSi(dsi) { Num = num; - NDS::RegisterEventFunc(Num ? NDS::Event_DSi_SDIOTransfer : NDS::Event_DSi_SDMMCTransfer, + DSi.RegisterEventFunc(Num ? Event_DSi_SDIOTransfer : Event_DSi_SDMMCTransfer, Transfer_TX, MemberEventFunc(DSi_SDHost, FinishTX)); - NDS::RegisterEventFunc(Num ? NDS::Event_DSi_SDIOTransfer : NDS::Event_DSi_SDMMCTransfer, + DSi.RegisterEventFunc(Num ? Event_DSi_SDIOTransfer : Event_DSi_SDMMCTransfer, Transfer_RX, MemberEventFunc(DSi_SDHost, FinishRX)); Ports[0] = nullptr; @@ -75,9 +75,9 @@ DSi_SDHost::~DSi_SDHost() if (Ports[0]) delete Ports[0]; if (Ports[1]) delete Ports[1]; - NDS::UnregisterEventFunc(Num ? NDS::Event_DSi_SDIOTransfer : NDS::Event_DSi_SDMMCTransfer, + DSi.UnregisterEventFunc(Num ? Event_DSi_SDIOTransfer : Event_DSi_SDMMCTransfer, Transfer_TX); - NDS::UnregisterEventFunc(Num ? NDS::Event_DSi_SDIOTransfer : NDS::Event_DSi_SDMMCTransfer, + DSi.UnregisterEventFunc(Num ? Event_DSi_SDIOTransfer : Event_DSi_SDMMCTransfer, Transfer_RX); } @@ -156,15 +156,15 @@ void DSi_SDHost::Reset() else sd = nullptr; - mmc = new DSi_MMCStorage(this, *DSi::NANDImage); - mmc->SetCID(DSi::NANDImage->GetEMMCID().data()); + mmc = new DSi_MMCStorage(this, *DSi.NANDImage); + mmc->SetCID(DSi.NANDImage->GetEMMCID().data()); Ports[0] = sd; Ports[1] = mmc; } else { - DSi_NWifi* nwifi = new DSi_NWifi(this); + DSi_NWifi* nwifi = new DSi_NWifi(DSi, this); Ports[0] = nwifi; } @@ -228,7 +228,7 @@ void DSi_SDHost::UpdateData32IRQ() newflags &= (Data32IRQ >> 11); if ((oldflags == 0) && (newflags != 0)) - NDS::SetIRQ2(Num ? NDS::IRQ2_DSi_SDIO : NDS::IRQ2_DSi_SDMMC); + DSi.SetIRQ2(Num ? IRQ2_DSi_SDIO : IRQ2_DSi_SDMMC); } void DSi_SDHost::ClearIRQ(u32 irq) @@ -244,7 +244,7 @@ void DSi_SDHost::SetIRQ(u32 irq) u32 newflags = IRQStatus & ~IRQMask; if ((oldflags == 0) && (newflags != 0)) - NDS::SetIRQ2(Num ? NDS::IRQ2_DSi_SDIO : NDS::IRQ2_DSi_SDMMC); + DSi.SetIRQ2(Num ? IRQ2_DSi_SDIO : IRQ2_DSi_SDMMC); } void DSi_SDHost::UpdateIRQ(u32 oldmask) @@ -253,7 +253,7 @@ void DSi_SDHost::UpdateIRQ(u32 oldmask) u32 newflags = IRQStatus & ~IRQMask; if ((oldflags == 0) && (newflags != 0)) - NDS::SetIRQ2(Num ? NDS::IRQ2_DSi_SDIO : NDS::IRQ2_DSi_SDMMC); + DSi.SetIRQ2(Num ? IRQ2_DSi_SDIO : IRQ2_DSi_SDMMC); } void DSi_SDHost::SetCardIRQ() @@ -270,8 +270,8 @@ void DSi_SDHost::SetCardIRQ() if ((oldflags == 0) && (newflags != 0)) // checkme { - NDS::SetIRQ2(Num ? NDS::IRQ2_DSi_SDIO : NDS::IRQ2_DSi_SDMMC); - NDS::SetIRQ2(Num ? NDS::IRQ2_DSi_SDIO_Data1 : NDS::IRQ2_DSi_SD_Data1); + DSi.SetIRQ2(Num ? IRQ2_DSi_SDIO : IRQ2_DSi_SDMMC); + DSi.SetIRQ2(Num ? IRQ2_DSi_SDIO_Data1 : IRQ2_DSi_SD_Data1); } } @@ -282,8 +282,8 @@ void DSi_SDHost::UpdateCardIRQ(u16 oldmask) if ((oldflags == 0) && (newflags != 0)) // checkme { - NDS::SetIRQ2(Num ? NDS::IRQ2_DSi_SDIO : NDS::IRQ2_DSi_SDMMC); - NDS::SetIRQ2(Num ? NDS::IRQ2_DSi_SDIO_Data1 : NDS::IRQ2_DSi_SD_Data1); + DSi.SetIRQ2(Num ? IRQ2_DSi_SDIO : IRQ2_DSi_SDMMC); + DSi.SetIRQ2(Num ? IRQ2_DSi_SDIO_Data1 : IRQ2_DSi_SD_Data1); } } @@ -324,7 +324,7 @@ u32 DSi_SDHost::DataRX(u8* data, u32 len) // we need a delay because DSi boot2 will send a command and then wait for IRQ0 // but if IRQ24 is thrown instantly, the handler clears IRQ0 before the // send-command function starts polling IRQ status - NDS::ScheduleEvent(Num ? NDS::Event_DSi_SDIOTransfer : NDS::Event_DSi_SDMMCTransfer, + DSi.ScheduleEvent(Num ? Event_DSi_SDIOTransfer : Event_DSi_SDMMCTransfer, false, 512, Transfer_RX, 0); return len; @@ -366,7 +366,7 @@ u32 DSi_SDHost::DataTX(u8* data, u32 len) if (DataFIFO32.IsEmpty()) { SetIRQ(25); - DSi::CheckNDMAs(1, Num ? 0x29 : 0x28); + DSi.CheckNDMAs(1, Num ? 0x29 : 0x28); } return 0; } @@ -405,7 +405,7 @@ u32 DSi_SDHost::DataTX(u8* data, u32 len) CurFIFO ^= 1; BlockCountInternal--; - NDS::ScheduleEvent(Num ? NDS::Event_DSi_SDIOTransfer : NDS::Event_DSi_SDMMCTransfer, + DSi.ScheduleEvent(Num ? Event_DSi_SDIOTransfer : Event_DSi_SDMMCTransfer, false, 512, Transfer_TX, 0); return len; @@ -536,7 +536,7 @@ u16 DSi_SDHost::Read(u32 addr) case 0x10A: return 0; } - Log(LogLevel::Warn, "unknown %s read %08X @ %08X\n", SD_DESC, addr, NDS::GetPC(1)); + Log(LogLevel::Warn, "unknown %s read %08X @ %08X\n", SD_DESC, addr, DSi.GetPC(1)); return 0; } @@ -761,7 +761,7 @@ void DSi_SDHost::UpdateFIFO32() if ((DataFIFO32.Level() << 2) >= BlockLen32) { - DSi::CheckNDMAs(1, Num ? 0x29 : 0x28); + DSi.CheckNDMAs(1, Num ? 0x29 : 0x28); } } |