If the interrupt is not freed but merely disabled, instead of reallocating
it every time the timer is enabled again we can instead just re-enable it.
That means we're no longer setting the handler every time, and we need to
ensure it does not change. Doing so by adding an additional wrapper
function does not only solve that problem, it also allows us to remove
some code duplication and simplify how machine_uart uses the timer.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
The UART.IRQ_IDLE callback is called about two character times after the
last byte, or 1 ms, whichever is larger. For the irq, timer 0 is used.
machine_timer.c had to be reworked to make it's mechanisms available for
machine_uart.c.
The irq.flags() value is change only at a requested event. Otherwise keep
the state.
Signed-off-by: robert-hh <robert@hammelrath.com>