summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2023-05-27 12:07:35 +0200
committer Olivier Galibert <galibert@pobox.com>2023-05-27 12:07:35 +0200
commit0f032084002a58514a389d55154880bd55dfb2d5 (patch)
treed9ac7483c6caf5c9a70e1ca809863a7180e6ebec /src
parent8cdf1257c48409d1f58f1edccc53d433a1ee7831 (diff)
nn71003: RB recognized a SPI interface
Diffstat (limited to 'src')
-rw-r--r--src/devices/sound/nn71003f.cpp48
-rw-r--r--src/devices/sound/nn71003f.h17
-rw-r--r--src/mame/nichibutsu/hrdvd.cpp6
3 files changed, 36 insertions, 35 deletions
diff --git a/src/devices/sound/nn71003f.cpp b/src/devices/sound/nn71003f.cpp
index f9cc6c04b70..780f51f9399 100644
--- a/src/devices/sound/nn71003f.cpp
+++ b/src/devices/sound/nn71003f.cpp
@@ -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)
diff --git a/src/devices/sound/nn71003f.h b/src/devices/sound/nn71003f.h
index 128aabb3fcf..d2c8b860fa1 100644
--- a/src/devices/sound/nn71003f.h
+++ b/src/devices/sound/nn71003f.h
@@ -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)
diff --git a/src/mame/nichibutsu/hrdvd.cpp b/src/mame/nichibutsu/hrdvd.cpp
index dcf9a0cdd1c..3f6f1032595 100644
--- a/src/mame/nichibutsu/hrdvd.cpp
+++ b/src/mame/nichibutsu/hrdvd.cpp
@@ -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);
}