commit 2bd8546267bd4a52c09224dc8dc9fbb8b8a86c44
parent 3587e4271ed10243bc4e951875e3099fe99b3df4
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Thu, 1 Aug 2024 02:24:07 +0200
detect boot via LCD, not via flash read as it is not working when flash is not initialized
Diffstat:
5 files changed, 25 insertions(+), 17 deletions(-)
diff --git a/source/nord/n2x/n2xLib/n2xflash.cpp b/source/nord/n2x/n2xLib/n2xflash.cpp
@@ -19,12 +19,4 @@ namespace n2x
}
}
}
-
- uint8_t Flash::onReadByte()
- {
- if(getAddress() == 0x31 && --m_bootCounter == 0)
- m_hardware.notifyBootFinished();
-
- return I2cFlash::onReadByte();
- }
}
diff --git a/source/nord/n2x/n2xLib/n2xflash.h b/source/nord/n2x/n2xLib/n2xflash.h
@@ -11,11 +11,7 @@ namespace n2x
public:
Flash(Hardware& _hardware);
- protected:
- uint8_t onReadByte() override;
-
private:
Hardware& m_hardware;
- uint32_t m_bootCounter = 2;
};
}
diff --git a/source/nord/n2x/n2xLib/n2xfrontpanel.cpp b/source/nord/n2x/n2xLib/n2xfrontpanel.cpp
@@ -3,6 +3,7 @@
#include <cassert>
#include <cstring> // memcpy
+#include "n2xhardware.h"
#include "dsp56kEmu/logging.h"
namespace n2x
@@ -84,7 +85,7 @@ namespace n2x
if(m_ledLatch10 & (1<<7))
{
m_lcds[2] = m_ledLatch8;
- printLCD();
+ onLCDChanged();
}
break;
case g_frontPanelAddressCS6 + 0xc:
@@ -105,7 +106,7 @@ namespace n2x
}
if(gotLCDs)
- printLCD();
+ onLCDChanged();
}
break;
}
@@ -216,7 +217,17 @@ namespace n2x
LOG("LCD:\n" << message);
}
- FrontPanel::FrontPanel(): m_cs4(*this), m_cs6(*this)
+ void FrontPanelCS6::onLCDChanged()
+ {
+ // Check if the LCD display " 1", used as indication that device has finished booting
+ if(m_lcds[0] == 255 && m_lcds[1] == 254 && m_lcds[2] == 159)
+ {
+ m_panel.getHardware().notifyBootFinished();
+ }
+ printLCD();
+ }
+
+ FrontPanel::FrontPanel(Hardware& _hardware) : m_hardware(_hardware), m_cs4(*this), m_cs6(*this)
{
}
}
diff --git a/source/nord/n2x/n2xLib/n2xfrontpanel.h b/source/nord/n2x/n2xLib/n2xfrontpanel.h
@@ -5,6 +5,7 @@
namespace n2x
{
+ class Hardware;
class FrontPanel;
template<uint32_t Base>
@@ -40,6 +41,7 @@ namespace n2x
private:
void printLCD() const;
+ void onLCDChanged();
uint8_t m_ledLatch8 = 0;
uint8_t m_ledLatch10 = 0;
@@ -54,7 +56,7 @@ namespace n2x
class FrontPanel
{
public:
- FrontPanel();
+ FrontPanel(Hardware& _hardware);
auto& cs4() { return m_cs4; }
auto& cs6() { return m_cs6; }
@@ -74,7 +76,10 @@ namespace n2x
m_cs6.setButtonState(_type, _pressed);
}
+ Hardware& getHardware() const { return m_hardware; }
+
private:
+ Hardware& m_hardware;
FrontPanelCS4 m_cs4;
FrontPanelCS6 m_cs6;
};
diff --git a/source/nord/n2x/n2xLib/n2xmc.cpp b/source/nord/n2x/n2xLib/n2xmc.cpp
@@ -21,7 +21,11 @@ namespace n2x
static constexpr uint32_t g_maskResetDSP = 1 << g_bitResetDSP;
static constexpr uint32_t g_maskResetDAC = 1 << g_bitResetDAC;
- Microcontroller::Microcontroller(Hardware& _hardware, const Rom& _rom) : m_flash(_hardware), m_hdi08(m_hdi08A, m_hdi08B), m_midi(getQSM())
+ Microcontroller::Microcontroller(Hardware& _hardware, const Rom& _rom)
+ : m_flash(_hardware)
+ , m_hdi08(m_hdi08A, m_hdi08B)
+ , m_panel(_hardware)
+ , m_midi(getQSM())
{
if(!_rom.isValid())
return;