diff --git a/configs/clicker2-stm32/src/stm32_mrf24j40.c b/configs/clicker2-stm32/src/stm32_mrf24j40.c index ef36bc4b3e..99ad2faa06 100644 --- a/configs/clicker2-stm32/src/stm32_mrf24j40.c +++ b/configs/clicker2-stm32/src/stm32_mrf24j40.c @@ -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; } diff --git a/include/nuttx/wireless/ieee802154/at86rf23x.h b/include/nuttx/wireless/ieee802154/at86rf23x.h index b33e58020f..7d6f1fe0ce 100644 --- a/include/nuttx/wireless/ieee802154/at86rf23x.h +++ b/include/nuttx/wireless/ieee802154/at86rf23x.h @@ -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 diff --git a/include/nuttx/wireless/ieee802154/ieee802154_radio.h b/include/nuttx/wireless/ieee802154/ieee802154_radio.h index 7adbbfd7ae..3e64aa5c60 100644 --- a/include/nuttx/wireless/ieee802154/ieee802154_radio.h +++ b/include/nuttx/wireless/ieee802154/ieee802154_radio.h @@ -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 } diff --git a/wireless/ieee802154/radio802154_device.c b/wireless/ieee802154/radio802154_device.c index feb4410465..bdd1e07c81 100644 --- a/wireless/ieee802154/radio802154_device.c +++ b/wireless/ieee802154/radio802154_device.c @@ -466,6 +466,10 @@ static int radio802154dev_ioctl(FAR struct file *filep, int cmd, return ret; } +/**************************************************************************** + * Public Functions + ****************************************************************************/ + /**************************************************************************** * Name: radio802154dev_register *