From: George Wright Date: Thu, 25 Jun 2026 02:15:51 +0000 (-0700) Subject: sa1100: add initial reset controller implementation X-Git-Url: http://git.gwright.org.uk/?a=commitdiff_plain;h=8c636e0854b4548b658a3cccb5b3d6a7f5b718ab;p=WindEmu.git sa1100: add initial reset controller implementation --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 0289585..d0b542d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 index 0000000..4300062 --- /dev/null +++ b/WindCore/series7/reset_controller.cpp @@ -0,0 +1,62 @@ +// ARMware - an ARM emulator +// Copyright (C) <2007> Wei Hu +// +// 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 . +// + +#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 index 0000000..e9c719f --- /dev/null +++ b/WindCore/series7/reset_controller.h @@ -0,0 +1,53 @@ +// ARMware - an ARM emulator +// Copyright (C) <2007> Wei Hu +// +// 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 . +// + +#ifndef RESET_CONTROLLER_H +#define RESET_CONTROLLER_H + +#include + +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