-
Notifications
You must be signed in to change notification settings - Fork 7.5k
kernel: extensions and clarifications to time-conversion changes #20457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This isn't something the user will ever include directory, so take steps to hide it. Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Some use cases require using high-resolution tick or cycle clocks to measure sub-millisecond durations. Generate the corresponding 32-bit conversions to avoid the cost of 64-bit math in the common case where the duration fits in 32 bits in both original and converted scale. Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very sensible to me. I tried to check all the new conversion functions against the doc and they do look all correct. I did not check the parameters to z_tmcvt()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@andyross could you please take a quick look before feature freeze? |
also please @nashif as the guardian of where include files go. Thank you. |
All checks are passing now. Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages. |
…ed API The addition of API to correctly handle conversion between durations in different clocks inadvertently changed the type of the value produced by the API. Specific changes were: s32_t z_ms_to_ticks(s32_t t) => u32_t k_ms_to_ticks_ceil32(u32_t t) : signedness change s32_t __ticks_to_us(s32_t t) => u64_t k_ticks_to_us_floor64(u64_t t) : signedness and rank change s32_t z_us_to_ticks(s32_t t) => u64_t k_us_to_ticks_ceil64(u64_t t) : signedness and rank change int sys_clock_hw_cycles_per_tick() => u32_t k_ticks_to_cyc_floor32(1) : signedness change The effect of this is to change the essential type of operands in existing expressions, potentially resulting in behavior changes when calculations were promoted to unsigned types, or code size by requiring 64-bot arithmetic. Add casts as necessary to preserve the original return type, and to explicitly recognize impact of passing macro parameters into a context where a specific type will be used. Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks harmless, sure.
Several concerns raised in review of #19591 were not addressed. This provides the changes promised in #19591 (comment) to mitigate those concerns.
I don't insist on the move of the internal header to a less visible location, but it certainly didn't get the consideration I expected when I asked for it to be done in #19591 (review) or in #17155 (comment).
I can do nothing at this point about the essential-type changes made in-tree by the previous merge.