Commit 5e6256ae3c88c2a672d570ff1baf22d7142f5740
authorbsekisser <squirmyworms@embarqmail.com>
Wed, 17 Sep 2014 19:31:38 +0000 (15:31 -0400)
committerbsekisser <squirmyworms@embarqmail.com>
Wed, 22 Oct 2014 22:47:27 +0000 (18:47 -0400)
tree35979b284ec84ae52310447adf5de460f6edf364
parent0428233dbfec25fe56a8189b2e8f7e6fb61189ff
Message:
interrupts: modify handling of interrupt state

Interrupt state edge detection and wait states combined into multi
function variable, enabling the removal of edge detection
code in the run loop and simplifying need to service interrupts
by placing the burden on code directly influencing the interrupt
handling state.

modified:   simavr/sim/sim_avr.c
edge detection code removed from both run loops.
raw (non-gdb) loop does precheck of interrupt state, while not
necessary, potentially saving a few cycles.

modified:   simavr/sim/sim_avr.h
uint8_t i_shadow changed to int8_t interrupt_state.

modified:   simavr/sim/sim_core.c
flag changes which may impact interrupt state are routed
through avr_sreg_set().
multi-cycle loop simplified to check avr->interrupt_state.

modified:   simavr/sim/sim_core.h
static inline avr_sreg_set() - handles changes to global
interrupt state and ensures wait states if I
flag changes from 0 -> 1.  superfluous 1 -> 1
states are ignored, should they occur. and
disabling interrupts clears avr->interrupt_state.
flag changes from SET_SREG_FROM routed to avr_sreg_set();

modified:   simavr/sim/sim_interrupts.c
avr_interrupt_reset()
interrupt_state cleared during reset.
avr_raise_intrrupt()
check interrupts enabled and no pending
interrupt_state before marking pending interrupt state.
avr_service_interrupts()
servicing code changed to tick pending wait state then
mark for any pending interrupts or set to zero
if none waiting.
on interrupt, direct interrupt state change to
avr_sreg_set();

modified:   simavr/sim/sim_interrupts.h
remove pending_wait.

modified:   tests/tests.c
interrupt edge dectection code removed from test run loop.
no further modifications required.

modified:   simavr/sim/sim_avr.c
modified:   simavr/sim/sim_avr.h
modified:   simavr/sim/sim_core.c
modified:   simavr/sim/sim_core.h
modified:   simavr/sim/sim_interrupts.c
modified:   simavr/sim/sim_interrupts.h
modified:   tests/tests.c
7 files changed:
simavr/sim/sim_avr.c
simavr/sim/sim_avr.h
simavr/sim/sim_core.c
simavr/sim/sim_core.h
simavr/sim/sim_interrupts.c
simavr/sim/sim_interrupts.h
tests/tests.c