Skip to content
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

[TIMER] k_timer_start should take 0 value for duration parameter #3928

Closed
zephyrbot opened this issue Aug 10, 2017 · 5 comments
Closed

[TIMER] k_timer_start should take 0 value for duration parameter #3928

zephyrbot opened this issue Aug 10, 2017 · 5 comments
Assignees
Labels
area: Kernel Enhancement Changes/Updates/Additions to existing features priority: medium Medium impact/importance bug
Milestone

Comments

@zephyrbot
Copy link
Collaborator

zephyrbot commented Aug 10, 2017

Reported by Youvedeep Singh:

As per Spec :-

k_timer_start(&timer, DURATION, PERIOD);

DURATION:- "A duration specifying the time interval before the timer expires for the first time, measured in milliseconds. It must be greater than zero."
(source : http://zephyr-docs.s3-website-us-east-1.amazonaws.com/online/dev/kernel/timing/timers.html)

So minimum value programmable should be NON Zero positive value. Also Timer should be programmed with value equal to value programmed by user without any extra addition.

Also currently while programming the timer we are providing one TICK extra due to _ALIGN_TICK. So it should be removed.

(Imported from Jira ZEP-2497)

@zephyrbot
Copy link
Collaborator Author

by Johan Hedberg:

I think it makes the k_timer_start() API "worse" if we disallow K_NO_WAIT, since that value has a very intuitive meaning: "fire the timer at the earliest possible opportunity". So I think the API should allow this and deal with it appropriately (either by silent translation of 0 to 1 or in some better way that makes the first timer go off sooner than within 1ms).

@zephyrbot
Copy link
Collaborator Author

by Youvedeep Singh:

Here summerising the discussion, :-

  1. Allow “K_NO_WAIT” as legal value of duration.
  2. When user gives “K_NO_WAIT” as Duration then do not put it in Timeout Queue, put it directly to QUEUE WORK.
  3. In TICK Based kernel currently we are add _ALIGN_TICK to duration, So adding an extra TICK to duration, That should be removed.
  4. Documentation on Zephyr page need to be changed to show 0 as legal value for duration and it indicates task need to be performed ASAP.

Also a patch is under review for this - #1073

@zephyrbot
Copy link
Collaborator Author

by Youvedeep Singh:

This issue is fixed now, SO good to close this Jira.

@zephyrbot
Copy link
Collaborator Author

by Youvedeep Singh:

Patch merged.

@zephyrbot zephyrbot added priority: medium Medium impact/importance bug area: Kernel Enhancement Changes/Updates/Additions to existing features labels Sep 23, 2017
@zephyrbot zephyrbot added this to the v1.9.0 milestone Sep 23, 2017
@david-perez
Copy link

Website docs for timers still state that "a duration [...] must be greater than zero." Also, why not define duration and period as unsigned in k_timer_start, as well as in the timer struct definition?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Kernel Enhancement Changes/Updates/Additions to existing features priority: medium Medium impact/importance bug
Projects
None yet
Development

No branches or pull requests

3 participants