Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@alexandruradovici
Copy link
Contributor

This is the user space patch to try to fix tock/tock#1691.

The timer_at function now uses the new alarm system call and sets the timer to a relative numbers of tics. It eliminates the need to two extra system calls.

Any feedback is welcome, I am not sure that repeating_cb is correctly implemented now.

Copy link
Member

@ppannuto ppannuto left a comment

Choose a reason for hiding this comment

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

Looks good, mostly just cosmetic things (delete now-unused code rather than comment; commit fully to the interval approach in variable names/use).

Is there a Tock issue implementing the underlying syscall you could link here? The PRs should go together.

Thanks!

@alexandruradovici
Copy link
Contributor Author

Thank you for the feedback, I made the changes. The PR supporting this has been already merged (tock/tock#1709).

Copy link
Member

@ppannuto ppannuto left a comment

Choose a reason for hiding this comment

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

I might be missing something, but on looking slightly more deeply, I think this may actually need to keep track of a notion of when things are expiring still. In the steady-state, just keeping intervals is sufficient. However, e.g. when a second timer is first introduced, it will need to know how far through the interval an existing timer is to decide whether to schedule itself after or before the existing time

* the alarm is outstanding.
*
* \param expiration the clock value to schedule the alarm for.
* \param interval the clock value to schedule the alarm for.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* \param interval the clock value to schedule the alarm for.
* \param interval How far in the future to schedule the alarm.

Probably want to move documentation away from implying an absolute clock value with the new interface

alarm_t *prev = NULL;
while (*cur != NULL) {
if (cmp_exp(alarm->t0, alarm->expiration, (*cur)->expiration) < 0) {
if (cmp_exp(alarm->t0, alarm->interval, (*cur)->interval) < 0) {
Copy link
Member

Choose a reason for hiding this comment

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

Should this be referenced from alarm->t0 if comparing intervals now? I think this method of scheduling doesn't quite work anymore, this list ordering assumes a fixed time, but really we need to somehow understand what amount of an interval has expired when sorting the next one into the list.

@phil-levis
Copy link
Contributor

Should be fixed by tock/tock#2089 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

delay_ms (1) blocks the process (and maybe the whole alarm system) on stm boards

3 participants