-
Notifications
You must be signed in to change notification settings - Fork 2k
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
ieee802154/radio_hal: introduce Radio HAL for IEEE802.15.4 compatible radios #14371
Conversation
I did not follow all the discussion in #13943 that closely but how come it is now that the CC2538 is the PoC? I thought |
(I like that for an API overhaul it is "only" 1500 additions :-)) |
I will add them 2. This was only a third radio :) |
For the API itself it's mostly documentation 🙈 |
Even better! :-) |
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.
Minor style nit-pick for the start
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.
@jia200x thanks for the PR. I would really like to get my hands at it, thus, a test application (as well as the other drivers we agreed on) would be a very valuable next step.
Implemented what I mentioned in #13943 (comment) |
With #14655 in place, you could remove the CC2538 changes from this PR here, right? |
Yes, it's the idea. I just wanted people to validate the latest fixups before squashing and moving all CC2538 commits there |
all comments were addressed. May I squash and move out the CC2538 commits? |
Yes. |
ebeb695
to
149349b
Compare
done! |
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.
Several doxygen warnings:
RIOT/sys/include/net/ieee802154/radio.h:292: warning: unable to resolve reference to `ieee802154_radio_ops::transmit' for \ref command
RIOT/sys/include/net/ieee802154/radio.h:292: warning: unable to resolve reference to `ieee802154_radio_ops::transmit' for \ref command
RIOT/sys/include/net/ieee802154/radio.h:461: warning: unable to resolve reference to `IEEE802154_RADIO_CONFIRM_CCA' for \ref command
RIOT/sys/include/net/ieee802154/radio.h:464: warning: unable to resolve reference to `call' for \ref command
RIOT/sys/include/net/ieee802154/radio.h:391: warning: unable to resolve reference to `IEEE802154_RADIO_CONFIRM_AWAKE_END' for \ref command
RIOT/sys/include/net/ieee802154/radio.h:394: warning: unable to resolve reference to `call' for \ref command
RIOT/sys/include/net/ieee802154/radio.h:396: warning: unable to resolve reference to `IEEE802154_TRX_STATE_TRX_OFF' for \ref command
RIOT/sys/include/net/ieee802154/radio.h:426: warning: unable to resolve reference to `IEEE802154_RADIO_CONFIRM_TX_READY' for \ref command
RIOT/sys/include/net/ieee802154/radio.h:427: warning: unable to resolve reference to `IEEE802154_RADIO_CONFIRM_RX_READY' for \ref command
RIOT/sys/include/net/ieee802154/radio.h:428: warning: unable to resolve reference to `IEEE802154_RADIO_CONFIRM_TRX_OFF_READY' for \ref command
RIOT/sys/include/net/ieee802154/radio.h:431: warning: unable to resolve reference to `call' for \ref command
RIOT/sys/include/net/ieee802154/radio.h:292: warning: unable to resolve reference to `ieee802154_radio_ops::transmit' for \ref command
RIOT/sys/include/net/ieee802154/radio.h:296: warning: unable to resolve reference to `IEEE802154_RADIO_CONFIRM_TX_DONE' for \ref command
RIOT/sys/include/net/ieee802154/radio.h:323: warning: unable to resolve reference to `IEEE802154_RADIO_RX_DONE' for \ref command
RIOT/sys/include/net/ieee802154/radio.h:363: warning: unable to resolve reference to `IEEE802154_TRX_STATE_TRX_OFF' for \ref command
RIOT/sys/include/net/ieee802154/radio.h:278: warning: unable to resolve reference to `IEEE802154_TRX_STATE_TX_ON' for \ref command
sys/include/net/ieee802154/radio.h
Outdated
*/ | ||
typedef enum { | ||
/** | ||
* @brief transmission uses Auto CCA or frame retransmissions with CSMA-CA |
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.
Mention that compiling firmware with both features enabled would not make sense and explain how to figure out if it is actually CSMA or CCA
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.
this would change anyway with the proposal in #14371 (comment)
* @return 0 on success | ||
* @return negative errno on error | ||
*/ | ||
int (*config_phy)(ieee802154_dev_t *dev, ieee802154_phy_conf_t *conf); |
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.
Would misconfiguration of conf->pow
lead to an error? If set to 1000dBm, should the device set the maximum transmission power or return an error? For channel and page it is quite clear that errors should be reported.
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 say an error should be reported.
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.
See e941563
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.
Should we also be able to configure channel spacing, center frequency, chip rate etc here?
A solution could be to extend ieee802154_phy_conf_t
like so
typedef struct {
ieee802154_phy_conf_t base;
uint8_t rate;
uint8_t chips;
…
} ieee802154_mr_oqpsk_phy_conf_t;
without having to change the API.
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.
exactly! That's why I added in the beginning an ieee802154_phy_config_t
struct, to add members without breaking the API. But never thought about extending it, so that would be really nice!
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.
What's a MIB?
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.
Th MAC Information Base, the list of variables that keep track of the MAC state.
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.
Does this yet exist?
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.
hmmm we have traces of it in the netdev_ieee802154_t
struct (channel, page, etc).
But the idea is that this should be handled by the upper layer anyway.
what do you think?
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.
Yea we'll need a place to manage channel spacing, center frequency, allowed channels, rates, etc. based on region anyway.
The drivers shouldn't need to worry which part of the world they are used in but just receive configuration parameters to comply with the local regulations from an upper layer that keeps all those gory tables contained in one place (and ideally configurable at compile-time, so we don't need to store the tables for the US, China, etc. in every device - would be nice if that was an option though)
* @brief Confirmation function for @ref ieee802154_radio_ops::request_cca | ||
* | ||
* This function must be called to finish the CCA procedure. This | ||
* function should be called on @ref IEEE802154_RADIO_CONFIRM_CCA, |
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.
Isn't it more that this function waits for IEEE802154_RADIO_CONFIRM_CCA
to be called which unlocks the mutex that was locked after the CCA request?
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, right
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.
Wait, I think I misread here. Adding a mutex is a use case specific thing. The IEEE802154_RADIO_CONFIRM_CCA
event doesn't necessarily unlock a mutex.
sys/include/net/ieee802154/radio.h
Outdated
* NULL if this information is not needed. | ||
* | ||
* @return number of bytes written in @p buffer (0 if @p buf == NULL) | ||
* @return -EINVAL if the CRC is not valid. Frame is dropped immediately. |
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 think this need update after the latest agreements on how to handle CRC.
All in all I'm fine with the API (besides minor change requests). I would like to focus on testing the PoC in #14655 to prove the API is acting as expexted. As indicated there, a rudimentary "test specification" would be nice. |
Uncrustify did some very weird stuff this time... I re-aranged some parts of the documentation and now looks much better. |
Since there's nothing to test here, should we skip Murdock? |
@maribu @PeterKietzmann do you have more comments? |
We can't, but we can skip compilation :-). |
It's a slow day on Murdock and there are no jobs scheduled, giving it a spin won't hurt to make sure no compiler complains. |
Ok, let's take it for a spin ;-) |
Murdock is super happy :) |
Should this be merged now or do we wait for the three ACKs in #13943 first? Feels weird to merge the API definition before the design document for it is merged. |
I guess since RDMs are somewhat set in stone, the plan is to merge this first and adapt the RDM from experience? |
Yes, that would be ideal. I expect the API to change a bit while it's experimental. When this is more stable, I would adopt the RDM as needed. |
sys/include/net/ieee802154/radio.h
Outdated
* function should return -EINVAL | ||
* | ||
* @pre the device is on | ||
* @post the upper layer calls @ref |
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.
Let's remove this post condition. I think it's always possible to ensure the radio will still be working in the corresponding state after calling this function.
Otherwise it becomes hard for the implementation of some network stacks (e.g the OpenThread contrib would need to keep track of the last state when calling this function).
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.
Yea the operating state should not change by calling this function.
Want to do that last doc update (& squash) so we can merge this? 😉 |
sure! I will :) |
Amended directly. Let's wait for Murdock |
Green :) |
thank you so much for the review @benpicco @PeterKietzmann @maribu @miri64 !!!!! |
Contribution description
This PR introduces the IEEE802.15.4 Radio HAL (described in #13943 ).
As discussed, the idea is to provide a more stable implementation before finishing the RDM.
The API definition comes along with the implementation for CC2538. A test application will be provided soonMoved to #14655Testing procedure
See #14655
Issues/PRs references
#13943