wireless/ieee802154: Adds MAC character driver structure. Nonfunctional

This commit is contained in:
Anthony Merlino
2017-03-29 12:51:01 -04:00
parent 4836534894
commit 8df78cc74b
5 changed files with 565 additions and 30 deletions
@@ -724,35 +724,52 @@ extern "C"
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: mac802154_register * Name: mac802154_create
* *
* Description: * Description:
* Create a 802.15.4 MAC device from a 802.15.4 compatible radio device. * Create a 802.15.4 MAC device from a 802.15.4 compatible radio device.
* To create a 802.15.4 MAC, you need to pass:
* *
* - an instance of a radio driver in radiodev * The returned MAC structure should be passed to either the next highest
* - a pointer to a structure that contains MAC callback routines to * layer in the network stack, or registered with a mac802154dev character
* handle confirmations and indications. NULL entries indicate no * driver. In either of these scenarios, the next highest layer should
* callback. * register a set of callbacks with the MAC layer by setting the mac->cbs
* member.
* *
* In return you get a mac structure that has pointers to MAC operations * NOTE: This API does not create any device accessible to userspace. If you
* and responses.
*
* This API does not create any device accessible to userspace. If you
* want to call these APIs from userspace, you have to wrap your mac in a * want to call these APIs from userspace, you have to wrap your mac in a
* character device via mac802154_device.c. * character device via mac802154_device.c.
* *
* Input Parameters:
* radiodev - an instance of an IEEE 802.15.4 radio
*
* Returned Value:
* A MAC structure that has pointers to MAC operations
* and responses.
*
****************************************************************************/ ****************************************************************************/
#if 0 /* REVISIT: This form is not currently used by the driver */
FAR struct ieee802154_mac_s * FAR struct ieee802154_mac_s *
mac802154_register(FAR struct ieee802154_radio_s *radiodev, mac802154_create(FAR struct ieee802154_radio_s *radiodev);
FAR struct ieee802154_maccb_s *callbacks);
#else /* This is the form used by the driver */ /****************************************************************************
FAR struct ieee802154_mac_s * * Name: mac802154dev_register
mac802154_register(FAR struct ieee802154_radio_s *radiodev, *
unsigned int minor); * Description:
#endif * Register a character driver to access the IEEE 802.15.4 MAC layer from
* user-space
*
* Input Parameters:
* mac - Pointer to the mac layer struct to be registerd.
* minor - The device minor number. The IEEE802.15.4 MAC character device
* will be registered as /dev/ieeeN where N is the minor number
*
* Returned Values:
* Zero (OK) is returned on success. Otherwise a negated errno value is
* returned to indicate the nature of the failure.
*
****************************************************************************/
int mac802154dev_register(FAR struct ieee802154_mac_s *mac, int minor);
#undef EXTERN #undef EXTERN
#ifdef __cplusplus #ifdef __cplusplus
+8
View File
@@ -21,6 +21,14 @@ config IEEE802154_MAC
such as 6lowpan. It is not required to use 802.15.4 radios, such as 6lowpan. It is not required to use 802.15.4 radios,
but is strongly suggested to ensure exchange of valid frames. but is strongly suggested to ensure exchange of valid frames.
config IEEE802154_MAC_DEV
bool "Character driver for IEEE 802.15.4 MAC layer"
default n
depends on IEEE802154_MAC
---help---
Enable the device driver to expose the IEEE 802.15.4 MAC layer
access to user space as IOCTLs
config IEEE802154_DEV config IEEE802154_DEV
bool "Debug character driver for ieee802.15.4 radio interfaces" bool "Debug character driver for ieee802.15.4 radio interfaces"
default n default n
+4
View File
@@ -45,6 +45,10 @@ ifeq ($(CONFIG_IEEE802154_MAC),y)
CSRCS += mac802154.c CSRCS += mac802154.c
endif endif
ifeq ($(CONFIG_IEEE802154_MAC_DEV),y)
CSRCS += mac802154_device.c
endif
ifeq ($(CONFIG_IEEE802154_DEV),y) ifeq ($(CONFIG_IEEE802154_DEV),y)
CSRCS += radio802154_device.c CSRCS += radio802154_device.c
endif endif
+15 -12
View File
@@ -506,29 +506,32 @@ static int mac802154_rsporphan(FAR struct ieee802154_mac_s *mac,
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: mac802154_register * Name: mac802154_create
* *
* Description: * Description:
* Create a 802.15.4 MAC device from a 802.15.4 compatible radio device. * Create a 802.15.4 MAC device from a 802.15.4 compatible radio device.
* To create a 802.15.4 MAC, you need to pass:
* *
* - an instance of a radio driver in radiodev * The returned MAC structure should be passed to either the next highest
* - a pointer to a structure that contains MAC callback routines to * layer in the network stack, or registered with a mac802154dev character
* handle confirmations and indications. NULL entries indicate no * driver. In either of these scenarios, the next highest layer should
* callback. * register a set of callbacks with the MAC layer by setting the mac->cbs
* member.
* *
* In return you get a mac structure that has pointers to MAC operations * NOTE: This API does not create any device accessible to userspace. If you
* and responses.
*
* This API does not create any device accessible to userspace. If you
* want to call these APIs from userspace, you have to wrap your mac in a * want to call these APIs from userspace, you have to wrap your mac in a
* character device via mac802154_device.c. * character device via mac802154_device.c.
* *
* Input Parameters:
* radiodev - an instance of an IEEE 802.15.4 radio
*
* Returned Value:
* A MAC structure that has pointers to MAC operations
* and responses.
*
****************************************************************************/ ****************************************************************************/
FAR struct ieee802154_mac_s * FAR struct ieee802154_mac_s *
mac802154_register(FAR struct ieee802154_radio_s *radiodev, mac802154_create(FAR struct ieee802154_radio_s *radiodev)
unsigned int minor)
{ {
FAR struct ieee802154_privmac_s *mac; FAR struct ieee802154_privmac_s *mac;
File diff suppressed because it is too large Load Diff