Enhance implementation of hwtimer_spin()

~~Fix a big problem with ```hwtimer_spin()``` (which was not correctly detecting timer overflows), and try to avoid interrupts in ```hwtimer_wait()``` while the timer is not set to target time plus release the mutex after wait is finished.
~~

~~This should improve reliability of the hwtimer mechanism.~~

Make the implementation of ```hwtimer_spin()``` easier to understand.