-
Notifications
You must be signed in to change notification settings - Fork 8.3k
[RFC][DNM] device: device api extension proposal #22409
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
A draft showing how to handle external API with devices. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
|
All checks passed. checkpatch (informational only, not a failure)Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages. |
|
As for spi and i2c, you are pushing a specialized feature (or if you prefer: a "not-generic enough one") to a generic node. Imo, your are taking the problem the wrong way. You are not responding to what we have been waiting for: a transaction manager RFC. If you do that you'll see what belongs to the transaction manager and what may belong to something else below. |
|
@tbursztyka we already have similar case. There is an onoff service and clock_control driver. I would like to use onoff service on clock device and not extended clock control API. How to do that? Maybe you could propose something as you clearly have something in mind and it is different than this proposal? Transaction manager is another case. We can have RFC with API for that but still there will be an issue how to use it with the device. |
|
Could we please start developing a consensus on what we need before we start proposing technical solutions that have to be reviewed without anything to judge them against? Also: https://docs.zephyrproject.org/latest/reference/drivers/index.html#device-specific-api-extensions which might be extended to subsystem-specific-api-extensions if that seems like a good solution for whatever the problem is. |
| /** @brief Check if given extension is supported. | ||
| * | ||
| * @param dev Device. | ||
| * @param api_mask Bit mask identifiing an extension. |
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.
I would use API ID number instead. 32 possibilities are not so much. Independently form fact how compatibility information is stored in drivers properties record.
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.
yes api id would allow extension beyond 32 bits and if 32 is too low at some point it can be internally extended without change of any API. I would like to keep it as bitmask internally to reduce overhead. Currently with device supporting only one api extension it is almost instant. Question is if we foresee devices with multple extensions (probably yes).
|
API 2020-07-07: Moved from triage to in-progress; relates to #23371. |
A draft showing how to handle external API with devices.
Short summary:
zephyr/include/device.h
Line 302 in 47ec301
z_device_ext_api_supported(dev, bitmask)) and getting data associated with that extension (z_device_ext_api_get_data(dev, bitmask))zephyr/include/device.h
Line 328 in 47ec301
device_get_onoff_service(dev, &srv)zephyr/include/sys/onoff.h
Line 434 in 47ec301
Example:
Signed-off-by: Krzysztof Chruscinski krzysztof.chruscinski@nordicsemi.no