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

drivers: ISR-friendly driver APIs #6184

Closed
carlescufi opened this issue Feb 13, 2018 · 4 comments
Closed

drivers: ISR-friendly driver APIs #6184

carlescufi opened this issue Feb 13, 2018 · 4 comments
Assignees
Labels
area: API Changes to public APIs Enhancement Changes/Updates/Additions to existing features RFC Request For Comments: want input from the community

Comments

@carlescufi
Copy link
Member

carlescufi commented Feb 13, 2018

Statement of problem: Zephyr's driver APIs are designed to be called only from threads, and never from ISRs. There are several aspects that prevent those APIs from being called from an ISR:

  • Many APIs are blocking
  • Many APIs make use of kernel objects or primitives that are not allowed to be used from an ISR
  • All driver APIs are mappable to system calls

Therefore I suggest we extend the current driver APIs where applicable with additional, ISR-friendly API calls that:

  • Are postfixed with _isr
  • Do not block or use kernel objects/primitives that are not allowed from ISR
  • Are never mapped to system calls
  • Can take shortcuts (no device structure for example)
@pfalcon
Copy link
Contributor

pfalcon commented Feb 13, 2018

Another facet of entropy drivers which need clarification: #6187

@pfalcon pfalcon added the RFC Request For Comments: want input from the community label Feb 13, 2018
@andrewboie
Copy link
Contributor

Therefore I suggest we extend the current driver APIs where applicable with additional, ISR-friendly API calls

No objections to doing this from me.
For the ones that block, it might in some cases preferable to add a timeout parameter where ISR invocation it would be 0. We do this for a bunch of kernel APIs.

All driver APIs are mappable to system calls

Mostly. Ones that register callbacks and so forth we intentionally leave out. But yes in the general case they are intended for use from thread context.

@nashif nashif added the Enhancement Changes/Updates/Additions to existing features label Feb 15, 2018
@galak galak added the area: API Changes to public APIs label Apr 30, 2019
@carlescufi carlescufi changed the title ISR-friendly driver APIs drivers: ISR-friendly driver APIs May 28, 2019
@pabigot
Copy link
Collaborator

pabigot commented Sep 6, 2019

I'm concerned that creating new API with _isr suffixes is going to make things more confusing, and won't help when the ISR indirectly invokes code that calls a non-ISR-safe function. Also this is only part of answering a user's "what will this function do?" question.

Further comments are in #18970.

@pabigot
Copy link
Collaborator

pabigot commented Jul 7, 2020

API 2020-07-07: Closing as duplicate of #18970 which is the centerpoint of current plans to document API expectations.

@pabigot pabigot closed this as completed Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs Enhancement Changes/Updates/Additions to existing features RFC Request For Comments: want input from the community
Projects
None yet
Development

No branches or pull requests

8 participants