Skip to content

Conversation

jnohlgard
Copy link
Member

@jnohlgard jnohlgard commented Jul 5, 2016

Significantly simplified version of #3990, using the ideas from #4002.
The public API of xtimer now uses two new types xtimer_ticks32_t, and xtimer_ticks64_t, to catch any missing usec/sec/nanosec to tick conversions. Internally, all timer scheduling and offsets are using hardware ticks instead of microseconds.
All internal xtimer functions use untyped (i.e. uint32_t, uint64_t) ticks and are prefixed with underscore to avoid mistakes. This extra level of abstraction is only a thin wrapper and the conversions between ticks and microseconds are inlined and will become a no-op if the hardware timer also runs at 1 MHz.

xtimer_usleep_until has been renamed xtimer_periodic_wakeup, to better reflect the purpose (and since it is now using ticks and not microseconds as parameters). This change was forked off into #5612.

Based on #5294, #5607.

Marked as WIP until all tests and drivers have been adapted to use the new xtimer_ticks*_t type.

@jnohlgard jnohlgard added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable TimerTaskForce Area: timers Area: timer subsystems labels Jul 5, 2016
@jnohlgard jnohlgard added this to the Release 2016.07 milestone Jul 5, 2016
@jnohlgard jnohlgard added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jul 5, 2016
@jnohlgard
Copy link
Member Author

Adding the CI build flag to assist in finding missing API updates..

@jnohlgard
Copy link
Member Author

Verified that the inline function for usec->tick conversion of a compile time constant generates no extra code via manual inspection of assembly output. Optimization level -O0 generates function calls for the compile time constants. -O1, -Os, and -Og all precompute the constant to store it as ticks directly in the binary instead of storing as microseconds.

Conversion of run time variable values will of course generate conversion instructions since it is not possible to rescale them during compile time.

@jnohlgard jnohlgard removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jul 6, 2016
@jnohlgard jnohlgard force-pushed the pr/xtimer-ticks branch 4 times, most recently from 4320828 to f68ba74 Compare July 6, 2016 20:52
@jnohlgard jnohlgard added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jul 6, 2016
@jnohlgard jnohlgard force-pushed the pr/xtimer-ticks branch 2 times, most recently from 9fc7a0f to 12f73f2 Compare July 7, 2016 13:40
@jnohlgard
Copy link
Member Author

#5612 was split off from this PR as a separate change.

@jnohlgard
Copy link
Member Author

postponing to release 2016.10

@jnohlgard
Copy link
Member Author

rebased

@kYc0o
Copy link
Contributor

kYc0o commented Nov 29, 2016

Can you squash your fixup? I think everything is OK now so we could have this PR merged soon :)

@jnohlgard
Copy link
Member Author

@kYc0o
squashed the fixup

Copy link
Contributor

@kYc0o kYc0o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@kYc0o
Copy link
Contributor

kYc0o commented Nov 29, 2016

And go!

@kYc0o kYc0o merged commit 84d0d61 into RIOT-OS:master Nov 29, 2016
@OlegHahm
Copy link
Member

Wow, cool!

@immesys
Copy link
Contributor

immesys commented Nov 30, 2016

Awesome! Thank you all for your work here

@jnohlgard jnohlgard deleted the pr/xtimer-ticks branch December 1, 2016 08:06
miri64 added a commit to miri64/RIOT that referenced this pull request Jan 11, 2017
@miri64 miri64 mentioned this pull request Jan 11, 2017
smlng added a commit to smlng/RIOT that referenced this pull request Mar 3, 2017
@smlng smlng mentioned this pull request Mar 3, 2017
smlng added a commit to smlng/RIOT that referenced this pull request Mar 7, 2017
smlng added a commit to smlng/RIOT that referenced this pull request Mar 7, 2017
neiljay pushed a commit to neiljay/RIOT that referenced this pull request Mar 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: timers Area: timer subsystems CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Process: API change Integration Process: PR contains or issue proposes an API change. Should be handled with care. Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants