Delay data capture timing for MSM5205 and MSM6585 (should help with synchronization later)

This commit is contained in:
AJR 2017-08-11 23:03:55 -04:00
parent def07b90ab
commit 99e8e15575
2 changed files with 35 additions and 19 deletions

View File

@ -45,11 +45,12 @@
Master clock frequency 640kHz 384kHz
Sampling frequency 4k/8k/16k/32kHz 4k/6k/8kHz
ADPCM bit length 4-bit 3-bit/4-bit
Data capture timing 5µsec 15.6µsec
DA converter 12-bit 10-bit
Low-pass filter -40dB/oct N/A
Overflow prevent circuit Included N/A
Data input follows VCK falling edge on MSM5205 (VCK rising edge on MSM6585)
Data capture follows VCK falling edge on MSM5205 (VCK rising edge on MSM6585)
TODO:
- lowpass filter for MSM6585
@ -108,7 +109,8 @@ void msm5205_device::device_start()
/* stream system initialize */
m_stream = machine().sound().stream_alloc(*this, 0, 1, clock());
m_timer = timer_alloc(TIMER_VCK);
m_vck_timer = timer_alloc(TIMER_VCK);
m_capture_timer = timer_alloc(TIMER_ADPCM_CAPTURE);
/* register for save states */
save_item(NAME(m_data));
@ -186,13 +188,19 @@ void msm5205_device::compute_tables()
void msm5205_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
assert(id == TIMER_VCK);
switch (id)
{
case TIMER_VCK:
m_vck = !m_vck;
m_vck_cb(m_vck);
if (!m_vck)
m_capture_timer->adjust(attotime::from_nsec(15600));
break;
m_vck = !m_vck;
m_vck_cb(m_vck);
if (!m_vck)
update_adpcm();
case TIMER_ADPCM_CAPTURE:
update_adpcm();
break;
}
}
// timer callback at VCK low edge on MSM5205 (at rising edge on MSM6585)
@ -355,12 +363,12 @@ void msm5205_device::device_clock_changed()
logerror("/%d prescaler selected\n", prescaler);
attotime half_period = clocks_to_attotime(prescaler / 2);
m_timer->adjust(half_period, 0, half_period);
m_vck_timer->adjust(half_period, 0, half_period);
}
else
{
logerror("VCK slave mode selected\n");
m_timer->adjust(attotime::never);
m_vck_timer->adjust(attotime::never);
}
}
@ -395,13 +403,19 @@ void msm5205_device::sound_stream_update(sound_stream &stream, stream_sample_t *
void msm6585_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
assert(id == TIMER_VCK);
switch (id)
{
case TIMER_VCK:
m_vck = !m_vck;
m_vck_cb(m_vck);
if (m_vck)
m_capture_timer->adjust(attotime::from_usec(3));
break;
m_vck = !m_vck;
m_vck_cb(m_vck);
if (m_vck)
update_adpcm();
case TIMER_ADPCM_CAPTURE:
update_adpcm();
break;
}
}

View File

@ -62,7 +62,8 @@ public:
protected:
enum
{
TIMER_VCK
TIMER_VCK,
TIMER_ADPCM_CAPTURE
};
msm5205_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
@ -82,8 +83,9 @@ protected:
virtual int get_prescaler() const;
// internal state
sound_stream * m_stream; // number of stream system
emu_timer *m_timer; // VCK callback timer
sound_stream *m_stream; // number of stream system
emu_timer *m_vck_timer; // VCK callback timer
emu_timer *m_capture_timer; // delay after VCK active edge for ADPCM input capture
u8 m_data; // next adpcm data
bool m_vck; // VCK signal
bool m_reset; // reset pin signal