h8_timer16: remove irq check from recalc_event for software that polls the timer irq flags with interrupts disabled, big performance drop for mu100 unfortunately
This commit is contained in:
parent
3b6aae51c2
commit
b18bf9cade
@ -17,7 +17,20 @@
|
|||||||
- Make the base class more generic, and derive the devices from that,
|
- Make the base class more generic, and derive the devices from that,
|
||||||
so they don't have to jumble so much with the IRQ/flag bits. The
|
so they don't have to jumble so much with the IRQ/flag bits. The
|
||||||
overflow IRQ/flag being hardcoded on bit 4 is also problematic.
|
overflow IRQ/flag being hardcoded on bit 4 is also problematic.
|
||||||
|
- recalc_event is inaccurate? Try for example with mu100 or timecrs2.
|
||||||
|
(h8_timer8 may have the same issue? did not check)
|
||||||
|
|
||||||
|
Test case: in the update_counter function, inside the m_tgr loop:
|
||||||
|
|
||||||
|
bool a1 = (m_tgr[i] > m_counter_cycle && prev >= m_counter_cycle && tt >= m_tgr[i]);
|
||||||
|
bool a2 = (m_tgr[i] <= m_counter_cycle && prev < m_tgr[i] && tt >= m_tgr[i]);
|
||||||
|
bool a3 = (m_tgr[i] <= m_counter_cycle && prev >= m_tcnt && m_tcnt >= m_tgr[i]);
|
||||||
|
bool b = a1 || a2 || a3;
|
||||||
|
bool c = (tt == m_tgr[i] || m_tcnt == m_tgr[i]);
|
||||||
|
if(b && !c) { printf("%s %d +%d = %d - tgr=%d max=%d\n", (m_ier & (1 << i)) ? "IRQ! " : "", prev, (int)delta, m_tcnt, m_tgr[i], m_counter_cycle); }
|
||||||
|
|
||||||
- Proper support for input capture registers.
|
- Proper support for input capture registers.
|
||||||
|
- Add support for chained timers.
|
||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
@ -88,7 +101,6 @@ void h8_timer16_channel_device::set_ier(u8 value)
|
|||||||
{
|
{
|
||||||
update_counter();
|
update_counter();
|
||||||
m_ier = value;
|
m_ier = value;
|
||||||
recalc_event();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void h8_timer16_channel_device::set_enable(bool enable)
|
void h8_timer16_channel_device::set_enable(bool enable)
|
||||||
@ -117,7 +129,6 @@ void h8_timer16_channel_device::tier_w(u8 data)
|
|||||||
m_ier & IRQ_V ? 'v' : '.',
|
m_ier & IRQ_V ? 'v' : '.',
|
||||||
m_ier & IRQ_U ? 'u' : '.',
|
m_ier & IRQ_U ? 'u' : '.',
|
||||||
m_ier & IRQ_TRIG ? 1 : 0);
|
m_ier & IRQ_TRIG ? 1 : 0);
|
||||||
recalc_event();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 h8_timer16_channel_device::tsr_r()
|
u8 h8_timer16_channel_device::tsr_r()
|
||||||
@ -259,12 +270,13 @@ void h8_timer16_channel_device::update_counter(u64 cur_time)
|
|||||||
else
|
else
|
||||||
m_tcnt = tt % m_counter_cycle;
|
m_tcnt = tt % m_counter_cycle;
|
||||||
|
|
||||||
for(int i = 0; i < m_tgr_count; i++)
|
for(int i = 0; i < m_tgr_count; i++) {
|
||||||
if(tt == m_tgr[i] || m_tcnt == m_tgr[i]) {
|
if(tt == m_tgr[i] || m_tcnt == m_tgr[i]) {
|
||||||
m_isr |= 1 << i;
|
m_isr |= 1 << i;
|
||||||
if(m_ier & (1 << i) && m_interrupt[i] != -1)
|
if(m_ier & (1 << i) && m_interrupt[i] != -1)
|
||||||
m_intc->internal_interrupt(m_interrupt[i]);
|
m_intc->internal_interrupt(m_interrupt[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(tt >= 0x10000 && (m_counter_cycle == 0x10000 || prev >= m_counter_cycle)) {
|
if(tt >= 0x10000 && (m_counter_cycle == 0x10000 || prev >= m_counter_cycle)) {
|
||||||
m_isr |= IRQ_V;
|
m_isr |= IRQ_V;
|
||||||
if(m_ier & IRQ_V && m_interrupt[4] != -1)
|
if(m_ier & IRQ_V && m_interrupt[4] != -1)
|
||||||
@ -304,11 +316,10 @@ void h8_timer16_channel_device::recalc_event(u64 cur_time)
|
|||||||
m_counter_cycle = m_tgr[m_tgr_clearing];
|
m_counter_cycle = m_tgr[m_tgr_clearing];
|
||||||
else
|
else
|
||||||
m_counter_cycle = 0x10000;
|
m_counter_cycle = 0x10000;
|
||||||
if((m_ier & IRQ_V) && (m_counter_cycle == 0x10000 || m_tcnt >= m_counter_cycle))
|
if(m_counter_cycle == 0x10000 || m_tcnt >= m_counter_cycle)
|
||||||
event_delay = 0x10000 - m_tcnt;
|
event_delay = 0x10000 - m_tcnt;
|
||||||
|
|
||||||
for(int i = 0; i < m_tgr_count; i++)
|
for(int i = 0; i < m_tgr_count; i++) {
|
||||||
if(m_ier & (1 << i)) {
|
|
||||||
u32 new_delay = 0xffffffff;
|
u32 new_delay = 0xffffffff;
|
||||||
if(m_tgr[i] > m_tcnt) {
|
if(m_tgr[i] > m_tcnt) {
|
||||||
if(m_tcnt >= m_counter_cycle || m_tgr[i] <= m_counter_cycle)
|
if(m_tcnt >= m_counter_cycle || m_tgr[i] <= m_counter_cycle)
|
||||||
|
Loading…
Reference in New Issue
Block a user