summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2017-08-11 23:03:55 -0400
committer AJR <ajrhacker@users.noreply.github.com>2017-08-11 23:13:30 -0400
commit99e8e1557593c4abb2f817b3bcb768163c602a4f (patch)
tree1077f3a325ab50af8bf43d0fbae2bf7c5a742fa9
parentdef07b90abe61f2170a9b889b508ff1300d92895 (diff)
Delay data capture timing for MSM5205 and MSM6585 (should help with synchronization later)
-rw-r--r--src/devices/sound/msm5205.cpp50
-rw-r--r--src/devices/sound/msm5205.h8
2 files changed, 37 insertions, 21 deletions
diff --git a/src/devices/sound/msm5205.cpp b/src/devices/sound/msm5205.cpp
index c44f4760a87..2730ff9e3dd 100644
--- a/src/devices/sound/msm5205.cpp
+++ b/src/devices/sound/msm5205.cpp
@@ -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);
-
- m_vck = !m_vck;
- m_vck_cb(m_vck);
-
- if (!m_vck)
- update_adpcm();
+ 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;
+
+ 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);
-
- m_vck = !m_vck;
- m_vck_cb(m_vck);
-
- if (m_vck)
- update_adpcm();
+ 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;
+
+ case TIMER_ADPCM_CAPTURE:
+ update_adpcm();
+ break;
+ }
}
diff --git a/src/devices/sound/msm5205.h b/src/devices/sound/msm5205.h
index 7f5af4fd975..90e6fd58661 100644
--- a/src/devices/sound/msm5205.h
+++ b/src/devices/sound/msm5205.h
@@ -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