-
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
drivers/at86rf2xx: isolate netdev logic #18988
Conversation
19dcb76
to
a544b98
Compare
This PR is technically an API change, because I removed several functions (getters, |
a544b98
to
f34695f
Compare
83f27d0
to
fa61430
Compare
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.
Just moves code around, solid cleanup.
Some small comments:
drivers/at86rf2xx/at86rf2xx_getset.c
Outdated
@@ -363,7 +363,6 @@ void at86rf2xx_set_option(at86rf2xx_t *dev, uint16_t option, bool state) | |||
DEBUG("[at86rf2xx] opt: enabling CSMA mode" \ | |||
"(4 retries, min BE: 3 max BE: 5)\n"); | |||
/* Initialize CSMA seed with hardware address */ |
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.
The comment needs to be moved too
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.
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.
Just squash directly
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.
done!
#ifdef MODULE_SIXLOWPAN | ||
/* https://tools.ietf.org/html/rfc4944#section-12 requires the first bit to | ||
* 0 for unicast addresses */ | ||
dev->netdev.short_addr[0] &= 0x7F; |
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.
netdev_eui64_get()
should already take care of this
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.
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.
Alright, if you are getting rid of this anyway you might as well keep it.
netdev_ieee802154_reset(&dev->netdev); | ||
/* set short and long address */ | ||
at86rf2xx_set_addr_long(dev, (eui64_t *)dev->netdev.long_addr); | ||
at86rf2xx_set_addr_short(dev, (network_uint16_t *)dev->netdev.short_addr); | ||
|
||
if (!IS_ACTIVE(AT86RF2XX_BASIC_MODE)) { | ||
static const netopt_enable_t enable = NETOPT_ENABLE; | ||
netdev_ieee802154_set(&dev->netdev, NETOPT_ACK_REQ, | ||
&enable, sizeof(enable)); | ||
} | ||
at86rf2xx_reset(dev); |
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.
maybe just call _init()
here (btw: is NETOPT_STATE_RESET
even used by anything?)
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.
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.
Well if it goes away anyway no need to bother with it.
a4ca5eb
to
1d60301
Compare
Contribution description
This PR isolates the netdev logic, in order to facilitate the replacement with the Radio HAL interface.
There's still more cleanup to be done, but I think this is the bare minimum to write the Radio HAL port. We can later continue with optimizations.
Testing procedure
AT86RF2xx devices should still work as expected.
Issues/PRs references
#18967