fixed timer code based on pxa timer.c version