n2xdsp.h (1351B)
1 #pragma once 2 3 #include <memory> 4 #include <string> 5 6 #include "dsp56kEmu/dsp.h" 7 #include "dsp56kEmu/dspthread.h" 8 9 #include "baseLib/semaphore.h" 10 11 #include "hardwareLib/dspBootCode.h" 12 #include "hardwareLib/haltDSP.h" 13 14 namespace mc68k 15 { 16 class Hdi08; 17 } 18 19 namespace n2x 20 { 21 class Hardware; 22 23 class DSP 24 { 25 public: 26 DSP(Hardware& _hw, mc68k::Hdi08& _hdiUc, uint32_t _index); 27 28 dsp56k::HDI08& hdi08() 29 { 30 return m_periphX.getHDI08(); 31 } 32 33 dsp56k::DSP& dsp() 34 { 35 return m_dsp; 36 } 37 38 dsp56k::Peripherals56362& getPeriph() 39 { 40 return m_periphX; 41 } 42 43 dsp56k::DSPThread& getDSPThread() const { return *m_thread; } 44 auto& getHaltDSP() { return m_haltDSP; } 45 46 void terminate(); 47 void join() const; 48 void onDspBootFinished(); 49 50 private: 51 void onUCRxEmpty(bool _needMoreData); 52 void hdiTransferUCtoDSP(uint32_t _word); 53 void hdiSendIrqToDSP(uint8_t _irq); 54 uint8_t hdiUcReadIsr(uint8_t _isr); 55 bool hdiTransferDSPtoUC(); 56 57 Hardware& m_hardware; 58 mc68k::Hdi08& m_hdiUC; 59 60 const uint32_t m_index; 61 const std::string m_name; 62 63 dsp56k::PeripheralsNop m_periphNop; 64 dsp56k::Peripherals56362 m_periphX; 65 dsp56k::Memory m_memory; 66 dsp56k::DSP m_dsp; 67 68 std::unique_ptr<dsp56k::DSPThread> m_thread; 69 70 dsp56k::SpscSemaphore m_triggerInterruptDone; 71 uint32_t m_irqInterruptDone = 0; 72 73 hwLib::HaltDSP m_haltDSP; 74 75 hwLib::DspBoot m_boot; 76 }; 77 }