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

Relax us ticker frequency requirement. #1123

Merged
merged 3 commits into from
Aug 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions docs/porting/target/us_ticker.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Implementing the microsecond ticker enables Mbed OS to perform operations that r

### Defined behavior

- Has a reported frequency between 250KHz and 8MHz.
- Has a reported frequency between 250 KHz and 8 MHz for counters that are less than 32 bits wide.
- Has a reported frequency up to 100 MHz for counters that are 32 bits wide.
- Has a counter that is at least 16 bits wide.
- The function `ticker_init` is safe to call repeatedly.
- The function `ticker_init` allows the ticker to keep counting and disables the ticker interrupt.
Expand All @@ -17,7 +18,7 @@ Implementing the microsecond ticker enables Mbed OS to perform operations that r
- The ticker interrupt fires only when the ticker time increments to or past the value set by `ticker_set_interrupt`.
- It is safe to call `ticker_set_interrupt` repeatedly before the handler is called.
- The function `ticker_fire_interrupt` causes `ticker_irq_handler` to be called immediately from interrupt context.
- The ticker operations `ticker_read`, `ticker_clear_interrupt`, `ticker_set_interrupt` and `ticker_fire_interrupt` take less than 20us to complete.
- The ticker operations `ticker_read`, `ticker_clear_interrupt`, `ticker_set_interrupt` and `ticker_fire_interrupt` take less than 20 us to complete.
- The ticker operations `ticker_init` and `ticker_read` are atomic.

### Undefined behavior
Expand All @@ -31,13 +32,13 @@ Implementing the microsecond ticker enables Mbed OS to perform operations that r

Be careful around these common trouble areas when implementing this API:

- The ticker cannot drift when rescheduled repeatedly
- The ticker keeps counting when it rolls over
- The ticker interrupt fires when the compare value is set to 0 and overflow occurs
- The ticker cannot drift when rescheduled repeatedly.
- The ticker keeps counting when it rolls over.
- The ticker interrupt fires when the compare value is set to 0 and overflow occurs.

## Dependencies

To implement this API, the device must have a hardware counter that has a count value at least 16 bits wide and can operate between 250KHz and 8MHz.
To implement this API, the device must have a hardware counter that has a count value at least 16 bits wide and can operate between 250 KHz and 8 MHz.

## Implementing the microsecond ticker API

Expand Down