]> localhost Git - WindEmu.git/commitdiff
sa1100: add initial reset controller implementation
authorGeorge Wright <gw@gwright.org.uk>
Thu, 25 Jun 2026 02:15:51 +0000 (19:15 -0700)
committerGeorge Wright <gw@gwright.org.uk>
Fri, 26 Jun 2026 03:44:07 +0000 (20:44 -0700)
CMakeLists.txt
WindCore/series7/reset_controller.cpp [new file with mode: 0644]
WindCore/series7/reset_controller.h [new file with mode: 0644]

index 0289585af8d807806f779f53d9837c664ee0165a..d0b542dc25df53c919c0c10d40c2a97a24432305 100644 (file)
@@ -26,6 +26,7 @@ set(WIND_CORE_SOURCES
     WindCore/series7/gpio_controller.cpp
     WindCore/series7/lcd_controller.cpp
     WindCore/series7/os_timer.cpp
+    WindCore/series7/reset_controller.cpp
     WindCore/series7/sa1100.cpp
     WindCore/series7/sa1100_memory.cpp
 )
diff --git a/WindCore/series7/reset_controller.cpp b/WindCore/series7/reset_controller.cpp
new file mode 100644 (file)
index 0000000..4300062
--- /dev/null
@@ -0,0 +1,62 @@
+// ARMware - an ARM emulator
+// Copyright (C) <2007>  Wei Hu <wei.hu.tw@gmail.com>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+
+#include "reset_controller.h"
+
+#include "logger.h"
+
+namespace SA1100 {
+
+uint32_t ResetController::read32(const uint32_t address) const {
+  switch (address) {
+  case RSRR:
+    LOG_REG_R("ResetController RSRR", address, 0);
+    // :SA-1110 Developer's Manual: Wei 2003-Dec-11:
+    //
+    // RSRR is write-only.
+    return 0;
+
+  case RCSR: {
+    LOG_REG_R("ResetController RCSR", address, mRCSR);
+    return mRCSR;
+  }
+
+  default:
+    LOG_REG_R("ResetController Unknown", address, 0);
+    return 0;
+  }
+}
+
+void ResetController::write32(const uint32_t address, const uint32_t value) {
+  switch (address) {
+  case RSRR:
+    LOG_REG_W("ResetController RSRR", address, value);
+    mRSRR = value;
+    break;
+
+  case RCSR:
+    LOG_REG_W("ResetController RCSR", address, value);
+    mRCSR = value;
+    break;
+
+  default:
+    LOG_REG_W("ResetController Unknown", address, value);
+    break;
+  }
+}
+
+} // namespace SA1100
diff --git a/WindCore/series7/reset_controller.h b/WindCore/series7/reset_controller.h
new file mode 100644 (file)
index 0000000..e9c719f
--- /dev/null
@@ -0,0 +1,53 @@
+// ARMware - an ARM emulator
+// Copyright (C) <2007>  Wei Hu <wei.hu.tw@gmail.com>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+
+#ifndef RESET_CONTROLLER_H
+#define RESET_CONTROLLER_H
+
+#include <cstdint>
+
+namespace SA1100 {
+
+class ResetController {
+public:
+  ResetController() { initRegisters(); }
+
+  void reset() {
+    mRSRR = 0;
+    mRCSR = 2;
+  }
+
+  bool resetRequested() { return mRSRR & 0xFFFFFFFF; }
+
+  uint32_t read32(const uint32_t address) const;
+  void write32(const uint32_t address, const uint32_t value);
+
+private:
+  enum { RSRR = 0x90030000, RCSR = 0x90030004 };
+
+  uint32_t mRSRR; // Reset controller software reset register
+  uint32_t mRCSR; // Reset controller status register
+
+  void initRegisters() {
+    mRSRR = 0;
+    mRCSR = 1;
+  }
+};
+
+} // namespace SA1100
+
+#endif // RESET_CONTROLLER_H