From e6e353c06544268cb4b6653eab132ac139edc92b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 21 Apr 2017 10:58:48 -0600 Subject: [PATCH] wireless/ieee802154: Beginning of support for IEEE 802.15.4 MAC library. --- include/wireless/ieee802154.h | 59 ++++++++++++++++ wireless/ieee802154/libmac/Kconfig | 11 +++ wireless/ieee802154/libmac/Make.defs | 40 +++++++++++ wireless/ieee802154/libmac/Makefile | 101 +++++++++++++++++++++++++++ wireless/iwpan/Kconfig | 1 + 5 files changed, 212 insertions(+) create mode 100644 wireless/ieee802154/libmac/Kconfig create mode 100644 wireless/ieee802154/libmac/Make.defs create mode 100644 wireless/ieee802154/libmac/Makefile diff --git a/include/wireless/ieee802154.h b/include/wireless/ieee802154.h index dec34c6c8..705ab3559 100644 --- a/include/wireless/ieee802154.h +++ b/include/wireless/ieee802154.h @@ -120,6 +120,65 @@ int sixlowpan_energydetect(int sock, FAR const char *ifname, #endif /* libmac *******************************************************************/ +/* Character driver IOCTL helpers */ + +int ieee802154_assoc_req(int fd, FAR struct ieee802154_assoc_req_s *req); +int ieee802154_desassoc_req(int fd, + FAR struct ieee802154_disassoc_req_s *req); +int ieee802154_get_req(int fd, FAR struct ieee802154_get_req_s *req); +int ieee802154_gts_req(int fd, FAR struct ieee802154_gts_req_s *req); +int ieee802154_orphan_resp(int fd, + FAR struct ieee802154_orphan_resp_s *resp); +int ieee802154_rxenable_req(int fd, + FAR struct ieee802154_rxenable_req_s *req); +int ieee802154_scan_req(int fd, FAR struct ieee802154_scan_req_s *req); +int ieee802154_set_req(int fd, FAR struct ieee802154_set_req_s *req); +int ieee802154_start_req(int fd, FAR struct ieee802154_start_req_s *req); +int ieee802154_sync_req(int fd, FAR struct ieee802154_sync_req_s *req); +int ieee802154_poll_req(int fd, FAR struct ieee802154_poll_req_s *req); +#if 0 +int ieee802154_dps_req(int fd, FAR struct ieee802154_dps_req_s *req); +int ieee802154_sounding_req(int fd, + FAR struct ieee802154_sounding_req_s *req); +int ieee802154_calibrate_req(int fd, + FAR struct ieee802154_calibrate_req_s *req); +#endif + +#ifdef CONFIG_NET_6LOWPAN +/* Netork driver IOCTL helpers */ + +int sixlowpan_assoc_req(int sock, FAR const char *ifname, + FAR struct ieee802154_assoc_req_s *req); +int sixlowpan_desassoc_req(int sock, FAR const char *ifname, + FAR struct ieee802154_disassoc_req_s *req); +int sixlowpan_get_req(int sock, FAR const char *ifname, + FAR struct ieee802154_get_req_s *req); +int sixlowpan_gts_req(int sock, FAR const char *ifname, + FAR struct ieee802154_gts_req_s *req); +int sixlowpan_orphan_resp(int sock, FAR const char *ifname, + FAR struct ieee802154_orphan_resp_s *resp); +int sixlowpan_rxenable_req(int sock, FAR const char *ifname, + FAR struct ieee802154_rxenable_req_s *req); +int sixlowpan_scan_req(int sock, FAR const char *ifname, + FAR struct ieee802154_scan_req_s *req); +int sixlowpan_set_req(int sock, FAR const char *ifname, + FAR struct ieee802154_set_req_s *req); +int sixlowpan_start_req(int sock, FAR const char *ifname, + FAR struct ieee802154_start_req_s *req); +int sixlowpan_sync_req(int sock, FAR const char *ifname, + FAR struct ieee802154_sync_req_s *req); +int sixlowpan_poll_req(int sock, FAR const char *ifname, + FAR struct ieee802154_poll_req_s *req); +#if 0 +int sixlowpan_dps_req(int sock, FAR const char *ifname, + FAR struct ieee802154_dps_req_s *req); +int sixlowpan_sounding_req(int sock, FAR const char *ifname, + FAR struct ieee802154_sounding_req_s *req); +int sixlowpan_calibrate_req(int sock, FAR const char *ifname, + FAR struct ieee802154_calibrate_req_s *req); +#endif + +#endif /* libutils *****************************************************************/ diff --git a/wireless/ieee802154/libmac/Kconfig b/wireless/ieee802154/libmac/Kconfig new file mode 100644 index 000000000..5cffa639d --- /dev/null +++ b/wireless/ieee802154/libmac/Kconfig @@ -0,0 +1,11 @@ +# +# For a description of the syntax of this configuration file, +# see misc/tools/kconfig-language.txt. +# + +config IEEE802154_LIBMAC + bool "IEEE 802.15.4 MAC library routines" + default n + ---help--- + Some MAC library routines for ieee 802.15.4 apps + diff --git a/wireless/ieee802154/libmac/Make.defs b/wireless/ieee802154/libmac/Make.defs new file mode 100644 index 000000000..06201a756 --- /dev/null +++ b/wireless/ieee802154/libmac/Make.defs @@ -0,0 +1,40 @@ +############################################################################ +# apps/wireless/ieee802154/libradio/Make.defs +# Adds selected applications to apps/ build +# +# Copyright (C) 2016-17 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +ifeq ($(CONFIG_IEEE802154_LIBMAC),y) +CONFIGURED_APPS += wireless/ieee802154/libmac +endif + diff --git a/wireless/ieee802154/libmac/Makefile b/wireless/ieee802154/libmac/Makefile new file mode 100644 index 000000000..352e58398 --- /dev/null +++ b/wireless/ieee802154/libmac/Makefile @@ -0,0 +1,101 @@ +############################################################################ +# apps/wireless/ieee802154/libmac/Makefile +# +# Copyright (C) 2017 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# libmac source files + +ASRCS = +CSRCS = + +ifeq ($(CONFIG_NET_6LOWPAN),y) +endif + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\..\libapps$(LIBEXT) +else +ifeq ($(WINTOOL),y) + BIN = ..\\..\\..\\libapps$(LIBEXT) +else + BIN = ../../../libapps$(LIBEXT) +endif +endif + +ROOTDEPPATH = --dep-path . +VPATH = + +# Build targets + +all: .built +.PHONY: context .depend depend clean distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + $(call ARCHIVE, $(BIN), $(OBJS)) + @touch .built + +install: + +context: + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + $(call DELFILE, .built) + $(call CLEAN) + +distclean: clean + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) + +-include Make.dep + diff --git a/wireless/iwpan/Kconfig b/wireless/iwpan/Kconfig index 8a9425ca9..d06eddb20 100644 --- a/wireless/iwpan/Kconfig +++ b/wireless/iwpan/Kconfig @@ -7,6 +7,7 @@ menuconfig WIRELESS_IWPAN bool "IEEE 802.15.4 Command Line Tool" default n depends on NET && DRIVERS_WIRELESS + select IEEE802154_LIBMAC select IEEE802154_LIBRADIO select IEEE802154_LIBUTILS ---help---