drivers/ieee802154: Stop exposing old radio API functions

set_ieee_addr, set_short_addr and set_pan_id are now unused by L2, so
removing their exposure through the radio API.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2017-09-05 14:20:35 +02:00 committed by Jukka Rissanen
parent 4f0b25bef1
commit ea0aee2bb3
6 changed files with 51 additions and 125 deletions

View file

@ -309,6 +309,54 @@ static inline u8_t *get_mac(struct device *dev)
return cc2520->mac_addr;
}
static int _cc2520_set_pan_id(struct device *dev, u16_t pan_id)
{
struct cc2520_context *cc2520 = dev->driver_data;
SYS_LOG_DBG("0x%x", pan_id);
pan_id = sys_le16_to_cpu(pan_id);
if (!write_mem_pan_id(&cc2520->spi, (u8_t *) &pan_id)) {
SYS_LOG_ERR("Failed");
return -EIO;
}
return 0;
}
static int _cc2520_set_short_addr(struct device *dev, u16_t short_addr)
{
struct cc2520_context *cc2520 = dev->driver_data;
SYS_LOG_DBG("0x%x", short_addr);
short_addr = sys_le16_to_cpu(short_addr);
if (!write_mem_short_addr(&cc2520->spi, (u8_t *) &short_addr)) {
SYS_LOG_ERR("Failed");
return -EIO;
}
return 0;
}
static int _cc2520_set_ieee_addr(struct device *dev, const u8_t *ieee_addr)
{
struct cc2520_context *cc2520 = dev->driver_data;
if (!write_mem_ext_addr(&cc2520->spi, (void *)ieee_addr)) {
SYS_LOG_ERR("Failed");
return -EIO;
}
SYS_LOG_DBG("IEEE address %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
ieee_addr[7], ieee_addr[6], ieee_addr[5], ieee_addr[4],
ieee_addr[3], ieee_addr[2], ieee_addr[1], ieee_addr[0]);
return 0;
}
/******************
* GPIO functions *
*****************/
@ -744,54 +792,6 @@ static int cc2520_set_channel(struct device *dev, u16_t channel)
return 0;
}
static int cc2520_set_pan_id(struct device *dev, u16_t pan_id)
{
struct cc2520_context *cc2520 = dev->driver_data;
SYS_LOG_DBG("0x%x", pan_id);
pan_id = sys_le16_to_cpu(pan_id);
if (!write_mem_pan_id(&cc2520->spi, (u8_t *) &pan_id)) {
SYS_LOG_ERR("Failed");
return -EIO;
}
return 0;
}
static int cc2520_set_short_addr(struct device *dev, u16_t short_addr)
{
struct cc2520_context *cc2520 = dev->driver_data;
SYS_LOG_DBG("0x%x", short_addr);
short_addr = sys_le16_to_cpu(short_addr);
if (!write_mem_short_addr(&cc2520->spi, (u8_t *) &short_addr)) {
SYS_LOG_ERR("Failed");
return -EIO;
}
return 0;
}
static int cc2520_set_ieee_addr(struct device *dev, const u8_t *ieee_addr)
{
struct cc2520_context *cc2520 = dev->driver_data;
if (!write_mem_ext_addr(&cc2520->spi, (void *)ieee_addr)) {
SYS_LOG_ERR("Failed");
return -EIO;
}
SYS_LOG_DBG("IEEE address %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
ieee_addr[7], ieee_addr[6], ieee_addr[5], ieee_addr[4],
ieee_addr[3], ieee_addr[2], ieee_addr[1], ieee_addr[0]);
return 0;
}
static int cc2520_set_filter(struct device *dev,
enum ieee802154_filter_type type,
const struct ieee802154_filter *filter)
@ -799,11 +799,11 @@ static int cc2520_set_filter(struct device *dev,
SYS_LOG_DBG("Applying filter %u", type);
if (type == IEEE802154_FILTER_TYPE_IEEE_ADDR) {
return cc2520_set_ieee_addr(dev, filter->ieee_addr);
return _cc2520_set_ieee_addr(dev, filter->ieee_addr);
} else if (type == IEEE802154_FILTER_TYPE_SHORT_ADDR) {
return cc2520_set_short_addr(dev, filter->short_addr);
return _cc2520_set_short_addr(dev, filter->short_addr);
} else if (type == IEEE802154_FILTER_TYPE_PAN_ID) {
return cc2520_set_pan_id(dev, filter->pan_id);
return _cc2520_set_pan_id(dev, filter->pan_id);
}
return -EINVAL;
@ -1126,9 +1126,6 @@ static struct ieee802154_radio_api cc2520_radio_api = {
.cca = cc2520_cca,
.set_channel = cc2520_set_channel,
.set_filter = cc2520_set_filter,
.set_pan_id = cc2520_set_pan_id,
.set_short_addr = cc2520_set_short_addr,
.set_ieee_addr = cc2520_set_ieee_addr,
.set_txpower = cc2520_set_txpower,
.start = cc2520_start,
.stop = cc2520_stop,

View file

@ -683,9 +683,6 @@ static struct ieee802154_radio_api kw41z_radio_api = {
.cca = kw41z_cca,
.set_channel = kw41z_set_channel,
.set_filter = kw41z_set_filter,
.set_pan_id = kw41z_set_pan_id,
.set_short_addr = kw41z_set_short_addr,
.set_ieee_addr = kw41z_set_ieee_addr,
.set_txpower = kw41z_set_txpower,
.start = kw41z_start,
.stop = kw41z_stop,

View file

@ -1484,9 +1484,6 @@ static struct ieee802154_radio_api mcr20a_radio_api = {
.cca = mcr20a_cca,
.set_channel = mcr20a_set_channel,
.set_filter = mcr20a_set_filter,
.set_pan_id = mcr20a_set_pan_id,
.set_short_addr = mcr20a_set_short_addr,
.set_ieee_addr = mcr20a_set_ieee_addr,
.set_txpower = mcr20a_set_txpower,
.start = mcr20a_start,
.stop = mcr20a_stop,

View file

@ -425,9 +425,6 @@ static struct ieee802154_radio_api nrf5_radio_api = {
.cca = nrf5_cca,
.set_channel = nrf5_set_channel,
.set_filter = nrf5_set_filter,
.set_pan_id = nrf5_set_pan_id,
.set_short_addr = nrf5_set_short_addr,
.set_ieee_addr = nrf5_set_ieee_addr,
.set_txpower = nrf5_set_txpower,
.start = nrf5_start,
.stop = nrf5_stop,

View file

@ -123,39 +123,6 @@ static int upipe_set_channel(struct device *dev, u16_t channel)
return 0;
}
static int upipe_set_pan_id(struct device *dev, u16_t pan_id)
{
struct upipe_context *upipe = dev->driver_data;
if (upipe->stopped) {
return -EIO;
}
return 0;
}
static int upipe_set_short_addr(struct device *dev, u16_t short_addr)
{
struct upipe_context *upipe = dev->driver_data;
if (upipe->stopped) {
return -EIO;
}
return 0;
}
static int upipe_set_ieee_addr(struct device *dev, const u8_t *ieee_addr)
{
struct upipe_context *upipe = dev->driver_data;
if (upipe->stopped) {
return -EIO;
}
return 0;
}
static int upipe_set_txpower(struct device *dev, s16_t dbm)
{
struct upipe_context *upipe = dev->driver_data;
@ -279,9 +246,6 @@ static struct ieee802154_radio_api upipe_radio_api = {
.get_capabilities = upipe_get_capabilities,
.cca = upipe_cca,
.set_channel = upipe_set_channel,
.set_pan_id = upipe_set_pan_id,
.set_short_addr = upipe_set_short_addr,
.set_ieee_addr = upipe_set_ieee_addr,
.set_txpower = upipe_set_txpower,
.tx = upipe_tx,
.start = upipe_start,

View file

@ -36,29 +36,6 @@ static int fake_set_channel(struct device *dev, u16_t channel)
return 0;
}
static int fake_set_pan_id(struct device *dev, u16_t pan_id)
{
NET_INFO("PAN id 0x%x\n", pan_id);
return 0;
}
static int fake_set_short_addr(struct device *dev, u16_t short_addr)
{
NET_INFO("Short address: 0x%x\n", short_addr);
return 0;
}
static int fake_set_ieee_addr(struct device *dev, const u8_t *ieee_addr)
{
NET_INFO("IEEE address %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
ieee_addr[0], ieee_addr[1], ieee_addr[2], ieee_addr[3],
ieee_addr[4], ieee_addr[5], ieee_addr[6], ieee_addr[7]);
return 0;
}
static int fake_set_txpower(struct device *dev, s16_t dbm)
{
NET_INFO("TX power %d dbm\n", dbm);
@ -147,9 +124,6 @@ static struct ieee802154_radio_api fake_radio_api = {
.get_capabilities = fake_get_capabilities,
.cca = fake_cca,
.set_channel = fake_set_channel,
.set_pan_id = fake_set_pan_id,
.set_short_addr = fake_set_short_addr,
.set_ieee_addr = fake_set_ieee_addr,
.set_txpower = fake_set_txpower,
.start = fake_start,
.stop = fake_stop,