drivers/ieee802154: Implement get_capabilities in existing drivers

Further support will need work per-driver basis, as soon as the L2 will
be able to make usage of such support.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2017-09-04 15:24:36 +02:00 committed by Jukka Rissanen
commit b2726e14a6
6 changed files with 76 additions and 36 deletions

View file

@ -703,6 +703,14 @@ out:
/********************
* Radio device API *
*******************/
static enum ieee802154_hw_caps cc2520_get_capabilities(struct device *dev)
{
/* ToDo: Add support for
* IEEE802154_HW_PROMISC | IEEE802154_HW_FILTER
*/
return IEEE802154_HW_FCS | IEEE802154_HW_2_4_GHZ;
}
static int cc2520_cca(struct device *dev)
{
struct cc2520_context *cc2520 = dev->driver_data;
@ -1097,6 +1105,7 @@ static struct ieee802154_radio_api cc2520_radio_api = {
.iface_api.init = cc2520_iface_init,
.iface_api.send = ieee802154_radio_send,
.get_capabilities = cc2520_get_capabilities,
.cca = cc2520_cca,
.set_channel = cc2520_set_channel,
.set_pan_id = cc2520_set_pan_id,

View file

@ -189,6 +189,11 @@ static inline void kw41z_tmr2_disable(void)
ZLL->PHY_CTRL &= ~ZLL_PHY_CTRL_TMR2CMP_EN_MASK;
}
static enum ieee802154_hw_caps kw41z_get_capabilities(struct device *dev)
{
return IEEE802154_HW_FCS | IEEE802154_HW_2_4_GHZ;
}
static int kw41z_cca(struct device *dev)
{
struct kw41z_context *kw41z = dev->driver_data;
@ -655,6 +660,7 @@ static struct ieee802154_radio_api kw41z_radio_api = {
.iface_api.init = kw41z_iface_init,
.iface_api.send = ieee802154_radio_send,
.get_capabilities = kw41z_get_capabilities,
.cca = kw41z_cca,
.set_channel = kw41z_set_channel,
.set_pan_id = kw41z_set_pan_id,

View file

@ -858,6 +858,11 @@ static int mcr20a_set_cca_mode(struct device *dev, u8_t mode)
return 0;
}
static enum ieee802154_hw_caps mcr20a_get_capabilities(struct device *dev)
{
return IEEE802154_HW_FCS | IEEE802154_HW_2_4_GHZ;
}
/* Note: CCA before TX is enabled by default */
static int mcr20a_cca(struct device *dev)
{
@ -1456,6 +1461,7 @@ static struct ieee802154_radio_api mcr20a_radio_api = {
.iface_api.init = mcr20a_iface_init,
.iface_api.send = ieee802154_radio_send,
.get_capabilities = mcr20a_get_capabilities,
.cca = mcr20a_cca,
.set_channel = mcr20a_set_channel,
.set_pan_id = mcr20a_set_pan_id,

View file

@ -140,6 +140,12 @@ out:
/* Radio device API */
static enum ieee802154_hw_caps nrf5_get_capabilities(struct device *dev)
{
return IEEE802154_HW_FCS | IEEE802154_HW_2_4_GHZ;
}
static int nrf5_cca(struct device *dev)
{
struct nrf5_802154_data *nrf5_radio = NRF5_802154_DATA(dev);
@ -396,6 +402,7 @@ static struct ieee802154_radio_api nrf5_radio_api = {
.iface_api.init = nrf5_iface_init,
.iface_api.send = ieee802154_radio_send,
.get_capabilities = nrf5_get_capabilities,
.cca = nrf5_cca,
.set_channel = nrf5_set_channel,
.set_pan_id = nrf5_set_pan_id,

View file

@ -96,6 +96,11 @@ done:
return buf;
}
static enum ieee802154_hw_caps upipe_get_capabilities(struct device *dev)
{
return IEEE802154_HW_FCS | IEEE802154_HW_2_4_GHZ;
}
static int upipe_cca(struct device *dev)
{
struct upipe_context *upipe = dev->driver_data;
@ -271,6 +276,7 @@ static struct ieee802154_radio_api upipe_radio_api = {
.iface_api.init = upipe_iface_init,
.iface_api.send = ieee802154_radio_send,
.get_capabilities = upipe_get_capabilities,
.cca = upipe_cca,
.set_channel = upipe_set_channel,
.set_pan_id = upipe_set_pan_id,

View file

@ -19,6 +19,11 @@
extern struct net_pkt *current_pkt;
extern struct k_sem driver_lock;
static enum ieee802154_hw_caps fake_get_capabilities(struct device *dev)
{
return IEEE802154_HW_FCS | IEEE802154_HW_2_4_GHZ;
}
static int fake_cca(struct device *dev)
{
return 0;
@ -139,6 +144,7 @@ static struct ieee802154_radio_api fake_radio_api = {
.iface_api.init = fake_iface_init,
.iface_api.send = ieee802154_radio_send,
.get_capabilities = fake_get_capabilities,
.cca = fake_cca,
.set_channel = fake_set_channel,
.set_pan_id = fake_set_pan_id,