diff --git a/wireless/ieee802154/libmac/Makefile b/wireless/ieee802154/libmac/Makefile index 58d3d1cb0..b2e3c59ce 100644 --- a/wireless/ieee802154/libmac/Makefile +++ b/wireless/ieee802154/libmac/Makefile @@ -41,9 +41,17 @@ include $(APPDIR)/Make.defs ASRCS = CSRCS = ieee802154_assocreq.c ieee802154_assocresp.c ieee802154_disassocreq.c +CSRCS += ieee802154_getreq.c ieee802154_gtsreq.c ieee802154_orphanresp.c +CSRCS += ieee802154_resetreq.c ieee802154_rxenabreq.c ieee802154_scanreq.c +CSRCS += ieee802154_setreq.c ieee802154_startreq.c ieee802154_syncreq.c +CSRCS += ieee802154_pollreq.c ifeq ($(CONFIG_NET_6LOWPAN),y) CSRCS += sixlowpan_assocreq.c sixlowpan_assocresp.c sixlowpan_disassocreq.c +CSRCS += sixlowpan_getreq.c sixlowpan_gtsreq.c sixlowpan_orphanresp.c +CSRCS += sixlowpan_resetreq.c sixlowpan_rxenabreq.c sixlowpan_scanreq.c +CSRCS += sixlowpan_setreq.c sixlowpan_startreq.c sixlowpan_syncreq.c +CSRCS += sixlowpan_pollreq.c endif AOBJS = $(ASRCS:.S=$(OBJEXT)) diff --git a/wireless/ieee802154/libmac/ieee802154_assocreq.c b/wireless/ieee802154/libmac/ieee802154_assocreq.c index 2d9752846..41648c39f 100644 --- a/wireless/ieee802154/libmac/ieee802154_assocreq.c +++ b/wireless/ieee802154/libmac/ieee802154_assocreq.c @@ -62,7 +62,6 @@ int ieee802154_assoc_req(int fd, FAR struct ieee802154_assoc_req_s *req) { int errcode = errno; printf("MAC802154IOC_MLME_ASSOC_REQUEST failed: %d\n", errcode); - return ret; } return ret; diff --git a/wireless/ieee802154/libmac/ieee802154_assocresp.c b/wireless/ieee802154/libmac/ieee802154_assocresp.c index c7ee4f22d..481a051ae 100644 --- a/wireless/ieee802154/libmac/ieee802154_assocresp.c +++ b/wireless/ieee802154/libmac/ieee802154_assocresp.c @@ -64,7 +64,6 @@ int ieee802154_assoc_resp(int fd, FAR struct ieee802154_assoc_resp_s *resp) { int errcode = errno; printf("MAC802154IOC_MLME_ASSOC_RESPONSE failed: %d\n", errcode); - return ret; } memcpy(resp, &arg.assocresp, sizeof(struct ieee802154_assoc_resp_s)); diff --git a/wireless/ieee802154/libmac/ieee802154_disassocreq.c b/wireless/ieee802154/libmac/ieee802154_disassocreq.c index 1dcd58d57..6fccf7324 100644 --- a/wireless/ieee802154/libmac/ieee802154_disassocreq.c +++ b/wireless/ieee802154/libmac/ieee802154_disassocreq.c @@ -62,7 +62,6 @@ int ieee802154_disassoc_req(int fd, FAR struct ieee802154_disassoc_req_s *req) { int errcode = errno; printf("MAC802154IOC_MLME_DISASSOC_REQUEST failed: %d\n", errcode); - return ret; } return ret; diff --git a/wireless/ieee802154/libmac/ieee802154_getreq.c b/wireless/ieee802154/libmac/ieee802154_getreq.c new file mode 100644 index 000000000..5fb3006c8 --- /dev/null +++ b/wireless/ieee802154/libmac/ieee802154_getreq.c @@ -0,0 +1,68 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/ieee802154_getreq.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int ieee802154_get_req(int fd, FAR struct ieee802154_get_req_s *req) +{ + int ret; + + ret = ioctl(fd, MAC802154IOC_MLME_GET_REQUEST, (unsigned long)((uintptr_t)req)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_GET_REQUEST failed: %d\n", errcode); + } + + return ret; +} diff --git a/wireless/ieee802154/libmac/ieee802154_gtsreq.c b/wireless/ieee802154/libmac/ieee802154_gtsreq.c new file mode 100644 index 000000000..3766b3819 --- /dev/null +++ b/wireless/ieee802154/libmac/ieee802154_gtsreq.c @@ -0,0 +1,68 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/ieee802154_gtsreq.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int ieee802154_gts_req(int fd, FAR struct ieee802154_gts_req_s *req) +{ + int ret; + + ret = ioctl(fd, MAC802154IOC_MLME_GTS_REQUEST, (unsigned long)((uintptr_t)req)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_GTS_REQUEST failed: %d\n", errcode); + } + + return ret; +} diff --git a/wireless/ieee802154/libmac/ieee802154_orphanresp.c b/wireless/ieee802154/libmac/ieee802154_orphanresp.c new file mode 100644 index 000000000..d80cb2252 --- /dev/null +++ b/wireless/ieee802154/libmac/ieee802154_orphanresp.c @@ -0,0 +1,71 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/ieee802154_orphanresp.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int ieee802154_orphan_resp(int fd, FAR struct ieee802154_orphan_resp_s *resp) +{ + union ieee802154_macarg_u arg; + int ret; + + ret = ioctl(fd, MAC802154IOC_MLME_ORPHAN_RESPONSE, (unsigned long)((uintptr_t)&arg)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_ORPHAN_RESPONSE failed: %d\n", errcode); + } + + memcpy(resp, &arg.orphanresp, sizeof(struct ieee802154_orphan_resp_s)); + return ret; +} diff --git a/wireless/ieee802154/libmac/ieee802154_pollreq.c b/wireless/ieee802154/libmac/ieee802154_pollreq.c new file mode 100644 index 000000000..ee87ba78e --- /dev/null +++ b/wireless/ieee802154/libmac/ieee802154_pollreq.c @@ -0,0 +1,68 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/ieee802154_pollreq.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int ieee802154_poll_req(int fd, FAR struct ieee802154_poll_req_s *req) +{ + int ret; + + ret = ioctl(fd, MAC802154IOC_MLME_POLL_REQUEST, (unsigned long)((uintptr_t)req)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_POLL_REQUEST failed: %d\n", errcode); + } + + return ret; +} diff --git a/wireless/ieee802154/libmac/ieee802154_resetreq.c b/wireless/ieee802154/libmac/ieee802154_resetreq.c new file mode 100644 index 000000000..66c2e99e4 --- /dev/null +++ b/wireless/ieee802154/libmac/ieee802154_resetreq.c @@ -0,0 +1,68 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/ieee802154_resetreq.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int ieee802154_reset_req(int fd, FAR struct ieee802154_reset_req_s *req) +{ + int ret; + + ret = ioctl(fd, MAC802154IOC_MLME_RESET_REQUEST, (unsigned long)((uintptr_t)req)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_RESET_REQUEST failed: %d\n", errcode); + } + + return ret; +} diff --git a/wireless/ieee802154/libmac/ieee802154_rxenabreq.c b/wireless/ieee802154/libmac/ieee802154_rxenabreq.c new file mode 100644 index 000000000..a823252bb --- /dev/null +++ b/wireless/ieee802154/libmac/ieee802154_rxenabreq.c @@ -0,0 +1,68 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/ieee802154_rxenabreq.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int ieee802154_rxenable_req(int fd, FAR struct ieee802154_rxenable_req_s *req) +{ + int ret; + + ret = ioctl(fd, MAC802154IOC_MLME_RXENABLE_REQUEST, (unsigned long)((uintptr_t)req)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_RXENABLE_REQUEST failed: %d\n", errcode); + } + + return ret; +} diff --git a/wireless/ieee802154/libmac/ieee802154_scanreq.c b/wireless/ieee802154/libmac/ieee802154_scanreq.c new file mode 100644 index 000000000..1d190f294 --- /dev/null +++ b/wireless/ieee802154/libmac/ieee802154_scanreq.c @@ -0,0 +1,68 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/ieee802154_scanreq.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int ieee802154_scan_req(int fd, FAR struct ieee802154_scan_req_s *req) +{ + int ret; + + ret = ioctl(fd, MAC802154IOC_MLME_SCAN_REQUEST, (unsigned long)((uintptr_t)req)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_SCAN_REQUEST failed: %d\n", errcode); + } + + return ret; +} diff --git a/wireless/ieee802154/libmac/ieee802154_setreq.c b/wireless/ieee802154/libmac/ieee802154_setreq.c new file mode 100644 index 000000000..d7398385e --- /dev/null +++ b/wireless/ieee802154/libmac/ieee802154_setreq.c @@ -0,0 +1,68 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/ieee802154_setreq.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int ieee802154_set_req(int fd, FAR struct ieee802154_set_req_s *req) +{ + int ret; + + ret = ioctl(fd, MAC802154IOC_MLME_SET_REQUEST, (unsigned long)((uintptr_t)req)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_SET_REQUEST failed: %d\n", errcode); + } + + return ret; +} diff --git a/wireless/ieee802154/libmac/ieee802154_startreq.c b/wireless/ieee802154/libmac/ieee802154_startreq.c new file mode 100644 index 000000000..8ca5121bc --- /dev/null +++ b/wireless/ieee802154/libmac/ieee802154_startreq.c @@ -0,0 +1,68 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/ieee802154_startreq.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int ieee802154_start_req(int fd, FAR struct ieee802154_start_req_s *req) +{ + int ret; + + ret = ioctl(fd, MAC802154IOC_MLME_START_REQUEST, (unsigned long)((uintptr_t)req)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_START_REQUEST failed: %d\n", errcode); + } + + return ret; +} diff --git a/wireless/ieee802154/libmac/ieee802154_syncreq.c b/wireless/ieee802154/libmac/ieee802154_syncreq.c new file mode 100644 index 000000000..3b060c23b --- /dev/null +++ b/wireless/ieee802154/libmac/ieee802154_syncreq.c @@ -0,0 +1,68 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/ieee802154_syncreq.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int ieee802154_sync_req(int fd, FAR struct ieee802154_sync_req_s *req) +{ + int ret; + + ret = ioctl(fd, MAC802154IOC_MLME_SYNC_REQUEST, (unsigned long)((uintptr_t)req)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_SYNC_REQUEST failed: %d\n", errcode); + } + + return ret; +} diff --git a/wireless/ieee802154/libmac/sixlowpan_assocreq.c b/wireless/ieee802154/libmac/sixlowpan_assocreq.c index 754010f40..b7909f160 100644 --- a/wireless/ieee802154/libmac/sixlowpan_assocreq.c +++ b/wireless/ieee802154/libmac/sixlowpan_assocreq.c @@ -69,7 +69,6 @@ int sixlowpan_assoc_req(int sock, FAR const char *ifname, { int errcode = errno; printf("MAC802154IOC_MLME_ASSOC_REQUEST failed: %d\n", errcode); - return ret; } return ret; diff --git a/wireless/ieee802154/libmac/sixlowpan_assocresp.c b/wireless/ieee802154/libmac/sixlowpan_assocresp.c index a210576e6..306c4911c 100644 --- a/wireless/ieee802154/libmac/sixlowpan_assocresp.c +++ b/wireless/ieee802154/libmac/sixlowpan_assocresp.c @@ -68,7 +68,6 @@ int sixlowpan_assoc_resp(int sock, FAR const char *ifname, { int errcode = errno; printf("MAC802154IOC_MLME_ASSOC_RESPONSE failed: %d\n", errcode); - return ret; } memcpy(resp, &arg.u.assocresp, sizeof(struct ieee802154_assoc_resp_s)); diff --git a/wireless/ieee802154/libmac/sixlowpan_disassocreq.c b/wireless/ieee802154/libmac/sixlowpan_disassocreq.c index ee6f9d7f5..81c3a1029 100644 --- a/wireless/ieee802154/libmac/sixlowpan_disassocreq.c +++ b/wireless/ieee802154/libmac/sixlowpan_disassocreq.c @@ -69,7 +69,6 @@ int sixlowpan_desassoc_req(int sock, FAR const char *ifname, { int errcode = errno; printf("MAC802154IOC_MLME_DISASSOC_REQUEST failed: %d\n", errcode); - return ret; } return ret; diff --git a/wireless/ieee802154/libmac/sixlowpan_getreq.c b/wireless/ieee802154/libmac/sixlowpan_getreq.c new file mode 100644 index 000000000..1e6c8ecdd --- /dev/null +++ b/wireless/ieee802154/libmac/sixlowpan_getreq.c @@ -0,0 +1,75 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/sixlowpan_getreq.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int sixlowpan_get_req(int sock, FAR const char *ifname, + FAR const struct ieee802154_get_req_s *req) +{ + struct ieee802154_netmac_s arg; + int ret; + + strncpy(arg.ifr_name, ifname, IFNAMSIZ); + memcpy(&arg.u.getreq, req, sizeof(struct ieee802154_get_req_s)); + + ret = ioctl(sock, MAC802154IOC_MLME_GET_REQUEST, + (unsigned long)((uintptr_t)&arg)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_GET_REQUEST failed: %d\n", errcode); + } + + return ret; +} diff --git a/wireless/ieee802154/libmac/sixlowpan_gtsreq.c b/wireless/ieee802154/libmac/sixlowpan_gtsreq.c new file mode 100644 index 000000000..971131756 --- /dev/null +++ b/wireless/ieee802154/libmac/sixlowpan_gtsreq.c @@ -0,0 +1,75 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/sixlowpan_gtsreq.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int sixlowpan_gts_req(int sock, FAR const char *ifname, + FAR const struct ieee802154_gts_req_s *req) +{ + struct ieee802154_netmac_s arg; + int ret; + + strncpy(arg.ifr_name, ifname, IFNAMSIZ); + memcpy(&arg.u.gtsreq, req, sizeof(struct ieee802154_gts_req_s)); + + ret = ioctl(sock, MAC802154IOC_MLME_GTS_REQUEST, + (unsigned long)((uintptr_t)&arg)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_GTS_REQUEST failed: %d\n", errcode); + } + + return ret; +} diff --git a/wireless/ieee802154/libmac/sixlowpan_orphanresp.c b/wireless/ieee802154/libmac/sixlowpan_orphanresp.c new file mode 100644 index 000000000..d6a21f5d9 --- /dev/null +++ b/wireless/ieee802154/libmac/sixlowpan_orphanresp.c @@ -0,0 +1,75 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/sixlowpan_orphanresp.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int sixlowpan_orphan_resp(int sock, FAR const char *ifname, + FAR struct ieee802154_orphan_resp_s *resp) +{ + struct ieee802154_netmac_s arg; + int ret; + + strncpy(arg.ifr_name, ifname, IFNAMSIZ); + + ret = ioctl(sock, MAC802154IOC_MLME_ORPHAN_RESPONSE, + (unsigned long)((uintptr_t)&arg)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_ORPHAN_RESPONSE failed: %d\n", errcode); + } + + memcpy(resp, &arg.u.orphanresp, sizeof(struct ieee802154_orphan_resp_s)); + return ret; +} diff --git a/wireless/ieee802154/libmac/sixlowpan_pollreq.c b/wireless/ieee802154/libmac/sixlowpan_pollreq.c new file mode 100644 index 000000000..23a49aa61 --- /dev/null +++ b/wireless/ieee802154/libmac/sixlowpan_pollreq.c @@ -0,0 +1,75 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/sixlowpan_pollreq.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int sixlowpan_poll_req(int sock, FAR const char *ifname, + FAR const struct ieee802154_poll_req_s *req) +{ + struct ieee802154_netmac_s arg; + int ret; + + strncpy(arg.ifr_name, ifname, IFNAMSIZ); + memcpy(&arg.u.pollreq, req, sizeof(struct ieee802154_poll_req_s)); + + ret = ioctl(sock, MAC802154IOC_MLME_POLL_REQUEST, + (unsigned long)((uintptr_t)&arg)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_POLL_REQUEST failed: %d\n", errcode); + } + + return ret; +} diff --git a/wireless/ieee802154/libmac/sixlowpan_resetreq.c b/wireless/ieee802154/libmac/sixlowpan_resetreq.c new file mode 100644 index 000000000..05440696f --- /dev/null +++ b/wireless/ieee802154/libmac/sixlowpan_resetreq.c @@ -0,0 +1,75 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/sixlowpan_resetreq.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int sixlowpan_reset_req(int sock, FAR const char *ifname, + FAR const struct ieee802154_reset_req_s *req) +{ + struct ieee802154_netmac_s arg; + int ret; + + strncpy(arg.ifr_name, ifname, IFNAMSIZ); + memcpy(&arg.u.resetreq, req, sizeof(struct ieee802154_reset_req_s)); + + ret = ioctl(sock, MAC802154IOC_MLME_RESET_REQUEST, + (unsigned long)((uintptr_t)&arg)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_RESET_REQUEST failed: %d\n", errcode); + } + + return ret; +} diff --git a/wireless/ieee802154/libmac/sixlowpan_rxenabreq.c b/wireless/ieee802154/libmac/sixlowpan_rxenabreq.c new file mode 100644 index 000000000..7194352a6 --- /dev/null +++ b/wireless/ieee802154/libmac/sixlowpan_rxenabreq.c @@ -0,0 +1,75 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/sixlowpan_rxenabreq.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int sixlowpan_rxenable_req(int sock, FAR const char *ifname, + FAR const struct ieee802154_rxenable_req_s *req) +{ + struct ieee802154_netmac_s arg; + int ret; + + strncpy(arg.ifr_name, ifname, IFNAMSIZ); + memcpy(&arg.u.rxenabreq, req, sizeof(struct ieee802154_rxenable_req_s)); + + ret = ioctl(sock, MAC802154IOC_MLME_RXENABLE_REQUEST, + (unsigned long)((uintptr_t)&arg)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_RXENABLE_REQUEST failed: %d\n", errcode); + } + + return ret; +} diff --git a/wireless/ieee802154/libmac/sixlowpan_scanreq.c b/wireless/ieee802154/libmac/sixlowpan_scanreq.c new file mode 100644 index 000000000..8cb1e14fc --- /dev/null +++ b/wireless/ieee802154/libmac/sixlowpan_scanreq.c @@ -0,0 +1,75 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/sixlowpan_scanreq.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int sixlowpan_scan_req(int sock, FAR const char *ifname, + FAR const struct ieee802154_scan_req_s *req) +{ + struct ieee802154_netmac_s arg; + int ret; + + strncpy(arg.ifr_name, ifname, IFNAMSIZ); + memcpy(&arg.u.scanreq, req, sizeof(struct ieee802154_scan_req_s)); + + ret = ioctl(sock, MAC802154IOC_MLME_SCAN_REQUEST, + (unsigned long)((uintptr_t)&arg)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_SCAN_REQUEST failed: %d\n", errcode); + } + + return ret; +} diff --git a/wireless/ieee802154/libmac/sixlowpan_setreq.c b/wireless/ieee802154/libmac/sixlowpan_setreq.c new file mode 100644 index 000000000..14ac2dc03 --- /dev/null +++ b/wireless/ieee802154/libmac/sixlowpan_setreq.c @@ -0,0 +1,75 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/sixlowpan_setreq.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int sixlowpan_set_req(int sock, FAR const char *ifname, + FAR const struct ieee802154_set_req_s *req) +{ + struct ieee802154_netmac_s arg; + int ret; + + strncpy(arg.ifr_name, ifname, IFNAMSIZ); + memcpy(&arg.u.setreq, req, sizeof(struct ieee802154_set_req_s)); + + ret = ioctl(sock, MAC802154IOC_MLME_SET_REQUEST, + (unsigned long)((uintptr_t)&arg)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_SET_REQUEST failed: %d\n", errcode); + } + + return ret; +} diff --git a/wireless/ieee802154/libmac/sixlowpan_startreq.c b/wireless/ieee802154/libmac/sixlowpan_startreq.c new file mode 100644 index 000000000..dfcade8f9 --- /dev/null +++ b/wireless/ieee802154/libmac/sixlowpan_startreq.c @@ -0,0 +1,75 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/sixlowpan_startreq.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int sixlowpan_start_req(int sock, FAR const char *ifname, + FAR const struct ieee802154_start_req_s *req) +{ + struct ieee802154_netmac_s arg; + int ret; + + strncpy(arg.ifr_name, ifname, IFNAMSIZ); + memcpy(&arg.u.startreq, req, sizeof(struct ieee802154_start_req_s)); + + ret = ioctl(sock, MAC802154IOC_MLME_START_REQUEST, + (unsigned long)((uintptr_t)&arg)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_START_REQUEST failed: %d\n", errcode); + } + + return ret; +} diff --git a/wireless/ieee802154/libmac/sixlowpan_syncreq.c b/wireless/ieee802154/libmac/sixlowpan_syncreq.c new file mode 100644 index 000000000..40e1b093e --- /dev/null +++ b/wireless/ieee802154/libmac/sixlowpan_syncreq.c @@ -0,0 +1,75 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/sixlowpan_syncreq.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int sixlowpan_sync_req(int sock, FAR const char *ifname, + FAR const struct ieee802154_sync_req_s *req) +{ + struct ieee802154_netmac_s arg; + int ret; + + strncpy(arg.ifr_name, ifname, IFNAMSIZ); + memcpy(&arg.u.syncreq, req, sizeof(struct ieee802154_sync_req_s)); + + ret = ioctl(sock, MAC802154IOC_MLME_SYNC_REQUEST, + (unsigned long)((uintptr_t)&arg)); + if (ret < 0) + { + int errcode = errno; + printf("MAC802154IOC_MLME_SYNC_REQUEST failed: %d\n", errcode); + } + + return ret; +}