[xTimer] Question about xtimer implementation.

Hello,

My name is Phuong. Glad to know you.

I’m a RIOT newbie, I’m porting RIOT to ARM Cortex-A9 platform and everything seem to be OK such as context switching, interrupt, initialize and execute threads… However, I’m stuck at xtimer implementation.

The CPU has 32bit timers/counters and it has countdown mode only. When the timer reaches zero it generates timer interrupt request to the CPU. I reference to another platforms porting which are implemented count up timer mode only.

I do not really understand how does xtimer module work, would you please show me how to implement for countdown timer case ?

Thanks and Best Regards, Phuong Dang

Hi Phuong,

The CPU has 32bit timers/counters and it has countdown mode only. When the timer reaches zero it generates timer interrupt request to the CPU. I reference to another platforms porting which are implemented count up timer mode only.

I usually just substract the every actual timer value from e.g., "0xffffffff". That way the value just gets interpreted as "counting up".

I do not really understand how does xtimer module work, would you please show me how to implement for countdown timer case ?

This needs to be done in your board's periph/timer implementation, thus it should be independent from xtimer.

Hope this helps! Kaspar