Clicker2-STM32: Add logic to register the MRF24J40 radio character device.

This commit is contained in:
Gregory Nutt 2017-03-23 06:58:54 -06:00
parent 22651dcae2
commit 40a8ef3c00
4 changed files with 50 additions and 5 deletions

View file

@ -65,7 +65,12 @@
# error Wireless support requires CONFIG_DRIVERS_WIRELESS
#endif
#if !defined(CONFIG_CLICKER2_STM32_MB1_BEE) && !defined(CONFIG_CLICKER2_STM32_MB2_BEE)
#ifndef CONFIG_IEEE802154_DEV
# error IEEE802.15.4 radio character device required (CONFIG_IEEE802154_DEV)
#endif
#if !defined(CONFIG_CLICKER2_STM32_MB1_BEE) && \
!defined(CONFIG_CLICKER2_STM32_MB2_BEE)
# error Only the Mikroe BEE board is supported
#endif
@ -81,6 +86,8 @@
# endif
#endif
#define RADIO_DEVNAME "/dev/mrf24j40"
/****************************************************************************
* Private Types
****************************************************************************/
@ -239,8 +246,19 @@ static int stm32_mrf24j40_devsetup(FAR struct stm32_priv_s *priv)
return -ENODEV;
}
/* Now.. do what with the MRF24J40 instance? */
#warning Missing logic
#ifdef CONFIG_IEEE802154_DEV
/* Register a character driver to access the IEEE 802.15.4 radio from
* user-space
*/
ret = radio802154dev_register(radio, RADIO_DEVNAME);
if (ret < 0)
{
wlerr("ERROR: Failed to register the radio device %s: %d\n",
RADIO_DEVNAME, ret);
return ret;
}
#endif
return OK;
}

View file

@ -91,8 +91,9 @@ extern "C"
*
****************************************************************************/
FAR struct ieee802154_radio_s *at86rf23x_init(FAR struct spi_dev_s *spi,
FAR const struct at86rf23x_lower_s *lower);
FAR struct ieee802154_radio_s *
at86rf23x_init(FAR struct spi_dev_s *spi,
FAR const struct at86rf23x_lower_s *lower);
#undef EXTERN
#ifdef __cplusplus

View file

@ -170,6 +170,28 @@ extern "C"
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: radio802154dev_register
*
* Description:
* Register a character driver to access the IEEE 802.15.4 radio from
* user-space
*
* Input Parameters:
* radio - Pointer to the radio struct to be registerd.
* devname - The name of the IEEE 802.15.4 radio to be registered.
*
* Returned Values:
* Zero (OK) is returned on success. Otherwise a negated errno value is
* returned to indicate the nature of the failure.
*
****************************************************************************/
#ifdef CONFIG_IEEE802154_DEV
int radio802154dev_register(FAR struct ieee802154_radio_s *radio,
FAR char *devname);
#endif
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -466,6 +466,10 @@ static int radio802154dev_ioctl(FAR struct file *filep, int cmd,
return ret;
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: radio802154dev_register
*