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
+21 -3
View File
@@ -65,7 +65,12 @@
# error Wireless support requires CONFIG_DRIVERS_WIRELESS # error Wireless support requires CONFIG_DRIVERS_WIRELESS
#endif #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 # error Only the Mikroe BEE board is supported
#endif #endif
@@ -81,6 +86,8 @@
# endif # endif
#endif #endif
#define RADIO_DEVNAME "/dev/mrf24j40"
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/
@@ -239,8 +246,19 @@ static int stm32_mrf24j40_devsetup(FAR struct stm32_priv_s *priv)
return -ENODEV; return -ENODEV;
} }
/* Now.. do what with the MRF24J40 instance? */ #ifdef CONFIG_IEEE802154_DEV
#warning Missing logic /* 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; return OK;
} }
@@ -91,8 +91,9 @@ extern "C"
* *
****************************************************************************/ ****************************************************************************/
FAR struct ieee802154_radio_s *at86rf23x_init(FAR struct spi_dev_s *spi, FAR struct ieee802154_radio_s *
FAR const struct at86rf23x_lower_s *lower); at86rf23x_init(FAR struct spi_dev_s *spi,
FAR const struct at86rf23x_lower_s *lower);
#undef EXTERN #undef EXTERN
#ifdef __cplusplus #ifdef __cplusplus
@@ -170,6 +170,28 @@ extern "C"
* Public Function Prototypes * 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 #undef EXTERN
#ifdef __cplusplus #ifdef __cplusplus
} }
+4
View File
@@ -466,6 +466,10 @@ static int radio802154dev_ioctl(FAR struct file *filep, int cmd,
return ret; return ret;
} }
/****************************************************************************
* Public Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: radio802154dev_register * Name: radio802154dev_register
* *