Timer Task Force
Timer Task Force
This page is used to collect requirements and suggestions concerning a hwtimer/vtimer/RTC redesign.
- very efficient timers for use in time-critical drivers
- easy-to-use interface (unified interface)
- work with varying MCU timer widths (16, 24, 32-bit timers)
- adaptable to varying configurations of timers, RTTs, RTCs
- (use RTC if available for super-long-time timers)
- Wait for a time period (e.g. timer_usleep(howlong))
- receive message after given period of time (e.g. timer_msg(howlong))
- receive message periodically
- Await a point in time
- Wait for a (past) time + x
- what granularity to use? msec,usec,nsec, timer ticks, a combination?
- xtimer has been implemented
- missing usage of possibly present low-power timer / RTT / RTC
- at 70Mhz ticks, theoretical timer granularity can reach 14ns. Factor 10 speed increase is probable before the next timer revamp. That means that we have to use nanoseconds granularity (in the API) if we want to not waste hardware potential now or in the future. That also means that 32bit timer values would overflow in seconds.
- using microseconds, 32bit can hold 71 minutes. Sounds like not much to me.
- using miliseconds, 32bit can hold 49days.
- a 64bit unsigned value can hold >584years in nanoseconds.
- using 64bit values simplifies code a lot (we could use signed values for easy comparision or the representation of negative time values, in code "c=a-b" looks a lot more readable than "c.sec=a.sec-b.sec, c.nsec=a.nsec-b.nsec" and handling overflows
- not sure how much this affects code size (one 32bit value vs. a struct with two 32bit values vs. one 64bit values) or how 8bit systems handle 64bit integers
- see here for some numbers on this