mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
nn71003: RB recognized a SPI interface
This commit is contained in:
parent
8cdf1257c4
commit
0f03208400
@ -14,54 +14,54 @@ DEFINE_DEVICE_TYPE(NN71003F, nn71003f_device, "nn71003f", "NN71003F mpeg audio c
|
||||
nn71003f_device::nn71003f_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, NN71003F, tag, owner, clock),
|
||||
device_sound_interface(mconfig, *this),
|
||||
m_irq_cb(*this)
|
||||
m_miso(*this)
|
||||
{
|
||||
}
|
||||
|
||||
void nn71003f_device::device_start()
|
||||
{
|
||||
m_irq_cb.resolve_safe();
|
||||
save_item(NAME(m_cmd_atn));
|
||||
save_item(NAME(m_cmd_clk));
|
||||
save_item(NAME(m_cmd_dat));
|
||||
m_miso.resolve_safe();
|
||||
save_item(NAME(m_ss));
|
||||
save_item(NAME(m_sclk));
|
||||
save_item(NAME(m_mosi));
|
||||
}
|
||||
|
||||
void nn71003f_device::device_reset()
|
||||
{
|
||||
m_cmd_atn = 0;
|
||||
m_cmd_clk = 0;
|
||||
m_cmd_dat = 0;
|
||||
m_ss = 0;
|
||||
m_sclk = 0;
|
||||
m_mosi = 0;
|
||||
}
|
||||
|
||||
void nn71003f_device::cmd_atn_w(int state)
|
||||
void nn71003f_device::ss_w(int state)
|
||||
{
|
||||
if(state == m_cmd_atn)
|
||||
if(state == m_ss)
|
||||
return;
|
||||
m_cmd_atn = state;
|
||||
if(!m_cmd_atn)
|
||||
m_cmd_cnt = 0;
|
||||
m_ss = state;
|
||||
if(!m_ss)
|
||||
m_spi_cnt = 0;
|
||||
}
|
||||
|
||||
void nn71003f_device::cmd_clk_w(int state)
|
||||
void nn71003f_device::sclk_w(int state)
|
||||
{
|
||||
if(state == m_cmd_clk)
|
||||
if(state == m_sclk)
|
||||
return;
|
||||
m_cmd_clk = state;
|
||||
if(!m_cmd_clk)
|
||||
m_sclk = state;
|
||||
if(!m_sclk)
|
||||
return;
|
||||
m_cmd_byte = (m_cmd_byte << 1) | m_cmd_dat;
|
||||
m_cmd_cnt ++;
|
||||
if(m_cmd_cnt & 7)
|
||||
m_spi_byte = (m_spi_byte << 1) | m_mosi;
|
||||
m_spi_cnt ++;
|
||||
if(m_spi_cnt & 7)
|
||||
return;
|
||||
|
||||
logerror("CMD %x: %02x\n", m_cmd_cnt >> 3, m_cmd_byte);
|
||||
logerror("SPI %x: %02x\n", m_spi_cnt >> 3, m_spi_byte);
|
||||
}
|
||||
|
||||
void nn71003f_device::cmd_dat_w(int state)
|
||||
void nn71003f_device::mosi_w(int state)
|
||||
{
|
||||
if(state == m_cmd_dat)
|
||||
if(state == m_mosi)
|
||||
return;
|
||||
m_cmd_dat = state;
|
||||
m_mosi = state;
|
||||
}
|
||||
|
||||
void nn71003f_device::frm_w(int state)
|
||||
|
@ -15,15 +15,16 @@ class nn71003f_device : public device_t, public device_sound_interface
|
||||
public:
|
||||
nn71003f_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
|
||||
|
||||
// Serial audio interface
|
||||
void frm_w(int state);
|
||||
void dat_w(int state);
|
||||
void clk_w(int state);
|
||||
|
||||
void cmd_atn_w(int state);
|
||||
void cmd_clk_w(int state);
|
||||
void cmd_dat_w(int state);
|
||||
|
||||
auto irq_cb() { return m_irq_cb.bind(); }
|
||||
// Slave SPI interface
|
||||
void ss_w(int state);
|
||||
void sclk_w(int state);
|
||||
void mosi_w(int state);
|
||||
auto miso_cb() { return m_miso.bind(); }
|
||||
|
||||
protected:
|
||||
virtual void device_start() override;
|
||||
@ -31,9 +32,9 @@ protected:
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
|
||||
private:
|
||||
devcb_write_line m_irq_cb;
|
||||
u8 m_cmd_byte, m_cmd_cnt;
|
||||
int m_cmd_atn, m_cmd_clk, m_cmd_dat;
|
||||
devcb_write_line m_miso;
|
||||
u8 m_spi_byte, m_spi_cnt;
|
||||
int m_ss, m_sclk, m_mosi;
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(NN71003F, nn71003f_device)
|
||||
|
@ -133,9 +133,9 @@ void hrdvd_state::pb_w(uint16_t data)
|
||||
{
|
||||
u8 delta = data ^ m_pb;
|
||||
m_pb = (m_pb & 0xc0) | (data & 0x3f);
|
||||
m_mpega->cmd_atn_w(BIT(m_pb, 0));
|
||||
m_mpega->cmd_clk_w(BIT(m_pb, 1));
|
||||
m_mpega->cmd_dat_w(BIT(m_pb, 2));
|
||||
m_mpega->ss_w(BIT(m_pb, 0));
|
||||
m_mpega->sclk_w(BIT(m_pb, 1));
|
||||
m_mpega->mosi_w(BIT(m_pb, 2));
|
||||
if(delta & 0x38)
|
||||
logerror("pb %02x\n", data);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user