aboutsummaryrefslogtreecommitdiff
path: root/src/SPI.h
diff options
context:
space:
mode:
authorJesse Talavera <jesse@jesse.tg>2023-12-12 05:07:22 -0500
committerGitHub <noreply@github.com>2023-12-12 11:07:22 +0100
commit9bfc9c08ffe88de4b54734d6fd03182c0a51e181 (patch)
tree28a9177f377f6ab85f9aabc54c3a523fd7d610ff /src/SPI.h
parent2cba2e783a2ef3a83b7d8bf0cb6e42a6298edbf6 (diff)
Sprinkle `const` around where appropriate (#1909)
* Sprinkle `const` around where appropriate - This will make it easier to use `NDS` objects in `const` contexts (e.g. `const` parameters or methods) * Remove the `const` qualifier on `DSi_DSP::DSPRead16` - MMIO reads can be non-pure, so this may not be `const` in the future
Diffstat (limited to 'src/SPI.h')
-rw-r--r--src/SPI.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/SPI.h b/src/SPI.h
index aee4165..7ed889a 100644
--- a/src/SPI.h
+++ b/src/SPI.h
@@ -51,7 +51,7 @@ public:
virtual void Reset() = 0;
virtual void DoSavestate(Savestate* file) = 0;
- virtual u8 Read() { return Data; }
+ virtual u8 Read() const { return Data; }
virtual void Write(u8 val) = 0;
virtual void Release() { Hold = false; DataPos = 0; }
@@ -76,7 +76,7 @@ public:
Firmware& GetFirmware() noexcept { return FirmwareData; }
[[nodiscard]] const Firmware& GetFirmware() const noexcept { return FirmwareData; }
void SetFirmware(Firmware&& firmware) { FirmwareData = std::move(firmware); }
- bool IsLoadedFirmwareBuiltIn();
+ bool IsLoadedFirmwareBuiltIn() const;
void Write(u8 val) override;
void Release() override;
@@ -89,7 +89,7 @@ private:
u8 StatusReg;
u32 Addr;
- bool VerifyCRC16(u32 start, u32 offset, u32 len, u32 crcoffset);
+ bool VerifyCRC16(u32 start, u32 offset, u32 len, u32 crcoffset) const;
};
class PowerMan : public SPIDevice
@@ -100,7 +100,7 @@ public:
void Reset() override;
void DoSavestate(Savestate* file) override;
- bool GetBatteryLevelOkay();
+ bool GetBatteryLevelOkay() const;
void SetBatteryLevelOkay(bool okay);
void Write(u8 val) override;
@@ -121,7 +121,7 @@ public:
virtual void DoSavestate(Savestate* file) override;
virtual void SetTouchCoords(u16 x, u16 y);
- virtual void MicInputFrame(s16* data, int samples);
+ virtual void MicInputFrame(const s16* data, int samples);
virtual void Write(u8 val) override;
@@ -148,16 +148,18 @@ public:
FirmwareMem* GetFirmwareMem() { return (FirmwareMem*)Devices[SPIDevice_FirmwareMem]; }
const FirmwareMem* GetFirmwareMem() const { return (FirmwareMem*)Devices[SPIDevice_FirmwareMem]; }
PowerMan* GetPowerMan() { return (PowerMan*)Devices[SPIDevice_PowerMan]; }
+ const PowerMan* GetPowerMan() const { return (PowerMan*)Devices[SPIDevice_PowerMan]; }
TSC* GetTSC() { return (TSC*)Devices[SPIDevice_TSC]; }
+ const TSC* GetTSC() const { return (TSC*)Devices[SPIDevice_TSC]; }
const Firmware& GetFirmware() const { return GetFirmwareMem()->GetFirmware(); }
Firmware& GetFirmware() { return GetFirmwareMem()->GetFirmware(); }
void SetFirmware(Firmware&& firmware) { GetFirmwareMem()->SetFirmware(std::move(firmware)); }
- u16 ReadCnt() { return Cnt; }
+ u16 ReadCnt() const { return Cnt; }
void WriteCnt(u16 val);
- u8 ReadData();
+ u8 ReadData() const;
void WriteData(u8 val);
void TransferDone(u32 param);