mirror of
https://github.com/Creased/RCM-Emulator.git
synced 2026-12-06 02:48:11 +01:00
Serve measured MAX77620 CID3 and CID5 as whole bytes
This commit is contained in:
1 parent
5caa4d5e2d
commit
265ca5404c
3 files changed
+23
-8
No files matched your search
@@ -52,8 +52,9 @@ void reset_to_defaults(EmuState *s) {
|
|||||||
s->usb_pd_amperage_ma = 1500;
|
s->usb_pd_amperage_ma = 1500;
|
||||||
s->pmic_otp = 0x35;
|
s->pmic_otp = 0x35;
|
||||||
s->is_mariko = false;
|
s->is_mariko = false;
|
||||||
s->pmic_silicon_rev = 0;
|
s->pmic_silicon_rev = 0x5B; // CID3, measured on a real console
|
||||||
s->cpu_pmic_version = 0;
|
s->pmic_es_rev = 0x81; // CID5
|
||||||
|
s->cpu_pmic_version = 0x1C;
|
||||||
s->sd_inserted = true;
|
s->sd_inserted = true;
|
||||||
s->sd_cid_manfid = 0x03;
|
s->sd_cid_manfid = 0x03;
|
||||||
s->sd_cid_oemid = 0x5344; // "SD"
|
s->sd_cid_oemid = 0x5344; // "SD"
|
||||||
@@ -138,6 +139,7 @@ void reset_to_defaults(EmuState *s) {
|
|||||||
X(pmic_otp, "soc", "pmic_otp", 0) \
|
X(pmic_otp, "soc", "pmic_otp", 0) \
|
||||||
X(is_mariko, "soc", "is_mariko", 0) \
|
X(is_mariko, "soc", "is_mariko", 0) \
|
||||||
X(pmic_silicon_rev, "soc", "pmic_silicon_rev",0) \
|
X(pmic_silicon_rev, "soc", "pmic_silicon_rev",0) \
|
||||||
|
X(pmic_es_rev, "soc", "pmic_es_rev", 0) \
|
||||||
X(cpu_pmic_version, "soc", "cpu_pmic_version",0) \
|
X(cpu_pmic_version, "soc", "cpu_pmic_version",0) \
|
||||||
/* Storage — SD (SDMMC1 CMD2) */ \
|
/* Storage — SD (SDMMC1 CMD2) */ \
|
||||||
X(sd_inserted, "sd", "inserted", 0) \
|
X(sd_inserted, "sd", "inserted", 0) \
|
||||||
@@ -410,8 +412,11 @@ void build_ui(EmuState *state) {
|
|||||||
if (ImGui::Combo("PMIC OTP", &idx, otp_items, IM_ARRAYSIZE(otp_items))) {
|
if (ImGui::Combo("PMIC OTP", &idx, otp_items, IM_ARRAYSIZE(otp_items))) {
|
||||||
state->pmic_otp.store(idx == 1 ? 0x53 : 0x35);
|
state->pmic_otp.store(idx == 1 ? 0x53 : 0x35);
|
||||||
}
|
}
|
||||||
atomic_slider_int<uint8_t>("MAX77620 silicon rev", state->pmic_silicon_rev, 0, 15);
|
// Whole bytes (CID3 reads 0x5B on real silicon), so the range has to
|
||||||
atomic_slider_int<uint8_t>("MAX77621 chipid", state->cpu_pmic_version, 0, 15);
|
// span 0..255 - a 0..15 slider silently clamped these to a nibble.
|
||||||
|
atomic_slider_int<uint8_t>("MAX77620 CID3 (Si rev)", state->pmic_silicon_rev, 0, 255);
|
||||||
|
atomic_slider_int<uint8_t>("MAX77620 CID5 (ES rev)", state->pmic_es_rev, 0, 255);
|
||||||
|
atomic_slider_int<uint8_t>("MAX77621 chipid", state->cpu_pmic_version, 0, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::CollapsingHeader("Charger (BQ24193)", ImGuiTreeNodeFlags_DefaultOpen)) {
|
if (ImGui::CollapsingHeader("Charger (BQ24193)", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||||
|
|||||||
+10
-2
@@ -158,8 +158,16 @@ struct EmuState {
|
|||||||
// Erista, 2 = T210B01 Mariko). Hekate's h_cfg.t210b01 derives from this,
|
// Erista, 2 = T210B01 Mariko). Hekate's h_cfg.t210b01 derives from this,
|
||||||
// which controls the pkg1 OEM-header skip among other things.
|
// which controls the pkg1 OEM-header skip among other things.
|
||||||
std::atomic<bool> is_mariko{false};
|
std::atomic<bool> is_mariko{false};
|
||||||
std::atomic<uint8_t> pmic_silicon_rev{0}; // MAX77620 CID3 low nibble: "max77620 v%d"
|
// Silicon revisions, as read off a real console (Mariko, HAC-001(-01)):
|
||||||
std::atomic<uint8_t> cpu_pmic_version{0}; // MAX77621 CHIPID1: "max77621 v%d"
|
// CID3 = 0x5B -> payloads print the low nibble, "max77620 v11"
|
||||||
|
// CID5 = 0x81 -> ES version (DIDM 8 / DIDO 1)
|
||||||
|
// These are whole bytes, not nibbles: masking CID3 to 4 bits (the old
|
||||||
|
// behaviour) made a genuine 0x5B read back as 0x0B. CID3/CID5 describe the
|
||||||
|
// silicon and are expected to be identical on Erista - only CID4 (the OTP
|
||||||
|
// version) differs by generation - but only Mariko is measured so far.
|
||||||
|
std::atomic<uint8_t> pmic_silicon_rev{0x5B}; // MAX77620 CID3
|
||||||
|
std::atomic<uint8_t> pmic_es_rev{0x81}; // MAX77620 CID5
|
||||||
|
std::atomic<uint8_t> cpu_pmic_version{0x1C}; // MAX77621 CHIPID1 (unverified)
|
||||||
|
|
||||||
// SD card insertion (GPIO Port Z bit 1 = 0 means inserted).
|
// SD card insertion (GPIO Port Z bit 1 = 0 means inserted).
|
||||||
std::atomic<bool> sd_inserted{true};
|
std::atomic<bool> sd_inserted{true};
|
||||||
|
|||||||
+4
-2
@@ -398,9 +398,11 @@ uint32_t i2c_read(EmuState *state, uint64_t addr) {
|
|||||||
case 0x15: { // ONOFFSTAT — EN0 bit reflects power button
|
case 0x15: { // ONOFFSTAT — EN0 bit reflects power button
|
||||||
return state->btn_power.load() ? (1 << 2) : 0;
|
return state->btn_power.load() ? (1 << 2) : 0;
|
||||||
}
|
}
|
||||||
case 0x5B: return state->pmic_silicon_rev.load() & 0xF; // CID3: low nibble shown as "v%d"
|
// CID3 is a whole byte (0x5B on a real console); payloads print its low
|
||||||
|
// nibble as "max77620 v%d". Masking here would turn 0x5B into 0x0B.
|
||||||
|
case 0x5B: return state->pmic_silicon_rev.load();
|
||||||
case 0x5C: return state->pmic_otp.load(); // CID4: 0x35 Erista, 0x53 Mariko
|
case 0x5C: return state->pmic_otp.load(); // CID4: 0x35 Erista, 0x53 Mariko
|
||||||
case 0x5D: return 0x08; // CID5: ES version
|
case 0x5D: return state->pmic_es_rev.load(); // CID5: ES version (0x81)
|
||||||
// Everything else comes out of the modelled register file, which holds
|
// Everything else comes out of the modelled register file, which holds
|
||||||
// the values max77620_config_default() programs plus anything the
|
// the values max77620_config_default() programs plus anything the
|
||||||
// payload has written since. Returning 0 here (the old behaviour) made
|
// payload has written since. Returning 0 here (the old behaviour) made
|
||||||
|
|||||||
Reference in new issue
Block a user