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:
parent
9c4605583e
commit
b2726e14a6
6 changed files with 76 additions and 36 deletions
|
@ -703,6 +703,14 @@ out:
|
||||||
/********************
|
/********************
|
||||||
* Radio device API *
|
* 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)
|
static int cc2520_cca(struct device *dev)
|
||||||
{
|
{
|
||||||
struct cc2520_context *cc2520 = dev->driver_data;
|
struct cc2520_context *cc2520 = dev->driver_data;
|
||||||
|
@ -1097,15 +1105,16 @@ static struct ieee802154_radio_api cc2520_radio_api = {
|
||||||
.iface_api.init = cc2520_iface_init,
|
.iface_api.init = cc2520_iface_init,
|
||||||
.iface_api.send = ieee802154_radio_send,
|
.iface_api.send = ieee802154_radio_send,
|
||||||
|
|
||||||
.cca = cc2520_cca,
|
.get_capabilities = cc2520_get_capabilities,
|
||||||
.set_channel = cc2520_set_channel,
|
.cca = cc2520_cca,
|
||||||
.set_pan_id = cc2520_set_pan_id,
|
.set_channel = cc2520_set_channel,
|
||||||
.set_short_addr = cc2520_set_short_addr,
|
.set_pan_id = cc2520_set_pan_id,
|
||||||
.set_ieee_addr = cc2520_set_ieee_addr,
|
.set_short_addr = cc2520_set_short_addr,
|
||||||
.set_txpower = cc2520_set_txpower,
|
.set_ieee_addr = cc2520_set_ieee_addr,
|
||||||
.start = cc2520_start,
|
.set_txpower = cc2520_set_txpower,
|
||||||
.stop = cc2520_stop,
|
.start = cc2520_start,
|
||||||
.tx = cc2520_tx,
|
.stop = cc2520_stop,
|
||||||
|
.tx = cc2520_tx,
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(CONFIG_IEEE802154_CC2520_RAW)
|
#if defined(CONFIG_IEEE802154_CC2520_RAW)
|
||||||
|
|
|
@ -189,6 +189,11 @@ static inline void kw41z_tmr2_disable(void)
|
||||||
ZLL->PHY_CTRL &= ~ZLL_PHY_CTRL_TMR2CMP_EN_MASK;
|
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)
|
static int kw41z_cca(struct device *dev)
|
||||||
{
|
{
|
||||||
struct kw41z_context *kw41z = dev->driver_data;
|
struct kw41z_context *kw41z = dev->driver_data;
|
||||||
|
@ -655,15 +660,16 @@ static struct ieee802154_radio_api kw41z_radio_api = {
|
||||||
.iface_api.init = kw41z_iface_init,
|
.iface_api.init = kw41z_iface_init,
|
||||||
.iface_api.send = ieee802154_radio_send,
|
.iface_api.send = ieee802154_radio_send,
|
||||||
|
|
||||||
.cca = kw41z_cca,
|
.get_capabilities = kw41z_get_capabilities,
|
||||||
.set_channel = kw41z_set_channel,
|
.cca = kw41z_cca,
|
||||||
.set_pan_id = kw41z_set_pan_id,
|
.set_channel = kw41z_set_channel,
|
||||||
.set_short_addr = kw41z_set_short_addr,
|
.set_pan_id = kw41z_set_pan_id,
|
||||||
.set_ieee_addr = kw41z_set_ieee_addr,
|
.set_short_addr = kw41z_set_short_addr,
|
||||||
.set_txpower = kw41z_set_txpower,
|
.set_ieee_addr = kw41z_set_ieee_addr,
|
||||||
.start = kw41z_start,
|
.set_txpower = kw41z_set_txpower,
|
||||||
.stop = kw41z_stop,
|
.start = kw41z_start,
|
||||||
.tx = kw41z_tx,
|
.stop = kw41z_stop,
|
||||||
|
.tx = kw41z_tx,
|
||||||
};
|
};
|
||||||
|
|
||||||
NET_DEVICE_INIT(kw41z, CONFIG_IEEE802154_KW41Z_DRV_NAME,
|
NET_DEVICE_INIT(kw41z, CONFIG_IEEE802154_KW41Z_DRV_NAME,
|
||||||
|
|
|
@ -858,6 +858,11 @@ static int mcr20a_set_cca_mode(struct device *dev, u8_t mode)
|
||||||
return 0;
|
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 */
|
/* Note: CCA before TX is enabled by default */
|
||||||
static int mcr20a_cca(struct device *dev)
|
static int mcr20a_cca(struct device *dev)
|
||||||
{
|
{
|
||||||
|
@ -1456,15 +1461,16 @@ static struct ieee802154_radio_api mcr20a_radio_api = {
|
||||||
.iface_api.init = mcr20a_iface_init,
|
.iface_api.init = mcr20a_iface_init,
|
||||||
.iface_api.send = ieee802154_radio_send,
|
.iface_api.send = ieee802154_radio_send,
|
||||||
|
|
||||||
.cca = mcr20a_cca,
|
.get_capabilities = mcr20a_get_capabilities,
|
||||||
.set_channel = mcr20a_set_channel,
|
.cca = mcr20a_cca,
|
||||||
.set_pan_id = mcr20a_set_pan_id,
|
.set_channel = mcr20a_set_channel,
|
||||||
.set_short_addr = mcr20a_set_short_addr,
|
.set_pan_id = mcr20a_set_pan_id,
|
||||||
.set_ieee_addr = mcr20a_set_ieee_addr,
|
.set_short_addr = mcr20a_set_short_addr,
|
||||||
.set_txpower = mcr20a_set_txpower,
|
.set_ieee_addr = mcr20a_set_ieee_addr,
|
||||||
.start = mcr20a_start,
|
.set_txpower = mcr20a_set_txpower,
|
||||||
.stop = mcr20a_stop,
|
.start = mcr20a_start,
|
||||||
.tx = mcr20a_tx,
|
.stop = mcr20a_stop,
|
||||||
|
.tx = mcr20a_tx,
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(CONFIG_IEEE802154_MCR20A_RAW)
|
#if defined(CONFIG_IEEE802154_MCR20A_RAW)
|
||||||
|
|
|
@ -140,6 +140,12 @@ out:
|
||||||
|
|
||||||
/* Radio device API */
|
/* 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)
|
static int nrf5_cca(struct device *dev)
|
||||||
{
|
{
|
||||||
struct nrf5_802154_data *nrf5_radio = NRF5_802154_DATA(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.init = nrf5_iface_init,
|
||||||
.iface_api.send = ieee802154_radio_send,
|
.iface_api.send = ieee802154_radio_send,
|
||||||
|
|
||||||
|
.get_capabilities = nrf5_get_capabilities,
|
||||||
.cca = nrf5_cca,
|
.cca = nrf5_cca,
|
||||||
.set_channel = nrf5_set_channel,
|
.set_channel = nrf5_set_channel,
|
||||||
.set_pan_id = nrf5_set_pan_id,
|
.set_pan_id = nrf5_set_pan_id,
|
||||||
|
|
|
@ -96,6 +96,11 @@ done:
|
||||||
return buf;
|
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)
|
static int upipe_cca(struct device *dev)
|
||||||
{
|
{
|
||||||
struct upipe_context *upipe = dev->driver_data;
|
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.init = upipe_iface_init,
|
||||||
.iface_api.send = ieee802154_radio_send,
|
.iface_api.send = ieee802154_radio_send,
|
||||||
|
|
||||||
|
.get_capabilities = upipe_get_capabilities,
|
||||||
.cca = upipe_cca,
|
.cca = upipe_cca,
|
||||||
.set_channel = upipe_set_channel,
|
.set_channel = upipe_set_channel,
|
||||||
.set_pan_id = upipe_set_pan_id,
|
.set_pan_id = upipe_set_pan_id,
|
||||||
|
|
|
@ -19,6 +19,11 @@
|
||||||
extern struct net_pkt *current_pkt;
|
extern struct net_pkt *current_pkt;
|
||||||
extern struct k_sem driver_lock;
|
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)
|
static int fake_cca(struct device *dev)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -139,15 +144,16 @@ static struct ieee802154_radio_api fake_radio_api = {
|
||||||
.iface_api.init = fake_iface_init,
|
.iface_api.init = fake_iface_init,
|
||||||
.iface_api.send = ieee802154_radio_send,
|
.iface_api.send = ieee802154_radio_send,
|
||||||
|
|
||||||
.cca = fake_cca,
|
.get_capabilities = fake_get_capabilities,
|
||||||
.set_channel = fake_set_channel,
|
.cca = fake_cca,
|
||||||
.set_pan_id = fake_set_pan_id,
|
.set_channel = fake_set_channel,
|
||||||
.set_short_addr = fake_set_short_addr,
|
.set_pan_id = fake_set_pan_id,
|
||||||
.set_ieee_addr = fake_set_ieee_addr,
|
.set_short_addr = fake_set_short_addr,
|
||||||
.set_txpower = fake_set_txpower,
|
.set_ieee_addr = fake_set_ieee_addr,
|
||||||
.start = fake_start,
|
.set_txpower = fake_set_txpower,
|
||||||
.stop = fake_stop,
|
.start = fake_start,
|
||||||
.tx = fake_tx,
|
.stop = fake_stop,
|
||||||
|
.tx = fake_tx,
|
||||||
};
|
};
|
||||||
|
|
||||||
NET_DEVICE_INIT(fake, "fake_ieee802154",
|
NET_DEVICE_INIT(fake, "fake_ieee802154",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue