From 6e584ed3112fa0b145555ad8dff027699392fad6 Mon Sep 17 00:00:00 2001 From: Arto Kinnunen Date: Wed, 23 Jun 2021 10:03:35 +0300 Subject: [PATCH 01/18] Remove existing mcr20a-rf-driver --- .../mcr20a-rf-driver/CMakeLists.txt | 14 - .../802.15.4_RF/mcr20a-rf-driver/LICENSE | 2 - .../802.15.4_RF/mcr20a-rf-driver/README.md | 6 - .../mcr20a-rf-driver/apache-2.0.txt | 56 - .../mcr20a-rf-driver/mbed_lib.json | 9 - .../mcr20a-rf-driver/NanostackRfPhyMcr20a.h | 73 - .../mcr20a-rf-driver/source/MCR20Drv.c | 671 ------- .../mcr20a-rf-driver/source/MCR20Drv.h | 374 ---- .../mcr20a-rf-driver/source/MCR20Overwrites.h | 310 --- .../mcr20a-rf-driver/source/MCR20Reg.h | 731 ------- .../source/NanostackRfPhyMcr20a.cpp | 1765 ----------------- .../mcr20a-rf-driver/source/XcvrSpi.h | 90 - 12 files changed, 4101 deletions(-) delete mode 100644 connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/CMakeLists.txt delete mode 100644 connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/LICENSE delete mode 100644 connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/README.md delete mode 100644 connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/apache-2.0.txt delete mode 100644 connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/mbed_lib.json delete mode 100644 connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/mcr20a-rf-driver/NanostackRfPhyMcr20a.h delete mode 100644 connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/MCR20Drv.c delete mode 100644 connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/MCR20Drv.h delete mode 100644 connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/MCR20Overwrites.h delete mode 100644 connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/MCR20Reg.h delete mode 100644 connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/NanostackRfPhyMcr20a.cpp delete mode 100644 connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/XcvrSpi.h diff --git a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/CMakeLists.txt b/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/CMakeLists.txt deleted file mode 100644 index a29383253d..0000000000 --- a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2020 ARM Limited. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -target_include_directories(mbed-802.15.4-rf - INTERFACE - mcr20a-rf-driver - source -) - -target_sources(mbed-802.15.4-rf - INTERFACE - source/MCR20Drv.c - source/NanostackRfPhyMcr20a.cpp -) diff --git a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/LICENSE b/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/LICENSE deleted file mode 100644 index 97df0e645d..0000000000 --- a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/LICENSE +++ /dev/null @@ -1,2 +0,0 @@ -Unless specifically indicated otherwise in a file, files are licensed -under the Apache 2.0 license, as can be found in: apache-2.0.txt \ No newline at end of file diff --git a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/README.md b/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/README.md deleted file mode 100644 index aa927dde77..0000000000 --- a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Example RF driver for Freescale 802.15.4 transceivers # - -Support for: - * MCR20A - -This driver is used with 6LoWPAN stack. \ No newline at end of file diff --git a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/apache-2.0.txt b/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/apache-2.0.txt deleted file mode 100644 index 0e4cf3ee99..0000000000 --- a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/apache-2.0.txt +++ /dev/null @@ -1,56 +0,0 @@ - - -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - - You must give any other recipients of the Work or Derivative Works a copy of this License; and - You must cause any modified files to carry prominent notices stating that You changed the files; and - You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. - - You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/mbed_lib.json b/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/mbed_lib.json deleted file mode 100644 index 3dc0a3f323..0000000000 --- a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/mbed_lib.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "mcr20a", - "config": { - "provide-default": { - "help": "Provide default NanostackRfpy. [true/false]", - "value": false - } - } -} \ No newline at end of file diff --git a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/mcr20a-rf-driver/NanostackRfPhyMcr20a.h b/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/mcr20a-rf-driver/NanostackRfPhyMcr20a.h deleted file mode 100644 index a7200c0d10..0000000000 --- a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/mcr20a-rf-driver/NanostackRfPhyMcr20a.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NANOSTACK_PHY_MCR20A_H_ -#define NANOSTACK_PHY_MCR20A_H_ - -#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && DEVICE_INTERRUPTIN && defined(MBED_CONF_RTOS_PRESENT) -#include "inttypes.h" -#include "NanostackRfPhy.h" -#include "DigitalIn.h" -#include "DigitalOut.h" -#include "InterruptIn.h" -#include "SPI.h" -#include "rtos.h" - -// Arduino pin defaults for convenience -#if !defined(MCR20A_SPI_MOSI) -#define MCR20A_SPI_MOSI D11 -#endif -#if !defined(MCR20A_SPI_MISO) -#define MCR20A_SPI_MISO D12 -#endif -#if !defined(MCR20A_SPI_SCLK) -#define MCR20A_SPI_SCLK D13 -#endif -#if !defined(MCR20A_SPI_CS) -#define MCR20A_SPI_CS D10 -#endif -#if !defined(MCR20A_SPI_RST) -#define MCR20A_SPI_RST D5 -#endif -#if !defined(MCR20A_SPI_IRQ) -#define MCR20A_SPI_IRQ D2 -#endif - -class NanostackRfPhyMcr20a : public NanostackRfPhy { -public: - NanostackRfPhyMcr20a(PinName spi_mosi, PinName spi_miso, - PinName spi_sclk, PinName spi_cs, PinName spi_rst, - PinName spi_irq); - virtual ~NanostackRfPhyMcr20a(); - virtual int8_t rf_register(); - virtual void rf_unregister(); - virtual void get_mac_address(uint8_t *mac); - virtual void set_mac_address(uint8_t *mac); - -private: - mbed::SPI _spi; - mbed::DigitalOut _rf_cs; - mbed::DigitalOut _rf_rst; - mbed::InterruptIn _rf_irq; - mbed::DigitalIn _rf_irq_pin; - rtos::Thread _irq_thread; - - void _pins_set(); - void _pins_clear(); -}; - -#endif /* MBED_CONF_NANOSTACK_CONFIGURATION */ -#endif /* NANOSTACK_PHY_MCR20A_H_ */ diff --git a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/MCR20Drv.c b/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/MCR20Drv.c deleted file mode 100644 index 3460732479..0000000000 --- a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/MCR20Drv.c +++ /dev/null @@ -1,671 +0,0 @@ -/*! -* Copyright (c) 2015, Freescale Semiconductor, Inc. -* All rights reserved. -* SPDX-License-Identifier: BSD-3-Clause -* -* \file MCR20Drv.c -* -* Redistribution and use in source and binary forms, with or without modification, -* are permitted provided that the following conditions are met: -* -* o Redistributions of source code must retain the above copyright notice, this list -* of conditions and the following disclaimer. -* -* o 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. -* -* o Neither the name of Freescale Semiconductor, Inc. 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 HOLDER 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 HEADERS * -*---------------------------------------------------------------------------* -* Add to this section all the headers that this module needs to include. * -*---------------------------------------------------------------------------* -*****************************************************************************/ - -#include "MCR20Drv.h" -#include "MCR20Reg.h" -#include "XcvrSpi.h" - -#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && DEVICE_INTERRUPTIN && defined(MBED_CONF_RTOS_PRESENT) - -#include "platform/mbed_critical.h" -#include - -/***************************************************************************** -* PRIVATE VARIABLES * -*---------------------------------------------------------------------------* -* Add to this section all the variables and constants that have local * -* (file) scope. * -* Each of this declarations shall be preceded by the 'static' keyword. * -* These variables / constants cannot be accessed outside this module. * -*---------------------------------------------------------------------------* -*****************************************************************************/ -uint32_t mPhyIrqDisableCnt = 1; - -/***************************************************************************** -* PUBLIC VARIABLES * -*---------------------------------------------------------------------------* -* Add to this section all the variables and constants that have global * -* (project) scope. * -* These variables / constants can be accessed outside this module. * -* These variables / constants shall be preceded by the 'extern' keyword in * -* the interface header. * -*---------------------------------------------------------------------------* -*****************************************************************************/ - -/***************************************************************************** -* PRIVATE FUNCTIONS PROTOTYPES * -*---------------------------------------------------------------------------* -* Add to this section all the functions prototypes that have local (file) * -* scope. * -* These functions cannot be accessed outside this module. * -* These declarations shall be preceded by the 'static' keyword. * -*---------------------------------------------------------------------------* -*****************************************************************************/ - -/***************************************************************************** -* PRIVATE FUNCTIONS * -*---------------------------------------------------------------------------* -* Add to this section all the functions that have local (file) scope. * -* These functions cannot be accessed outside this module. * -* These definitions shall be preceded by the 'static' keyword. * -*---------------------------------------------------------------------------* -*****************************************************************************/ - - -/***************************************************************************** -* PUBLIC FUNCTIONS * -*---------------------------------------------------------------------------* -* Add to this section all the functions that have global (project) scope. * -* These functions can be accessed outside this module. * -* These functions shall have their declarations (prototypes) within the * -* interface header file and shall be preceded by the 'extern' keyword. * -*---------------------------------------------------------------------------* -*****************************************************************************/ - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_Init -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -void MCR20Drv_Init -( - void -) -{ - xcvr_spi_init(gXcvrSpiInstance_c); - xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000); - - gXcvrDeassertCS_d(); - MCR20Drv_RST_B_Deassert(); - RF_IRQ_Init(); - RF_IRQ_Disable(); - mPhyIrqDisableCnt = 1; -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_DirectAccessSPIWrite -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -void MCR20Drv_DirectAccessSPIWrite -( - uint8_t address, - uint8_t value -) -{ - uint16_t txData; - - ProtectFromMCR20Interrupt(); - - xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000); - - gXcvrAssertCS_d(); - - txData = (address & TransceiverSPI_DirectRegisterAddressMask); - txData |= value << 8; - - xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, sizeof(txData)); - - gXcvrDeassertCS_d(); - UnprotectFromMCR20Interrupt(); -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_DirectAccessSPIMultiByteWrite -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -void MCR20Drv_DirectAccessSPIMultiByteWrite -( - uint8_t startAddress, - uint8_t *byteArray, - uint8_t numOfBytes -) -{ - uint8_t txData; - - if ((numOfBytes == 0) || (byteArray == NULL)) { - return; - } - - ProtectFromMCR20Interrupt(); - - xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000); - - gXcvrAssertCS_d(); - - txData = (startAddress & TransceiverSPI_DirectRegisterAddressMask); - - xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, 0, sizeof(txData)); - xcvr_spi_transfer(gXcvrSpiInstance_c, byteArray, 0, numOfBytes); - - gXcvrDeassertCS_d(); - UnprotectFromMCR20Interrupt(); -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_PB_SPIByteWrite -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -void MCR20Drv_PB_SPIByteWrite -( - uint8_t address, - uint8_t value -) -{ - uint32_t txData; - - ProtectFromMCR20Interrupt(); - - xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000); - - gXcvrAssertCS_d(); - - txData = TransceiverSPI_WriteSelect | - TransceiverSPI_PacketBuffAccessSelect | - TransceiverSPI_PacketBuffByteModeSelect; - txData |= (address) << 8; - txData |= (value) << 16; - - xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, 3); - - gXcvrDeassertCS_d(); - UnprotectFromMCR20Interrupt(); -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_PB_SPIBurstWrite -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -void MCR20Drv_PB_SPIBurstWrite -( - uint8_t *byteArray, - uint8_t numOfBytes -) -{ - uint8_t txData; - - if ((numOfBytes == 0) || (byteArray == NULL)) { - return; - } - - ProtectFromMCR20Interrupt(); - - xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000); - - gXcvrAssertCS_d(); - - txData = TransceiverSPI_WriteSelect | - TransceiverSPI_PacketBuffAccessSelect | - TransceiverSPI_PacketBuffBurstModeSelect; - - xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, 0, 1); - xcvr_spi_transfer(gXcvrSpiInstance_c, byteArray, 0, numOfBytes); - - gXcvrDeassertCS_d(); - UnprotectFromMCR20Interrupt(); -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_DirectAccessSPIRead -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ - -uint8_t MCR20Drv_DirectAccessSPIRead -( - uint8_t address -) -{ - uint8_t txData; - uint8_t rxData; - - ProtectFromMCR20Interrupt(); - - xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000); - - gXcvrAssertCS_d(); - - txData = (address & TransceiverSPI_DirectRegisterAddressMask) | - TransceiverSPI_ReadSelect; - - xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, 0, sizeof(txData)); - xcvr_spi_transfer(gXcvrSpiInstance_c, 0, &rxData, sizeof(rxData)); - - gXcvrDeassertCS_d(); - UnprotectFromMCR20Interrupt(); - - return rxData; - -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_DirectAccessSPIMultyByteRead -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -uint8_t MCR20Drv_DirectAccessSPIMultiByteRead -( - uint8_t startAddress, - uint8_t *byteArray, - uint8_t numOfBytes -) -{ - uint8_t txData; - uint8_t phyIRQSTS1; - - if ((numOfBytes == 0) || (byteArray == NULL)) { - return 0; - } - - ProtectFromMCR20Interrupt(); - - xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000); - - gXcvrAssertCS_d(); - - txData = (startAddress & TransceiverSPI_DirectRegisterAddressMask) | - TransceiverSPI_ReadSelect; - - xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, &phyIRQSTS1, sizeof(txData)); - xcvr_spi_transfer(gXcvrSpiInstance_c, 0, byteArray, numOfBytes); - - gXcvrDeassertCS_d(); - UnprotectFromMCR20Interrupt(); - - return phyIRQSTS1; -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_PB_SPIBurstRead -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -uint8_t MCR20Drv_PB_SPIBurstRead -( - uint8_t *byteArray, - uint8_t numOfBytes -) -{ - uint8_t txData; - uint8_t phyIRQSTS1; - - if ((numOfBytes == 0) || (byteArray == NULL)) { - return 0; - } - - ProtectFromMCR20Interrupt(); - - xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000); - - gXcvrAssertCS_d(); - - txData = TransceiverSPI_ReadSelect | - TransceiverSPI_PacketBuffAccessSelect | - TransceiverSPI_PacketBuffBurstModeSelect; - - xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, &phyIRQSTS1, sizeof(txData)); - xcvr_spi_transfer(gXcvrSpiInstance_c, 0, byteArray, numOfBytes); - - gXcvrDeassertCS_d(); - UnprotectFromMCR20Interrupt(); - - return phyIRQSTS1; -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_IndirectAccessSPIWrite -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -void MCR20Drv_IndirectAccessSPIWrite -( - uint8_t address, - uint8_t value -) -{ - uint32_t txData; - - ProtectFromMCR20Interrupt(); - - xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000); - - gXcvrAssertCS_d(); - - txData = TransceiverSPI_IARIndexReg; - txData |= (address) << 8; - txData |= (value) << 16; - - xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, 3); - - gXcvrDeassertCS_d(); - UnprotectFromMCR20Interrupt(); -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_IndirectAccessSPIMultiByteWrite -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -void MCR20Drv_IndirectAccessSPIMultiByteWrite -( - uint8_t startAddress, - uint8_t *byteArray, - uint8_t numOfBytes -) -{ - uint16_t txData; - - if ((numOfBytes == 0) || (byteArray == NULL)) { - return; - } - - ProtectFromMCR20Interrupt(); - - xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000); - - gXcvrAssertCS_d(); - - txData = TransceiverSPI_IARIndexReg; - txData |= (startAddress) << 8; - - xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, sizeof(txData)); - xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)byteArray, 0, numOfBytes); - - gXcvrDeassertCS_d(); - UnprotectFromMCR20Interrupt(); -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_IndirectAccessSPIRead -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -uint8_t MCR20Drv_IndirectAccessSPIRead -( - uint8_t address -) -{ - uint16_t txData; - uint8_t rxData; - - ProtectFromMCR20Interrupt(); - - xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000); - - gXcvrAssertCS_d(); - - txData = TransceiverSPI_IARIndexReg | TransceiverSPI_ReadSelect; - txData |= (address) << 8; - - xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, sizeof(txData)); - xcvr_spi_transfer(gXcvrSpiInstance_c, 0, &rxData, sizeof(rxData)); - - gXcvrDeassertCS_d(); - UnprotectFromMCR20Interrupt(); - - return rxData; -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_IndirectAccessSPIMultiByteRead -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -void MCR20Drv_IndirectAccessSPIMultiByteRead -( - uint8_t startAddress, - uint8_t *byteArray, - uint8_t numOfBytes -) -{ - uint16_t txData; - - if ((numOfBytes == 0) || (byteArray == NULL)) { - return; - } - - ProtectFromMCR20Interrupt(); - - xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000); - - gXcvrAssertCS_d(); - - txData = (TransceiverSPI_IARIndexReg | TransceiverSPI_ReadSelect); - txData |= (startAddress) << 8; - - xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, sizeof(txData)); - xcvr_spi_transfer(gXcvrSpiInstance_c, 0, byteArray, numOfBytes); - - gXcvrDeassertCS_d(); - UnprotectFromMCR20Interrupt(); -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_IsIrqPending -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -uint32_t MCR20Drv_IsIrqPending -( - void -) -{ - return RF_isIRQ_Pending(); -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_IRQ_Disable -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -void MCR20Drv_IRQ_Disable -( - void -) -{ - core_util_critical_section_enter(); - - if (mPhyIrqDisableCnt == 0) { - RF_IRQ_Disable(); - } - - mPhyIrqDisableCnt++; - - core_util_critical_section_exit(); -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_IRQ_Enable -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -void MCR20Drv_IRQ_Enable -( - void -) -{ - core_util_critical_section_enter(); - - if (mPhyIrqDisableCnt) { - mPhyIrqDisableCnt--; - - if (mPhyIrqDisableCnt == 0) { - RF_IRQ_Enable(); - } - } - - core_util_critical_section_exit(); -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_RST_Assert -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -void MCR20Drv_RST_B_Assert -( - void -) -{ - RF_RST_Set(0); -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_RST_Deassert -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -void MCR20Drv_RST_B_Deassert -( - void -) -{ - RF_RST_Set(1); -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_SoftRST_Assert -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -void MCR20Drv_SoftRST_Assert -( - void -) -{ - MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x80)); -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_SoftRST_Deassert -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -void MCR20Drv_SoftRST_Deassert -( - void -) -{ - MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x00)); -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_Soft_RESET -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -void MCR20Drv_Soft_RESET -( - void -) -{ - //assert SOG_RST - MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x80)); - - //deassert SOG_RST - MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x00)); -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_RESET -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -void MCR20Drv_RESET -( - void -) -{ - volatile uint32_t delay = 1000; - //assert RST_B - MCR20Drv_RST_B_Assert(); - - while (delay--); - - //deassert RST_B - MCR20Drv_RST_B_Deassert(); -} - -/*--------------------------------------------------------------------------- -* Name: MCR20Drv_Set_CLK_OUT_Freq -* Description: - -* Parameters: - -* Return: - -*---------------------------------------------------------------------------*/ -void MCR20Drv_Set_CLK_OUT_Freq -( - uint8_t freqDiv -) -{ - uint8_t clkOutCtrlReg = (freqDiv & cCLK_OUT_DIV_Mask) | cCLK_OUT_EN | cCLK_OUT_EXTEND; - - if (freqDiv == gCLK_OUT_FREQ_DISABLE) { - clkOutCtrlReg = (cCLK_OUT_EXTEND | gCLK_OUT_FREQ_4_MHz); //reset value with clock out disabled - } - - MCR20Drv_DirectAccessSPIWrite((uint8_t) CLK_OUT_CTRL, clkOutCtrlReg); -} - -#endif /* MBED_CONF_NANOSTACK_CONFIGURATION */ diff --git a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/MCR20Drv.h b/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/MCR20Drv.h deleted file mode 100644 index bcbe6dcd53..0000000000 --- a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/MCR20Drv.h +++ /dev/null @@ -1,374 +0,0 @@ -/*! -* Copyright (c) 2015, Freescale Semiconductor, Inc. -* All rights reserved. -* SPDX-License-Identifier: BSD-3-Clause -* -* \file MCR20Drv.h -* -* Redistribution and use in source and binary forms, with or without modification, -* are permitted provided that the following conditions are met: -* -* o Redistributions of source code must retain the above copyright notice, this list -* of conditions and the following disclaimer. -* -* o 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. -* -* o Neither the name of Freescale Semiconductor, Inc. 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 HOLDER 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. -*/ - -#ifndef __MCR20_DRV_H__ -#define __MCR20_DRV_H__ - -#include - -/***************************************************************************** - * INCLUDED HEADERS * - *---------------------------------------------------------------------------* - * Add to this section all the headers that this module needs to include. * - * Note that it is not a good practice to include header files into header * - * files, so use this section only if there is no other better solution. * - *---------------------------------------------------------------------------* - *****************************************************************************/ - -/***************************************************************************** - * PRIVATE MACROS * - *---------------------------------------------------------------------------* - * Add to this section all the access macros, registers mappings, bit access * - * macros, masks, flags etc ... - *---------------------------------------------------------------------------* - *****************************************************************************/ - -/* Disable XCVR clock output by default, to reduce power consumption */ -#ifndef gMCR20_ClkOutFreq_d -#define gMCR20_ClkOutFreq_d gCLK_OUT_FREQ_DISABLE -#endif - -/***************************************************************************** - * PUBLIC FUNCTIONS * - *---------------------------------------------------------------------------* - * Add to this section all the global functions prototype preceded (as a * - * good practice) by the keyword 'extern' * - *---------------------------------------------------------------------------* - *****************************************************************************/ - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_Init - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -extern void MCR20Drv_Init -( - void -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_SPI_DMA_Init - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_SPI_DMA_Init -( - void -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_Start_PB_DMA_SPI_Write - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_Start_PB_DMA_SPI_Write -( - uint8_t *srcAddress, - uint8_t numOfBytes -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_Start_PB_DMA_SPI_Read - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_Start_PB_DMA_SPI_Read -( - uint8_t *dstAddress, - uint8_t numOfBytes -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_DirectAccessSPIWrite - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_DirectAccessSPIWrite -( - uint8_t address, - uint8_t value -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_DirectAccessSPIMultiByteWrite - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_DirectAccessSPIMultiByteWrite -( - uint8_t startAddress, - uint8_t *byteArray, - uint8_t numOfBytes -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_PB_SPIBurstWrite - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_PB_SPIBurstWrite -( - uint8_t *byteArray, - uint8_t numOfBytes -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_DirectAccessSPIRead - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -uint8_t MCR20Drv_DirectAccessSPIRead -( - uint8_t address -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_DirectAccessSPIMultyByteRead - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ - -uint8_t MCR20Drv_DirectAccessSPIMultiByteRead -( - uint8_t startAddress, - uint8_t *byteArray, - uint8_t numOfBytes -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_PB_SPIByteWrite - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_PB_SPIByteWrite -( - uint8_t address, - uint8_t value -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_PB_SPIBurstRead - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -uint8_t MCR20Drv_PB_SPIBurstRead -( - uint8_t *byteArray, - uint8_t numOfBytes -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_IndirectAccessSPIWrite - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_IndirectAccessSPIWrite -( - uint8_t address, - uint8_t value -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_IndirectAccessSPIMultiByteWrite - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_IndirectAccessSPIMultiByteWrite -( - uint8_t startAddress, - uint8_t *byteArray, - uint8_t numOfBytes -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_IndirectAccessSPIRead - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -uint8_t MCR20Drv_IndirectAccessSPIRead -( - uint8_t address -); -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_IndirectAccessSPIMultiByteRead - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_IndirectAccessSPIMultiByteRead -( - uint8_t startAddress, - uint8_t *byteArray, - uint8_t numOfBytes -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_IsIrqPending - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -uint32_t MCR20Drv_IsIrqPending -( - void -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_IRQ_Disable - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_IRQ_Disable -( - void -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_IRQ_Enable - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_IRQ_Enable -( - void -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_RST_PortConfig - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_RST_B_PortConfig -( - void -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_RST_Assert - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_RST_B_Assert -( - void -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_RST_Deassert - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_RST_B_Deassert -( - void -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_SoftRST_Assert - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_SoftRST_Assert -( - void -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_SoftRST_Deassert - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_SoftRST_Deassert -( - void -); - - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_RESET - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_RESET -( - void -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_Soft_RESET - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_Soft_RESET -( - void -); - -/*--------------------------------------------------------------------------- - * Name: MCR20Drv_Set_CLK_OUT_Freq - * Description: - - * Parameters: - - * Return: - - *---------------------------------------------------------------------------*/ -void MCR20Drv_Set_CLK_OUT_Freq -( - uint8_t freqDiv -); - -#define ProtectFromMCR20Interrupt() MCR20Drv_IRQ_Disable() -#define UnprotectFromMCR20Interrupt() MCR20Drv_IRQ_Enable() - -#endif /* __MCR20_DRV_H__ */ diff --git a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/MCR20Overwrites.h b/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/MCR20Overwrites.h deleted file mode 100644 index af1f99f7dc..0000000000 --- a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/MCR20Overwrites.h +++ /dev/null @@ -1,310 +0,0 @@ -/*! -* Copyright (c) 2015, Freescale Semiconductor, Inc. -* All rights reserved. -* SPDX-License-Identifier: BSD-3-Clause -* -* \file MCR20Overwrites.h -* Description: Overwrites header file for MCR20 Register values -* -* Redistribution and use in source and binary forms, with or without modification, -* are permitted provided that the following conditions are met: -* -* o Redistributions of source code must retain the above copyright notice, this list -* of conditions and the following disclaimer. -* -* o 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. -* -* o Neither the name of Freescale Semiconductor, Inc. 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 HOLDER 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. -*/ - -#ifndef OVERWRITES_H_ -#define OVERWRITES_H_ - -typedef struct overwrites_tag { - char address; - char data; -} overwrites_t; - - -/*****************************************************************************************************************/ -// This file is created exclusively for use with the transceiver 2.0 silicon -// and is provided for the world to use. It contains a list of all -// known overwrite values. Overwrite values are non-default register -// values that configure the transceiver device to a more optimally performing -// posture. It is expected that low level software (i.e. PHY) will -// consume this file as a #include, and transfer the contents to the -// the indicated addresses in the transceiver's memory space. This file has -// at least one required entry, that being its own version current version -// number, to be stored at transceiver's location 0x3B the -// OVERWRITES_VERSION_NUMBER register. The RAM register is provided in -// the transceiver address space to assist in future debug efforts. The -// analyst may read this location (once device has been booted with -// mysterious software) and have a good indication of what register -// overwrites were performed (with all versions of the overwrites.h file -// being archived forever at the Compass location shown above. -// -// The transceiver has an indirect register (IAR) space. Write access to this space -// requires 3 or more writes: -// 1st) the first write is an index value to the indirect (write Bit7=0, register access Bit 6=0) + 0x3E -// 2nd) IAR Register #0x00 - 0xFF. -// 3rd) The data to write -// nth) Burst mode additional data if required. -// -// Write access to direct space requires only a single address, data pair. - -overwrites_t const overwrites_direct[] = { - {0x3B, 0x0C}, //version 0C: new value for ACKDELAY targeting 198us (23 May, 2013, Larry Roshak) - {0x23, 0x17} //PA_PWR new default Power Step is "23" -}; - -overwrites_t const overwrites_indirect[] = { - {0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) - {0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3 - {0x92, 0x07}, //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1 - {0x8A, 0x71}, //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid) - {0x79, 0x2F}, //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) - {0x7A, 0x2F}, //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) - {0x7B, 0x24}, //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) - {0x7C, 0x24}, //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) - {0x7D, 0x24}, //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) - {0x7E, 0x24}, //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) - {0x7F, 0x32}, //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) - {0x80, 0x1D}, //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) - {0x81, 0x2D}, //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) - {0x82, 0x24}, //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) - {0x83, 0x24}, //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) - {0x64, 0x28}, //PA_CAL_DIS=1 Disabled PA calibration - {0x52, 0x55}, //AGC_THR1 RSSI tune up - {0x53, 0x2D}, //AGC_THR2 RSSI tune up - {0x66, 0x5F}, //ATT_RSSI1 tune up - {0x67, 0x8F}, //ATT_RSSI2 tune up - {0x68, 0x61}, //RSSI_OFFSET - {0x78, 0x03}, //CHF_PMAGAIN - {0x22, 0x50}, //CCA1_THRESH - {0x4D, 0x13}, //CORR_NVAL moved from 0x14 to 0x13 for 0.5 dB improved Rx Sensitivity - {0x39, 0x3D} //ACKDELAY new value targeting a delay of 198us (23 May, 2013, Larry Roshak) -}; - - -/* begin of deprecated versions - -==VERSION 1== -(version 1 is empty) - -==VERSION 2== -overwrites_t const overwrites_indirect[] ={ -{0x31, 0x02} //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) -}; - -==VERSION 3== -overwrites_t const overwrites_indirect[] ={ -{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) -{0x91, 0xB3}, //VCO_CTRL1: override VCOALC_REF_TX to 3 -{0x92, 0x07} //VCO_CTRL2: override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1 -}; - -==VERSION 4== -overwrites_t const overwrites_direct[] ={ -{0x3B, 0x04} //version 04 is the current version: update PA_COILTUNING default -}; - -overwrites_t const overwrites_indirect[] ={ -{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) -{0x91, 0xB3}, //VCO_CTRL1: override VCOALC_REF_TX to 3 -{0x92, 0x07} //VCO_CTRL2: override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1 -{0x8A, 0x71} //PA_TUNING: override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid) -}; - -==VERSION 5== -overwrites_t const overwrites_direct[] ={ -{0x3B, 0x05} //version 05: updates Channel Filter Register set (21 Dec 2012, on behalf of S. Soca) -}; - -overwrites_t const overwrites_indirect[] ={ -{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) -{0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3 -{0x92, 0x07} //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1 -{0x8A, 0x71} //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid) -{0x79, 0x2F} //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) -{0x7A, 0x2F} //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) -{0x7B, 0x24} //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7C, 0x24} //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7D, 0x24} //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7E, 0x24} //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x82, 0x24} //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x83, 0x24} //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7F, 0x32} //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x80, 0x1D} //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x81, 0x2D} //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) -}; - -==VERSION 6== -overwrites_t const overwrites_direct[] ={ -{0x3B, 0x06} //version 06: disable PA calibration -}; - -overwrites_t const overwrites_indirect[] ={ -{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) -{0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3 -{0x92, 0x07} //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1 -{0x8A, 0x71} //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid) -{0x79, 0x2F} //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) -{0x7A, 0x2F} //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) -{0x7B, 0x24} //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7C, 0x24} //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7D, 0x24} //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7E, 0x24} //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x82, 0x24} //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x83, 0x24} //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7F, 0x32} //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x80, 0x1D} //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x81, 0x2D} //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x64, 0x28} //PA_CAL_DIS=1 Disabled PA calibration -}; - -==VERSION 7== -overwrites_t const overwrites_direct[] ={ -{0x3B, 0x07} //version 07: updated registers for ED/RSSI -}; - -overwrites_t const overwrites_indirect[] ={ -{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) -{0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3 -{0x92, 0x07}, //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1 -{0x8A, 0x71}, //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid) -{0x79, 0x2F}, //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) -{0x7A, 0x2F}, //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) -{0x7B, 0x24}, //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7C, 0x24}, //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7D, 0x24}, //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7E, 0x24}, //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x82, 0x24}, //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x83, 0x24}, //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7F, 0x32}, //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x80, 0x1D}, //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x81, 0x2D}, //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x64, 0x28}, //PA_CAL_DIS=1 Disabled PA calibration -{0x52, 0x73}, //AGC_THR1 RSSI tune up -{0x53, 0x2D}, //AGC_THR2 RSSI tune up -{0x66, 0x5F}, //ATT_RSSI1 tune up -{0x67, 0x8F}, //ATT_RSSI2 tune up -{0x68, 0x60}, //RSSI_OFFSET -{0x69, 0x65} //RSSI_SLOPE -}; - - -==VERSION 8== -overwrites_t const overwrites_direct[] ={ -{0x3B, 0x08} //version 08: updated registers for ED/RSSI -}; - -overwrites_t const overwrites_indirect[] ={ -{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) -{0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3 -{0x92, 0x07}, //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1 -{0x8A, 0x71}, //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid) -{0x79, 0x2F}, //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) -{0x7A, 0x2F}, //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) -{0x7B, 0x24}, //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7C, 0x24}, //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7D, 0x24}, //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7E, 0x24}, //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x82, 0x24}, //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x83, 0x24}, //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7F, 0x32}, //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x80, 0x1D}, //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x81, 0x2D}, //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x64, 0x28}, //PA_CAL_DIS=1 Disabled PA calibration -{0x52, 0x73}, //AGC_THR1 RSSI tune up -{0x53, 0x2D}, //AGC_THR2 RSSI tune up -{0x66, 0x5F}, //ATT_RSSI1 tune up -{0x67, 0x8F}, //ATT_RSSI2 tune up -{0x69, 0x65} //RSSI_SLOPE -{0x68, 0x61}, //RSSI_OFFSET -{0x78, 0x03} //CHF_PMAGAIN -}; - - -==VERSION 9== -overwrites_t const overwrites_direct[] ={ -{0x3B, 0x09} //version 09: updated registers for ED/RSSI and PowerStep -{0x23, 0x17} //PA_PWR new default value -}; - -overwrites_t const overwrites_indirect[] ={ -{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) -{0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3 -{0x92, 0x07}, //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1 -{0x8A, 0x71}, //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid) -{0x79, 0x2F}, //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) -{0x7A, 0x2F}, //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) -{0x7B, 0x24}, //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7C, 0x24}, //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7D, 0x24}, //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7E, 0x24}, //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7F, 0x32}, //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x80, 0x1D}, //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x81, 0x2D}, //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x82, 0x24}, //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x83, 0x24}, //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x64, 0x28}, //PA_CAL_DIS=1 Disabled PA calibration -{0x52, 0x55}, //AGC_THR1 RSSI tune up -{0x53, 0x2D}, //AGC_THR2 RSSI tune up -{0x66, 0x5F}, //ATT_RSSI1 tune up -{0x67, 0x8F}, //ATT_RSSI2 tune up -{0x68, 0x61}, //RSSI_OFFSET -{0x78, 0x03} //CHF_PMAGAIN -}; - -==VERSION A== -overwrites_t const overwrites_direct[] ={ -{0x3B, 0x0A} //version 0A: updated registers for CCA -{0x23, 0x17} //PA_PWR new default Power Step is "23" -}; - -overwrites_t const overwrites_indirect[] ={ -{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) -{0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3 -{0x92, 0x07}, //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1 -{0x8A, 0x71}, //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid) -{0x79, 0x2F}, //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) -{0x7A, 0x2F}, //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) -{0x7B, 0x24}, //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7C, 0x24}, //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7D, 0x24}, //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7E, 0x24}, //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x7F, 0x32}, //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x80, 0x1D}, //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x81, 0x2D}, //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x82, 0x24}, //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x83, 0x24}, //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) -{0x64, 0x28}, //PA_CAL_DIS=1 Disabled PA calibration -{0x52, 0x55}, //AGC_THR1 RSSI tune up -{0x53, 0x2D}, //AGC_THR2 RSSI tune up -{0x66, 0x5F}, //ATT_RSSI1 tune up -{0x67, 0x8F}, //ATT_RSSI2 tune up -{0x68, 0x61}, //RSSI_OFFSET -{0x78, 0x03} //CHF_PMAGAIN -{0x22, 0x50} //CCA1_THRESH -}; - -end of deprecated versions */ - - -#endif //OVERWRITES_H_ - diff --git a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/MCR20Reg.h b/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/MCR20Reg.h deleted file mode 100644 index a42b31bcc0..0000000000 --- a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/MCR20Reg.h +++ /dev/null @@ -1,731 +0,0 @@ -/*! -* Copyright (c) 2015, Freescale Semiconductor, Inc. -* All rights reserved. -* SPDX-License-Identifier: BSD-3-Clause -* -* \file MCR20reg.h -* MCR20 Registers -* -* Redistribution and use in source and binary forms, with or without modification, -* are permitted provided that the following conditions are met: -* -* o Redistributions of source code must retain the above copyright notice, this list -* of conditions and the following disclaimer. -* -* o 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. -* -* o Neither the name of Freescale Semiconductor, Inc. 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 HOLDER 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. -*/ - -#ifndef __MCR20_REG_H__ -#define __MCR20_REG_H__ -/***************************************************************************** - * INCLUDED HEADERS * - *---------------------------------------------------------------------------* - * Add to this section all the headers that this module needs to include. * - * Note that it is not a good practice to include header files into header * - * files, so use this section only if there is no other better solution. * - *---------------------------------------------------------------------------* - *****************************************************************************/ - -/****************************************************************************/ -/* Transceiver SPI Registers */ -/****************************************************************************/ - -#define TransceiverSPI_IARIndexReg (0x3E) - -#define TransceiverSPI_ReadSelect (1<<7) -#define TransceiverSPI_WriteSelect (0<<7) -#define TransceiverSPI_RegisterAccessSelect (0<<6) -#define TransceiverSPI_PacketBuffAccessSelect (1<<6) -#define TransceiverSPI_PacketBuffBurstModeSelect (0<<5) -#define TransceiverSPI_PacketBuffByteModeSelect (1<<5) - -#define TransceiverSPI_DirectRegisterAddressMask (0x3F) - -#define IRQSTS1 0x00 -#define IRQSTS2 0x01 -#define IRQSTS3 0x02 -#define PHY_CTRL1 0x03 -#define PHY_CTRL2 0x04 -#define PHY_CTRL3 0x05 -#define RX_FRM_LEN 0x06 -#define PHY_CTRL4 0x07 -#define SRC_CTRL 0x08 -#define SRC_ADDRS_SUM_LSB 0x09 -#define SRC_ADDRS_SUM_MSB 0x0A -#define CCA1_ED_FNL 0x0B -#define EVENT_TMR_LSB 0x0C -#define EVENT_TMR_MSB 0x0D -#define EVENT_TMR_USB 0x0E -#define TIMESTAMP_LSB 0x0F -#define TIMESTAMP_MSB 0x10 -#define TIMESTAMP_USB 0x11 -#define T3CMP_LSB 0x12 -#define T3CMP_MSB 0x13 -#define T3CMP_USB 0x14 -#define T2PRIMECMP_LSB 0x15 -#define T2PRIMECMP_MSB 0x16 -#define T1CMP_LSB 0x17 -#define T1CMP_MSB 0x18 -#define T1CMP_USB 0x19 -#define T2CMP_LSB 0x1A -#define T2CMP_MSB 0x1B -#define T2CMP_USB 0x1C -#define T4CMP_LSB 0x1D -#define T4CMP_MSB 0x1E -#define T4CMP_USB 0x1F -#define PLL_INT0 0x20 -#define PLL_FRAC0_LSB 0x21 -#define PLL_FRAC0_MSB 0x22 -#define PA_PWR 0x23 -#define SEQ_STATE 0x24 -#define LQI_VALUE 0x25 -#define RSSI_CCA_CONT 0x26 -//-------------- 0x27 -#define ASM_CTRL1 0x28 -#define ASM_CTRL2 0x29 -#define ASM_DATA_0 0x2A -#define ASM_DATA_1 0x2B -#define ASM_DATA_2 0x2C -#define ASM_DATA_3 0x2D -#define ASM_DATA_4 0x2E -#define ASM_DATA_5 0x2F -#define ASM_DATA_6 0x30 -#define ASM_DATA_7 0x31 -#define ASM_DATA_8 0x32 -#define ASM_DATA_9 0x33 -#define ASM_DATA_A 0x34 -#define ASM_DATA_B 0x35 -#define ASM_DATA_C 0x36 -#define ASM_DATA_D 0x37 -#define ASM_DATA_E 0x38 -#define ASM_DATA_F 0x39 -//------------------- 0x3A -#define OVERWRITE_VER 0x3B -#define CLK_OUT_CTRL 0x3C -#define PWR_MODES 0x3D -#define IAR_INDEX 0x3E -#define IAR_DATA 0x3F - - -#define PART_ID 0x00 -#define XTAL_TRIM 0x01 -#define PMC_LP_TRIM 0x02 -#define MACPANID0_LSB 0x03 -#define MACPANID0_MSB 0x04 -#define MACSHORTADDRS0_LSB 0x05 -#define MACSHORTADDRS0_MSB 0x06 -#define MACLONGADDRS0_0 0x07 -#define MACLONGADDRS0_8 0x08 -#define MACLONGADDRS0_16 0x09 -#define MACLONGADDRS0_24 0x0A -#define MACLONGADDRS0_32 0x0B -#define MACLONGADDRS0_40 0x0C -#define MACLONGADDRS0_48 0x0D -#define MACLONGADDRS0_56 0x0E -#define RX_FRAME_FILTER 0x0F -#define PLL_INT1 0x10 -#define PLL_FRAC1_LSB 0x11 -#define PLL_FRAC1_MSB 0x12 -#define MACPANID1_LSB 0x13 -#define MACPANID1_MSB 0x14 -#define MACSHORTADDRS1_LSB 0x15 -#define MACSHORTADDRS1_MSB 0x16 -#define MACLONGADDRS1_0 0x17 -#define MACLONGADDRS1_8 0x18 -#define MACLONGADDRS1_16 0x19 -#define MACLONGADDRS1_24 0x1A -#define MACLONGADDRS1_32 0x1B -#define MACLONGADDRS1_40 0x1C -#define MACLONGADDRS1_48 0x1D -#define MACLONGADDRS1_56 0x1E -#define DUAL_PAN_CTRL 0x1F -#define DUAL_PAN_DWELL 0x20 -#define DUAL_PAN_STS 0x21 -#define CCA1_THRESH 0x22 -#define CCA1_ED_OFFSET_COMP 0x23 -#define LQI_OFFSET_COMP 0x24 -#define CCA_CTRL 0x25 -#define CCA2_CORR_PEAKS 0x26 -#define CCA2_CORR_THRESH 0x27 -#define TMR_PRESCALE 0x28 -//---------------- 0x29 -#define GPIO_DATA 0x2A -#define GPIO_DIR 0x2B -#define GPIO_PUL_EN 0x2C -#define GPIO_PUL_SEL 0x2D -#define GPIO_DS 0x2E -//-------------- 0x2F -#define ANT_PAD_CTRL 0x30 -#define MISC_PAD_CTRL 0x31 -#define BSM_CTRL 0x32 -//--------------- 0x33 -#define _RNG 0x34 -#define RX_BYTE_COUNT 0x35 -#define RX_WTR_MARK 0x36 -#define SOFT_RESET 0x37 -#define TXDELAY 0x38 -#define ACKDELAY 0x39 -#define SEQ_MGR_CTRL 0x3A -#define SEQ_MGR_STS 0x3B -#define SEQ_T_STS 0x3C -#define ABORT_STS 0x3D -#define CCCA_BUSY_CNT 0x3E -#define SRC_ADDR_CHECKSUM1 0x3F -#define SRC_ADDR_CHECKSUM2 0x40 -#define SRC_TBL_VALID1 0x41 -#define SRC_TBL_VALID2 0x42 -#define FILTERFAIL_CODE1 0x43 -#define FILTERFAIL_CODE2 0x44 -#define SLOT_PRELOAD 0x45 -//---------------- 0x46 -#define CORR_VT 0x47 -#define SYNC_CTRL 0x48 -#define PN_LSB_0 0x49 -#define PN_LSB_1 0x4A -#define PN_MSB_0 0x4B -#define PN_MSB_1 0x4C -#define CORR_NVAL 0x4D -#define TX_MODE_CTRL 0x4E -#define SNF_THR 0x4F -#define FAD_THR 0x50 -#define ANT_AGC_CTRL 0x51 -#define AGC_THR1 0x52 -#define AGC_THR2 0x53 -#define AGC_HYS 0x54 -#define AFC 0x55 -//--------------- 0x56 -//--------------- 0x57 -#define PHY_STS 0x58 -#define RX_MAX_CORR 0x59 -#define RX_MAX_PREAMBLE 0x5A -#define RSSI 0x5B -//--------------- 0x5C -//--------------- 0x5D -#define PLL_DIG_CTRL 0x5E -#define VCO_CAL 0x5F -#define VCO_BEST_DIFF 0x60 -#define VCO_BIAS 0x61 -#define KMOD_CTRL 0x62 -#define KMOD_CAL 0x63 -#define PA_CAL 0x64 -#define PA_PWRCAL 0x65 -#define ATT_RSSI1 0x66 -#define ATT_RSSI2 0x67 -#define RSSI_OFFSET 0x68 -#define RSSI_SLOPE 0x69 -#define RSSI_CAL1 0x6A -#define RSSI_CAL2 0x6B -//--------------- 0x6C -//--------------- 0x6D -#define XTAL_CTRL 0x6E -#define XTAL_COMP_MIN 0x6F -#define XTAL_COMP_MAX 0x70 -#define XTAL_GM 0x71 -//--------------- 0x72 -//--------------- 0x73 -#define LNA_TUNE 0x74 -#define LNA_AGCGAIN 0x75 -//--------------- 0x76 -//--------------- 0x77 -#define CHF_PMA_GAIN 0x78 -#define CHF_IBUF 0x79 -#define CHF_QBUF 0x7A -#define CHF_IRIN 0x7B -#define CHF_QRIN 0x7C -#define CHF_IL 0x7D -#define CHF_QL 0x7E -#define CHF_CC1 0x7F -#define CHF_CCL 0x80 -#define CHF_CC2 0x81 -#define CHF_IROUT 0x82 -#define CHF_QROUT 0x83 -//--------------- 0x84 -//--------------- 0x85 -#define RSSI_CTRL 0x86 -//--------------- 0x87 -//--------------- 0x88 -#define PA_BIAS 0x89 -#define PA_TUNING 0x8A -//--------------- 0x8B -//--------------- 0x8C -#define PMC_HP_TRIM 0x8D -#define VREGA_TRIM 0x8E -//--------------- 0x8F -//--------------- 0x90 -#define VCO_CTRL1 0x91 -#define VCO_CTRL2 0x92 -//--------------- 0x93 -//--------------- 0x94 -#define ANA_SPARE_OUT1 0x95 -#define ANA_SPARE_OUT2 0x96 -#define ANA_SPARE_IN 0x97 -#define MISCELLANEOUS 0x98 -//--------------- 0x99 -#define SEQ_MGR_OVRD0 0x9A -#define SEQ_MGR_OVRD1 0x9B -#define SEQ_MGR_OVRD2 0x9C -#define SEQ_MGR_OVRD3 0x9D -#define SEQ_MGR_OVRD4 0x9E -#define SEQ_MGR_OVRD5 0x9F -#define SEQ_MGR_OVRD6 0xA0 -#define SEQ_MGR_OVRD7 0xA1 -//--------------- 0xA2 -#define TESTMODE_CTRL 0xA3 -#define DTM_CTRL1 0xA4 -#define DTM_CTRL2 0xA5 -#define ATM_CTRL1 0xA6 -#define ATM_CTRL2 0xA7 -#define ATM_CTRL3 0xA8 -//--------------- 0xA9 -#define LIM_FE_TEST_CTRL 0xAA -#define CHF_TEST_CTRL 0xAB -#define VCO_TEST_CTRL 0xAC -#define PLL_TEST_CTRL 0xAD -#define PA_TEST_CTRL 0xAE -#define PMC_TEST_CTRL 0xAF -#define SCAN_DTM_PROTECT_1 0xFE -#define SCAN_DTM_PROTECT_0 0xFF - -// IRQSTS1 bits -#define cIRQSTS1_RX_FRM_PEND (1<<7) -#define cIRQSTS1_PLL_UNLOCK_IRQ (1<<6) -#define cIRQSTS1_FILTERFAIL_IRQ (1<<5) -#define cIRQSTS1_RXWTRMRKIRQ (1<<4) -#define cIRQSTS1_CCAIRQ (1<<3) -#define cIRQSTS1_RXIRQ (1<<2) -#define cIRQSTS1_TXIRQ (1<<1) -#define cIRQSTS1_SEQIRQ (1<<0) - -typedef union regIRQSTS1_tag { - uint8_t byte; - struct { - uint8_t SEQIRQ: 1; - uint8_t TXIRQ: 1; - uint8_t RXIRQ: 1; - uint8_t CCAIRQ: 1; - uint8_t RXWTRMRKIRQ: 1; - uint8_t FILTERFAIL_IRQ: 1; - uint8_t PLL_UNLOCK_IRQ: 1; - uint8_t RX_FRM_PEND: 1; - } bit; -} regIRQSTS1_t; - -// IRQSTS2 bits -#define cIRQSTS2_CRCVALID (1<<7) -#define cIRQSTS2_CCA (1<<6) -#define cIRQSTS2_SRCADDR (1<<5) -#define cIRQSTS2_PI (1<<4) -#define cIRQSTS2_TMRSTATUS (1<<3) -#define cIRQSTS2_ASM_IRQ (1<<2) -#define cIRQSTS2_PB_ERR_IRQ (1<<1) -#define cIRQSTS2_WAKE_IRQ (1<<0) - -typedef union regIRQSTS2_tag { - uint8_t byte; - struct { - uint8_t WAKE_IRQ: 1; - uint8_t PB_ERR_IRQ: 1; - uint8_t ASM_IRQ: 1; - uint8_t TMRSTATUS: 1; - uint8_t PI_: 1; - uint8_t SRCADDR: 1; - uint8_t CCA: 1; - uint8_t CRCVALID: 1; - } bit; -} regIRQSTS2_t; - -// IRQSTS3 bits -#define cIRQSTS3_TMR4MSK (1<<7) -#define cIRQSTS3_TMR3MSK (1<<6) -#define cIRQSTS3_TMR2MSK (1<<5) -#define cIRQSTS3_TMR1MSK (1<<4) -#define cIRQSTS3_TMR4IRQ (1<<3) -#define cIRQSTS3_TMR3IRQ (1<<2) -#define cIRQSTS3_TMR2IRQ (1<<1) -#define cIRQSTS3_TMR1IRQ (1<<0) - -typedef union regIRQSTS3_tag { - uint8_t byte; - struct { - uint8_t TMR1IRQ: 1; - uint8_t TMR2IRQ: 1; - uint8_t TMR3IRQ: 1; - uint8_t TMR4IRQ: 1; - uint8_t TMR1MSK: 1; - uint8_t TMR2MSK: 1; - uint8_t TMR3MSK: 1; - uint8_t TMR4MSK: 1; - } bit; -} regIRQSTS3_t; - -// PHY_CTRL1 bits -#define cPHY_CTRL1_TMRTRIGEN (1<<7) -#define cPHY_CTRL1_SLOTTED (1<<6) -#define cPHY_CTRL1_CCABFRTX (1<<5) -#define cPHY_CTRL1_RXACKRQD (1<<4) -#define cPHY_CTRL1_AUTOACK (1<<3) -#define cPHY_CTRL1_XCVSEQ (7<<0) - -typedef union regPHY_CTRL1_tag { - uint8_t byte; - struct { - uint8_t XCVSEQ: 3; - uint8_t AUTOACK: 1; - uint8_t RXACKRQD: 1; - uint8_t CCABFRTX: 1; - uint8_t SLOTTED: 1; - uint8_t TMRTRIGEN: 1; - } bit; -} regPHY_CTRL1_t; - -// PHY_CTRL2 bits -#define cPHY_CTRL2_CRC_MSK (1<<7) -#define cPHY_CTRL2_PLL_UNLOCK_MSK (1<<6) -#define cPHY_CTRL2_FILTERFAIL_MSK (1<<5) -#define cPHY_CTRL2_RX_WMRK_MSK (1<<4) -#define cPHY_CTRL2_CCAMSK (1<<3) -#define cPHY_CTRL2_RXMSK (1<<2) -#define cPHY_CTRL2_TXMSK (1<<1) -#define cPHY_CTRL2_SEQMSK (1<<0) - -typedef union regPHY_CTRL2_tag { - uint8_t byte; - struct { - uint8_t SEQMSK: 1; - uint8_t TXMSK: 1; - uint8_t RXMSK: 1; - uint8_t CCAMSK: 1; - uint8_t RX_WMRK_MSK: 1; - uint8_t FILTERFAIL_MSK: 1; - uint8_t PLL_UNLOCK_MSK: 1; - uint8_t CRC_MSK: 1; - } bit; -} regPHY_CTRL2_t; - -// PHY_CTRL3 bits -#define cPHY_CTRL3_TMR4CMP_EN (1<<7) -#define cPHY_CTRL3_TMR3CMP_EN (1<<6) -#define cPHY_CTRL3_TMR2CMP_EN (1<<5) -#define cPHY_CTRL3_TMR1CMP_EN (1<<4) -#define cPHY_CTRL3_ASM_MSK (1<<2) -#define cPHY_CTRL3_PB_ERR_MSK (1<<1) -#define cPHY_CTRL3_WAKE_MSK (1<<0) - -typedef union regPHY_CTRL3_tag { - uint8_t byte; - struct { - uint8_t WAKE_MSK: 1; - uint8_t PB_ERR_MSK: 1; - uint8_t ASM_MSK: 1; - uint8_t RESERVED: 1; - uint8_t TMR1CMP_EN: 1; - uint8_t TMR2CMP_EN: 1; - uint8_t TMR3CMP_EN: 1; - uint8_t TMR4CMP_EN: 1; - } bit; -} regPHY_CTRL3_t; - -// RX_FRM_LEN bits -#define cRX_FRAME_LENGTH (0x7F) - -// PHY_CTRL4 bits -#define cPHY_CTRL4_TRCV_MSK (1<<7) -#define cPHY_CTRL4_TC3TMOUT (1<<6) -#define cPHY_CTRL4_PANCORDNTR0 (1<<5) -#define cPHY_CTRL4_CCATYPE (3<<0) -#define cPHY_CTRL4_CCATYPE_Shift_c (3) -#define cPHY_CTRL4_TMRLOAD (1<<2) -#define cPHY_CTRL4_PROMISCUOUS (1<<1) -#define cPHY_CTRL4_TC2PRIME_EN (1<<0) - -typedef union regPHY_CTRL4_tag { - uint8_t byte; - struct { - uint8_t TC2PRIME_EN: 1; - uint8_t PROMISCUOUS: 1; - uint8_t TMRLOAD: 1; - uint8_t CCATYPE: 2; - uint8_t PANCORDNTR0: 1; - uint8_t TC3TMOUT: 1; - uint8_t TRCV_MSK: 1; - } bit; -} regPHY_CTRL4_t; - -// SRC_CTRL bits -#define cSRC_CTRL_INDEX (0x0F) -#define cSRC_CTRL_INDEX_Shift_c (4) -#define cSRC_CTRL_ACK_FRM_PND (1<<3) -#define cSRC_CTRL_SRCADDR_EN (1<<2) -#define cSRC_CTRL_INDEX_EN (1<<1) -#define cSRC_CTRL_INDEX_DISABLE (1<<0) - -typedef union regSRC_CTRL_tag { - uint8_t byte; - struct { - uint8_t INDEX_DISABLE: 1; - uint8_t INDEX_EN: 1; - uint8_t SRCADDR_EN: 1; - uint8_t ACK_FRM_PND: 1; - uint8_t INDEX: 4; - } bit; -} regSRC_CTRL_t; - -// ASM_CTRL1 bits -#define cASM_CTRL1_CLEAR (1<<7) -#define cASM_CTRL1_START (1<<6) -#define cASM_CTRL1_SELFTST (1<<5) -#define cASM_CTRL1_CTR (1<<4) -#define cASM_CTRL1_CBC (1<<3) -#define cASM_CTRL1_AES (1<<2) -#define cASM_CTRL1_LOAD_MAC (1<<1) - -// ASM_CTRL2 bits -#define cASM_CTRL2_DATA_REG_TYPE_SEL (7) -#define cASM_CTRL2_DATA_REG_TYPE_SEL_Shift_c (5) -#define cASM_CTRL2_TSTPAS (1<<1) - -// CLK_OUT_CTRL bits -#define cCLK_OUT_CTRL_EXTEND (1<<7) -#define cCLK_OUT_CTRL_HIZ (1<<6) -#define cCLK_OUT_CTRL_SR (1<<5) -#define cCLK_OUT_CTRL_DS (1<<4) -#define cCLK_OUT_CTRL_EN (1<<3) -#define cCLK_OUT_CTRL_DIV (7) - -// PWR_MODES bits -#define cPWR_MODES_XTAL_READY (1<<5) -#define cPWR_MODES_XTALEN (1<<4) -#define cPWR_MODES_ASM_CLK_EN (1<<3) -#define cPWR_MODES_AUTODOZE (1<<1) -#define cPWR_MODES_PMC_MODE (1<<0) - -// RX_FRAME_FILTER bits -#define cRX_FRAME_FLT_FRM_VER (0xC0) -#define cRX_FRAME_FLT_FRM_VER_Shift_c (6) -#define cRX_FRAME_FLT_ACTIVE_PROMISCUOUS (1<<5) -#define cRX_FRAME_FLT_NS_FT (1<<4) -#define cRX_FRAME_FLT_CMD_FT (1<<3) -#define cRX_FRAME_FLT_ACK_FT (1<<2) -#define cRX_FRAME_FLT_DATA_FT (1<<1) -#define cRX_FRAME_FLT_BEACON_FT (1<<0) - -typedef union regRX_FRAME_FILTER_tag { - uint8_t byte; - struct { - uint8_t FRAME_FLT_BEACON_FT: 1; - uint8_t FRAME_FLT_DATA_FT: 1; - uint8_t FRAME_FLT_ACK_FT: 1; - uint8_t FRAME_FLT_CMD_FT: 1; - uint8_t FRAME_FLT_NS_FT: 1; - uint8_t FRAME_FLT_ACTIVE_PROMISCUOUS: 1; - uint8_t FRAME_FLT_FRM_VER: 2; - } bit; -} regRX_FRAME_FILTER_t; - -// DUAL_PAN_CTRL bits -#define cDUAL_PAN_CTRL_DUAL_PAN_SAM_LVL_MSK (0xF0) -#define cDUAL_PAN_CTRL_DUAL_PAN_SAM_LVL_Shift_c (4) -#define cDUAL_PAN_CTRL_CURRENT_NETWORK (1<<3) -#define cDUAL_PAN_CTRL_PANCORDNTR1 (1<<2) -#define cDUAL_PAN_CTRL_DUAL_PAN_AUTO (1<<1) -#define cDUAL_PAN_CTRL_ACTIVE_NETWORK (1<<0) - -// DUAL_PAN_STS bits -#define cDUAL_PAN_STS_RECD_ON_PAN1 (1<<7) -#define cDUAL_PAN_STS_RECD_ON_PAN0 (1<<6) -#define cDUAL_PAN_STS_DUAL_PAN_REMAIN (0x3F) - -// CCA_CTRL bits -#define cCCA_CTRL_AGC_FRZ_EN (1<<6) -#define cCCA_CTRL_CONT_RSSI_EN (1<<5) -#define cCCA_CTRL_LQI_RSSI_NOT_CORR (1<<4) -#define cCCA_CTRL_CCA3_AND_NOT_OR (1<<3) -#define cCCA_CTRL_POWER_COMP_EN_LQI (1<<2) -#define cCCA_CTRL_POWER_COMP_EN_ED (1<<1) -#define cCCA_CTRL_POWER_COMP_EN_CCA1 (1<<0) - -// GPIO_DATA bits -#define cGPIO_DATA_7 (1<<7) -#define cGPIO_DATA_6 (1<<6) -#define cGPIO_DATA_5 (1<<5) -#define cGPIO_DATA_4 (1<<4) -#define cGPIO_DATA_3 (1<<3) -#define cGPIO_DATA_2 (1<<2) -#define cGPIO_DATA_1 (1<<1) -#define cGPIO_DATA_0 (1<<0) - -// GPIO_DIR bits -#define cGPIO_DIR_7 (1<<7) -#define cGPIO_DIR_6 (1<<6) -#define cGPIO_DIR_5 (1<<5) -#define cGPIO_DIR_4 (1<<4) -#define cGPIO_DIR_3 (1<<3) -#define cGPIO_DIR_2 (1<<2) -#define cGPIO_DIR_1 (1<<1) -#define cGPIO_DIR_0 (1<<0) - -// GPIO_PUL_EN bits -#define cGPIO_PUL_EN_7 (1<<7) -#define cGPIO_PUL_EN_6 (1<<6) -#define cGPIO_PUL_EN_5 (1<<5) -#define cGPIO_PUL_EN_4 (1<<4) -#define cGPIO_PUL_EN_3 (1<<3) -#define cGPIO_PUL_EN_2 (1<<2) -#define cGPIO_PUL_EN_1 (1<<1) -#define cGPIO_PUL_EN_0 (1<<0) - -// GPIO_PUL_SEL bits -#define cGPIO_PUL_SEL_7 (1<<7) -#define cGPIO_PUL_SEL_6 (1<<6) -#define cGPIO_PUL_SEL_5 (1<<5) -#define cGPIO_PUL_SEL_4 (1<<4) -#define cGPIO_PUL_SEL_3 (1<<3) -#define cGPIO_PUL_SEL_2 (1<<2) -#define cGPIO_PUL_SEL_1 (1<<1) -#define cGPIO_PUL_SEL_0 (1<<0) - -// GPIO_DS bits -#define cGPIO_DS_7 (1<<7) -#define cGPIO_DS_6 (1<<6) -#define cGPIO_DS_5 (1<<5) -#define cGPIO_DS_4 (1<<4) -#define cGPIO_DS_3 (1<<3) -#define cGPIO_DS_2 (1<<2) -#define cGPIO_DS_1 (1<<1) -#define cGPIO_DS_0 (1<<0) - -// SPI_CTRL bits -//#define cSPI_CTRL_MISO_HIZ_EN (1<<1) -//#define cSPI_CTRL_PB_PROTECT (1<<0) - -// ANT_PAD_CTRL bits -#define cANT_PAD_CTRL_ANTX_POL (0x0F) -#define cANT_PAD_CTRL_ANTX_POL_Shift_c (4) -#define cANT_PAD_CTRL_ANTX_CTRLMODE (1<<3) -#define cANT_PAD_CTRL_ANTX_HZ (1<<2) -#define cANT_PAD_CTRL_ANTX_EN (3) - -// MISC_PAD_CTRL bits -#define cMISC_PAD_CTRL_MISO_HIZ_EN (1<<3) -#define cMISC_PAD_CTRL_IRQ_B_OD (1<<2) -#define cMISC_PAD_CTRL_NON_GPIO_DS (1<<1) -#define cMISC_PAD_CTRL_ANTX_CURR (1<<0) - -// ANT_AGC_CTRL bits -#define cANT_AGC_CTRL_FAD_EN_Shift_c (0) -#define cANT_AGC_CTRL_FAD_EN_Mask_c (1< -#include "rtos.h" -#include "mbed_interface.h" -#include "platform/mbed_error.h" - -using namespace mbed; -using namespace rtos; - -/* Freescale headers which are for C files */ -extern "C" { -#include "MCR20Drv.h" -#include "MCR20Reg.h" -#include "MCR20Overwrites.h" -} - - -#define RF_BUFFER_SIZE 128 - -/*Radio RX and TX state definitions*/ -#define RFF_ON 0x01 -#define RFF_RX 0x02 -#define RFF_TX 0x04 -#define RFF_CCA 0x08 - -#define RF_MODE_NORMAL 0 -#define RF_MODE_SNIFFER 1 - -#define RF_CCA_THRESHOLD 75 /* -75 dBm */ - -#define RF_TX_POWER_MAX 0 - -/* PHY constants in symbols */ -#define gPhyWarmUpTime_c 9 -#define gPhySHRDuration_c 10 -#define gPhySymbolsPerOctet_c 2 -#define gPhyAckWaitDuration_c 54 - -#define gCcaED_c 0 -#define gCcaCCA_MODE1_c 1 - -#define gXcvrRunState_d gXcvrPwrAutodoze_c -#define gXcvrLowPowerState_d gXcvrPwrHibernate_c - -namespace { - -/* MCR20A XCVR states */ -typedef enum xcvrState_tag { - gIdle_c, - gRX_c, - gTX_c, - gCCA_c, - gTR_c, - gCCCA_c, -} xcvrState_t; - -/* MCR20A XCVR low power states */ -typedef enum xcvrPwrMode_tag { - gXcvrPwrIdle_c, - gXcvrPwrAutodoze_c, - gXcvrPwrDoze_c, - gXcvrPwrHibernate_c -} xcvrPwrMode_t; - - -/*RF Part Type*/ -typedef enum { - FREESCALE_UNKNOW_DEV = 0, - FREESCALE_MCR20A -} rf_trx_part_e; - -/*Atmel RF states*/ -typedef enum { - NOP = 0x00, - BUSY_RX = 0x01, - RF_TX_START = 0x02, - FORCE_TRX_OFF = 0x03, - FORCE_PLL_ON = 0x04, - RX_ON = 0x06, - TRX_OFF = 0x08, - PLL_ON = 0x09, - BUSY_RX_AACK = 0x11, - SLEEP = 0x0F, - RX_AACK_ON = 0x16, - TX_ARET_ON = 0x19 -} rf_trx_states_t; - -} // anonymous namespace - -/*RF receive buffer*/ -static uint8_t rf_buffer[RF_BUFFER_SIZE]; - -/* TX info */ -static uint8_t radio_tx_power = 0x17; /* 0 dBm */ -static uint8_t mac_tx_handle = 0; -static uint8_t need_ack = 0; -static uint16_t tx_len = 0; - -/* RF driver data */ -static xcvrState_t mPhySeqState; -static xcvrPwrMode_t mPwrState; -static phy_device_driver_s device_driver; -static uint8_t mStatusAndControlRegs[8]; -static uint8_t rf_rnd = 0; -static int8_t rf_radio_driver_id = -1; -static uint8_t MAC_address[8]; - -/* Driver instance handle and hardware */ -static NanostackRfPhyMcr20a *rf = NULL; -static SPI *spi = NULL; -static DigitalOut *cs = NULL; -static DigitalOut *rst = NULL; -static InterruptIn *irq = NULL; -static DigitalIn *irq_pin = NULL; -static Thread *irq_thread = NULL; - -/* Channel info */ /* 2405 2410 2415 2420 2425 2430 2435 2440 2445 2450 2455 2460 2465 2470 2475 2480 */ -static const uint8_t pll_int[16] = {0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D}; -static const uint16_t pll_frac[16] = {0x2800, 0x5000, 0x7800, 0xA000, 0xC800, 0xF000, 0x1800, 0x4000, 0x6800, 0x9000, 0xB800, 0xE000, 0x0800, 0x3000, 0x5800, 0x8000}; - -/* Channel configurations for 2.4 */ -static const phy_rf_channel_configuration_s phy_24ghz = {.channel_0_center_frequency = 2405000000U, .channel_spacing = 5000000U, .datarate = 250000U, .number_of_channels = 16U, .modulation = M_OQPSK}; - -static const phy_device_channel_page_s phy_channel_pages[] = { - { CHANNEL_PAGE_0, &phy_24ghz}, - { CHANNEL_PAGE_0, NULL} -}; - - -static rf_trx_part_e rf_radio_type_read(void); - -MBED_UNUSED static void rf_ack_wait_timer_start(uint16_t slots); -MBED_UNUSED static void rf_ack_wait_timer_stop(void); -MBED_UNUSED static void rf_handle_cca_ed_done(void); -MBED_UNUSED static void rf_handle_tx_end(void); -MBED_UNUSED static void rf_handle_rx_end(void); -MBED_UNUSED static void rf_on(void); -MBED_UNUSED static void rf_receive(void); -MBED_UNUSED static void rf_poll_trx_state_change(rf_trx_states_t trx_state); -MBED_UNUSED static void rf_init(void); -MBED_UNUSED static void rf_set_mac_address(const uint8_t *ptr); -MBED_UNUSED static int8_t rf_device_register(void); -MBED_UNUSED static void rf_device_unregister(void); -MBED_UNUSED static int8_t rf_start_cca(uint8_t *data_ptr, uint16_t data_length, uint8_t tx_handle, data_protocol_e data_protocol); -MBED_UNUSED static void rf_cca_abort(void); -MBED_UNUSED static void rf_read_mac_address(uint8_t *ptr); -MBED_UNUSED static int8_t rf_read_random(void); -MBED_UNUSED static void rf_calibration_cb(void); -MBED_UNUSED static void rf_init_phy_mode(void); -MBED_UNUSED static void rf_ack_wait_timer_interrupt(void); -MBED_UNUSED static void rf_calibration_timer_interrupt(void); -MBED_UNUSED static void rf_calibration_timer_start(uint32_t slots); -MBED_UNUSED static void rf_cca_timer_interrupt(void); -MBED_UNUSED static void rf_cca_timer_start(uint32_t slots); -MBED_UNUSED static uint16_t rf_get_phy_mtu_size(void); -MBED_UNUSED static uint8_t rf_scale_lqi(int8_t rssi); - -/** - * RF output power write - * - * \brief TX power has to be set before network start. - * - * \param power - * See datasheet for TX power settings - * - * \return 0, Supported Value - * \return -1, Not Supported Value - */ -MBED_UNUSED static int8_t rf_tx_power_set(uint8_t power); -MBED_UNUSED static uint8_t rf_tx_power_get(void); -MBED_UNUSED static int8_t rf_enable_antenna_diversity(void); - -/* Private functions */ -MBED_UNUSED static void rf_abort(void); -MBED_UNUSED static void rf_promiscuous(uint8_t mode); -MBED_UNUSED static void rf_get_timestamp(uint32_t *pRetClk); -MBED_UNUSED static void rf_set_timeout(uint32_t *pEndTime); -MBED_UNUSED static void rf_set_power_state(xcvrPwrMode_t newState); -MBED_UNUSED static uint8_t rf_if_read_rnd(void); -MBED_UNUSED static uint8_t rf_convert_LQI(uint8_t hwLqi); -MBED_UNUSED static uint8_t rf_get_channel_energy(void); -MBED_UNUSED static uint8_t rf_convert_energy_level(uint8_t energyLevel); -MBED_UNUSED static int8_t rf_convert_LQI_to_RSSI(uint8_t lqi); -MBED_UNUSED static int8_t rf_interface_state_control(phy_interface_state_e new_state, uint8_t rf_channel); -MBED_UNUSED static int8_t rf_extension(phy_extension_type_e extension_type, uint8_t *data_ptr); -MBED_UNUSED static int8_t rf_address_write(phy_address_type_e address_type, uint8_t *address_ptr); -static void PHY_InterruptThread(void); -static void handle_interrupt(void); - - -/* - * \brief Read connected radio part. - * - * This function only return valid information when rf_init() is called - * - * \return - */ -static rf_trx_part_e rf_radio_type_read(void) -{ - return FREESCALE_MCR20A; -} - -/* - * \brief Function initialises and registers the RF driver. - * - * \param none - * - * \return rf_radio_driver_id Driver ID given by NET library - */ -static int8_t rf_device_register(void) -{ - rf_trx_part_e radio_type; - - rf_init(); - - - - radio_type = rf_radio_type_read(); - if (radio_type == FREESCALE_MCR20A) { - /*Set pointer to MAC address*/ - device_driver.PHY_MAC = MAC_address; - device_driver.driver_description = (char *)"FREESCALE_MAC"; - - //Create setup Used Radio chips - /*Type of RF PHY is SubGHz*/ - device_driver.link_type = PHY_LINK_15_4_2_4GHZ_TYPE; - - device_driver.phy_channel_pages = phy_channel_pages; - /*Maximum size of payload is 127*/ - device_driver.phy_MTU = 127; - /*No header in PHY*/ - device_driver.phy_header_length = 0; - /*No tail in PHY*/ - device_driver.phy_tail_length = 0; - /*Set address write function*/ - device_driver.address_write = &rf_address_write; - /*Set RF extension function*/ - device_driver.extension = &rf_extension; - /*Set RF state control function*/ - device_driver.state_control = &rf_interface_state_control; - /*Set transmit function*/ - device_driver.tx = &rf_start_cca; - /*Upper layer callbacks init to NULL*/ - device_driver.phy_rx_cb = NULL; - device_driver.phy_tx_done_cb = NULL; - /*Virtual upper data callback init to NULL*/ - device_driver.arm_net_virtual_rx_cb = NULL; - device_driver.arm_net_virtual_tx_cb = NULL; - - /*Register device driver*/ - rf_radio_driver_id = arm_net_phy_register(&device_driver); - } - - return rf_radio_driver_id; -} - -/* - * \brief Function unregisters the RF driver. - * - * \param none - * - * \return none - */ -static void rf_device_unregister(void) -{ - arm_net_phy_unregister(rf_radio_driver_id); -} - -/* - * \brief Function returns the generated 8-bit random value for seeding Pseudo-random generator. - * - * \param none - * - * \return random value - */ -static int8_t rf_read_random(void) -{ - return rf_rnd; -} - -/* - * \brief Function is a call back for ACK wait timeout. - * - * \param none - * - * \return none - */ -static void rf_ack_wait_timer_interrupt(void) -{ - /* The packet was transmitted successfully, but no ACK was received */ - if (device_driver.phy_tx_done_cb) { - device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_TX_SUCCESS, 1, 1); - } - rf_receive(); -} - -/* - * \brief Function is a call back for calibration interval timer. - * - * \param none - * - * \return none - */ -static void rf_calibration_timer_interrupt(void) -{ -} - -/* - * \brief Function is a call back for cca interval timer. - * - * \param none - * - * \return none - */ -static void rf_cca_timer_interrupt(void) -{ - /* CCA time-out handled by Hardware */ -} - - -/* - * \brief Function starts the ACK wait time-out. - * - * \param slots The ACK wait time-out in [symbols] - * - * \return none - */ -static void rf_ack_wait_timer_start(uint16_t time) -{ - uint32_t timeout; - - rf_get_timestamp(&timeout); - timeout += time; - rf_set_timeout(&timeout); -} - -/* - * \brief Function starts the calibration interval. - * - * \param slots Given slots, resolution 50us - * - * \return none - */ -static void rf_calibration_timer_start(uint32_t slots) -{ - (void)slots; -} - -/* - * \brief Function starts the CCA timout. - * - * \param slots Given slots, resolution 50us - * - * \return none - */ -static void rf_cca_timer_start(uint32_t slots) -{ - (void)slots; -} - -/* - * \brief Function stops the ACK wait timeout. - * - * \param none - * - * \return none - */ -static void rf_ack_wait_timer_stop(void) -{ -} - -/* - * \brief Function reads the MAC address array. - * - * \param ptr Pointer to read array - * - * \return none - */ -static void rf_read_mac_address(uint8_t *ptr) -{ - memcpy(ptr, MAC_address, 8); -} - -/* - * \brief Function sets the MAC address array. - * - * \param ptr Pointer to given MAC address array - * - * \return none - */ -static void rf_set_mac_address(const uint8_t *ptr) -{ - memcpy(MAC_address, ptr, 8); -} - -static uint16_t rf_get_phy_mtu_size(void) -{ - return device_driver.phy_MTU; -} - -/* - * \brief Function writes 16-bit address in RF address filter. - * - * \param short_address Given short address - * - * \return none - */ -static void rf_set_short_adr(uint8_t *short_address) -{ - /* Write one register at a time to be accessible from hibernate mode */ - MCR20Drv_IndirectAccessSPIWrite(MACSHORTADDRS0_MSB, short_address[0]); - MCR20Drv_IndirectAccessSPIWrite(MACSHORTADDRS0_LSB, short_address[1]); -} - -/* - * \brief Function writes PAN Id in RF PAN Id filter. - * - * \param pan_id Given PAN Id - * - * \return none - */ -static void rf_set_pan_id(uint8_t *pan_id) -{ - /* Write one register at a time to be accessible from hibernate mode */ - MCR20Drv_IndirectAccessSPIWrite(MACPANID0_MSB, pan_id[0]); - MCR20Drv_IndirectAccessSPIWrite(MACPANID0_LSB, pan_id[1]); -} - -/* - * \brief Function writes 64-bit address in RF address filter. - * - * \param address Given 64-bit address - * - * \return none - */ -static void rf_set_address(uint8_t *address) -{ - /* Write one register at a time to be accessible from hibernate mode */ - MCR20Drv_IndirectAccessSPIWrite(MACLONGADDRS0_0, address[7]); - MCR20Drv_IndirectAccessSPIWrite(MACLONGADDRS0_8, address[6]); - MCR20Drv_IndirectAccessSPIWrite(MACLONGADDRS0_16, address[5]); - MCR20Drv_IndirectAccessSPIWrite(MACLONGADDRS0_24, address[4]); - MCR20Drv_IndirectAccessSPIWrite(MACLONGADDRS0_32, address[3]); - MCR20Drv_IndirectAccessSPIWrite(MACLONGADDRS0_40, address[2]); - MCR20Drv_IndirectAccessSPIWrite(MACLONGADDRS0_48, address[1]); - MCR20Drv_IndirectAccessSPIWrite(MACLONGADDRS0_56, address[0]); -} - -/* - * \brief Function sets the RF channel. - * - * \param ch New channel - * - * \return none - */ -static void rf_channel_set(uint8_t channel) -{ - MCR20Drv_DirectAccessSPIWrite(PLL_INT0, pll_int[channel - 11]); - MCR20Drv_DirectAccessSPIMultiByteWrite(PLL_FRAC0_LSB, (uint8_t *) &pll_frac[channel - 11], 2); -} - - -/* - * \brief Function initialises the radio driver and resets the radio. - * - * \param none - * - * \return none - */ -static void rf_init(void) -{ - uint32_t index; - mPhySeqState = gIdle_c; - mPwrState = gXcvrPwrIdle_c; - /*Reset RF module*/ - MCR20Drv_RESET(); - /* Initialize the transceiver SPI driver */ - MCR20Drv_Init(); - /* Disable Tristate on MISO for SPI reads */ - MCR20Drv_IndirectAccessSPIWrite(MISC_PAD_CTRL, 0x02); - /* Set XCVR clock output settings */ - MCR20Drv_Set_CLK_OUT_Freq(gMCR20_ClkOutFreq_d); - /* Set default XCVR power state */ - rf_set_power_state(gXcvrRunState_d); - - /* PHY_CTRL1 default HW settings + AUTOACK enabled */ - mStatusAndControlRegs[PHY_CTRL1] = cPHY_CTRL1_AUTOACK; - /* PHY_CTRL2 : mask all PP interrupts */ - mStatusAndControlRegs[PHY_CTRL2] = cPHY_CTRL2_CRC_MSK | \ - cPHY_CTRL2_PLL_UNLOCK_MSK | \ - /*cPHY_CTRL2_FILTERFAIL_MSK | */ \ - cPHY_CTRL2_RX_WMRK_MSK | \ - cPHY_CTRL2_CCAMSK | \ - cPHY_CTRL2_RXMSK | \ - cPHY_CTRL2_TXMSK | \ - cPHY_CTRL2_SEQMSK; - /* PHY_CTRL3 : enable timer 3 and disable remaining interrupts */ - mStatusAndControlRegs[PHY_CTRL3] = cPHY_CTRL3_ASM_MSK | \ - cPHY_CTRL3_PB_ERR_MSK | \ - cPHY_CTRL3_WAKE_MSK | \ - cPHY_CTRL3_TMR3CMP_EN; - /* PHY_CTRL4 unmask global TRX interrupts, enable 16 bit mode for TC2 - TC2 prime EN */ - mStatusAndControlRegs[PHY_CTRL4] = cPHY_CTRL4_TC2PRIME_EN | (gCcaCCA_MODE1_c << cPHY_CTRL4_CCATYPE_Shift_c); - /* Clear all PP IRQ bits to avoid unexpected interrupts immediately after initialization */ - mStatusAndControlRegs[IRQSTS1] = cIRQSTS1_PLL_UNLOCK_IRQ | \ - cIRQSTS1_FILTERFAIL_IRQ | \ - cIRQSTS1_RXWTRMRKIRQ | \ - cIRQSTS1_CCAIRQ | \ - cIRQSTS1_RXIRQ | \ - cIRQSTS1_TXIRQ | \ - cIRQSTS1_SEQIRQ; - - mStatusAndControlRegs[IRQSTS2] = cIRQSTS2_ASM_IRQ | cIRQSTS2_PB_ERR_IRQ | cIRQSTS2_WAKE_IRQ; - /* Mask and clear all TMR IRQs */ - mStatusAndControlRegs[IRQSTS3] = cIRQSTS3_TMR4MSK | cIRQSTS3_TMR3MSK | cIRQSTS3_TMR2MSK | cIRQSTS3_TMR1MSK | \ - cIRQSTS3_TMR4IRQ | cIRQSTS3_TMR3IRQ | cIRQSTS3_TMR2IRQ | cIRQSTS3_TMR1IRQ; - /* Write settings to XCVR */ - MCR20Drv_DirectAccessSPIMultiByteWrite(PHY_CTRL1, &mStatusAndControlRegs[PHY_CTRL1], 5); - /* Clear all interrupts */ - MCR20Drv_DirectAccessSPIMultiByteWrite(IRQSTS1, &mStatusAndControlRegs[IRQSTS1], 3); - - /* RX_FRAME_FILTER. Accept FrameVersion 0 and 1 packets, reject all others */ - MCR20Drv_IndirectAccessSPIWrite(RX_FRAME_FILTER, (cRX_FRAME_FLT_FRM_VER | \ - cRX_FRAME_FLT_BEACON_FT | \ - cRX_FRAME_FLT_DATA_FT | \ - cRX_FRAME_FLT_CMD_FT)); - /* Direct register overwrites */ - for (index = 0; index < sizeof(overwrites_direct) / sizeof(overwrites_t); index++) { - MCR20Drv_DirectAccessSPIWrite(overwrites_direct[index].address, overwrites_direct[index].data); - } - /* Indirect register overwrites */ - for (index = 0; index < sizeof(overwrites_indirect) / sizeof(overwrites_t); index++) { - MCR20Drv_IndirectAccessSPIWrite(overwrites_indirect[index].address, overwrites_indirect[index].data); - } - - /* Set the CCA energy threshold value */ - MCR20Drv_IndirectAccessSPIWrite(CCA1_THRESH, RF_CCA_THRESHOLD); - /* Set prescaller to obtain 1 symbol (16us) timebase */ - MCR20Drv_IndirectAccessSPIWrite(TMR_PRESCALE, 0x05); - - MCR20Drv_IRQ_Enable(); - - /*Read random variable. This will be used when seeding pseudo-random generator*/ - rf_rnd = rf_if_read_rnd(); - /*Write initial eui64*/ - rf_set_address(MAC_address); - /*set default channel to 11*/ - rf_channel_set(11); - /*Start receiver*/ - rf_receive(); -} - -/** - * \brief Function gets called when MAC is setting radio off. - * - * \param none - * - * \return none - */ -static void rf_off(void) -{ - /* Abort any ongoing sequences */ - rf_abort(); - /* Set XCVR in a low power state */ - rf_set_power_state(gXcvrLowPowerState_d); -} - -/* - * \brief Function polls the RF state until it has changed to desired state. - * - * \param trx_state RF state - * - * \return none - */ -static void rf_poll_trx_state_change(rf_trx_states_t trx_state) -{ - (void)trx_state; -} - -/* - * \brief Function starts the CCA process before starting data transmission and copies the data to RF TX FIFO. - * - * \param data_ptr Pointer to TX data - * \param data_length Length of the TX data - * \param tx_handle Handle to transmission - * \return 0 Success - * \return -1 Busy - */ -static int8_t rf_start_cca(uint8_t *data_ptr, uint16_t data_length, uint8_t tx_handle, data_protocol_e data_protocol) -{ - uint8_t ccaMode; - - /* Parameter validation */ - if (!data_ptr || (data_length > 125) || (PHY_LAYER_PAYLOAD != data_protocol)) { - return -1; - } - - if (mPhySeqState == gRX_c) { - uint8_t phyReg = MCR20Drv_DirectAccessSPIRead(SEQ_STATE) & 0x1F; - /* Check for an Rx in progress. */ - if ((phyReg <= 0x06) || (phyReg == 0x15) || (phyReg == 0x16)) { - if (device_driver.phy_tx_done_cb) { - device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_CCA_FAIL, 1, 1); - } - return -1; - } - rf_abort(); - } - - /*Check if transmitter is busy*/ - if (mPhySeqState != gIdle_c) { - /*Return busy*/ - return -1; - } - - /*Store TX handle*/ - mac_tx_handle = tx_handle; - /*Check if transmitted data needs to be acked*/ - need_ack = (*data_ptr & 0x20) == 0x20; - - /* Set XCVR power state in run mode */ - rf_set_power_state(gXcvrRunState_d); - /* Load data into XCVR */ - tx_len = data_length + 2; - MCR20Drv_PB_SPIBurstWrite(data_ptr - 1, data_length + 1); - MCR20Drv_PB_SPIByteWrite(0, tx_len); - - /* Set CCA mode 1 */ - ccaMode = (mStatusAndControlRegs[PHY_CTRL4] >> cPHY_CTRL4_CCATYPE_Shift_c) & cPHY_CTRL4_CCATYPE; - if (ccaMode != gCcaCCA_MODE1_c) { - mStatusAndControlRegs[PHY_CTRL4] &= ~(cPHY_CTRL4_CCATYPE << cPHY_CTRL4_CCATYPE_Shift_c); - mStatusAndControlRegs[PHY_CTRL4] |= gCcaCCA_MODE1_c << cPHY_CTRL4_CCATYPE_Shift_c; - MCR20Drv_DirectAccessSPIWrite(PHY_CTRL4, mStatusAndControlRegs[PHY_CTRL4]); - } - - /* Read XCVR registers */ - mStatusAndControlRegs[0] = MCR20Drv_DirectAccessSPIMultiByteRead(IRQSTS2, &mStatusAndControlRegs[1], 4); - mStatusAndControlRegs[PHY_CTRL1] &= ~(cPHY_CTRL1_XCVSEQ); - mStatusAndControlRegs[PHY_CTRL1] |= gCCA_c; - mPhySeqState = gCCA_c; - - /* Ensure that no spurious interrupts are raised */ - mStatusAndControlRegs[IRQSTS3] &= 0xF0; /* do not change other IRQ status */ - mStatusAndControlRegs[IRQSTS3] |= (cIRQSTS3_TMR3MSK | cIRQSTS3_TMR3IRQ); - MCR20Drv_DirectAccessSPIMultiByteWrite(IRQSTS1, mStatusAndControlRegs, 3); - - /* Write XCVR settings */ - MCR20Drv_DirectAccessSPIWrite(PHY_CTRL1, mStatusAndControlRegs[PHY_CTRL1]); - - /* Unmask SEQ interrupt */ - mStatusAndControlRegs[PHY_CTRL2] &= ~(cPHY_CTRL2_SEQMSK); - MCR20Drv_DirectAccessSPIWrite(PHY_CTRL2, mStatusAndControlRegs[PHY_CTRL2]); - - /*Return success*/ - return 0; -} - -/* - * \brief Function aborts CCA process. - * - * \param none - * - * \return none - */ -static void rf_cca_abort(void) -{ - rf_abort(); -} - -/* - * \brief Function starts the transmission of the frame. Called from ISR context! - * - * \param none - * - * \return none - */ -static void rf_start_tx(void) -{ - /* Perform TxRxAck sequence if required by phyTxMode */ - if (need_ack) { - mStatusAndControlRegs[PHY_CTRL1] |= cPHY_CTRL1_RXACKRQD; - mPhySeqState = gTR_c; - } else { - mStatusAndControlRegs[PHY_CTRL1] &= ~(cPHY_CTRL1_RXACKRQD); - mPhySeqState = gTX_c; - } - - mStatusAndControlRegs[PHY_CTRL1] &= ~(cPHY_CTRL1_XCVSEQ); - mStatusAndControlRegs[PHY_CTRL1] |= mPhySeqState; - - /* Unmask SEQ interrupt */ - mStatusAndControlRegs[PHY_CTRL2] &= ~(cPHY_CTRL2_SEQMSK); - - /* Start the sequence immediately */ - MCR20Drv_DirectAccessSPIMultiByteWrite(PHY_CTRL1, &mStatusAndControlRegs[PHY_CTRL1], 2); - - if (need_ack) { - rf_ack_wait_timer_start(gPhyWarmUpTime_c + gPhySHRDuration_c + tx_len * gPhySymbolsPerOctet_c + gPhyAckWaitDuration_c); - } -} - -/* - * \brief Function sets the RF in RX state. Called from ISR context! - * - * \param none - * - * \return none - */ -static void rf_receive(void) -{ - uint8_t phyRegs[5]; - - /* RX can start only from Idle state */ - if (mPhySeqState != gIdle_c) { - return; - } - - /* Set XCVR power state in run mode */ - rf_set_power_state(gXcvrRunState_d); - /* read XVCR settings */ - phyRegs[IRQSTS1] = MCR20Drv_DirectAccessSPIMultiByteRead(IRQSTS2, &phyRegs[IRQSTS2], 4); - /* unmask SEQ interrupt */ - phyRegs[PHY_CTRL2] &= ~(cPHY_CTRL2_SEQMSK); - /* set XcvrSeq to RX */ - phyRegs[PHY_CTRL1] &= ~(cPHY_CTRL1_XCVSEQ); - phyRegs[PHY_CTRL1] |= gRX_c; - mPhySeqState = gRX_c; - /* Ensure that no spurious interrupts are raised */ - phyRegs[IRQSTS3] &= 0xF0; /* do not change other IRQ status */ - phyRegs[IRQSTS3] |= cIRQSTS3_TMR3MSK | cIRQSTS3_TMR3IRQ; - /* sync settings with XCVR */ - MCR20Drv_DirectAccessSPIMultiByteWrite(IRQSTS1, phyRegs, 5); -} - -/* - * \brief Function calibrates the radio. - * - * \param none - * - * \return none - */ -static void rf_calibration_cb(void) -{ -} - -/* - * \brief Function sets RF_ON flag when radio is powered. - * - * \param none - * - * \return none - */ -static void rf_on(void) -{ -} - -/* - * \brief Function is a call back for RX end interrupt. - * - * \param none - * - * \return none - */ -static void rf_handle_rx_end(void) -{ - uint8_t rf_lqi = MCR20Drv_DirectAccessSPIRead(LQI_VALUE); - int8_t rf_rssi = 0; - uint8_t len = mStatusAndControlRegs[RX_FRM_LEN] - 2; - - - /*Start receiver*/ - rf_receive(); - - /*Check the length is valid*/ - if (len > 1 && len < RF_BUFFER_SIZE) { - rf_lqi = rf_convert_LQI(rf_lqi); - rf_rssi = rf_convert_LQI_to_RSSI(rf_lqi); - /*gcararu: Scale LQI using received RSSI, to match the LQI reported by the ATMEL radio */ - rf_lqi = rf_scale_lqi(rf_rssi); - - /*Read received packet*/ - MCR20Drv_PB_SPIBurstRead(rf_buffer, len); - if (device_driver.phy_rx_cb) { - device_driver.phy_rx_cb(rf_buffer, len, rf_lqi, rf_rssi, rf_radio_driver_id); - } - } -} - -/* - * \brief Function is called when MAC is shutting down the radio. - * - * \param none - * - * \return none - */ -static void rf_shutdown(void) -{ - /*Call RF OFF*/ - rf_off(); -} - -/* - * \brief Function is a call back for TX end interrupt. - * - * \param none - * - * \return none - */ -static void rf_handle_tx_end(void) -{ - uint8_t rx_frame_pending = mStatusAndControlRegs[IRQSTS1] & cIRQSTS1_RX_FRM_PEND; - - /*Start receiver*/ - rf_receive(); - - if (!device_driver.phy_tx_done_cb) { - return; - } - - /*Call PHY TX Done API*/ - if (need_ack) { - if (rx_frame_pending) { - device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_TX_DONE_PENDING, 1, 1); - } else { - // arm_net_phy_tx_done(rf_radio_driver_id, mac_tx_handle, PHY_LINK_TX_SUCCESS, 1, 1); - device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_TX_DONE, 1, 1); - } - } else { - device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_TX_SUCCESS, 1, 1); - } -} - -/* - * \brief Function is a call back for CCA ED done interrupt. - * - * \param none - * - * \return none - */ -static void rf_handle_cca_ed_done(void) -{ - /*Check the result of CCA process*/ - if (!(mStatusAndControlRegs[IRQSTS2] & cIRQSTS2_CCA)) { - rf_start_tx(); - } else if (device_driver.phy_tx_done_cb) { - /*Send CCA fail notification*/ - device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_CCA_FAIL, 1, 1); - } -} - -/* - * \brief Function sets the TX power variable. - * - * \param power TX power setting - * - * \return 0 Success - * \return -1 Fail - */ -static int8_t rf_tx_power_set(uint8_t power) -{ - /* gcapraru: Map MCR20A Tx power levels over ATMEL values */ - static uint8_t pwrLevelMapping[16] = {25, 25, 25, 24, 24, 24, 23, 23, 22, 22, 21, 20, 19, 18, 17, 14}; - - if (power > 15) { - return -1; - } - - radio_tx_power = power; - MCR20Drv_DirectAccessSPIWrite(PA_PWR, pwrLevelMapping[power]); - return 0; -} - -/* - * \brief Function returns the TX power variable. - * - * \param none - * - * \return radio_tx_power TX power variable - */ -static uint8_t rf_tx_power_get(void) -{ - return radio_tx_power; -} - -/* - * \brief Function enables the usage of Antenna diversity. - * - * \param none - * - * \return 0 Success - */ -static int8_t rf_enable_antenna_diversity(void) -{ - uint8_t phyReg; - - phyReg = MCR20Drv_IndirectAccessSPIRead(ANT_AGC_CTRL); - phyReg |= cANT_AGC_CTRL_FAD_EN_Mask_c; - MCR20Drv_IndirectAccessSPIWrite(ANT_AGC_CTRL, phyReg); - - phyReg = MCR20Drv_IndirectAccessSPIRead(ANT_PAD_CTRL); - phyReg |= 0x02; - MCR20Drv_IndirectAccessSPIWrite(ANT_PAD_CTRL, phyReg); - - return 0; -} - -/* - * \brief Function gives the control of RF states to MAC. - * - * \param new_state RF state - * \param rf_channel RF channel - * - * \return 0 Success - */ -static int8_t rf_interface_state_control(phy_interface_state_e new_state, uint8_t rf_channel) -{ - int8_t ret_val = 0; - switch (new_state) { - /*Reset PHY driver and set to idle*/ - case PHY_INTERFACE_RESET: - break; - /*Disable PHY Interface driver*/ - case PHY_INTERFACE_DOWN: - rf_shutdown(); - break; - /*Enable PHY Interface driver*/ - case PHY_INTERFACE_UP: - rf_channel_set(rf_channel); - rf_receive(); - break; - /*Enable wireless interface ED scan mode*/ - case PHY_INTERFACE_RX_ENERGY_STATE: - rf_abort(); - rf_channel_set(rf_channel); - break; - case PHY_INTERFACE_SNIFFER_STATE: /**< Enable Sniffer state */ - rf_promiscuous(1); - rf_channel_set(rf_channel); - rf_receive(); - break; - } - return ret_val; -} - -/* - * \brief Function controls the ACK pending, channel setting and energy detection. - * - * \param extension_type Type of control - * \param data_ptr Data from NET library - * - * \return 0 Success - */ -static int8_t rf_extension(phy_extension_type_e extension_type, uint8_t *data_ptr) -{ - switch (extension_type) { - /*Control MAC pending bit for Indirect data transmission*/ - case PHY_EXTENSION_CTRL_PENDING_BIT: { - uint8_t reg = MCR20Drv_DirectAccessSPIRead(SRC_CTRL); - - if (*data_ptr) { - reg |= cSRC_CTRL_ACK_FRM_PND; - } else { - reg &= ~cSRC_CTRL_ACK_FRM_PND; - } - - MCR20Drv_DirectAccessSPIWrite(SRC_CTRL, reg); - break; - - } - /*Return frame Auto Ack frame pending status*/ - case PHY_EXTENSION_READ_LAST_ACK_PENDING_STATUS: { - uint8_t reg = MCR20Drv_DirectAccessSPIRead(SRC_CTRL); - if (reg & cSRC_CTRL_ACK_FRM_PND) { - *data_ptr = 1; - } else { - *data_ptr = 0; - } - break; - } - /*Read energy on the channel*/ - case PHY_EXTENSION_READ_CHANNEL_ENERGY: - *data_ptr = rf_get_channel_energy(); - break; - default: - break; - } - return 0; -} - -/* - * \brief Function sets the addresses to RF address filters. - * - * \param address_type Type of address - * \param address_ptr Pointer to given address - * - * \return 0 Success - */ -static int8_t rf_address_write(phy_address_type_e address_type, uint8_t *address_ptr) -{ - int8_t ret_val = 0; - switch (address_type) { - /*Set 48-bit address*/ - case PHY_MAC_48BIT: - break; - /*Set 64-bit address*/ - case PHY_MAC_64BIT: - rf_set_address(address_ptr); - break; - /*Set 16-bit address*/ - case PHY_MAC_16BIT: - rf_set_short_adr(address_ptr); - break; - /*Set PAN Id*/ - case PHY_MAC_PANID: - rf_set_pan_id(address_ptr); - break; - } - return ret_val; -} - -/* - * \brief Function initialises the ACK wait time and returns the used PHY mode. - * - * \param none - * - * \return tmp Used PHY mode - */ -static void rf_init_phy_mode(void) -{ -} - -/* - * \brief Function is a RF interrupt vector. End of frame in RX and TX are handled here as well as CCA process interrupt. - * - * \param none - * - * \return none - */ -static void PHY_InterruptHandler(void) -{ - MCR20Drv_IRQ_Disable(); - irq_thread->flags_set(1); -} - -static void PHY_InterruptThread(void) -{ - for (;;) { - ThisThread::flags_wait_all(1); - handle_interrupt(); - MCR20Drv_IRQ_Enable(); - } -} - -static void handle_interrupt(void) -{ - uint8_t xcvseqCopy; - - /* Read transceiver interrupt status and control registers */ - mStatusAndControlRegs[IRQSTS1] = - MCR20Drv_DirectAccessSPIMultiByteRead(IRQSTS2, &mStatusAndControlRegs[IRQSTS2], 7); - - xcvseqCopy = mStatusAndControlRegs[PHY_CTRL1] & cPHY_CTRL1_XCVSEQ; - - /* Flter Fail IRQ */ - if ((mStatusAndControlRegs[IRQSTS1] & cIRQSTS1_FILTERFAIL_IRQ) && - !(mStatusAndControlRegs[PHY_CTRL2] & cPHY_CTRL2_FILTERFAIL_MSK)) { - if (xcvseqCopy == gRX_c) { - /* Abort current SEQ */ - mStatusAndControlRegs[PHY_CTRL1] &= ~(cPHY_CTRL1_XCVSEQ); - MCR20Drv_DirectAccessSPIWrite(PHY_CTRL1, mStatusAndControlRegs[PHY_CTRL1]); - /* Wait for Sequence Idle */ - while ((MCR20Drv_DirectAccessSPIRead(SEQ_STATE) & 0x1F) != 0); - /* Clear IRQ flags: */ - MCR20Drv_DirectAccessSPIWrite(IRQSTS1, cIRQSTS1_SEQIRQ); - /* Restart Rx asap */ - mStatusAndControlRegs[PHY_CTRL1] |= gRX_c; - MCR20Drv_DirectAccessSPIWrite(PHY_CTRL1, mStatusAndControlRegs[PHY_CTRL1]); - } - } - - /* TMR3 IRQ: ACK wait time-out */ - if ((mStatusAndControlRegs[IRQSTS3] & cIRQSTS3_TMR3IRQ) && - !(mStatusAndControlRegs[IRQSTS3] & cIRQSTS3_TMR3MSK)) { - /* Disable TMR3 IRQ */ - mStatusAndControlRegs[IRQSTS3] |= cIRQSTS3_TMR3MSK; - - if (xcvseqCopy == gTR_c) { - /* Set XCVR to Idle */ - mPhySeqState = gIdle_c; - mStatusAndControlRegs[PHY_CTRL1] &= ~(cPHY_CTRL1_XCVSEQ); - /* Mask interrupts */ - mStatusAndControlRegs[PHY_CTRL2] |= cPHY_CTRL2_CCAMSK | cPHY_CTRL2_RXMSK | cPHY_CTRL2_TXMSK | cPHY_CTRL2_SEQMSK; - /* Sync settings with XCVR */ - MCR20Drv_DirectAccessSPIMultiByteWrite(IRQSTS1, mStatusAndControlRegs, 5); - - rf_ack_wait_timer_interrupt(); - return; - } - } - - /* Sequencer interrupt, the autosequence has completed */ - if ((mStatusAndControlRegs[IRQSTS1] & cIRQSTS1_SEQIRQ) && - !(mStatusAndControlRegs[PHY_CTRL2] & cPHY_CTRL2_SEQMSK)) { - /* Set XCVR to Idle */ - mPhySeqState = gIdle_c; - mStatusAndControlRegs[PHY_CTRL1] &= ~(cPHY_CTRL1_XCVSEQ); - /* Mask interrupts */ - mStatusAndControlRegs[PHY_CTRL2] |= cPHY_CTRL2_CCAMSK | cPHY_CTRL2_RXMSK | cPHY_CTRL2_TXMSK | cPHY_CTRL2_SEQMSK; - /* Sync settings with XCVR */ - MCR20Drv_DirectAccessSPIMultiByteWrite(IRQSTS1, mStatusAndControlRegs, 5); - - /* PLL unlock, the autosequence has been aborted due to PLL unlock */ - if (mStatusAndControlRegs[IRQSTS1] & cIRQSTS1_PLL_UNLOCK_IRQ) { - if (xcvseqCopy == gRX_c) { - rf_receive(); - } - return; - } - - switch (xcvseqCopy) { - case gTX_c: - case gTR_c: - rf_handle_tx_end(); - break; - - case gRX_c: - rf_handle_rx_end(); - break; - - case gCCA_c: - rf_handle_cca_ed_done(); - break; - - default: - break; - } - - return; - } - /* Other IRQ. Clear XCVR interrupt flags */ - MCR20Drv_DirectAccessSPIMultiByteWrite(IRQSTS1, mStatusAndControlRegs, 3); -} - -/* - * \brief Function forces the XCVR to Idle state. - * - * \param none - * - * \return none - */ -static void rf_abort(void) -{ - /* Mask XCVR irq */ - MCR20Drv_IRQ_Disable(); - - mPhySeqState = gIdle_c; - - mStatusAndControlRegs[IRQSTS1] = MCR20Drv_DirectAccessSPIMultiByteRead(IRQSTS2, &mStatusAndControlRegs[IRQSTS2], 5); - - /* Mask SEQ interrupt */ - mStatusAndControlRegs[PHY_CTRL2] |= cPHY_CTRL2_SEQMSK; - MCR20Drv_DirectAccessSPIWrite(PHY_CTRL2, mStatusAndControlRegs[PHY_CTRL2]); - - if ((mStatusAndControlRegs[PHY_CTRL1] & cPHY_CTRL1_XCVSEQ) != gIdle_c) { - /* Abort current SEQ */ - mStatusAndControlRegs[PHY_CTRL1] &= ~(cPHY_CTRL1_XCVSEQ); - MCR20Drv_DirectAccessSPIWrite(PHY_CTRL1, mStatusAndControlRegs[PHY_CTRL1]); - - /* Wait for Sequence Idle (if not already) */ - while ((MCR20Drv_DirectAccessSPIRead(SEQ_STATE) & 0x1F) != 0); - //while ( !(MCR20Drv_DirectAccessSPIRead(IRQSTS1) & cIRQSTS1_SEQIRQ)); - mStatusAndControlRegs[IRQSTS1] |= cIRQSTS1_SEQIRQ; - } - - /* Clear all PP IRQ bits to avoid unexpected interrupts and mask TMR3 interrupt. - Do not change TMR IRQ status. */ - mStatusAndControlRegs[IRQSTS3] &= 0xF0; - mStatusAndControlRegs[IRQSTS3] |= (cIRQSTS3_TMR3MSK | cIRQSTS3_TMR3IRQ); - MCR20Drv_DirectAccessSPIMultiByteWrite(IRQSTS1, mStatusAndControlRegs, 3); - - /* Unmask XCVR irq */ - MCR20Drv_IRQ_Enable(); -} - -/* - * \brief Function reads a time-stamp value from XCVR [symbols] - * - * \param pEndTime pointer to location where time-stamp will be stored - * - * \return none - */ -static void rf_get_timestamp(uint32_t *pRetClk) -{ - if (NULL == pRetClk) { - return; - } - - platform_enter_critical(); - - *pRetClk = 0; - MCR20Drv_DirectAccessSPIMultiByteRead(EVENT_TMR_LSB, (uint8_t *) pRetClk, 3); - - platform_exit_critical(); -} - -/* - * \brief Function set a time-out to an XCVR sequence. - * - * \param pEndTime pointer to the sequence time-out value [symbols] - * - * \return none - */ -static void rf_set_timeout(uint32_t *pEndTime) -{ - uint8_t phyReg; - - if (NULL == pEndTime) { - return; - } - - platform_enter_critical(); - - phyReg = MCR20Drv_DirectAccessSPIRead(IRQSTS3); - phyReg &= 0xF0; /* do not change IRQ status */ - phyReg |= (cIRQSTS3_TMR3MSK); /* mask TMR3 interrupt */ - MCR20Drv_DirectAccessSPIWrite(IRQSTS3, phyReg); - - MCR20Drv_DirectAccessSPIMultiByteWrite(T3CMP_LSB, (uint8_t *) pEndTime, 3); - - phyReg &= ~(cIRQSTS3_TMR3MSK); /* unmask TMR3 interrupt */ - phyReg |= (cIRQSTS3_TMR3IRQ); /* aknowledge TMR3 IRQ */ - MCR20Drv_DirectAccessSPIWrite(IRQSTS3, phyReg); - - platform_exit_critical(); -} - -/* - * \brief Function reads a random number from RF. - * - * \param none - * - * \return 8-bit random number - */ -static uint8_t rf_if_read_rnd(void) -{ - uint8_t phyReg; - - MCR20Drv_IRQ_Disable(); - /* Check if XCVR is idle */ - phyReg = MCR20Drv_DirectAccessSPIRead(PHY_CTRL1); - - if ((phyReg & cPHY_CTRL1_XCVSEQ) == gIdle_c) { - /* Program a new sequence */ - MCR20Drv_DirectAccessSPIWrite(PHY_CTRL1, phyReg | gCCA_c); - /* Wait for sequence to finish */ - while (!(MCR20Drv_DirectAccessSPIRead(IRQSTS1) & cIRQSTS1_SEQIRQ)); - /* Clear interrupt flag */ - MCR20Drv_DirectAccessSPIWrite(IRQSTS1, cIRQSTS1_SEQIRQ); - } - - MCR20Drv_IRQ_Enable(); - - return MCR20Drv_IndirectAccessSPIRead(_RNG); -} - -/* - * \brief Function converts LQI into RSSI. - * - * \param LQI - * - * \return RSSI - */ -static int8_t rf_convert_LQI_to_RSSI(uint8_t lqi) -{ - int32_t rssi = (50 * lqi - 16820) / 163; - return (int8_t)rssi; -} - -/* - * \brief Function scale the LQI value reported by RF into a 0-255 value. - * - * \param hwLqi - the LQI value reported by RF - * - * \return scaled LQI - */ -static uint8_t rf_convert_LQI(uint8_t hwLqi) -{ - uint32_t tmpLQI; - - /* LQI Saturation Level */ - if (hwLqi >= 230) { - return 0xFF; - } else if (hwLqi <= 9) { - return 0; - } else { - /* Rescale the LQI values from min to saturation to the 0x00 - 0xFF range */ - /* The LQI value mst be multiplied by ~1.1087 */ - /* tmpLQI = hwLqi * 7123 ~= hwLqi * 65536 * 0.1087 = hwLqi * 2^16 * 0.1087*/ - tmpLQI = ((uint32_t)hwLqi * (uint32_t)7123); - /* tmpLQI = (tmpLQI / 2^16) + hwLqi */ - tmpLQI = (uint32_t)(tmpLQI >> 16) + (uint32_t)hwLqi; - - return (uint8_t)tmpLQI; - } -} - -/* - * \brief Function enables/disables Rx promiscuous mode. - * - * \param state of XCVR promiscuous mode - * - * \return none - */ -static void rf_promiscuous(uint8_t state) -{ - uint8_t rxFrameFltReg, phyCtrl4Reg; - - rxFrameFltReg = MCR20Drv_IndirectAccessSPIRead(RX_FRAME_FILTER); - phyCtrl4Reg = MCR20Drv_DirectAccessSPIRead(PHY_CTRL4); - - if (state) { - /* FRM_VER[1:0] = b00. 00: Any FrameVersion accepted (0,1,2 & 3) */ - /* All frame types accepted*/ - phyCtrl4Reg |= cPHY_CTRL4_PROMISCUOUS; - rxFrameFltReg &= ~(cRX_FRAME_FLT_FRM_VER); - rxFrameFltReg |= (cRX_FRAME_FLT_ACK_FT | cRX_FRAME_FLT_NS_FT); - } else { - phyCtrl4Reg &= ~cPHY_CTRL4_PROMISCUOUS; - /* FRM_VER[1:0] = b11. Accept FrameVersion 0 and 1 packets, reject all others */ - /* Beacon, Data and MAC command frame types accepted */ - rxFrameFltReg &= ~(cRX_FRAME_FLT_FRM_VER); - rxFrameFltReg |= (0x03 << cRX_FRAME_FLT_FRM_VER_Shift_c); - rxFrameFltReg &= ~(cRX_FRAME_FLT_ACK_FT | cRX_FRAME_FLT_NS_FT); - } - - MCR20Drv_IndirectAccessSPIWrite(RX_FRAME_FILTER, rxFrameFltReg); - MCR20Drv_DirectAccessSPIWrite(PHY_CTRL4, phyCtrl4Reg); -} - -/* - * \brief Function used to switch XCVR power state. - * - * \param state The XCVR power mode - * - * \return none - */ -static void rf_set_power_state(xcvrPwrMode_t newState) -{ - uint8_t pwrMode; - uint8_t xtalState; - - if (mPwrState == newState) { - return; - } - - /* Read power settings from RF */ - pwrMode = MCR20Drv_DirectAccessSPIRead(PWR_MODES); - xtalState = pwrMode & cPWR_MODES_XTALEN; - - switch (newState) { - case gXcvrPwrIdle_c: - pwrMode &= ~(cPWR_MODES_AUTODOZE); - pwrMode |= (cPWR_MODES_XTALEN | cPWR_MODES_PMC_MODE); - break; - case gXcvrPwrAutodoze_c: - pwrMode |= (cPWR_MODES_XTALEN | cPWR_MODES_AUTODOZE | cPWR_MODES_PMC_MODE); - break; - case gXcvrPwrDoze_c: - pwrMode &= ~(cPWR_MODES_AUTODOZE | cPWR_MODES_PMC_MODE); - pwrMode |= cPWR_MODES_XTALEN; - break; - case gXcvrPwrHibernate_c: - pwrMode &= ~(cPWR_MODES_XTALEN | cPWR_MODES_AUTODOZE | cPWR_MODES_PMC_MODE); - break; - default: - return; - } - - mPwrState = newState; - MCR20Drv_DirectAccessSPIWrite(PWR_MODES, pwrMode); - - if (!xtalState && (pwrMode & cPWR_MODES_XTALEN)) { - /* wait for crystal oscillator to complet its warmup */ - while ((MCR20Drv_DirectAccessSPIRead(PWR_MODES) & cPWR_MODES_XTAL_READY) != cPWR_MODES_XTAL_READY); - /* wait for radio wakeup from hibernate interrupt */ - while ((MCR20Drv_DirectAccessSPIRead(IRQSTS2) & (cIRQSTS2_WAKE_IRQ | cIRQSTS2_TMRSTATUS)) != (cIRQSTS2_WAKE_IRQ | cIRQSTS2_TMRSTATUS)); - - MCR20Drv_DirectAccessSPIWrite(IRQSTS2, cIRQSTS2_WAKE_IRQ); - } -} - -/* - * \brief Function reads the energy level on the preselected channel. - * - * \return energy level - */ -static uint8_t rf_get_channel_energy(void) -{ - uint8_t ccaMode; - - MCR20Drv_IRQ_Disable(); - /* RX can start only from Idle state */ - if (mPhySeqState != gIdle_c) { - MCR20Drv_IRQ_Enable(); - return 0; - } - - /* Set XCVR power state in run mode */ - rf_set_power_state(gXcvrRunState_d); - - /* Switch to ED mode */ - ccaMode = (mStatusAndControlRegs[PHY_CTRL4] >> cPHY_CTRL4_CCATYPE_Shift_c) & cPHY_CTRL4_CCATYPE; - if (ccaMode != gCcaED_c) { - mStatusAndControlRegs[PHY_CTRL4] &= ~(cPHY_CTRL4_CCATYPE << cPHY_CTRL4_CCATYPE_Shift_c); - mStatusAndControlRegs[PHY_CTRL4] |= gCcaED_c << cPHY_CTRL4_CCATYPE_Shift_c; - MCR20Drv_DirectAccessSPIWrite(PHY_CTRL4, mStatusAndControlRegs[PHY_CTRL4]); - } - - /* Start ED sequence */ - mStatusAndControlRegs[PHY_CTRL1] |= gCCA_c; - MCR20Drv_DirectAccessSPIWrite(IRQSTS1, cIRQSTS1_CCAIRQ | cIRQSTS1_SEQIRQ); - MCR20Drv_DirectAccessSPIWrite(PHY_CTRL1, mStatusAndControlRegs[PHY_CTRL1]); - /* Wait for sequence to finish */ - while (!(MCR20Drv_DirectAccessSPIRead(IRQSTS1) & cIRQSTS1_SEQIRQ)); - /* Set XCVR to Idle */ - mStatusAndControlRegs[PHY_CTRL1] &= ~(cPHY_CTRL1_XCVSEQ); - MCR20Drv_DirectAccessSPIWrite(PHY_CTRL1, mStatusAndControlRegs[PHY_CTRL1]); - MCR20Drv_DirectAccessSPIWrite(IRQSTS1, cIRQSTS1_CCAIRQ | cIRQSTS1_SEQIRQ); - - MCR20Drv_IRQ_Enable(); - - return rf_convert_energy_level(MCR20Drv_DirectAccessSPIRead(CCA1_ED_FNL)); -} - -/* - * \brief Function converts the energy level from dBm to a 0-255 value. - * - * \param energyLevel in dBm - * - * \return energy level (0-255) - */ -static uint8_t rf_convert_energy_level(uint8_t energyLevel) -{ - if (energyLevel >= 90) { - /* ED value is below minimum. Return 0x00. */ - energyLevel = 0x00; - } else if (energyLevel <= 26) { - /* ED value is above maximum. Return 0xFF. */ - energyLevel = 0xFF; - } else { - /* Energy level (-90 dBm to -26 dBm ) --> varies form 0 to 64 */ - energyLevel = (90 - energyLevel); - /* Rescale the energy level values to the 0x00-0xff range (0 to 64 translates in 0 to 255) */ - /* energyLevel * 3.9844 ~= 4 */ - /* Multiply with 4=2^2 by shifting left. - The multiplication will not overflow beacause energyLevel has values between 0 and 63 */ - energyLevel <<= 2; - } - - return energyLevel; -} - -static uint8_t rf_scale_lqi(int8_t rssi) -{ - uint8_t scaled_lqi; - /*Worst case sensitivity*/ - const int8_t rf_sensitivity = -98; - - /*rssi < RF sensitivity*/ - if (rssi < rf_sensitivity) { - scaled_lqi = 0; - } - /*-91 dBm < rssi < -81 dBm (AT86RF233 XPro)*/ - /*-90 dBm < rssi < -80 dBm (AT86RF212B XPro)*/ - else if (rssi < (rf_sensitivity + 10)) { - scaled_lqi = 31; - } - /*-81 dBm < rssi < -71 dBm (AT86RF233 XPro)*/ - /*-80 dBm < rssi < -70 dBm (AT86RF212B XPro)*/ - else if (rssi < (rf_sensitivity + 20)) { - scaled_lqi = 207; - } - /*-71 dBm < rssi < -61 dBm (AT86RF233 XPro)*/ - /*-70 dBm < rssi < -60 dBm (AT86RF212B XPro)*/ - else if (rssi < (rf_sensitivity + 30)) { - scaled_lqi = 255; - } - /*-61 dBm < rssi < -51 dBm (AT86RF233 XPro)*/ - /*-60 dBm < rssi < -50 dBm (AT86RF212B XPro)*/ - else if (rssi < (rf_sensitivity + 40)) { - scaled_lqi = 255; - } - /*-51 dBm < rssi < -41 dBm (AT86RF233 XPro)*/ - /*-50 dBm < rssi < -40 dBm (AT86RF212B XPro)*/ - else if (rssi < (rf_sensitivity + 50)) { - scaled_lqi = 255; - } - /*-41 dBm < rssi < -31 dBm (AT86RF233 XPro)*/ - /*-40 dBm < rssi < -30 dBm (AT86RF212B XPro)*/ - else if (rssi < (rf_sensitivity + 60)) { - scaled_lqi = 255; - } - /*-31 dBm < rssi < -21 dBm (AT86RF233 XPro)*/ - /*-30 dBm < rssi < -20 dBm (AT86RF212B XPro)*/ - else if (rssi < (rf_sensitivity + 70)) { - scaled_lqi = 255; - } - /*rssi > RF saturation*/ - else if (rssi > (rf_sensitivity + 80)) { - scaled_lqi = 111; - } - /*-21 dBm < rssi < -11 dBm (AT86RF233 XPro)*/ - /*-20 dBm < rssi < -10 dBm (AT86RF212B XPro)*/ - else { - scaled_lqi = 255; - } - - return scaled_lqi; -} - - -/*****************************************************************************/ -/* Layer porting to the Freescale driver */ -/*****************************************************************************/ -extern "C" void xcvr_spi_init(uint32_t instance) -{ - (void)instance; -} - -extern "C" void RF_IRQ_Init(void) -{ - MBED_ASSERT(irq != NULL); - irq->mode(PullUp); - irq->fall(&PHY_InterruptHandler); -} - -extern "C" void RF_IRQ_Enable(void) -{ - MBED_ASSERT(irq != NULL); - irq->enable_irq(); -} - -extern "C" void RF_IRQ_Disable(void) -{ - MBED_ASSERT(irq != NULL); - irq->disable_irq(); -} - -extern "C" uint8_t RF_isIRQ_Pending(void) -{ - MBED_ASSERT(rf != NULL); - return !irq_pin->read(); -} - -extern "C" void RF_RST_Set(int state) -{ - MBED_ASSERT(rst != NULL); - *rst = state; -} - -extern "C" void gXcvrAssertCS_d(void) -{ - MBED_ASSERT(cs != NULL); - *cs = 0; -} - -extern "C" void gXcvrDeassertCS_d(void) -{ - MBED_ASSERT(cs != NULL); - *cs = 1; -} - -extern "C" void xcvr_spi_configure_speed(uint32_t instance, uint32_t freq) -{ - MBED_ASSERT(spi != NULL); - (void)instance; - spi->frequency(freq); -} - -extern "C" void xcvr_spi_transfer(uint32_t instance, - uint8_t *sendBuffer, - uint8_t *receiveBuffer, - size_t transferByteCount) -{ - MBED_ASSERT(spi != NULL); - (void)instance; - volatile uint8_t dummy; - - if (!transferByteCount) { - return; - } - - if (!sendBuffer && !receiveBuffer) { - return; - } - - while (transferByteCount--) { - if (sendBuffer) { - dummy = *sendBuffer; - sendBuffer++; - } else { - dummy = 0xFF; - } - - dummy = spi->write(dummy); - - if (receiveBuffer) { - *receiveBuffer = dummy; - receiveBuffer++; - } - } -} - -/*****************************************************************************/ -/*****************************************************************************/ - -static void rf_if_lock(void) -{ - platform_enter_critical(); -} - -static void rf_if_unlock(void) -{ - platform_exit_critical(); -} - -NanostackRfPhyMcr20a::NanostackRfPhyMcr20a(PinName spi_mosi, PinName spi_miso, - PinName spi_sclk, PinName spi_cs, PinName spi_rst, PinName spi_irq) - : _spi(spi_mosi, spi_miso, spi_sclk), _rf_cs(spi_cs), _rf_rst(spi_rst, 1), - _rf_irq(spi_irq), _rf_irq_pin(spi_irq), - _irq_thread(osPriorityRealtime, 1024) -{ - char mac48[6]; - mbed_mac_address(mac48); - - MAC_address[0] = mac48[0]; - MAC_address[1] = mac48[1]; - MAC_address[2] = mac48[2]; - MAC_address[3] = 0xFF; - MAC_address[4] = 0xFF; - MAC_address[5] = mac48[3]; - MAC_address[6] = mac48[4]; - MAC_address[7] = mac48[5]; -} - -NanostackRfPhyMcr20a::~NanostackRfPhyMcr20a() -{ - // Do nothing -} - -int8_t NanostackRfPhyMcr20a::rf_register() -{ - - rf_if_lock(); - - if (rf != NULL) { - rf_if_unlock(); - error("Multiple registrations of NanostackRfPhyMcr20a not supported"); - return -1; - } - - _irq_thread.start(mbed::callback(PHY_InterruptThread)); - - _pins_set(); - int8_t radio_id = rf_device_register(); - if (radio_id < 0) { - _pins_clear(); - rf = NULL; - } - - rf_if_unlock(); - return radio_id; -} - -void NanostackRfPhyMcr20a::rf_unregister() -{ - rf_if_lock(); - - if (rf != this) { - rf_if_unlock(); - return; - } - - rf_device_unregister(); - rf = NULL; - _pins_clear(); - - rf_if_unlock(); -} - -void NanostackRfPhyMcr20a::get_mac_address(uint8_t *mac) -{ - rf_if_lock(); - - memcpy((void *)mac, (void *)MAC_address, sizeof(MAC_address)); - - rf_if_unlock(); -} - -void NanostackRfPhyMcr20a::set_mac_address(uint8_t *mac) -{ - rf_if_lock(); - - if (NULL != rf) { - error("NanostackRfPhyAtmel cannot change mac address when running"); - rf_if_unlock(); - return; - } - memcpy((void *)MAC_address, (void *)mac, sizeof(MAC_address)); - - rf_if_unlock(); -} - -void NanostackRfPhyMcr20a::_pins_set() -{ - spi = &_spi; - cs = &_rf_cs; - rst = &_rf_rst; - irq = &_rf_irq; - irq_pin = &_rf_irq_pin; - irq_thread = &_irq_thread; -} - -void NanostackRfPhyMcr20a::_pins_clear() -{ - spi = NULL; - cs = NULL; - rst = NULL; - irq = NULL; - irq_pin = NULL; - irq_thread = NULL; -} - -#if MBED_CONF_MCR20A_PROVIDE_DEFAULT - -NanostackRfPhy &NanostackRfPhy::get_default_instance() -{ - static NanostackRfPhyMcr20a rf_phy(MCR20A_SPI_MOSI, MCR20A_SPI_MISO, MCR20A_SPI_SCLK, MCR20A_SPI_CS, MCR20A_SPI_RST, MCR20A_SPI_IRQ); - return rf_phy; -} - -#endif // MBED_CONF_MCR20A_PROVIDE_DEFAULT - -#endif // MBED_CONF_NANOSTACK_CONFIGURATION diff --git a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/XcvrSpi.h b/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/XcvrSpi.h deleted file mode 100644 index 5b2f12b7eb..0000000000 --- a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/source/XcvrSpi.h +++ /dev/null @@ -1,90 +0,0 @@ -/*! -* Copyright (c) 2015, Freescale Semiconductor, Inc. -* All rights reserved. -* SPDX-License-Identifier: BSD-3-Clause -* -* \file XcvrSpi.h -* -* Redistribution and use in source and binary forms, with or without modification, -* are permitted provided that the following conditions are met: -* -* o Redistributions of source code must retain the above copyright notice, this list -* of conditions and the following disclaimer. -* -* o 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. -* -* o Neither the name of Freescale Semiconductor, Inc. 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 HOLDER 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. -*/ - -#ifndef __XCVR_SPI_H__ -#define __XCVR_SPI_H__ - - -/***************************************************************************** - * INCLUDED HEADERS * - *---------------------------------------------------------------------------* - * Add to this section all the headers that this module needs to include. * - * Note that it is not a good practice to include header files into header * - * files, so use this section only if there is no other better solution. * - *---------------------------------------------------------------------------* - *****************************************************************************/ - - -/***************************************************************************** - * PUBLIC MACROS * - *---------------------------------------------------------------------------* - * Add to this section all the access macros, registers mappings, bit access * - * macros, masks, flags etc ... - *---------------------------------------------------------------------------* - *****************************************************************************/ -#define gXcvrSpiInstance_c 0 - -/***************************************************************************** - * PUBLIC FUNCTIONS * - *---------------------------------------------------------------------------* - * Add to this section all the global functions prototype preceded (as a * - * good practice) by the keyword 'extern' * - *---------------------------------------------------------------------------* - *****************************************************************************/ - -#if defined(__cplusplus) -extern "C" { -#endif /* __cplusplus */ - -void RF_RST_Set(int state); -void RF_CS_Set(int state); -void RF_IRQ_Init(void); -void RF_IRQ_Disable(void); -void RF_IRQ_Enable(void); -uint8_t RF_isIRQ_Pending(void); - -void gXcvrAssertCS_d(void); -void gXcvrDeassertCS_d(void); - -void xcvr_spi_init(uint32_t instance); -void xcvr_spi_configure_speed(uint32_t instance, uint32_t freq); -void xcvr_spi_transfer(uint32_t instance, - uint8_t *sendBuffer, - uint8_t *receiveBuffer, - uint32_t transferByteCount); - -#if defined(__cplusplus) -} -#endif /* __cplusplus */ - -#endif /* __XCVR_SPI_H__ */ From eec3332ef684b2a5a5e5cbbf772cb7d389b6b152 Mon Sep 17 00:00:00 2001 From: Arto Kinnunen Date: Wed, 23 Jun 2021 10:06:51 +0300 Subject: [PATCH 02/18] Squashed 'connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/' content from commit 61de9be6dc git-subtree-dir: connectivity/drivers/802.15.4_RF/mcr20a-rf-driver git-subtree-split: 61de9be6dcdb22c39f8bf68d5b768b8132a9dea4 --- LICENSE | 2 + README.md | 6 + apache-2.0.txt | 56 + mbed_lib.json | 9 + mcr20a-rf-driver/NanostackRfPhyMcr20a.h | 74 + source/MCR20Drv.c | 671 +++++++++ source/MCR20Drv.h | 374 +++++ source/MCR20Overwrites.h | 310 ++++ source/MCR20Reg.h | 731 ++++++++++ source/NanostackRfPhyMcr20a.cpp | 1766 +++++++++++++++++++++++ source/XcvrSpi.h | 90 ++ 11 files changed, 4089 insertions(+) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 apache-2.0.txt create mode 100644 mbed_lib.json create mode 100644 mcr20a-rf-driver/NanostackRfPhyMcr20a.h create mode 100644 source/MCR20Drv.c create mode 100644 source/MCR20Drv.h create mode 100644 source/MCR20Overwrites.h create mode 100644 source/MCR20Reg.h create mode 100644 source/NanostackRfPhyMcr20a.cpp create mode 100644 source/XcvrSpi.h diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..97df0e645d --- /dev/null +++ b/LICENSE @@ -0,0 +1,2 @@ +Unless specifically indicated otherwise in a file, files are licensed +under the Apache 2.0 license, as can be found in: apache-2.0.txt \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000000..aa927dde77 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# Example RF driver for Freescale 802.15.4 transceivers # + +Support for: + * MCR20A + +This driver is used with 6LoWPAN stack. \ No newline at end of file diff --git a/apache-2.0.txt b/apache-2.0.txt new file mode 100644 index 0000000000..0e4cf3ee99 --- /dev/null +++ b/apache-2.0.txt @@ -0,0 +1,56 @@ + + +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + + You must give any other recipients of the Work or Derivative Works a copy of this License; and + You must cause any modified files to carry prominent notices stating that You changed the files; and + You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + + You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/mbed_lib.json b/mbed_lib.json new file mode 100644 index 0000000000..3dc0a3f323 --- /dev/null +++ b/mbed_lib.json @@ -0,0 +1,9 @@ +{ + "name": "mcr20a", + "config": { + "provide-default": { + "help": "Provide default NanostackRfpy. [true/false]", + "value": false + } + } +} \ No newline at end of file diff --git a/mcr20a-rf-driver/NanostackRfPhyMcr20a.h b/mcr20a-rf-driver/NanostackRfPhyMcr20a.h new file mode 100644 index 0000000000..08ddd73ac0 --- /dev/null +++ b/mcr20a-rf-driver/NanostackRfPhyMcr20a.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2014-2019, Pelion and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef NANOSTACK_PHY_MCR20A_H_ +#define NANOSTACK_PHY_MCR20A_H_ + +#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && DEVICE_INTERRUPTIN && defined(MBED_CONF_RTOS_PRESENT) +#include "inttypes.h" +#include "NanostackRfPhy.h" +#include "DigitalIn.h" +#include "DigitalOut.h" +#include "InterruptIn.h" +#include "SPI.h" +#include "rtos.h" + +// Arduino pin defaults for convenience +#if !defined(MCR20A_SPI_MOSI) +#define MCR20A_SPI_MOSI D11 +#endif +#if !defined(MCR20A_SPI_MISO) +#define MCR20A_SPI_MISO D12 +#endif +#if !defined(MCR20A_SPI_SCLK) +#define MCR20A_SPI_SCLK D13 +#endif +#if !defined(MCR20A_SPI_CS) +#define MCR20A_SPI_CS D10 +#endif +#if !defined(MCR20A_SPI_RST) +#define MCR20A_SPI_RST D5 +#endif +#if !defined(MCR20A_SPI_IRQ) +#define MCR20A_SPI_IRQ D2 +#endif + +class NanostackRfPhyMcr20a : public NanostackRfPhy { +public: + NanostackRfPhyMcr20a(PinName spi_mosi, PinName spi_miso, + PinName spi_sclk, PinName spi_cs, PinName spi_rst, + PinName spi_irq); + virtual ~NanostackRfPhyMcr20a(); + virtual int8_t rf_register(); + virtual void rf_unregister(); + virtual void get_mac_address(uint8_t *mac); + virtual void set_mac_address(uint8_t *mac); + +private: + mbed::SPI _spi; + mbed::DigitalOut _rf_cs; + mbed::DigitalOut _rf_rst; + mbed::InterruptIn _rf_irq; + mbed::DigitalIn _rf_irq_pin; + rtos::Thread _irq_thread; + + void _pins_set(); + void _pins_clear(); +}; + +#endif /* MBED_CONF_NANOSTACK_CONFIGURATION */ +#endif /* NANOSTACK_PHY_MCR20A_H_ */ diff --git a/source/MCR20Drv.c b/source/MCR20Drv.c new file mode 100644 index 0000000000..3460732479 --- /dev/null +++ b/source/MCR20Drv.c @@ -0,0 +1,671 @@ +/*! +* Copyright (c) 2015, Freescale Semiconductor, Inc. +* All rights reserved. +* SPDX-License-Identifier: BSD-3-Clause +* +* \file MCR20Drv.c +* +* Redistribution and use in source and binary forms, with or without modification, +* are permitted provided that the following conditions are met: +* +* o Redistributions of source code must retain the above copyright notice, this list +* of conditions and the following disclaimer. +* +* o 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. +* +* o Neither the name of Freescale Semiconductor, Inc. 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 HOLDER 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 HEADERS * +*---------------------------------------------------------------------------* +* Add to this section all the headers that this module needs to include. * +*---------------------------------------------------------------------------* +*****************************************************************************/ + +#include "MCR20Drv.h" +#include "MCR20Reg.h" +#include "XcvrSpi.h" + +#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && DEVICE_INTERRUPTIN && defined(MBED_CONF_RTOS_PRESENT) + +#include "platform/mbed_critical.h" +#include + +/***************************************************************************** +* PRIVATE VARIABLES * +*---------------------------------------------------------------------------* +* Add to this section all the variables and constants that have local * +* (file) scope. * +* Each of this declarations shall be preceded by the 'static' keyword. * +* These variables / constants cannot be accessed outside this module. * +*---------------------------------------------------------------------------* +*****************************************************************************/ +uint32_t mPhyIrqDisableCnt = 1; + +/***************************************************************************** +* PUBLIC VARIABLES * +*---------------------------------------------------------------------------* +* Add to this section all the variables and constants that have global * +* (project) scope. * +* These variables / constants can be accessed outside this module. * +* These variables / constants shall be preceded by the 'extern' keyword in * +* the interface header. * +*---------------------------------------------------------------------------* +*****************************************************************************/ + +/***************************************************************************** +* PRIVATE FUNCTIONS PROTOTYPES * +*---------------------------------------------------------------------------* +* Add to this section all the functions prototypes that have local (file) * +* scope. * +* These functions cannot be accessed outside this module. * +* These declarations shall be preceded by the 'static' keyword. * +*---------------------------------------------------------------------------* +*****************************************************************************/ + +/***************************************************************************** +* PRIVATE FUNCTIONS * +*---------------------------------------------------------------------------* +* Add to this section all the functions that have local (file) scope. * +* These functions cannot be accessed outside this module. * +* These definitions shall be preceded by the 'static' keyword. * +*---------------------------------------------------------------------------* +*****************************************************************************/ + + +/***************************************************************************** +* PUBLIC FUNCTIONS * +*---------------------------------------------------------------------------* +* Add to this section all the functions that have global (project) scope. * +* These functions can be accessed outside this module. * +* These functions shall have their declarations (prototypes) within the * +* interface header file and shall be preceded by the 'extern' keyword. * +*---------------------------------------------------------------------------* +*****************************************************************************/ + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_Init +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +void MCR20Drv_Init +( + void +) +{ + xcvr_spi_init(gXcvrSpiInstance_c); + xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000); + + gXcvrDeassertCS_d(); + MCR20Drv_RST_B_Deassert(); + RF_IRQ_Init(); + RF_IRQ_Disable(); + mPhyIrqDisableCnt = 1; +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_DirectAccessSPIWrite +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +void MCR20Drv_DirectAccessSPIWrite +( + uint8_t address, + uint8_t value +) +{ + uint16_t txData; + + ProtectFromMCR20Interrupt(); + + xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000); + + gXcvrAssertCS_d(); + + txData = (address & TransceiverSPI_DirectRegisterAddressMask); + txData |= value << 8; + + xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, sizeof(txData)); + + gXcvrDeassertCS_d(); + UnprotectFromMCR20Interrupt(); +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_DirectAccessSPIMultiByteWrite +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +void MCR20Drv_DirectAccessSPIMultiByteWrite +( + uint8_t startAddress, + uint8_t *byteArray, + uint8_t numOfBytes +) +{ + uint8_t txData; + + if ((numOfBytes == 0) || (byteArray == NULL)) { + return; + } + + ProtectFromMCR20Interrupt(); + + xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000); + + gXcvrAssertCS_d(); + + txData = (startAddress & TransceiverSPI_DirectRegisterAddressMask); + + xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, 0, sizeof(txData)); + xcvr_spi_transfer(gXcvrSpiInstance_c, byteArray, 0, numOfBytes); + + gXcvrDeassertCS_d(); + UnprotectFromMCR20Interrupt(); +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_PB_SPIByteWrite +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +void MCR20Drv_PB_SPIByteWrite +( + uint8_t address, + uint8_t value +) +{ + uint32_t txData; + + ProtectFromMCR20Interrupt(); + + xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000); + + gXcvrAssertCS_d(); + + txData = TransceiverSPI_WriteSelect | + TransceiverSPI_PacketBuffAccessSelect | + TransceiverSPI_PacketBuffByteModeSelect; + txData |= (address) << 8; + txData |= (value) << 16; + + xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, 3); + + gXcvrDeassertCS_d(); + UnprotectFromMCR20Interrupt(); +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_PB_SPIBurstWrite +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +void MCR20Drv_PB_SPIBurstWrite +( + uint8_t *byteArray, + uint8_t numOfBytes +) +{ + uint8_t txData; + + if ((numOfBytes == 0) || (byteArray == NULL)) { + return; + } + + ProtectFromMCR20Interrupt(); + + xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000); + + gXcvrAssertCS_d(); + + txData = TransceiverSPI_WriteSelect | + TransceiverSPI_PacketBuffAccessSelect | + TransceiverSPI_PacketBuffBurstModeSelect; + + xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, 0, 1); + xcvr_spi_transfer(gXcvrSpiInstance_c, byteArray, 0, numOfBytes); + + gXcvrDeassertCS_d(); + UnprotectFromMCR20Interrupt(); +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_DirectAccessSPIRead +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ + +uint8_t MCR20Drv_DirectAccessSPIRead +( + uint8_t address +) +{ + uint8_t txData; + uint8_t rxData; + + ProtectFromMCR20Interrupt(); + + xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000); + + gXcvrAssertCS_d(); + + txData = (address & TransceiverSPI_DirectRegisterAddressMask) | + TransceiverSPI_ReadSelect; + + xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, 0, sizeof(txData)); + xcvr_spi_transfer(gXcvrSpiInstance_c, 0, &rxData, sizeof(rxData)); + + gXcvrDeassertCS_d(); + UnprotectFromMCR20Interrupt(); + + return rxData; + +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_DirectAccessSPIMultyByteRead +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +uint8_t MCR20Drv_DirectAccessSPIMultiByteRead +( + uint8_t startAddress, + uint8_t *byteArray, + uint8_t numOfBytes +) +{ + uint8_t txData; + uint8_t phyIRQSTS1; + + if ((numOfBytes == 0) || (byteArray == NULL)) { + return 0; + } + + ProtectFromMCR20Interrupt(); + + xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000); + + gXcvrAssertCS_d(); + + txData = (startAddress & TransceiverSPI_DirectRegisterAddressMask) | + TransceiverSPI_ReadSelect; + + xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, &phyIRQSTS1, sizeof(txData)); + xcvr_spi_transfer(gXcvrSpiInstance_c, 0, byteArray, numOfBytes); + + gXcvrDeassertCS_d(); + UnprotectFromMCR20Interrupt(); + + return phyIRQSTS1; +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_PB_SPIBurstRead +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +uint8_t MCR20Drv_PB_SPIBurstRead +( + uint8_t *byteArray, + uint8_t numOfBytes +) +{ + uint8_t txData; + uint8_t phyIRQSTS1; + + if ((numOfBytes == 0) || (byteArray == NULL)) { + return 0; + } + + ProtectFromMCR20Interrupt(); + + xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000); + + gXcvrAssertCS_d(); + + txData = TransceiverSPI_ReadSelect | + TransceiverSPI_PacketBuffAccessSelect | + TransceiverSPI_PacketBuffBurstModeSelect; + + xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, &phyIRQSTS1, sizeof(txData)); + xcvr_spi_transfer(gXcvrSpiInstance_c, 0, byteArray, numOfBytes); + + gXcvrDeassertCS_d(); + UnprotectFromMCR20Interrupt(); + + return phyIRQSTS1; +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_IndirectAccessSPIWrite +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +void MCR20Drv_IndirectAccessSPIWrite +( + uint8_t address, + uint8_t value +) +{ + uint32_t txData; + + ProtectFromMCR20Interrupt(); + + xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000); + + gXcvrAssertCS_d(); + + txData = TransceiverSPI_IARIndexReg; + txData |= (address) << 8; + txData |= (value) << 16; + + xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, 3); + + gXcvrDeassertCS_d(); + UnprotectFromMCR20Interrupt(); +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_IndirectAccessSPIMultiByteWrite +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +void MCR20Drv_IndirectAccessSPIMultiByteWrite +( + uint8_t startAddress, + uint8_t *byteArray, + uint8_t numOfBytes +) +{ + uint16_t txData; + + if ((numOfBytes == 0) || (byteArray == NULL)) { + return; + } + + ProtectFromMCR20Interrupt(); + + xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000); + + gXcvrAssertCS_d(); + + txData = TransceiverSPI_IARIndexReg; + txData |= (startAddress) << 8; + + xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, sizeof(txData)); + xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)byteArray, 0, numOfBytes); + + gXcvrDeassertCS_d(); + UnprotectFromMCR20Interrupt(); +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_IndirectAccessSPIRead +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +uint8_t MCR20Drv_IndirectAccessSPIRead +( + uint8_t address +) +{ + uint16_t txData; + uint8_t rxData; + + ProtectFromMCR20Interrupt(); + + xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000); + + gXcvrAssertCS_d(); + + txData = TransceiverSPI_IARIndexReg | TransceiverSPI_ReadSelect; + txData |= (address) << 8; + + xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, sizeof(txData)); + xcvr_spi_transfer(gXcvrSpiInstance_c, 0, &rxData, sizeof(rxData)); + + gXcvrDeassertCS_d(); + UnprotectFromMCR20Interrupt(); + + return rxData; +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_IndirectAccessSPIMultiByteRead +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +void MCR20Drv_IndirectAccessSPIMultiByteRead +( + uint8_t startAddress, + uint8_t *byteArray, + uint8_t numOfBytes +) +{ + uint16_t txData; + + if ((numOfBytes == 0) || (byteArray == NULL)) { + return; + } + + ProtectFromMCR20Interrupt(); + + xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000); + + gXcvrAssertCS_d(); + + txData = (TransceiverSPI_IARIndexReg | TransceiverSPI_ReadSelect); + txData |= (startAddress) << 8; + + xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, sizeof(txData)); + xcvr_spi_transfer(gXcvrSpiInstance_c, 0, byteArray, numOfBytes); + + gXcvrDeassertCS_d(); + UnprotectFromMCR20Interrupt(); +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_IsIrqPending +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +uint32_t MCR20Drv_IsIrqPending +( + void +) +{ + return RF_isIRQ_Pending(); +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_IRQ_Disable +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +void MCR20Drv_IRQ_Disable +( + void +) +{ + core_util_critical_section_enter(); + + if (mPhyIrqDisableCnt == 0) { + RF_IRQ_Disable(); + } + + mPhyIrqDisableCnt++; + + core_util_critical_section_exit(); +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_IRQ_Enable +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +void MCR20Drv_IRQ_Enable +( + void +) +{ + core_util_critical_section_enter(); + + if (mPhyIrqDisableCnt) { + mPhyIrqDisableCnt--; + + if (mPhyIrqDisableCnt == 0) { + RF_IRQ_Enable(); + } + } + + core_util_critical_section_exit(); +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_RST_Assert +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +void MCR20Drv_RST_B_Assert +( + void +) +{ + RF_RST_Set(0); +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_RST_Deassert +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +void MCR20Drv_RST_B_Deassert +( + void +) +{ + RF_RST_Set(1); +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_SoftRST_Assert +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +void MCR20Drv_SoftRST_Assert +( + void +) +{ + MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x80)); +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_SoftRST_Deassert +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +void MCR20Drv_SoftRST_Deassert +( + void +) +{ + MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x00)); +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_Soft_RESET +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +void MCR20Drv_Soft_RESET +( + void +) +{ + //assert SOG_RST + MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x80)); + + //deassert SOG_RST + MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x00)); +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_RESET +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +void MCR20Drv_RESET +( + void +) +{ + volatile uint32_t delay = 1000; + //assert RST_B + MCR20Drv_RST_B_Assert(); + + while (delay--); + + //deassert RST_B + MCR20Drv_RST_B_Deassert(); +} + +/*--------------------------------------------------------------------------- +* Name: MCR20Drv_Set_CLK_OUT_Freq +* Description: - +* Parameters: - +* Return: - +*---------------------------------------------------------------------------*/ +void MCR20Drv_Set_CLK_OUT_Freq +( + uint8_t freqDiv +) +{ + uint8_t clkOutCtrlReg = (freqDiv & cCLK_OUT_DIV_Mask) | cCLK_OUT_EN | cCLK_OUT_EXTEND; + + if (freqDiv == gCLK_OUT_FREQ_DISABLE) { + clkOutCtrlReg = (cCLK_OUT_EXTEND | gCLK_OUT_FREQ_4_MHz); //reset value with clock out disabled + } + + MCR20Drv_DirectAccessSPIWrite((uint8_t) CLK_OUT_CTRL, clkOutCtrlReg); +} + +#endif /* MBED_CONF_NANOSTACK_CONFIGURATION */ diff --git a/source/MCR20Drv.h b/source/MCR20Drv.h new file mode 100644 index 0000000000..bcbe6dcd53 --- /dev/null +++ b/source/MCR20Drv.h @@ -0,0 +1,374 @@ +/*! +* Copyright (c) 2015, Freescale Semiconductor, Inc. +* All rights reserved. +* SPDX-License-Identifier: BSD-3-Clause +* +* \file MCR20Drv.h +* +* Redistribution and use in source and binary forms, with or without modification, +* are permitted provided that the following conditions are met: +* +* o Redistributions of source code must retain the above copyright notice, this list +* of conditions and the following disclaimer. +* +* o 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. +* +* o Neither the name of Freescale Semiconductor, Inc. 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 HOLDER 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. +*/ + +#ifndef __MCR20_DRV_H__ +#define __MCR20_DRV_H__ + +#include + +/***************************************************************************** + * INCLUDED HEADERS * + *---------------------------------------------------------------------------* + * Add to this section all the headers that this module needs to include. * + * Note that it is not a good practice to include header files into header * + * files, so use this section only if there is no other better solution. * + *---------------------------------------------------------------------------* + *****************************************************************************/ + +/***************************************************************************** + * PRIVATE MACROS * + *---------------------------------------------------------------------------* + * Add to this section all the access macros, registers mappings, bit access * + * macros, masks, flags etc ... + *---------------------------------------------------------------------------* + *****************************************************************************/ + +/* Disable XCVR clock output by default, to reduce power consumption */ +#ifndef gMCR20_ClkOutFreq_d +#define gMCR20_ClkOutFreq_d gCLK_OUT_FREQ_DISABLE +#endif + +/***************************************************************************** + * PUBLIC FUNCTIONS * + *---------------------------------------------------------------------------* + * Add to this section all the global functions prototype preceded (as a * + * good practice) by the keyword 'extern' * + *---------------------------------------------------------------------------* + *****************************************************************************/ + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_Init + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +extern void MCR20Drv_Init +( + void +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_SPI_DMA_Init + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_SPI_DMA_Init +( + void +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_Start_PB_DMA_SPI_Write + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_Start_PB_DMA_SPI_Write +( + uint8_t *srcAddress, + uint8_t numOfBytes +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_Start_PB_DMA_SPI_Read + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_Start_PB_DMA_SPI_Read +( + uint8_t *dstAddress, + uint8_t numOfBytes +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_DirectAccessSPIWrite + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_DirectAccessSPIWrite +( + uint8_t address, + uint8_t value +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_DirectAccessSPIMultiByteWrite + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_DirectAccessSPIMultiByteWrite +( + uint8_t startAddress, + uint8_t *byteArray, + uint8_t numOfBytes +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_PB_SPIBurstWrite + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_PB_SPIBurstWrite +( + uint8_t *byteArray, + uint8_t numOfBytes +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_DirectAccessSPIRead + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +uint8_t MCR20Drv_DirectAccessSPIRead +( + uint8_t address +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_DirectAccessSPIMultyByteRead + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ + +uint8_t MCR20Drv_DirectAccessSPIMultiByteRead +( + uint8_t startAddress, + uint8_t *byteArray, + uint8_t numOfBytes +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_PB_SPIByteWrite + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_PB_SPIByteWrite +( + uint8_t address, + uint8_t value +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_PB_SPIBurstRead + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +uint8_t MCR20Drv_PB_SPIBurstRead +( + uint8_t *byteArray, + uint8_t numOfBytes +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_IndirectAccessSPIWrite + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_IndirectAccessSPIWrite +( + uint8_t address, + uint8_t value +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_IndirectAccessSPIMultiByteWrite + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_IndirectAccessSPIMultiByteWrite +( + uint8_t startAddress, + uint8_t *byteArray, + uint8_t numOfBytes +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_IndirectAccessSPIRead + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +uint8_t MCR20Drv_IndirectAccessSPIRead +( + uint8_t address +); +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_IndirectAccessSPIMultiByteRead + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_IndirectAccessSPIMultiByteRead +( + uint8_t startAddress, + uint8_t *byteArray, + uint8_t numOfBytes +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_IsIrqPending + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +uint32_t MCR20Drv_IsIrqPending +( + void +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_IRQ_Disable + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_IRQ_Disable +( + void +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_IRQ_Enable + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_IRQ_Enable +( + void +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_RST_PortConfig + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_RST_B_PortConfig +( + void +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_RST_Assert + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_RST_B_Assert +( + void +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_RST_Deassert + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_RST_B_Deassert +( + void +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_SoftRST_Assert + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_SoftRST_Assert +( + void +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_SoftRST_Deassert + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_SoftRST_Deassert +( + void +); + + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_RESET + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_RESET +( + void +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_Soft_RESET + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_Soft_RESET +( + void +); + +/*--------------------------------------------------------------------------- + * Name: MCR20Drv_Set_CLK_OUT_Freq + * Description: - + * Parameters: - + * Return: - + *---------------------------------------------------------------------------*/ +void MCR20Drv_Set_CLK_OUT_Freq +( + uint8_t freqDiv +); + +#define ProtectFromMCR20Interrupt() MCR20Drv_IRQ_Disable() +#define UnprotectFromMCR20Interrupt() MCR20Drv_IRQ_Enable() + +#endif /* __MCR20_DRV_H__ */ diff --git a/source/MCR20Overwrites.h b/source/MCR20Overwrites.h new file mode 100644 index 0000000000..af1f99f7dc --- /dev/null +++ b/source/MCR20Overwrites.h @@ -0,0 +1,310 @@ +/*! +* Copyright (c) 2015, Freescale Semiconductor, Inc. +* All rights reserved. +* SPDX-License-Identifier: BSD-3-Clause +* +* \file MCR20Overwrites.h +* Description: Overwrites header file for MCR20 Register values +* +* Redistribution and use in source and binary forms, with or without modification, +* are permitted provided that the following conditions are met: +* +* o Redistributions of source code must retain the above copyright notice, this list +* of conditions and the following disclaimer. +* +* o 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. +* +* o Neither the name of Freescale Semiconductor, Inc. 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 HOLDER 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. +*/ + +#ifndef OVERWRITES_H_ +#define OVERWRITES_H_ + +typedef struct overwrites_tag { + char address; + char data; +} overwrites_t; + + +/*****************************************************************************************************************/ +// This file is created exclusively for use with the transceiver 2.0 silicon +// and is provided for the world to use. It contains a list of all +// known overwrite values. Overwrite values are non-default register +// values that configure the transceiver device to a more optimally performing +// posture. It is expected that low level software (i.e. PHY) will +// consume this file as a #include, and transfer the contents to the +// the indicated addresses in the transceiver's memory space. This file has +// at least one required entry, that being its own version current version +// number, to be stored at transceiver's location 0x3B the +// OVERWRITES_VERSION_NUMBER register. The RAM register is provided in +// the transceiver address space to assist in future debug efforts. The +// analyst may read this location (once device has been booted with +// mysterious software) and have a good indication of what register +// overwrites were performed (with all versions of the overwrites.h file +// being archived forever at the Compass location shown above. +// +// The transceiver has an indirect register (IAR) space. Write access to this space +// requires 3 or more writes: +// 1st) the first write is an index value to the indirect (write Bit7=0, register access Bit 6=0) + 0x3E +// 2nd) IAR Register #0x00 - 0xFF. +// 3rd) The data to write +// nth) Burst mode additional data if required. +// +// Write access to direct space requires only a single address, data pair. + +overwrites_t const overwrites_direct[] = { + {0x3B, 0x0C}, //version 0C: new value for ACKDELAY targeting 198us (23 May, 2013, Larry Roshak) + {0x23, 0x17} //PA_PWR new default Power Step is "23" +}; + +overwrites_t const overwrites_indirect[] = { + {0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) + {0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3 + {0x92, 0x07}, //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1 + {0x8A, 0x71}, //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid) + {0x79, 0x2F}, //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) + {0x7A, 0x2F}, //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) + {0x7B, 0x24}, //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) + {0x7C, 0x24}, //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) + {0x7D, 0x24}, //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) + {0x7E, 0x24}, //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) + {0x7F, 0x32}, //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) + {0x80, 0x1D}, //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) + {0x81, 0x2D}, //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) + {0x82, 0x24}, //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) + {0x83, 0x24}, //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) + {0x64, 0x28}, //PA_CAL_DIS=1 Disabled PA calibration + {0x52, 0x55}, //AGC_THR1 RSSI tune up + {0x53, 0x2D}, //AGC_THR2 RSSI tune up + {0x66, 0x5F}, //ATT_RSSI1 tune up + {0x67, 0x8F}, //ATT_RSSI2 tune up + {0x68, 0x61}, //RSSI_OFFSET + {0x78, 0x03}, //CHF_PMAGAIN + {0x22, 0x50}, //CCA1_THRESH + {0x4D, 0x13}, //CORR_NVAL moved from 0x14 to 0x13 for 0.5 dB improved Rx Sensitivity + {0x39, 0x3D} //ACKDELAY new value targeting a delay of 198us (23 May, 2013, Larry Roshak) +}; + + +/* begin of deprecated versions + +==VERSION 1== +(version 1 is empty) + +==VERSION 2== +overwrites_t const overwrites_indirect[] ={ +{0x31, 0x02} //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) +}; + +==VERSION 3== +overwrites_t const overwrites_indirect[] ={ +{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) +{0x91, 0xB3}, //VCO_CTRL1: override VCOALC_REF_TX to 3 +{0x92, 0x07} //VCO_CTRL2: override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1 +}; + +==VERSION 4== +overwrites_t const overwrites_direct[] ={ +{0x3B, 0x04} //version 04 is the current version: update PA_COILTUNING default +}; + +overwrites_t const overwrites_indirect[] ={ +{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) +{0x91, 0xB3}, //VCO_CTRL1: override VCOALC_REF_TX to 3 +{0x92, 0x07} //VCO_CTRL2: override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1 +{0x8A, 0x71} //PA_TUNING: override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid) +}; + +==VERSION 5== +overwrites_t const overwrites_direct[] ={ +{0x3B, 0x05} //version 05: updates Channel Filter Register set (21 Dec 2012, on behalf of S. Soca) +}; + +overwrites_t const overwrites_indirect[] ={ +{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) +{0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3 +{0x92, 0x07} //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1 +{0x8A, 0x71} //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid) +{0x79, 0x2F} //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) +{0x7A, 0x2F} //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) +{0x7B, 0x24} //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7C, 0x24} //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7D, 0x24} //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7E, 0x24} //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x82, 0x24} //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x83, 0x24} //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7F, 0x32} //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x80, 0x1D} //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x81, 0x2D} //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) +}; + +==VERSION 6== +overwrites_t const overwrites_direct[] ={ +{0x3B, 0x06} //version 06: disable PA calibration +}; + +overwrites_t const overwrites_indirect[] ={ +{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) +{0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3 +{0x92, 0x07} //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1 +{0x8A, 0x71} //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid) +{0x79, 0x2F} //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) +{0x7A, 0x2F} //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) +{0x7B, 0x24} //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7C, 0x24} //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7D, 0x24} //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7E, 0x24} //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x82, 0x24} //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x83, 0x24} //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7F, 0x32} //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x80, 0x1D} //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x81, 0x2D} //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x64, 0x28} //PA_CAL_DIS=1 Disabled PA calibration +}; + +==VERSION 7== +overwrites_t const overwrites_direct[] ={ +{0x3B, 0x07} //version 07: updated registers for ED/RSSI +}; + +overwrites_t const overwrites_indirect[] ={ +{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) +{0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3 +{0x92, 0x07}, //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1 +{0x8A, 0x71}, //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid) +{0x79, 0x2F}, //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) +{0x7A, 0x2F}, //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) +{0x7B, 0x24}, //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7C, 0x24}, //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7D, 0x24}, //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7E, 0x24}, //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x82, 0x24}, //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x83, 0x24}, //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7F, 0x32}, //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x80, 0x1D}, //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x81, 0x2D}, //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x64, 0x28}, //PA_CAL_DIS=1 Disabled PA calibration +{0x52, 0x73}, //AGC_THR1 RSSI tune up +{0x53, 0x2D}, //AGC_THR2 RSSI tune up +{0x66, 0x5F}, //ATT_RSSI1 tune up +{0x67, 0x8F}, //ATT_RSSI2 tune up +{0x68, 0x60}, //RSSI_OFFSET +{0x69, 0x65} //RSSI_SLOPE +}; + + +==VERSION 8== +overwrites_t const overwrites_direct[] ={ +{0x3B, 0x08} //version 08: updated registers for ED/RSSI +}; + +overwrites_t const overwrites_indirect[] ={ +{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) +{0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3 +{0x92, 0x07}, //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1 +{0x8A, 0x71}, //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid) +{0x79, 0x2F}, //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) +{0x7A, 0x2F}, //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) +{0x7B, 0x24}, //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7C, 0x24}, //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7D, 0x24}, //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7E, 0x24}, //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x82, 0x24}, //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x83, 0x24}, //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7F, 0x32}, //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x80, 0x1D}, //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x81, 0x2D}, //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x64, 0x28}, //PA_CAL_DIS=1 Disabled PA calibration +{0x52, 0x73}, //AGC_THR1 RSSI tune up +{0x53, 0x2D}, //AGC_THR2 RSSI tune up +{0x66, 0x5F}, //ATT_RSSI1 tune up +{0x67, 0x8F}, //ATT_RSSI2 tune up +{0x69, 0x65} //RSSI_SLOPE +{0x68, 0x61}, //RSSI_OFFSET +{0x78, 0x03} //CHF_PMAGAIN +}; + + +==VERSION 9== +overwrites_t const overwrites_direct[] ={ +{0x3B, 0x09} //version 09: updated registers for ED/RSSI and PowerStep +{0x23, 0x17} //PA_PWR new default value +}; + +overwrites_t const overwrites_indirect[] ={ +{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) +{0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3 +{0x92, 0x07}, //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1 +{0x8A, 0x71}, //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid) +{0x79, 0x2F}, //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) +{0x7A, 0x2F}, //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) +{0x7B, 0x24}, //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7C, 0x24}, //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7D, 0x24}, //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7E, 0x24}, //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7F, 0x32}, //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x80, 0x1D}, //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x81, 0x2D}, //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x82, 0x24}, //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x83, 0x24}, //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x64, 0x28}, //PA_CAL_DIS=1 Disabled PA calibration +{0x52, 0x55}, //AGC_THR1 RSSI tune up +{0x53, 0x2D}, //AGC_THR2 RSSI tune up +{0x66, 0x5F}, //ATT_RSSI1 tune up +{0x67, 0x8F}, //ATT_RSSI2 tune up +{0x68, 0x61}, //RSSI_OFFSET +{0x78, 0x03} //CHF_PMAGAIN +}; + +==VERSION A== +overwrites_t const overwrites_direct[] ={ +{0x3B, 0x0A} //version 0A: updated registers for CCA +{0x23, 0x17} //PA_PWR new default Power Step is "23" +}; + +overwrites_t const overwrites_indirect[] ={ +{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents) +{0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3 +{0x92, 0x07}, //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1 +{0x8A, 0x71}, //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid) +{0x79, 0x2F}, //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) +{0x7A, 0x2F}, //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca) +{0x7B, 0x24}, //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7C, 0x24}, //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7D, 0x24}, //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7E, 0x24}, //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x7F, 0x32}, //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x80, 0x1D}, //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x81, 0x2D}, //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x82, 0x24}, //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x83, 0x24}, //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca) +{0x64, 0x28}, //PA_CAL_DIS=1 Disabled PA calibration +{0x52, 0x55}, //AGC_THR1 RSSI tune up +{0x53, 0x2D}, //AGC_THR2 RSSI tune up +{0x66, 0x5F}, //ATT_RSSI1 tune up +{0x67, 0x8F}, //ATT_RSSI2 tune up +{0x68, 0x61}, //RSSI_OFFSET +{0x78, 0x03} //CHF_PMAGAIN +{0x22, 0x50} //CCA1_THRESH +}; + +end of deprecated versions */ + + +#endif //OVERWRITES_H_ + diff --git a/source/MCR20Reg.h b/source/MCR20Reg.h new file mode 100644 index 0000000000..a42b31bcc0 --- /dev/null +++ b/source/MCR20Reg.h @@ -0,0 +1,731 @@ +/*! +* Copyright (c) 2015, Freescale Semiconductor, Inc. +* All rights reserved. +* SPDX-License-Identifier: BSD-3-Clause +* +* \file MCR20reg.h +* MCR20 Registers +* +* Redistribution and use in source and binary forms, with or without modification, +* are permitted provided that the following conditions are met: +* +* o Redistributions of source code must retain the above copyright notice, this list +* of conditions and the following disclaimer. +* +* o 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. +* +* o Neither the name of Freescale Semiconductor, Inc. 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 HOLDER 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. +*/ + +#ifndef __MCR20_REG_H__ +#define __MCR20_REG_H__ +/***************************************************************************** + * INCLUDED HEADERS * + *---------------------------------------------------------------------------* + * Add to this section all the headers that this module needs to include. * + * Note that it is not a good practice to include header files into header * + * files, so use this section only if there is no other better solution. * + *---------------------------------------------------------------------------* + *****************************************************************************/ + +/****************************************************************************/ +/* Transceiver SPI Registers */ +/****************************************************************************/ + +#define TransceiverSPI_IARIndexReg (0x3E) + +#define TransceiverSPI_ReadSelect (1<<7) +#define TransceiverSPI_WriteSelect (0<<7) +#define TransceiverSPI_RegisterAccessSelect (0<<6) +#define TransceiverSPI_PacketBuffAccessSelect (1<<6) +#define TransceiverSPI_PacketBuffBurstModeSelect (0<<5) +#define TransceiverSPI_PacketBuffByteModeSelect (1<<5) + +#define TransceiverSPI_DirectRegisterAddressMask (0x3F) + +#define IRQSTS1 0x00 +#define IRQSTS2 0x01 +#define IRQSTS3 0x02 +#define PHY_CTRL1 0x03 +#define PHY_CTRL2 0x04 +#define PHY_CTRL3 0x05 +#define RX_FRM_LEN 0x06 +#define PHY_CTRL4 0x07 +#define SRC_CTRL 0x08 +#define SRC_ADDRS_SUM_LSB 0x09 +#define SRC_ADDRS_SUM_MSB 0x0A +#define CCA1_ED_FNL 0x0B +#define EVENT_TMR_LSB 0x0C +#define EVENT_TMR_MSB 0x0D +#define EVENT_TMR_USB 0x0E +#define TIMESTAMP_LSB 0x0F +#define TIMESTAMP_MSB 0x10 +#define TIMESTAMP_USB 0x11 +#define T3CMP_LSB 0x12 +#define T3CMP_MSB 0x13 +#define T3CMP_USB 0x14 +#define T2PRIMECMP_LSB 0x15 +#define T2PRIMECMP_MSB 0x16 +#define T1CMP_LSB 0x17 +#define T1CMP_MSB 0x18 +#define T1CMP_USB 0x19 +#define T2CMP_LSB 0x1A +#define T2CMP_MSB 0x1B +#define T2CMP_USB 0x1C +#define T4CMP_LSB 0x1D +#define T4CMP_MSB 0x1E +#define T4CMP_USB 0x1F +#define PLL_INT0 0x20 +#define PLL_FRAC0_LSB 0x21 +#define PLL_FRAC0_MSB 0x22 +#define PA_PWR 0x23 +#define SEQ_STATE 0x24 +#define LQI_VALUE 0x25 +#define RSSI_CCA_CONT 0x26 +//-------------- 0x27 +#define ASM_CTRL1 0x28 +#define ASM_CTRL2 0x29 +#define ASM_DATA_0 0x2A +#define ASM_DATA_1 0x2B +#define ASM_DATA_2 0x2C +#define ASM_DATA_3 0x2D +#define ASM_DATA_4 0x2E +#define ASM_DATA_5 0x2F +#define ASM_DATA_6 0x30 +#define ASM_DATA_7 0x31 +#define ASM_DATA_8 0x32 +#define ASM_DATA_9 0x33 +#define ASM_DATA_A 0x34 +#define ASM_DATA_B 0x35 +#define ASM_DATA_C 0x36 +#define ASM_DATA_D 0x37 +#define ASM_DATA_E 0x38 +#define ASM_DATA_F 0x39 +//------------------- 0x3A +#define OVERWRITE_VER 0x3B +#define CLK_OUT_CTRL 0x3C +#define PWR_MODES 0x3D +#define IAR_INDEX 0x3E +#define IAR_DATA 0x3F + + +#define PART_ID 0x00 +#define XTAL_TRIM 0x01 +#define PMC_LP_TRIM 0x02 +#define MACPANID0_LSB 0x03 +#define MACPANID0_MSB 0x04 +#define MACSHORTADDRS0_LSB 0x05 +#define MACSHORTADDRS0_MSB 0x06 +#define MACLONGADDRS0_0 0x07 +#define MACLONGADDRS0_8 0x08 +#define MACLONGADDRS0_16 0x09 +#define MACLONGADDRS0_24 0x0A +#define MACLONGADDRS0_32 0x0B +#define MACLONGADDRS0_40 0x0C +#define MACLONGADDRS0_48 0x0D +#define MACLONGADDRS0_56 0x0E +#define RX_FRAME_FILTER 0x0F +#define PLL_INT1 0x10 +#define PLL_FRAC1_LSB 0x11 +#define PLL_FRAC1_MSB 0x12 +#define MACPANID1_LSB 0x13 +#define MACPANID1_MSB 0x14 +#define MACSHORTADDRS1_LSB 0x15 +#define MACSHORTADDRS1_MSB 0x16 +#define MACLONGADDRS1_0 0x17 +#define MACLONGADDRS1_8 0x18 +#define MACLONGADDRS1_16 0x19 +#define MACLONGADDRS1_24 0x1A +#define MACLONGADDRS1_32 0x1B +#define MACLONGADDRS1_40 0x1C +#define MACLONGADDRS1_48 0x1D +#define MACLONGADDRS1_56 0x1E +#define DUAL_PAN_CTRL 0x1F +#define DUAL_PAN_DWELL 0x20 +#define DUAL_PAN_STS 0x21 +#define CCA1_THRESH 0x22 +#define CCA1_ED_OFFSET_COMP 0x23 +#define LQI_OFFSET_COMP 0x24 +#define CCA_CTRL 0x25 +#define CCA2_CORR_PEAKS 0x26 +#define CCA2_CORR_THRESH 0x27 +#define TMR_PRESCALE 0x28 +//---------------- 0x29 +#define GPIO_DATA 0x2A +#define GPIO_DIR 0x2B +#define GPIO_PUL_EN 0x2C +#define GPIO_PUL_SEL 0x2D +#define GPIO_DS 0x2E +//-------------- 0x2F +#define ANT_PAD_CTRL 0x30 +#define MISC_PAD_CTRL 0x31 +#define BSM_CTRL 0x32 +//--------------- 0x33 +#define _RNG 0x34 +#define RX_BYTE_COUNT 0x35 +#define RX_WTR_MARK 0x36 +#define SOFT_RESET 0x37 +#define TXDELAY 0x38 +#define ACKDELAY 0x39 +#define SEQ_MGR_CTRL 0x3A +#define SEQ_MGR_STS 0x3B +#define SEQ_T_STS 0x3C +#define ABORT_STS 0x3D +#define CCCA_BUSY_CNT 0x3E +#define SRC_ADDR_CHECKSUM1 0x3F +#define SRC_ADDR_CHECKSUM2 0x40 +#define SRC_TBL_VALID1 0x41 +#define SRC_TBL_VALID2 0x42 +#define FILTERFAIL_CODE1 0x43 +#define FILTERFAIL_CODE2 0x44 +#define SLOT_PRELOAD 0x45 +//---------------- 0x46 +#define CORR_VT 0x47 +#define SYNC_CTRL 0x48 +#define PN_LSB_0 0x49 +#define PN_LSB_1 0x4A +#define PN_MSB_0 0x4B +#define PN_MSB_1 0x4C +#define CORR_NVAL 0x4D +#define TX_MODE_CTRL 0x4E +#define SNF_THR 0x4F +#define FAD_THR 0x50 +#define ANT_AGC_CTRL 0x51 +#define AGC_THR1 0x52 +#define AGC_THR2 0x53 +#define AGC_HYS 0x54 +#define AFC 0x55 +//--------------- 0x56 +//--------------- 0x57 +#define PHY_STS 0x58 +#define RX_MAX_CORR 0x59 +#define RX_MAX_PREAMBLE 0x5A +#define RSSI 0x5B +//--------------- 0x5C +//--------------- 0x5D +#define PLL_DIG_CTRL 0x5E +#define VCO_CAL 0x5F +#define VCO_BEST_DIFF 0x60 +#define VCO_BIAS 0x61 +#define KMOD_CTRL 0x62 +#define KMOD_CAL 0x63 +#define PA_CAL 0x64 +#define PA_PWRCAL 0x65 +#define ATT_RSSI1 0x66 +#define ATT_RSSI2 0x67 +#define RSSI_OFFSET 0x68 +#define RSSI_SLOPE 0x69 +#define RSSI_CAL1 0x6A +#define RSSI_CAL2 0x6B +//--------------- 0x6C +//--------------- 0x6D +#define XTAL_CTRL 0x6E +#define XTAL_COMP_MIN 0x6F +#define XTAL_COMP_MAX 0x70 +#define XTAL_GM 0x71 +//--------------- 0x72 +//--------------- 0x73 +#define LNA_TUNE 0x74 +#define LNA_AGCGAIN 0x75 +//--------------- 0x76 +//--------------- 0x77 +#define CHF_PMA_GAIN 0x78 +#define CHF_IBUF 0x79 +#define CHF_QBUF 0x7A +#define CHF_IRIN 0x7B +#define CHF_QRIN 0x7C +#define CHF_IL 0x7D +#define CHF_QL 0x7E +#define CHF_CC1 0x7F +#define CHF_CCL 0x80 +#define CHF_CC2 0x81 +#define CHF_IROUT 0x82 +#define CHF_QROUT 0x83 +//--------------- 0x84 +//--------------- 0x85 +#define RSSI_CTRL 0x86 +//--------------- 0x87 +//--------------- 0x88 +#define PA_BIAS 0x89 +#define PA_TUNING 0x8A +//--------------- 0x8B +//--------------- 0x8C +#define PMC_HP_TRIM 0x8D +#define VREGA_TRIM 0x8E +//--------------- 0x8F +//--------------- 0x90 +#define VCO_CTRL1 0x91 +#define VCO_CTRL2 0x92 +//--------------- 0x93 +//--------------- 0x94 +#define ANA_SPARE_OUT1 0x95 +#define ANA_SPARE_OUT2 0x96 +#define ANA_SPARE_IN 0x97 +#define MISCELLANEOUS 0x98 +//--------------- 0x99 +#define SEQ_MGR_OVRD0 0x9A +#define SEQ_MGR_OVRD1 0x9B +#define SEQ_MGR_OVRD2 0x9C +#define SEQ_MGR_OVRD3 0x9D +#define SEQ_MGR_OVRD4 0x9E +#define SEQ_MGR_OVRD5 0x9F +#define SEQ_MGR_OVRD6 0xA0 +#define SEQ_MGR_OVRD7 0xA1 +//--------------- 0xA2 +#define TESTMODE_CTRL 0xA3 +#define DTM_CTRL1 0xA4 +#define DTM_CTRL2 0xA5 +#define ATM_CTRL1 0xA6 +#define ATM_CTRL2 0xA7 +#define ATM_CTRL3 0xA8 +//--------------- 0xA9 +#define LIM_FE_TEST_CTRL 0xAA +#define CHF_TEST_CTRL 0xAB +#define VCO_TEST_CTRL 0xAC +#define PLL_TEST_CTRL 0xAD +#define PA_TEST_CTRL 0xAE +#define PMC_TEST_CTRL 0xAF +#define SCAN_DTM_PROTECT_1 0xFE +#define SCAN_DTM_PROTECT_0 0xFF + +// IRQSTS1 bits +#define cIRQSTS1_RX_FRM_PEND (1<<7) +#define cIRQSTS1_PLL_UNLOCK_IRQ (1<<6) +#define cIRQSTS1_FILTERFAIL_IRQ (1<<5) +#define cIRQSTS1_RXWTRMRKIRQ (1<<4) +#define cIRQSTS1_CCAIRQ (1<<3) +#define cIRQSTS1_RXIRQ (1<<2) +#define cIRQSTS1_TXIRQ (1<<1) +#define cIRQSTS1_SEQIRQ (1<<0) + +typedef union regIRQSTS1_tag { + uint8_t byte; + struct { + uint8_t SEQIRQ: 1; + uint8_t TXIRQ: 1; + uint8_t RXIRQ: 1; + uint8_t CCAIRQ: 1; + uint8_t RXWTRMRKIRQ: 1; + uint8_t FILTERFAIL_IRQ: 1; + uint8_t PLL_UNLOCK_IRQ: 1; + uint8_t RX_FRM_PEND: 1; + } bit; +} regIRQSTS1_t; + +// IRQSTS2 bits +#define cIRQSTS2_CRCVALID (1<<7) +#define cIRQSTS2_CCA (1<<6) +#define cIRQSTS2_SRCADDR (1<<5) +#define cIRQSTS2_PI (1<<4) +#define cIRQSTS2_TMRSTATUS (1<<3) +#define cIRQSTS2_ASM_IRQ (1<<2) +#define cIRQSTS2_PB_ERR_IRQ (1<<1) +#define cIRQSTS2_WAKE_IRQ (1<<0) + +typedef union regIRQSTS2_tag { + uint8_t byte; + struct { + uint8_t WAKE_IRQ: 1; + uint8_t PB_ERR_IRQ: 1; + uint8_t ASM_IRQ: 1; + uint8_t TMRSTATUS: 1; + uint8_t PI_: 1; + uint8_t SRCADDR: 1; + uint8_t CCA: 1; + uint8_t CRCVALID: 1; + } bit; +} regIRQSTS2_t; + +// IRQSTS3 bits +#define cIRQSTS3_TMR4MSK (1<<7) +#define cIRQSTS3_TMR3MSK (1<<6) +#define cIRQSTS3_TMR2MSK (1<<5) +#define cIRQSTS3_TMR1MSK (1<<4) +#define cIRQSTS3_TMR4IRQ (1<<3) +#define cIRQSTS3_TMR3IRQ (1<<2) +#define cIRQSTS3_TMR2IRQ (1<<1) +#define cIRQSTS3_TMR1IRQ (1<<0) + +typedef union regIRQSTS3_tag { + uint8_t byte; + struct { + uint8_t TMR1IRQ: 1; + uint8_t TMR2IRQ: 1; + uint8_t TMR3IRQ: 1; + uint8_t TMR4IRQ: 1; + uint8_t TMR1MSK: 1; + uint8_t TMR2MSK: 1; + uint8_t TMR3MSK: 1; + uint8_t TMR4MSK: 1; + } bit; +} regIRQSTS3_t; + +// PHY_CTRL1 bits +#define cPHY_CTRL1_TMRTRIGEN (1<<7) +#define cPHY_CTRL1_SLOTTED (1<<6) +#define cPHY_CTRL1_CCABFRTX (1<<5) +#define cPHY_CTRL1_RXACKRQD (1<<4) +#define cPHY_CTRL1_AUTOACK (1<<3) +#define cPHY_CTRL1_XCVSEQ (7<<0) + +typedef union regPHY_CTRL1_tag { + uint8_t byte; + struct { + uint8_t XCVSEQ: 3; + uint8_t AUTOACK: 1; + uint8_t RXACKRQD: 1; + uint8_t CCABFRTX: 1; + uint8_t SLOTTED: 1; + uint8_t TMRTRIGEN: 1; + } bit; +} regPHY_CTRL1_t; + +// PHY_CTRL2 bits +#define cPHY_CTRL2_CRC_MSK (1<<7) +#define cPHY_CTRL2_PLL_UNLOCK_MSK (1<<6) +#define cPHY_CTRL2_FILTERFAIL_MSK (1<<5) +#define cPHY_CTRL2_RX_WMRK_MSK (1<<4) +#define cPHY_CTRL2_CCAMSK (1<<3) +#define cPHY_CTRL2_RXMSK (1<<2) +#define cPHY_CTRL2_TXMSK (1<<1) +#define cPHY_CTRL2_SEQMSK (1<<0) + +typedef union regPHY_CTRL2_tag { + uint8_t byte; + struct { + uint8_t SEQMSK: 1; + uint8_t TXMSK: 1; + uint8_t RXMSK: 1; + uint8_t CCAMSK: 1; + uint8_t RX_WMRK_MSK: 1; + uint8_t FILTERFAIL_MSK: 1; + uint8_t PLL_UNLOCK_MSK: 1; + uint8_t CRC_MSK: 1; + } bit; +} regPHY_CTRL2_t; + +// PHY_CTRL3 bits +#define cPHY_CTRL3_TMR4CMP_EN (1<<7) +#define cPHY_CTRL3_TMR3CMP_EN (1<<6) +#define cPHY_CTRL3_TMR2CMP_EN (1<<5) +#define cPHY_CTRL3_TMR1CMP_EN (1<<4) +#define cPHY_CTRL3_ASM_MSK (1<<2) +#define cPHY_CTRL3_PB_ERR_MSK (1<<1) +#define cPHY_CTRL3_WAKE_MSK (1<<0) + +typedef union regPHY_CTRL3_tag { + uint8_t byte; + struct { + uint8_t WAKE_MSK: 1; + uint8_t PB_ERR_MSK: 1; + uint8_t ASM_MSK: 1; + uint8_t RESERVED: 1; + uint8_t TMR1CMP_EN: 1; + uint8_t TMR2CMP_EN: 1; + uint8_t TMR3CMP_EN: 1; + uint8_t TMR4CMP_EN: 1; + } bit; +} regPHY_CTRL3_t; + +// RX_FRM_LEN bits +#define cRX_FRAME_LENGTH (0x7F) + +// PHY_CTRL4 bits +#define cPHY_CTRL4_TRCV_MSK (1<<7) +#define cPHY_CTRL4_TC3TMOUT (1<<6) +#define cPHY_CTRL4_PANCORDNTR0 (1<<5) +#define cPHY_CTRL4_CCATYPE (3<<0) +#define cPHY_CTRL4_CCATYPE_Shift_c (3) +#define cPHY_CTRL4_TMRLOAD (1<<2) +#define cPHY_CTRL4_PROMISCUOUS (1<<1) +#define cPHY_CTRL4_TC2PRIME_EN (1<<0) + +typedef union regPHY_CTRL4_tag { + uint8_t byte; + struct { + uint8_t TC2PRIME_EN: 1; + uint8_t PROMISCUOUS: 1; + uint8_t TMRLOAD: 1; + uint8_t CCATYPE: 2; + uint8_t PANCORDNTR0: 1; + uint8_t TC3TMOUT: 1; + uint8_t TRCV_MSK: 1; + } bit; +} regPHY_CTRL4_t; + +// SRC_CTRL bits +#define cSRC_CTRL_INDEX (0x0F) +#define cSRC_CTRL_INDEX_Shift_c (4) +#define cSRC_CTRL_ACK_FRM_PND (1<<3) +#define cSRC_CTRL_SRCADDR_EN (1<<2) +#define cSRC_CTRL_INDEX_EN (1<<1) +#define cSRC_CTRL_INDEX_DISABLE (1<<0) + +typedef union regSRC_CTRL_tag { + uint8_t byte; + struct { + uint8_t INDEX_DISABLE: 1; + uint8_t INDEX_EN: 1; + uint8_t SRCADDR_EN: 1; + uint8_t ACK_FRM_PND: 1; + uint8_t INDEX: 4; + } bit; +} regSRC_CTRL_t; + +// ASM_CTRL1 bits +#define cASM_CTRL1_CLEAR (1<<7) +#define cASM_CTRL1_START (1<<6) +#define cASM_CTRL1_SELFTST (1<<5) +#define cASM_CTRL1_CTR (1<<4) +#define cASM_CTRL1_CBC (1<<3) +#define cASM_CTRL1_AES (1<<2) +#define cASM_CTRL1_LOAD_MAC (1<<1) + +// ASM_CTRL2 bits +#define cASM_CTRL2_DATA_REG_TYPE_SEL (7) +#define cASM_CTRL2_DATA_REG_TYPE_SEL_Shift_c (5) +#define cASM_CTRL2_TSTPAS (1<<1) + +// CLK_OUT_CTRL bits +#define cCLK_OUT_CTRL_EXTEND (1<<7) +#define cCLK_OUT_CTRL_HIZ (1<<6) +#define cCLK_OUT_CTRL_SR (1<<5) +#define cCLK_OUT_CTRL_DS (1<<4) +#define cCLK_OUT_CTRL_EN (1<<3) +#define cCLK_OUT_CTRL_DIV (7) + +// PWR_MODES bits +#define cPWR_MODES_XTAL_READY (1<<5) +#define cPWR_MODES_XTALEN (1<<4) +#define cPWR_MODES_ASM_CLK_EN (1<<3) +#define cPWR_MODES_AUTODOZE (1<<1) +#define cPWR_MODES_PMC_MODE (1<<0) + +// RX_FRAME_FILTER bits +#define cRX_FRAME_FLT_FRM_VER (0xC0) +#define cRX_FRAME_FLT_FRM_VER_Shift_c (6) +#define cRX_FRAME_FLT_ACTIVE_PROMISCUOUS (1<<5) +#define cRX_FRAME_FLT_NS_FT (1<<4) +#define cRX_FRAME_FLT_CMD_FT (1<<3) +#define cRX_FRAME_FLT_ACK_FT (1<<2) +#define cRX_FRAME_FLT_DATA_FT (1<<1) +#define cRX_FRAME_FLT_BEACON_FT (1<<0) + +typedef union regRX_FRAME_FILTER_tag { + uint8_t byte; + struct { + uint8_t FRAME_FLT_BEACON_FT: 1; + uint8_t FRAME_FLT_DATA_FT: 1; + uint8_t FRAME_FLT_ACK_FT: 1; + uint8_t FRAME_FLT_CMD_FT: 1; + uint8_t FRAME_FLT_NS_FT: 1; + uint8_t FRAME_FLT_ACTIVE_PROMISCUOUS: 1; + uint8_t FRAME_FLT_FRM_VER: 2; + } bit; +} regRX_FRAME_FILTER_t; + +// DUAL_PAN_CTRL bits +#define cDUAL_PAN_CTRL_DUAL_PAN_SAM_LVL_MSK (0xF0) +#define cDUAL_PAN_CTRL_DUAL_PAN_SAM_LVL_Shift_c (4) +#define cDUAL_PAN_CTRL_CURRENT_NETWORK (1<<3) +#define cDUAL_PAN_CTRL_PANCORDNTR1 (1<<2) +#define cDUAL_PAN_CTRL_DUAL_PAN_AUTO (1<<1) +#define cDUAL_PAN_CTRL_ACTIVE_NETWORK (1<<0) + +// DUAL_PAN_STS bits +#define cDUAL_PAN_STS_RECD_ON_PAN1 (1<<7) +#define cDUAL_PAN_STS_RECD_ON_PAN0 (1<<6) +#define cDUAL_PAN_STS_DUAL_PAN_REMAIN (0x3F) + +// CCA_CTRL bits +#define cCCA_CTRL_AGC_FRZ_EN (1<<6) +#define cCCA_CTRL_CONT_RSSI_EN (1<<5) +#define cCCA_CTRL_LQI_RSSI_NOT_CORR (1<<4) +#define cCCA_CTRL_CCA3_AND_NOT_OR (1<<3) +#define cCCA_CTRL_POWER_COMP_EN_LQI (1<<2) +#define cCCA_CTRL_POWER_COMP_EN_ED (1<<1) +#define cCCA_CTRL_POWER_COMP_EN_CCA1 (1<<0) + +// GPIO_DATA bits +#define cGPIO_DATA_7 (1<<7) +#define cGPIO_DATA_6 (1<<6) +#define cGPIO_DATA_5 (1<<5) +#define cGPIO_DATA_4 (1<<4) +#define cGPIO_DATA_3 (1<<3) +#define cGPIO_DATA_2 (1<<2) +#define cGPIO_DATA_1 (1<<1) +#define cGPIO_DATA_0 (1<<0) + +// GPIO_DIR bits +#define cGPIO_DIR_7 (1<<7) +#define cGPIO_DIR_6 (1<<6) +#define cGPIO_DIR_5 (1<<5) +#define cGPIO_DIR_4 (1<<4) +#define cGPIO_DIR_3 (1<<3) +#define cGPIO_DIR_2 (1<<2) +#define cGPIO_DIR_1 (1<<1) +#define cGPIO_DIR_0 (1<<0) + +// GPIO_PUL_EN bits +#define cGPIO_PUL_EN_7 (1<<7) +#define cGPIO_PUL_EN_6 (1<<6) +#define cGPIO_PUL_EN_5 (1<<5) +#define cGPIO_PUL_EN_4 (1<<4) +#define cGPIO_PUL_EN_3 (1<<3) +#define cGPIO_PUL_EN_2 (1<<2) +#define cGPIO_PUL_EN_1 (1<<1) +#define cGPIO_PUL_EN_0 (1<<0) + +// GPIO_PUL_SEL bits +#define cGPIO_PUL_SEL_7 (1<<7) +#define cGPIO_PUL_SEL_6 (1<<6) +#define cGPIO_PUL_SEL_5 (1<<5) +#define cGPIO_PUL_SEL_4 (1<<4) +#define cGPIO_PUL_SEL_3 (1<<3) +#define cGPIO_PUL_SEL_2 (1<<2) +#define cGPIO_PUL_SEL_1 (1<<1) +#define cGPIO_PUL_SEL_0 (1<<0) + +// GPIO_DS bits +#define cGPIO_DS_7 (1<<7) +#define cGPIO_DS_6 (1<<6) +#define cGPIO_DS_5 (1<<5) +#define cGPIO_DS_4 (1<<4) +#define cGPIO_DS_3 (1<<3) +#define cGPIO_DS_2 (1<<2) +#define cGPIO_DS_1 (1<<1) +#define cGPIO_DS_0 (1<<0) + +// SPI_CTRL bits +//#define cSPI_CTRL_MISO_HIZ_EN (1<<1) +//#define cSPI_CTRL_PB_PROTECT (1<<0) + +// ANT_PAD_CTRL bits +#define cANT_PAD_CTRL_ANTX_POL (0x0F) +#define cANT_PAD_CTRL_ANTX_POL_Shift_c (4) +#define cANT_PAD_CTRL_ANTX_CTRLMODE (1<<3) +#define cANT_PAD_CTRL_ANTX_HZ (1<<2) +#define cANT_PAD_CTRL_ANTX_EN (3) + +// MISC_PAD_CTRL bits +#define cMISC_PAD_CTRL_MISO_HIZ_EN (1<<3) +#define cMISC_PAD_CTRL_IRQ_B_OD (1<<2) +#define cMISC_PAD_CTRL_NON_GPIO_DS (1<<1) +#define cMISC_PAD_CTRL_ANTX_CURR (1<<0) + +// ANT_AGC_CTRL bits +#define cANT_AGC_CTRL_FAD_EN_Shift_c (0) +#define cANT_AGC_CTRL_FAD_EN_Mask_c (1< +#include "rtos.h" +#include "mbed_interface.h" +#include "platform/mbed_error.h" + +using namespace mbed; +using namespace rtos; + +/* Freescale headers which are for C files */ +extern "C" { +#include "MCR20Drv.h" +#include "MCR20Reg.h" +#include "MCR20Overwrites.h" +} + + +#define RF_BUFFER_SIZE 128 + +/*Radio RX and TX state definitions*/ +#define RFF_ON 0x01 +#define RFF_RX 0x02 +#define RFF_TX 0x04 +#define RFF_CCA 0x08 + +#define RF_MODE_NORMAL 0 +#define RF_MODE_SNIFFER 1 + +#define RF_CCA_THRESHOLD 75 /* -75 dBm */ + +#define RF_TX_POWER_MAX 0 + +/* PHY constants in symbols */ +#define gPhyWarmUpTime_c 9 +#define gPhySHRDuration_c 10 +#define gPhySymbolsPerOctet_c 2 +#define gPhyAckWaitDuration_c 54 + +#define gCcaED_c 0 +#define gCcaCCA_MODE1_c 1 + +#define gXcvrRunState_d gXcvrPwrAutodoze_c +#define gXcvrLowPowerState_d gXcvrPwrHibernate_c + +namespace { + +/* MCR20A XCVR states */ +typedef enum xcvrState_tag { + gIdle_c, + gRX_c, + gTX_c, + gCCA_c, + gTR_c, + gCCCA_c, +} xcvrState_t; + +/* MCR20A XCVR low power states */ +typedef enum xcvrPwrMode_tag { + gXcvrPwrIdle_c, + gXcvrPwrAutodoze_c, + gXcvrPwrDoze_c, + gXcvrPwrHibernate_c +} xcvrPwrMode_t; + + +/*RF Part Type*/ +typedef enum { + FREESCALE_UNKNOW_DEV = 0, + FREESCALE_MCR20A +} rf_trx_part_e; + +/*Atmel RF states*/ +typedef enum { + NOP = 0x00, + BUSY_RX = 0x01, + RF_TX_START = 0x02, + FORCE_TRX_OFF = 0x03, + FORCE_PLL_ON = 0x04, + RX_ON = 0x06, + TRX_OFF = 0x08, + PLL_ON = 0x09, + BUSY_RX_AACK = 0x11, + SLEEP = 0x0F, + RX_AACK_ON = 0x16, + TX_ARET_ON = 0x19 +} rf_trx_states_t; + +} // anonymous namespace + +/*RF receive buffer*/ +static uint8_t rf_buffer[RF_BUFFER_SIZE]; + +/* TX info */ +static uint8_t radio_tx_power = 0x17; /* 0 dBm */ +static uint8_t mac_tx_handle = 0; +static uint8_t need_ack = 0; +static uint16_t tx_len = 0; + +/* RF driver data */ +static xcvrState_t mPhySeqState; +static xcvrPwrMode_t mPwrState; +static phy_device_driver_s device_driver; +static uint8_t mStatusAndControlRegs[8]; +static uint8_t rf_rnd = 0; +static int8_t rf_radio_driver_id = -1; +static uint8_t MAC_address[8]; + +/* Driver instance handle and hardware */ +static NanostackRfPhyMcr20a *rf = NULL; +static SPI *spi = NULL; +static DigitalOut *cs = NULL; +static DigitalOut *rst = NULL; +static InterruptIn *irq = NULL; +static DigitalIn *irq_pin = NULL; +static Thread *irq_thread = NULL; + +/* Channel info */ /* 2405 2410 2415 2420 2425 2430 2435 2440 2445 2450 2455 2460 2465 2470 2475 2480 */ +static const uint8_t pll_int[16] = {0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D}; +static const uint16_t pll_frac[16] = {0x2800, 0x5000, 0x7800, 0xA000, 0xC800, 0xF000, 0x1800, 0x4000, 0x6800, 0x9000, 0xB800, 0xE000, 0x0800, 0x3000, 0x5800, 0x8000}; + +/* Channel configurations for 2.4 */ +static const phy_rf_channel_configuration_s phy_24ghz = {.channel_0_center_frequency = 2405000000U, .channel_spacing = 5000000U, .datarate = 250000U, .number_of_channels = 16U, .modulation = M_OQPSK}; + +static const phy_device_channel_page_s phy_channel_pages[] = { + { CHANNEL_PAGE_0, &phy_24ghz}, + { CHANNEL_PAGE_0, NULL} +}; + + +static rf_trx_part_e rf_radio_type_read(void); + +MBED_UNUSED static void rf_ack_wait_timer_start(uint16_t slots); +MBED_UNUSED static void rf_ack_wait_timer_stop(void); +MBED_UNUSED static void rf_handle_cca_ed_done(void); +MBED_UNUSED static void rf_handle_tx_end(void); +MBED_UNUSED static void rf_handle_rx_end(void); +MBED_UNUSED static void rf_on(void); +MBED_UNUSED static void rf_receive(void); +MBED_UNUSED static void rf_poll_trx_state_change(rf_trx_states_t trx_state); +MBED_UNUSED static void rf_init(void); +MBED_UNUSED static void rf_set_mac_address(const uint8_t *ptr); +MBED_UNUSED static int8_t rf_device_register(void); +MBED_UNUSED static void rf_device_unregister(void); +MBED_UNUSED static int8_t rf_start_cca(uint8_t *data_ptr, uint16_t data_length, uint8_t tx_handle, data_protocol_e data_protocol); +MBED_UNUSED static void rf_cca_abort(void); +MBED_UNUSED static void rf_read_mac_address(uint8_t *ptr); +MBED_UNUSED static int8_t rf_read_random(void); +MBED_UNUSED static void rf_calibration_cb(void); +MBED_UNUSED static void rf_init_phy_mode(void); +MBED_UNUSED static void rf_ack_wait_timer_interrupt(void); +MBED_UNUSED static void rf_calibration_timer_interrupt(void); +MBED_UNUSED static void rf_calibration_timer_start(uint32_t slots); +MBED_UNUSED static void rf_cca_timer_interrupt(void); +MBED_UNUSED static void rf_cca_timer_start(uint32_t slots); +MBED_UNUSED static uint16_t rf_get_phy_mtu_size(void); +MBED_UNUSED static uint8_t rf_scale_lqi(int8_t rssi); + +/** + * RF output power write + * + * \brief TX power has to be set before network start. + * + * \param power + * See datasheet for TX power settings + * + * \return 0, Supported Value + * \return -1, Not Supported Value + */ +MBED_UNUSED static int8_t rf_tx_power_set(uint8_t power); +MBED_UNUSED static uint8_t rf_tx_power_get(void); +MBED_UNUSED static int8_t rf_enable_antenna_diversity(void); + +/* Private functions */ +MBED_UNUSED static void rf_abort(void); +MBED_UNUSED static void rf_promiscuous(uint8_t mode); +MBED_UNUSED static void rf_get_timestamp(uint32_t *pRetClk); +MBED_UNUSED static void rf_set_timeout(uint32_t *pEndTime); +MBED_UNUSED static void rf_set_power_state(xcvrPwrMode_t newState); +MBED_UNUSED static uint8_t rf_if_read_rnd(void); +MBED_UNUSED static uint8_t rf_convert_LQI(uint8_t hwLqi); +MBED_UNUSED static uint8_t rf_get_channel_energy(void); +MBED_UNUSED static uint8_t rf_convert_energy_level(uint8_t energyLevel); +MBED_UNUSED static int8_t rf_convert_LQI_to_RSSI(uint8_t lqi); +MBED_UNUSED static int8_t rf_interface_state_control(phy_interface_state_e new_state, uint8_t rf_channel); +MBED_UNUSED static int8_t rf_extension(phy_extension_type_e extension_type, uint8_t *data_ptr); +MBED_UNUSED static int8_t rf_address_write(phy_address_type_e address_type, uint8_t *address_ptr); +static void PHY_InterruptThread(void); +static void handle_interrupt(void); + + +/* + * \brief Read connected radio part. + * + * This function only return valid information when rf_init() is called + * + * \return + */ +static rf_trx_part_e rf_radio_type_read(void) +{ + return FREESCALE_MCR20A; +} + +/* + * \brief Function initialises and registers the RF driver. + * + * \param none + * + * \return rf_radio_driver_id Driver ID given by NET library + */ +static int8_t rf_device_register(void) +{ + rf_trx_part_e radio_type; + + rf_init(); + + + + radio_type = rf_radio_type_read(); + if (radio_type == FREESCALE_MCR20A) { + /*Set pointer to MAC address*/ + device_driver.PHY_MAC = MAC_address; + device_driver.driver_description = (char *)"FREESCALE_MAC"; + + //Create setup Used Radio chips + /*Type of RF PHY is SubGHz*/ + device_driver.link_type = PHY_LINK_15_4_2_4GHZ_TYPE; + + device_driver.phy_channel_pages = phy_channel_pages; + /*Maximum size of payload is 127*/ + device_driver.phy_MTU = 127; + /*No header in PHY*/ + device_driver.phy_header_length = 0; + /*No tail in PHY*/ + device_driver.phy_tail_length = 0; + /*Set address write function*/ + device_driver.address_write = &rf_address_write; + /*Set RF extension function*/ + device_driver.extension = &rf_extension; + /*Set RF state control function*/ + device_driver.state_control = &rf_interface_state_control; + /*Set transmit function*/ + device_driver.tx = &rf_start_cca; + /*Upper layer callbacks init to NULL*/ + device_driver.phy_rx_cb = NULL; + device_driver.phy_tx_done_cb = NULL; + /*Virtual upper data callback init to NULL*/ + device_driver.arm_net_virtual_rx_cb = NULL; + device_driver.arm_net_virtual_tx_cb = NULL; + + /*Register device driver*/ + rf_radio_driver_id = arm_net_phy_register(&device_driver); + } + + return rf_radio_driver_id; +} + +/* + * \brief Function unregisters the RF driver. + * + * \param none + * + * \return none + */ +static void rf_device_unregister(void) +{ + arm_net_phy_unregister(rf_radio_driver_id); +} + +/* + * \brief Function returns the generated 8-bit random value for seeding Pseudo-random generator. + * + * \param none + * + * \return random value + */ +static int8_t rf_read_random(void) +{ + return rf_rnd; +} + +/* + * \brief Function is a call back for ACK wait timeout. + * + * \param none + * + * \return none + */ +static void rf_ack_wait_timer_interrupt(void) +{ + /* The packet was transmitted successfully, but no ACK was received */ + if (device_driver.phy_tx_done_cb) { + device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_TX_SUCCESS, 1, 1); + } + rf_receive(); +} + +/* + * \brief Function is a call back for calibration interval timer. + * + * \param none + * + * \return none + */ +static void rf_calibration_timer_interrupt(void) +{ +} + +/* + * \brief Function is a call back for cca interval timer. + * + * \param none + * + * \return none + */ +static void rf_cca_timer_interrupt(void) +{ + /* CCA time-out handled by Hardware */ +} + + +/* + * \brief Function starts the ACK wait time-out. + * + * \param slots The ACK wait time-out in [symbols] + * + * \return none + */ +static void rf_ack_wait_timer_start(uint16_t time) +{ + uint32_t timeout; + + rf_get_timestamp(&timeout); + timeout += time; + rf_set_timeout(&timeout); +} + +/* + * \brief Function starts the calibration interval. + * + * \param slots Given slots, resolution 50us + * + * \return none + */ +static void rf_calibration_timer_start(uint32_t slots) +{ + (void)slots; +} + +/* + * \brief Function starts the CCA timout. + * + * \param slots Given slots, resolution 50us + * + * \return none + */ +static void rf_cca_timer_start(uint32_t slots) +{ + (void)slots; +} + +/* + * \brief Function stops the ACK wait timeout. + * + * \param none + * + * \return none + */ +static void rf_ack_wait_timer_stop(void) +{ +} + +/* + * \brief Function reads the MAC address array. + * + * \param ptr Pointer to read array + * + * \return none + */ +static void rf_read_mac_address(uint8_t *ptr) +{ + memcpy(ptr, MAC_address, 8); +} + +/* + * \brief Function sets the MAC address array. + * + * \param ptr Pointer to given MAC address array + * + * \return none + */ +static void rf_set_mac_address(const uint8_t *ptr) +{ + memcpy(MAC_address, ptr, 8); +} + +static uint16_t rf_get_phy_mtu_size(void) +{ + return device_driver.phy_MTU; +} + +/* + * \brief Function writes 16-bit address in RF address filter. + * + * \param short_address Given short address + * + * \return none + */ +static void rf_set_short_adr(uint8_t *short_address) +{ + /* Write one register at a time to be accessible from hibernate mode */ + MCR20Drv_IndirectAccessSPIWrite(MACSHORTADDRS0_MSB, short_address[0]); + MCR20Drv_IndirectAccessSPIWrite(MACSHORTADDRS0_LSB, short_address[1]); +} + +/* + * \brief Function writes PAN Id in RF PAN Id filter. + * + * \param pan_id Given PAN Id + * + * \return none + */ +static void rf_set_pan_id(uint8_t *pan_id) +{ + /* Write one register at a time to be accessible from hibernate mode */ + MCR20Drv_IndirectAccessSPIWrite(MACPANID0_MSB, pan_id[0]); + MCR20Drv_IndirectAccessSPIWrite(MACPANID0_LSB, pan_id[1]); +} + +/* + * \brief Function writes 64-bit address in RF address filter. + * + * \param address Given 64-bit address + * + * \return none + */ +static void rf_set_address(uint8_t *address) +{ + /* Write one register at a time to be accessible from hibernate mode */ + MCR20Drv_IndirectAccessSPIWrite(MACLONGADDRS0_0, address[7]); + MCR20Drv_IndirectAccessSPIWrite(MACLONGADDRS0_8, address[6]); + MCR20Drv_IndirectAccessSPIWrite(MACLONGADDRS0_16, address[5]); + MCR20Drv_IndirectAccessSPIWrite(MACLONGADDRS0_24, address[4]); + MCR20Drv_IndirectAccessSPIWrite(MACLONGADDRS0_32, address[3]); + MCR20Drv_IndirectAccessSPIWrite(MACLONGADDRS0_40, address[2]); + MCR20Drv_IndirectAccessSPIWrite(MACLONGADDRS0_48, address[1]); + MCR20Drv_IndirectAccessSPIWrite(MACLONGADDRS0_56, address[0]); +} + +/* + * \brief Function sets the RF channel. + * + * \param ch New channel + * + * \return none + */ +static void rf_channel_set(uint8_t channel) +{ + MCR20Drv_DirectAccessSPIWrite(PLL_INT0, pll_int[channel - 11]); + MCR20Drv_DirectAccessSPIMultiByteWrite(PLL_FRAC0_LSB, (uint8_t *) &pll_frac[channel - 11], 2); +} + + +/* + * \brief Function initialises the radio driver and resets the radio. + * + * \param none + * + * \return none + */ +static void rf_init(void) +{ + uint32_t index; + mPhySeqState = gIdle_c; + mPwrState = gXcvrPwrIdle_c; + /*Reset RF module*/ + MCR20Drv_RESET(); + /* Initialize the transceiver SPI driver */ + MCR20Drv_Init(); + /* Disable Tristate on MISO for SPI reads */ + MCR20Drv_IndirectAccessSPIWrite(MISC_PAD_CTRL, 0x02); + /* Set XCVR clock output settings */ + MCR20Drv_Set_CLK_OUT_Freq(gMCR20_ClkOutFreq_d); + /* Set default XCVR power state */ + rf_set_power_state(gXcvrRunState_d); + + /* PHY_CTRL1 default HW settings + AUTOACK enabled */ + mStatusAndControlRegs[PHY_CTRL1] = cPHY_CTRL1_AUTOACK; + /* PHY_CTRL2 : mask all PP interrupts */ + mStatusAndControlRegs[PHY_CTRL2] = cPHY_CTRL2_CRC_MSK | \ + cPHY_CTRL2_PLL_UNLOCK_MSK | \ + /*cPHY_CTRL2_FILTERFAIL_MSK | */ \ + cPHY_CTRL2_RX_WMRK_MSK | \ + cPHY_CTRL2_CCAMSK | \ + cPHY_CTRL2_RXMSK | \ + cPHY_CTRL2_TXMSK | \ + cPHY_CTRL2_SEQMSK; + /* PHY_CTRL3 : enable timer 3 and disable remaining interrupts */ + mStatusAndControlRegs[PHY_CTRL3] = cPHY_CTRL3_ASM_MSK | \ + cPHY_CTRL3_PB_ERR_MSK | \ + cPHY_CTRL3_WAKE_MSK | \ + cPHY_CTRL3_TMR3CMP_EN; + /* PHY_CTRL4 unmask global TRX interrupts, enable 16 bit mode for TC2 - TC2 prime EN */ + mStatusAndControlRegs[PHY_CTRL4] = cPHY_CTRL4_TC2PRIME_EN | (gCcaCCA_MODE1_c << cPHY_CTRL4_CCATYPE_Shift_c); + /* Clear all PP IRQ bits to avoid unexpected interrupts immediately after initialization */ + mStatusAndControlRegs[IRQSTS1] = cIRQSTS1_PLL_UNLOCK_IRQ | \ + cIRQSTS1_FILTERFAIL_IRQ | \ + cIRQSTS1_RXWTRMRKIRQ | \ + cIRQSTS1_CCAIRQ | \ + cIRQSTS1_RXIRQ | \ + cIRQSTS1_TXIRQ | \ + cIRQSTS1_SEQIRQ; + + mStatusAndControlRegs[IRQSTS2] = cIRQSTS2_ASM_IRQ | cIRQSTS2_PB_ERR_IRQ | cIRQSTS2_WAKE_IRQ; + /* Mask and clear all TMR IRQs */ + mStatusAndControlRegs[IRQSTS3] = cIRQSTS3_TMR4MSK | cIRQSTS3_TMR3MSK | cIRQSTS3_TMR2MSK | cIRQSTS3_TMR1MSK | \ + cIRQSTS3_TMR4IRQ | cIRQSTS3_TMR3IRQ | cIRQSTS3_TMR2IRQ | cIRQSTS3_TMR1IRQ; + /* Write settings to XCVR */ + MCR20Drv_DirectAccessSPIMultiByteWrite(PHY_CTRL1, &mStatusAndControlRegs[PHY_CTRL1], 5); + /* Clear all interrupts */ + MCR20Drv_DirectAccessSPIMultiByteWrite(IRQSTS1, &mStatusAndControlRegs[IRQSTS1], 3); + + /* RX_FRAME_FILTER. Accept FrameVersion 0 and 1 packets, reject all others */ + MCR20Drv_IndirectAccessSPIWrite(RX_FRAME_FILTER, (cRX_FRAME_FLT_FRM_VER | \ + cRX_FRAME_FLT_BEACON_FT | \ + cRX_FRAME_FLT_DATA_FT | \ + cRX_FRAME_FLT_CMD_FT)); + /* Direct register overwrites */ + for (index = 0; index < sizeof(overwrites_direct) / sizeof(overwrites_t); index++) { + MCR20Drv_DirectAccessSPIWrite(overwrites_direct[index].address, overwrites_direct[index].data); + } + /* Indirect register overwrites */ + for (index = 0; index < sizeof(overwrites_indirect) / sizeof(overwrites_t); index++) { + MCR20Drv_IndirectAccessSPIWrite(overwrites_indirect[index].address, overwrites_indirect[index].data); + } + + /* Set the CCA energy threshold value */ + MCR20Drv_IndirectAccessSPIWrite(CCA1_THRESH, RF_CCA_THRESHOLD); + /* Set prescaller to obtain 1 symbol (16us) timebase */ + MCR20Drv_IndirectAccessSPIWrite(TMR_PRESCALE, 0x05); + + MCR20Drv_IRQ_Enable(); + + /*Read random variable. This will be used when seeding pseudo-random generator*/ + rf_rnd = rf_if_read_rnd(); + /*Write initial eui64*/ + rf_set_address(MAC_address); + /*set default channel to 11*/ + rf_channel_set(11); + /*Start receiver*/ + rf_receive(); +} + +/** + * \brief Function gets called when MAC is setting radio off. + * + * \param none + * + * \return none + */ +static void rf_off(void) +{ + /* Abort any ongoing sequences */ + rf_abort(); + /* Set XCVR in a low power state */ + rf_set_power_state(gXcvrLowPowerState_d); +} + +/* + * \brief Function polls the RF state until it has changed to desired state. + * + * \param trx_state RF state + * + * \return none + */ +static void rf_poll_trx_state_change(rf_trx_states_t trx_state) +{ + (void)trx_state; +} + +/* + * \brief Function starts the CCA process before starting data transmission and copies the data to RF TX FIFO. + * + * \param data_ptr Pointer to TX data + * \param data_length Length of the TX data + * \param tx_handle Handle to transmission + * \return 0 Success + * \return -1 Busy + */ +static int8_t rf_start_cca(uint8_t *data_ptr, uint16_t data_length, uint8_t tx_handle, data_protocol_e data_protocol) +{ + uint8_t ccaMode; + + /* Parameter validation */ + if (!data_ptr || (data_length > 125) || (PHY_LAYER_PAYLOAD != data_protocol)) { + return -1; + } + + if (mPhySeqState == gRX_c) { + uint8_t phyReg = MCR20Drv_DirectAccessSPIRead(SEQ_STATE) & 0x1F; + /* Check for an Rx in progress. */ + if ((phyReg <= 0x06) || (phyReg == 0x15) || (phyReg == 0x16)) { + if (device_driver.phy_tx_done_cb) { + device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_CCA_FAIL, 1, 1); + } + return -1; + } + rf_abort(); + } + + /*Check if transmitter is busy*/ + if (mPhySeqState != gIdle_c) { + /*Return busy*/ + return -1; + } + + /*Store TX handle*/ + mac_tx_handle = tx_handle; + /*Check if transmitted data needs to be acked*/ + need_ack = (*data_ptr & 0x20) == 0x20; + + /* Set XCVR power state in run mode */ + rf_set_power_state(gXcvrRunState_d); + /* Load data into XCVR */ + tx_len = data_length + 2; + MCR20Drv_PB_SPIBurstWrite(data_ptr - 1, data_length + 1); + MCR20Drv_PB_SPIByteWrite(0, tx_len); + + /* Set CCA mode 1 */ + ccaMode = (mStatusAndControlRegs[PHY_CTRL4] >> cPHY_CTRL4_CCATYPE_Shift_c) & cPHY_CTRL4_CCATYPE; + if (ccaMode != gCcaCCA_MODE1_c) { + mStatusAndControlRegs[PHY_CTRL4] &= ~(cPHY_CTRL4_CCATYPE << cPHY_CTRL4_CCATYPE_Shift_c); + mStatusAndControlRegs[PHY_CTRL4] |= gCcaCCA_MODE1_c << cPHY_CTRL4_CCATYPE_Shift_c; + MCR20Drv_DirectAccessSPIWrite(PHY_CTRL4, mStatusAndControlRegs[PHY_CTRL4]); + } + + /* Read XCVR registers */ + mStatusAndControlRegs[0] = MCR20Drv_DirectAccessSPIMultiByteRead(IRQSTS2, &mStatusAndControlRegs[1], 4); + mStatusAndControlRegs[PHY_CTRL1] &= ~(cPHY_CTRL1_XCVSEQ); + mStatusAndControlRegs[PHY_CTRL1] |= gCCA_c; + mPhySeqState = gCCA_c; + + /* Ensure that no spurious interrupts are raised */ + mStatusAndControlRegs[IRQSTS3] &= 0xF0; /* do not change other IRQ status */ + mStatusAndControlRegs[IRQSTS3] |= (cIRQSTS3_TMR3MSK | cIRQSTS3_TMR3IRQ); + MCR20Drv_DirectAccessSPIMultiByteWrite(IRQSTS1, mStatusAndControlRegs, 3); + + /* Write XCVR settings */ + MCR20Drv_DirectAccessSPIWrite(PHY_CTRL1, mStatusAndControlRegs[PHY_CTRL1]); + + /* Unmask SEQ interrupt */ + mStatusAndControlRegs[PHY_CTRL2] &= ~(cPHY_CTRL2_SEQMSK); + MCR20Drv_DirectAccessSPIWrite(PHY_CTRL2, mStatusAndControlRegs[PHY_CTRL2]); + + /*Return success*/ + return 0; +} + +/* + * \brief Function aborts CCA process. + * + * \param none + * + * \return none + */ +static void rf_cca_abort(void) +{ + rf_abort(); +} + +/* + * \brief Function starts the transmission of the frame. Called from ISR context! + * + * \param none + * + * \return none + */ +static void rf_start_tx(void) +{ + /* Perform TxRxAck sequence if required by phyTxMode */ + if (need_ack) { + mStatusAndControlRegs[PHY_CTRL1] |= cPHY_CTRL1_RXACKRQD; + mPhySeqState = gTR_c; + } else { + mStatusAndControlRegs[PHY_CTRL1] &= ~(cPHY_CTRL1_RXACKRQD); + mPhySeqState = gTX_c; + } + + mStatusAndControlRegs[PHY_CTRL1] &= ~(cPHY_CTRL1_XCVSEQ); + mStatusAndControlRegs[PHY_CTRL1] |= mPhySeqState; + + /* Unmask SEQ interrupt */ + mStatusAndControlRegs[PHY_CTRL2] &= ~(cPHY_CTRL2_SEQMSK); + + /* Start the sequence immediately */ + MCR20Drv_DirectAccessSPIMultiByteWrite(PHY_CTRL1, &mStatusAndControlRegs[PHY_CTRL1], 2); + + if (need_ack) { + rf_ack_wait_timer_start(gPhyWarmUpTime_c + gPhySHRDuration_c + tx_len * gPhySymbolsPerOctet_c + gPhyAckWaitDuration_c); + } +} + +/* + * \brief Function sets the RF in RX state. Called from ISR context! + * + * \param none + * + * \return none + */ +static void rf_receive(void) +{ + uint8_t phyRegs[5]; + + /* RX can start only from Idle state */ + if (mPhySeqState != gIdle_c) { + return; + } + + /* Set XCVR power state in run mode */ + rf_set_power_state(gXcvrRunState_d); + /* read XVCR settings */ + phyRegs[IRQSTS1] = MCR20Drv_DirectAccessSPIMultiByteRead(IRQSTS2, &phyRegs[IRQSTS2], 4); + /* unmask SEQ interrupt */ + phyRegs[PHY_CTRL2] &= ~(cPHY_CTRL2_SEQMSK); + /* set XcvrSeq to RX */ + phyRegs[PHY_CTRL1] &= ~(cPHY_CTRL1_XCVSEQ); + phyRegs[PHY_CTRL1] |= gRX_c; + mPhySeqState = gRX_c; + /* Ensure that no spurious interrupts are raised */ + phyRegs[IRQSTS3] &= 0xF0; /* do not change other IRQ status */ + phyRegs[IRQSTS3] |= cIRQSTS3_TMR3MSK | cIRQSTS3_TMR3IRQ; + /* sync settings with XCVR */ + MCR20Drv_DirectAccessSPIMultiByteWrite(IRQSTS1, phyRegs, 5); +} + +/* + * \brief Function calibrates the radio. + * + * \param none + * + * \return none + */ +static void rf_calibration_cb(void) +{ +} + +/* + * \brief Function sets RF_ON flag when radio is powered. + * + * \param none + * + * \return none + */ +static void rf_on(void) +{ +} + +/* + * \brief Function is a call back for RX end interrupt. + * + * \param none + * + * \return none + */ +static void rf_handle_rx_end(void) +{ + uint8_t rf_lqi = MCR20Drv_DirectAccessSPIRead(LQI_VALUE); + int8_t rf_rssi = 0; + uint8_t len = mStatusAndControlRegs[RX_FRM_LEN] - 2; + + + /*Start receiver*/ + rf_receive(); + + /*Check the length is valid*/ + if (len > 1 && len < RF_BUFFER_SIZE) { + rf_lqi = rf_convert_LQI(rf_lqi); + rf_rssi = rf_convert_LQI_to_RSSI(rf_lqi); + /*gcararu: Scale LQI using received RSSI, to match the LQI reported by the ATMEL radio */ + rf_lqi = rf_scale_lqi(rf_rssi); + + /*Read received packet*/ + MCR20Drv_PB_SPIBurstRead(rf_buffer, len); + if (device_driver.phy_rx_cb) { + device_driver.phy_rx_cb(rf_buffer, len, rf_lqi, rf_rssi, rf_radio_driver_id); + } + } +} + +/* + * \brief Function is called when MAC is shutting down the radio. + * + * \param none + * + * \return none + */ +static void rf_shutdown(void) +{ + /*Call RF OFF*/ + rf_off(); +} + +/* + * \brief Function is a call back for TX end interrupt. + * + * \param none + * + * \return none + */ +static void rf_handle_tx_end(void) +{ + uint8_t rx_frame_pending = mStatusAndControlRegs[IRQSTS1] & cIRQSTS1_RX_FRM_PEND; + + /*Start receiver*/ + rf_receive(); + + if (!device_driver.phy_tx_done_cb) { + return; + } + + /*Call PHY TX Done API*/ + if (need_ack) { + if (rx_frame_pending) { + device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_TX_DONE_PENDING, 1, 1); + } else { + // arm_net_phy_tx_done(rf_radio_driver_id, mac_tx_handle, PHY_LINK_TX_SUCCESS, 1, 1); + device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_TX_DONE, 1, 1); + } + } else { + device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_TX_SUCCESS, 1, 1); + } +} + +/* + * \brief Function is a call back for CCA ED done interrupt. + * + * \param none + * + * \return none + */ +static void rf_handle_cca_ed_done(void) +{ + /*Check the result of CCA process*/ + if (!(mStatusAndControlRegs[IRQSTS2] & cIRQSTS2_CCA)) { + rf_start_tx(); + } else if (device_driver.phy_tx_done_cb) { + /*Send CCA fail notification*/ + device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_CCA_FAIL, 1, 1); + } +} + +/* + * \brief Function sets the TX power variable. + * + * \param power TX power setting + * + * \return 0 Success + * \return -1 Fail + */ +static int8_t rf_tx_power_set(uint8_t power) +{ + /* gcapraru: Map MCR20A Tx power levels over ATMEL values */ + static uint8_t pwrLevelMapping[16] = {25, 25, 25, 24, 24, 24, 23, 23, 22, 22, 21, 20, 19, 18, 17, 14}; + + if (power > 15) { + return -1; + } + + radio_tx_power = power; + MCR20Drv_DirectAccessSPIWrite(PA_PWR, pwrLevelMapping[power]); + return 0; +} + +/* + * \brief Function returns the TX power variable. + * + * \param none + * + * \return radio_tx_power TX power variable + */ +static uint8_t rf_tx_power_get(void) +{ + return radio_tx_power; +} + +/* + * \brief Function enables the usage of Antenna diversity. + * + * \param none + * + * \return 0 Success + */ +static int8_t rf_enable_antenna_diversity(void) +{ + uint8_t phyReg; + + phyReg = MCR20Drv_IndirectAccessSPIRead(ANT_AGC_CTRL); + phyReg |= cANT_AGC_CTRL_FAD_EN_Mask_c; + MCR20Drv_IndirectAccessSPIWrite(ANT_AGC_CTRL, phyReg); + + phyReg = MCR20Drv_IndirectAccessSPIRead(ANT_PAD_CTRL); + phyReg |= 0x02; + MCR20Drv_IndirectAccessSPIWrite(ANT_PAD_CTRL, phyReg); + + return 0; +} + +/* + * \brief Function gives the control of RF states to MAC. + * + * \param new_state RF state + * \param rf_channel RF channel + * + * \return 0 Success + */ +static int8_t rf_interface_state_control(phy_interface_state_e new_state, uint8_t rf_channel) +{ + int8_t ret_val = 0; + switch (new_state) { + /*Reset PHY driver and set to idle*/ + case PHY_INTERFACE_RESET: + break; + /*Disable PHY Interface driver*/ + case PHY_INTERFACE_DOWN: + rf_shutdown(); + break; + /*Enable PHY Interface driver*/ + case PHY_INTERFACE_UP: + rf_channel_set(rf_channel); + rf_receive(); + break; + /*Enable wireless interface ED scan mode*/ + case PHY_INTERFACE_RX_ENERGY_STATE: + rf_abort(); + rf_channel_set(rf_channel); + break; + case PHY_INTERFACE_SNIFFER_STATE: /**< Enable Sniffer state */ + rf_promiscuous(1); + rf_channel_set(rf_channel); + rf_receive(); + break; + } + return ret_val; +} + +/* + * \brief Function controls the ACK pending, channel setting and energy detection. + * + * \param extension_type Type of control + * \param data_ptr Data from NET library + * + * \return 0 Success + */ +static int8_t rf_extension(phy_extension_type_e extension_type, uint8_t *data_ptr) +{ + switch (extension_type) { + /*Control MAC pending bit for Indirect data transmission*/ + case PHY_EXTENSION_CTRL_PENDING_BIT: { + uint8_t reg = MCR20Drv_DirectAccessSPIRead(SRC_CTRL); + + if (*data_ptr) { + reg |= cSRC_CTRL_ACK_FRM_PND; + } else { + reg &= ~cSRC_CTRL_ACK_FRM_PND; + } + + MCR20Drv_DirectAccessSPIWrite(SRC_CTRL, reg); + break; + + } + /*Return frame Auto Ack frame pending status*/ + case PHY_EXTENSION_READ_LAST_ACK_PENDING_STATUS: { + uint8_t reg = MCR20Drv_DirectAccessSPIRead(SRC_CTRL); + if (reg & cSRC_CTRL_ACK_FRM_PND) { + *data_ptr = 1; + } else { + *data_ptr = 0; + } + break; + } + /*Read energy on the channel*/ + case PHY_EXTENSION_READ_CHANNEL_ENERGY: + *data_ptr = rf_get_channel_energy(); + break; + default: + break; + } + return 0; +} + +/* + * \brief Function sets the addresses to RF address filters. + * + * \param address_type Type of address + * \param address_ptr Pointer to given address + * + * \return 0 Success + */ +static int8_t rf_address_write(phy_address_type_e address_type, uint8_t *address_ptr) +{ + int8_t ret_val = 0; + switch (address_type) { + /*Set 48-bit address*/ + case PHY_MAC_48BIT: + break; + /*Set 64-bit address*/ + case PHY_MAC_64BIT: + rf_set_address(address_ptr); + break; + /*Set 16-bit address*/ + case PHY_MAC_16BIT: + rf_set_short_adr(address_ptr); + break; + /*Set PAN Id*/ + case PHY_MAC_PANID: + rf_set_pan_id(address_ptr); + break; + } + return ret_val; +} + +/* + * \brief Function initialises the ACK wait time and returns the used PHY mode. + * + * \param none + * + * \return tmp Used PHY mode + */ +static void rf_init_phy_mode(void) +{ +} + +/* + * \brief Function is a RF interrupt vector. End of frame in RX and TX are handled here as well as CCA process interrupt. + * + * \param none + * + * \return none + */ +static void PHY_InterruptHandler(void) +{ + MCR20Drv_IRQ_Disable(); + irq_thread->flags_set(1); +} + +static void PHY_InterruptThread(void) +{ + for (;;) { + ThisThread::flags_wait_all(1); + handle_interrupt(); + MCR20Drv_IRQ_Enable(); + } +} + +static void handle_interrupt(void) +{ + uint8_t xcvseqCopy; + + /* Read transceiver interrupt status and control registers */ + mStatusAndControlRegs[IRQSTS1] = + MCR20Drv_DirectAccessSPIMultiByteRead(IRQSTS2, &mStatusAndControlRegs[IRQSTS2], 7); + + xcvseqCopy = mStatusAndControlRegs[PHY_CTRL1] & cPHY_CTRL1_XCVSEQ; + + /* Flter Fail IRQ */ + if ((mStatusAndControlRegs[IRQSTS1] & cIRQSTS1_FILTERFAIL_IRQ) && + !(mStatusAndControlRegs[PHY_CTRL2] & cPHY_CTRL2_FILTERFAIL_MSK)) { + if (xcvseqCopy == gRX_c) { + /* Abort current SEQ */ + mStatusAndControlRegs[PHY_CTRL1] &= ~(cPHY_CTRL1_XCVSEQ); + MCR20Drv_DirectAccessSPIWrite(PHY_CTRL1, mStatusAndControlRegs[PHY_CTRL1]); + /* Wait for Sequence Idle */ + while ((MCR20Drv_DirectAccessSPIRead(SEQ_STATE) & 0x1F) != 0); + /* Clear IRQ flags: */ + MCR20Drv_DirectAccessSPIWrite(IRQSTS1, cIRQSTS1_SEQIRQ); + /* Restart Rx asap */ + mStatusAndControlRegs[PHY_CTRL1] |= gRX_c; + MCR20Drv_DirectAccessSPIWrite(PHY_CTRL1, mStatusAndControlRegs[PHY_CTRL1]); + } + } + + /* TMR3 IRQ: ACK wait time-out */ + if ((mStatusAndControlRegs[IRQSTS3] & cIRQSTS3_TMR3IRQ) && + !(mStatusAndControlRegs[IRQSTS3] & cIRQSTS3_TMR3MSK)) { + /* Disable TMR3 IRQ */ + mStatusAndControlRegs[IRQSTS3] |= cIRQSTS3_TMR3MSK; + + if (xcvseqCopy == gTR_c) { + /* Set XCVR to Idle */ + mPhySeqState = gIdle_c; + mStatusAndControlRegs[PHY_CTRL1] &= ~(cPHY_CTRL1_XCVSEQ); + /* Mask interrupts */ + mStatusAndControlRegs[PHY_CTRL2] |= cPHY_CTRL2_CCAMSK | cPHY_CTRL2_RXMSK | cPHY_CTRL2_TXMSK | cPHY_CTRL2_SEQMSK; + /* Sync settings with XCVR */ + MCR20Drv_DirectAccessSPIMultiByteWrite(IRQSTS1, mStatusAndControlRegs, 5); + + rf_ack_wait_timer_interrupt(); + return; + } + } + + /* Sequencer interrupt, the autosequence has completed */ + if ((mStatusAndControlRegs[IRQSTS1] & cIRQSTS1_SEQIRQ) && + !(mStatusAndControlRegs[PHY_CTRL2] & cPHY_CTRL2_SEQMSK)) { + /* Set XCVR to Idle */ + mPhySeqState = gIdle_c; + mStatusAndControlRegs[PHY_CTRL1] &= ~(cPHY_CTRL1_XCVSEQ); + /* Mask interrupts */ + mStatusAndControlRegs[PHY_CTRL2] |= cPHY_CTRL2_CCAMSK | cPHY_CTRL2_RXMSK | cPHY_CTRL2_TXMSK | cPHY_CTRL2_SEQMSK; + /* Sync settings with XCVR */ + MCR20Drv_DirectAccessSPIMultiByteWrite(IRQSTS1, mStatusAndControlRegs, 5); + + /* PLL unlock, the autosequence has been aborted due to PLL unlock */ + if (mStatusAndControlRegs[IRQSTS1] & cIRQSTS1_PLL_UNLOCK_IRQ) { + if (xcvseqCopy == gRX_c) { + rf_receive(); + } + return; + } + + switch (xcvseqCopy) { + case gTX_c: + case gTR_c: + rf_handle_tx_end(); + break; + + case gRX_c: + rf_handle_rx_end(); + break; + + case gCCA_c: + rf_handle_cca_ed_done(); + break; + + default: + break; + } + + return; + } + /* Other IRQ. Clear XCVR interrupt flags */ + MCR20Drv_DirectAccessSPIMultiByteWrite(IRQSTS1, mStatusAndControlRegs, 3); +} + +/* + * \brief Function forces the XCVR to Idle state. + * + * \param none + * + * \return none + */ +static void rf_abort(void) +{ + /* Mask XCVR irq */ + MCR20Drv_IRQ_Disable(); + + mPhySeqState = gIdle_c; + + mStatusAndControlRegs[IRQSTS1] = MCR20Drv_DirectAccessSPIMultiByteRead(IRQSTS2, &mStatusAndControlRegs[IRQSTS2], 5); + + /* Mask SEQ interrupt */ + mStatusAndControlRegs[PHY_CTRL2] |= cPHY_CTRL2_SEQMSK; + MCR20Drv_DirectAccessSPIWrite(PHY_CTRL2, mStatusAndControlRegs[PHY_CTRL2]); + + if ((mStatusAndControlRegs[PHY_CTRL1] & cPHY_CTRL1_XCVSEQ) != gIdle_c) { + /* Abort current SEQ */ + mStatusAndControlRegs[PHY_CTRL1] &= ~(cPHY_CTRL1_XCVSEQ); + MCR20Drv_DirectAccessSPIWrite(PHY_CTRL1, mStatusAndControlRegs[PHY_CTRL1]); + + /* Wait for Sequence Idle (if not already) */ + while ((MCR20Drv_DirectAccessSPIRead(SEQ_STATE) & 0x1F) != 0); + //while ( !(MCR20Drv_DirectAccessSPIRead(IRQSTS1) & cIRQSTS1_SEQIRQ)); + mStatusAndControlRegs[IRQSTS1] |= cIRQSTS1_SEQIRQ; + } + + /* Clear all PP IRQ bits to avoid unexpected interrupts and mask TMR3 interrupt. + Do not change TMR IRQ status. */ + mStatusAndControlRegs[IRQSTS3] &= 0xF0; + mStatusAndControlRegs[IRQSTS3] |= (cIRQSTS3_TMR3MSK | cIRQSTS3_TMR3IRQ); + MCR20Drv_DirectAccessSPIMultiByteWrite(IRQSTS1, mStatusAndControlRegs, 3); + + /* Unmask XCVR irq */ + MCR20Drv_IRQ_Enable(); +} + +/* + * \brief Function reads a time-stamp value from XCVR [symbols] + * + * \param pEndTime pointer to location where time-stamp will be stored + * + * \return none + */ +static void rf_get_timestamp(uint32_t *pRetClk) +{ + if (NULL == pRetClk) { + return; + } + + platform_enter_critical(); + + *pRetClk = 0; + MCR20Drv_DirectAccessSPIMultiByteRead(EVENT_TMR_LSB, (uint8_t *) pRetClk, 3); + + platform_exit_critical(); +} + +/* + * \brief Function set a time-out to an XCVR sequence. + * + * \param pEndTime pointer to the sequence time-out value [symbols] + * + * \return none + */ +static void rf_set_timeout(uint32_t *pEndTime) +{ + uint8_t phyReg; + + if (NULL == pEndTime) { + return; + } + + platform_enter_critical(); + + phyReg = MCR20Drv_DirectAccessSPIRead(IRQSTS3); + phyReg &= 0xF0; /* do not change IRQ status */ + phyReg |= (cIRQSTS3_TMR3MSK); /* mask TMR3 interrupt */ + MCR20Drv_DirectAccessSPIWrite(IRQSTS3, phyReg); + + MCR20Drv_DirectAccessSPIMultiByteWrite(T3CMP_LSB, (uint8_t *) pEndTime, 3); + + phyReg &= ~(cIRQSTS3_TMR3MSK); /* unmask TMR3 interrupt */ + phyReg |= (cIRQSTS3_TMR3IRQ); /* aknowledge TMR3 IRQ */ + MCR20Drv_DirectAccessSPIWrite(IRQSTS3, phyReg); + + platform_exit_critical(); +} + +/* + * \brief Function reads a random number from RF. + * + * \param none + * + * \return 8-bit random number + */ +static uint8_t rf_if_read_rnd(void) +{ + uint8_t phyReg; + + MCR20Drv_IRQ_Disable(); + /* Check if XCVR is idle */ + phyReg = MCR20Drv_DirectAccessSPIRead(PHY_CTRL1); + + if ((phyReg & cPHY_CTRL1_XCVSEQ) == gIdle_c) { + /* Program a new sequence */ + MCR20Drv_DirectAccessSPIWrite(PHY_CTRL1, phyReg | gCCA_c); + /* Wait for sequence to finish */ + while (!(MCR20Drv_DirectAccessSPIRead(IRQSTS1) & cIRQSTS1_SEQIRQ)); + /* Clear interrupt flag */ + MCR20Drv_DirectAccessSPIWrite(IRQSTS1, cIRQSTS1_SEQIRQ); + } + + MCR20Drv_IRQ_Enable(); + + return MCR20Drv_IndirectAccessSPIRead(_RNG); +} + +/* + * \brief Function converts LQI into RSSI. + * + * \param LQI + * + * \return RSSI + */ +static int8_t rf_convert_LQI_to_RSSI(uint8_t lqi) +{ + int32_t rssi = (50 * lqi - 16820) / 163; + return (int8_t)rssi; +} + +/* + * \brief Function scale the LQI value reported by RF into a 0-255 value. + * + * \param hwLqi - the LQI value reported by RF + * + * \return scaled LQI + */ +static uint8_t rf_convert_LQI(uint8_t hwLqi) +{ + uint32_t tmpLQI; + + /* LQI Saturation Level */ + if (hwLqi >= 230) { + return 0xFF; + } else if (hwLqi <= 9) { + return 0; + } else { + /* Rescale the LQI values from min to saturation to the 0x00 - 0xFF range */ + /* The LQI value mst be multiplied by ~1.1087 */ + /* tmpLQI = hwLqi * 7123 ~= hwLqi * 65536 * 0.1087 = hwLqi * 2^16 * 0.1087*/ + tmpLQI = ((uint32_t)hwLqi * (uint32_t)7123); + /* tmpLQI = (tmpLQI / 2^16) + hwLqi */ + tmpLQI = (uint32_t)(tmpLQI >> 16) + (uint32_t)hwLqi; + + return (uint8_t)tmpLQI; + } +} + +/* + * \brief Function enables/disables Rx promiscuous mode. + * + * \param state of XCVR promiscuous mode + * + * \return none + */ +static void rf_promiscuous(uint8_t state) +{ + uint8_t rxFrameFltReg, phyCtrl4Reg; + + rxFrameFltReg = MCR20Drv_IndirectAccessSPIRead(RX_FRAME_FILTER); + phyCtrl4Reg = MCR20Drv_DirectAccessSPIRead(PHY_CTRL4); + + if (state) { + /* FRM_VER[1:0] = b00. 00: Any FrameVersion accepted (0,1,2 & 3) */ + /* All frame types accepted*/ + phyCtrl4Reg |= cPHY_CTRL4_PROMISCUOUS; + rxFrameFltReg &= ~(cRX_FRAME_FLT_FRM_VER); + rxFrameFltReg |= (cRX_FRAME_FLT_ACK_FT | cRX_FRAME_FLT_NS_FT); + } else { + phyCtrl4Reg &= ~cPHY_CTRL4_PROMISCUOUS; + /* FRM_VER[1:0] = b11. Accept FrameVersion 0 and 1 packets, reject all others */ + /* Beacon, Data and MAC command frame types accepted */ + rxFrameFltReg &= ~(cRX_FRAME_FLT_FRM_VER); + rxFrameFltReg |= (0x03 << cRX_FRAME_FLT_FRM_VER_Shift_c); + rxFrameFltReg &= ~(cRX_FRAME_FLT_ACK_FT | cRX_FRAME_FLT_NS_FT); + } + + MCR20Drv_IndirectAccessSPIWrite(RX_FRAME_FILTER, rxFrameFltReg); + MCR20Drv_DirectAccessSPIWrite(PHY_CTRL4, phyCtrl4Reg); +} + +/* + * \brief Function used to switch XCVR power state. + * + * \param state The XCVR power mode + * + * \return none + */ +static void rf_set_power_state(xcvrPwrMode_t newState) +{ + uint8_t pwrMode; + uint8_t xtalState; + + if (mPwrState == newState) { + return; + } + + /* Read power settings from RF */ + pwrMode = MCR20Drv_DirectAccessSPIRead(PWR_MODES); + xtalState = pwrMode & cPWR_MODES_XTALEN; + + switch (newState) { + case gXcvrPwrIdle_c: + pwrMode &= ~(cPWR_MODES_AUTODOZE); + pwrMode |= (cPWR_MODES_XTALEN | cPWR_MODES_PMC_MODE); + break; + case gXcvrPwrAutodoze_c: + pwrMode |= (cPWR_MODES_XTALEN | cPWR_MODES_AUTODOZE | cPWR_MODES_PMC_MODE); + break; + case gXcvrPwrDoze_c: + pwrMode &= ~(cPWR_MODES_AUTODOZE | cPWR_MODES_PMC_MODE); + pwrMode |= cPWR_MODES_XTALEN; + break; + case gXcvrPwrHibernate_c: + pwrMode &= ~(cPWR_MODES_XTALEN | cPWR_MODES_AUTODOZE | cPWR_MODES_PMC_MODE); + break; + default: + return; + } + + mPwrState = newState; + MCR20Drv_DirectAccessSPIWrite(PWR_MODES, pwrMode); + + if (!xtalState && (pwrMode & cPWR_MODES_XTALEN)) { + /* wait for crystal oscillator to complet its warmup */ + while ((MCR20Drv_DirectAccessSPIRead(PWR_MODES) & cPWR_MODES_XTAL_READY) != cPWR_MODES_XTAL_READY); + /* wait for radio wakeup from hibernate interrupt */ + while ((MCR20Drv_DirectAccessSPIRead(IRQSTS2) & (cIRQSTS2_WAKE_IRQ | cIRQSTS2_TMRSTATUS)) != (cIRQSTS2_WAKE_IRQ | cIRQSTS2_TMRSTATUS)); + + MCR20Drv_DirectAccessSPIWrite(IRQSTS2, cIRQSTS2_WAKE_IRQ); + } +} + +/* + * \brief Function reads the energy level on the preselected channel. + * + * \return energy level + */ +static uint8_t rf_get_channel_energy(void) +{ + uint8_t ccaMode; + + MCR20Drv_IRQ_Disable(); + /* RX can start only from Idle state */ + if (mPhySeqState != gIdle_c) { + MCR20Drv_IRQ_Enable(); + return 0; + } + + /* Set XCVR power state in run mode */ + rf_set_power_state(gXcvrRunState_d); + + /* Switch to ED mode */ + ccaMode = (mStatusAndControlRegs[PHY_CTRL4] >> cPHY_CTRL4_CCATYPE_Shift_c) & cPHY_CTRL4_CCATYPE; + if (ccaMode != gCcaED_c) { + mStatusAndControlRegs[PHY_CTRL4] &= ~(cPHY_CTRL4_CCATYPE << cPHY_CTRL4_CCATYPE_Shift_c); + mStatusAndControlRegs[PHY_CTRL4] |= gCcaED_c << cPHY_CTRL4_CCATYPE_Shift_c; + MCR20Drv_DirectAccessSPIWrite(PHY_CTRL4, mStatusAndControlRegs[PHY_CTRL4]); + } + + /* Start ED sequence */ + mStatusAndControlRegs[PHY_CTRL1] |= gCCA_c; + MCR20Drv_DirectAccessSPIWrite(IRQSTS1, cIRQSTS1_CCAIRQ | cIRQSTS1_SEQIRQ); + MCR20Drv_DirectAccessSPIWrite(PHY_CTRL1, mStatusAndControlRegs[PHY_CTRL1]); + /* Wait for sequence to finish */ + while (!(MCR20Drv_DirectAccessSPIRead(IRQSTS1) & cIRQSTS1_SEQIRQ)); + /* Set XCVR to Idle */ + mStatusAndControlRegs[PHY_CTRL1] &= ~(cPHY_CTRL1_XCVSEQ); + MCR20Drv_DirectAccessSPIWrite(PHY_CTRL1, mStatusAndControlRegs[PHY_CTRL1]); + MCR20Drv_DirectAccessSPIWrite(IRQSTS1, cIRQSTS1_CCAIRQ | cIRQSTS1_SEQIRQ); + + MCR20Drv_IRQ_Enable(); + + return rf_convert_energy_level(MCR20Drv_DirectAccessSPIRead(CCA1_ED_FNL)); +} + +/* + * \brief Function converts the energy level from dBm to a 0-255 value. + * + * \param energyLevel in dBm + * + * \return energy level (0-255) + */ +static uint8_t rf_convert_energy_level(uint8_t energyLevel) +{ + if (energyLevel >= 90) { + /* ED value is below minimum. Return 0x00. */ + energyLevel = 0x00; + } else if (energyLevel <= 26) { + /* ED value is above maximum. Return 0xFF. */ + energyLevel = 0xFF; + } else { + /* Energy level (-90 dBm to -26 dBm ) --> varies form 0 to 64 */ + energyLevel = (90 - energyLevel); + /* Rescale the energy level values to the 0x00-0xff range (0 to 64 translates in 0 to 255) */ + /* energyLevel * 3.9844 ~= 4 */ + /* Multiply with 4=2^2 by shifting left. + The multiplication will not overflow beacause energyLevel has values between 0 and 63 */ + energyLevel <<= 2; + } + + return energyLevel; +} + +static uint8_t rf_scale_lqi(int8_t rssi) +{ + uint8_t scaled_lqi; + /*Worst case sensitivity*/ + const int8_t rf_sensitivity = -98; + + /*rssi < RF sensitivity*/ + if (rssi < rf_sensitivity) { + scaled_lqi = 0; + } + /*-91 dBm < rssi < -81 dBm (AT86RF233 XPro)*/ + /*-90 dBm < rssi < -80 dBm (AT86RF212B XPro)*/ + else if (rssi < (rf_sensitivity + 10)) { + scaled_lqi = 31; + } + /*-81 dBm < rssi < -71 dBm (AT86RF233 XPro)*/ + /*-80 dBm < rssi < -70 dBm (AT86RF212B XPro)*/ + else if (rssi < (rf_sensitivity + 20)) { + scaled_lqi = 207; + } + /*-71 dBm < rssi < -61 dBm (AT86RF233 XPro)*/ + /*-70 dBm < rssi < -60 dBm (AT86RF212B XPro)*/ + else if (rssi < (rf_sensitivity + 30)) { + scaled_lqi = 255; + } + /*-61 dBm < rssi < -51 dBm (AT86RF233 XPro)*/ + /*-60 dBm < rssi < -50 dBm (AT86RF212B XPro)*/ + else if (rssi < (rf_sensitivity + 40)) { + scaled_lqi = 255; + } + /*-51 dBm < rssi < -41 dBm (AT86RF233 XPro)*/ + /*-50 dBm < rssi < -40 dBm (AT86RF212B XPro)*/ + else if (rssi < (rf_sensitivity + 50)) { + scaled_lqi = 255; + } + /*-41 dBm < rssi < -31 dBm (AT86RF233 XPro)*/ + /*-40 dBm < rssi < -30 dBm (AT86RF212B XPro)*/ + else if (rssi < (rf_sensitivity + 60)) { + scaled_lqi = 255; + } + /*-31 dBm < rssi < -21 dBm (AT86RF233 XPro)*/ + /*-30 dBm < rssi < -20 dBm (AT86RF212B XPro)*/ + else if (rssi < (rf_sensitivity + 70)) { + scaled_lqi = 255; + } + /*rssi > RF saturation*/ + else if (rssi > (rf_sensitivity + 80)) { + scaled_lqi = 111; + } + /*-21 dBm < rssi < -11 dBm (AT86RF233 XPro)*/ + /*-20 dBm < rssi < -10 dBm (AT86RF212B XPro)*/ + else { + scaled_lqi = 255; + } + + return scaled_lqi; +} + + +/*****************************************************************************/ +/* Layer porting to the Freescale driver */ +/*****************************************************************************/ +extern "C" void xcvr_spi_init(uint32_t instance) +{ + (void)instance; +} + +extern "C" void RF_IRQ_Init(void) +{ + MBED_ASSERT(irq != NULL); + irq->mode(PullUp); + irq->fall(&PHY_InterruptHandler); +} + +extern "C" void RF_IRQ_Enable(void) +{ + MBED_ASSERT(irq != NULL); + irq->enable_irq(); +} + +extern "C" void RF_IRQ_Disable(void) +{ + MBED_ASSERT(irq != NULL); + irq->disable_irq(); +} + +extern "C" uint8_t RF_isIRQ_Pending(void) +{ + MBED_ASSERT(rf != NULL); + return !irq_pin->read(); +} + +extern "C" void RF_RST_Set(int state) +{ + MBED_ASSERT(rst != NULL); + *rst = state; +} + +extern "C" void gXcvrAssertCS_d(void) +{ + MBED_ASSERT(cs != NULL); + *cs = 0; +} + +extern "C" void gXcvrDeassertCS_d(void) +{ + MBED_ASSERT(cs != NULL); + *cs = 1; +} + +extern "C" void xcvr_spi_configure_speed(uint32_t instance, uint32_t freq) +{ + MBED_ASSERT(spi != NULL); + (void)instance; + spi->frequency(freq); +} + +extern "C" void xcvr_spi_transfer(uint32_t instance, + uint8_t *sendBuffer, + uint8_t *receiveBuffer, + size_t transferByteCount) +{ + MBED_ASSERT(spi != NULL); + (void)instance; + volatile uint8_t dummy; + + if (!transferByteCount) { + return; + } + + if (!sendBuffer && !receiveBuffer) { + return; + } + + while (transferByteCount--) { + if (sendBuffer) { + dummy = *sendBuffer; + sendBuffer++; + } else { + dummy = 0xFF; + } + + dummy = spi->write(dummy); + + if (receiveBuffer) { + *receiveBuffer = dummy; + receiveBuffer++; + } + } +} + +/*****************************************************************************/ +/*****************************************************************************/ + +static void rf_if_lock(void) +{ + platform_enter_critical(); +} + +static void rf_if_unlock(void) +{ + platform_exit_critical(); +} + +NanostackRfPhyMcr20a::NanostackRfPhyMcr20a(PinName spi_mosi, PinName spi_miso, + PinName spi_sclk, PinName spi_cs, PinName spi_rst, PinName spi_irq) + : _spi(spi_mosi, spi_miso, spi_sclk), _rf_cs(spi_cs), _rf_rst(spi_rst, 1), + _rf_irq(spi_irq), _rf_irq_pin(spi_irq), + _irq_thread(osPriorityRealtime, 1024) +{ + char mac48[6]; + mbed_mac_address(mac48); + + MAC_address[0] = mac48[0]; + MAC_address[1] = mac48[1]; + MAC_address[2] = mac48[2]; + MAC_address[3] = 0xFF; + MAC_address[4] = 0xFF; + MAC_address[5] = mac48[3]; + MAC_address[6] = mac48[4]; + MAC_address[7] = mac48[5]; +} + +NanostackRfPhyMcr20a::~NanostackRfPhyMcr20a() +{ + // Do nothing +} + +int8_t NanostackRfPhyMcr20a::rf_register() +{ + + rf_if_lock(); + + if (rf != NULL) { + rf_if_unlock(); + error("Multiple registrations of NanostackRfPhyMcr20a not supported"); + return -1; + } + + _irq_thread.start(mbed::callback(PHY_InterruptThread)); + + _pins_set(); + int8_t radio_id = rf_device_register(); + if (radio_id < 0) { + _pins_clear(); + rf = NULL; + } + + rf_if_unlock(); + return radio_id; +} + +void NanostackRfPhyMcr20a::rf_unregister() +{ + rf_if_lock(); + + if (rf != this) { + rf_if_unlock(); + return; + } + + rf_device_unregister(); + rf = NULL; + _pins_clear(); + + rf_if_unlock(); +} + +void NanostackRfPhyMcr20a::get_mac_address(uint8_t *mac) +{ + rf_if_lock(); + + memcpy((void *)mac, (void *)MAC_address, sizeof(MAC_address)); + + rf_if_unlock(); +} + +void NanostackRfPhyMcr20a::set_mac_address(uint8_t *mac) +{ + rf_if_lock(); + + if (NULL != rf) { + error("NanostackRfPhyAtmel cannot change mac address when running"); + rf_if_unlock(); + return; + } + memcpy((void *)MAC_address, (void *)mac, sizeof(MAC_address)); + + rf_if_unlock(); +} + +void NanostackRfPhyMcr20a::_pins_set() +{ + spi = &_spi; + cs = &_rf_cs; + rst = &_rf_rst; + irq = &_rf_irq; + irq_pin = &_rf_irq_pin; + irq_thread = &_irq_thread; +} + +void NanostackRfPhyMcr20a::_pins_clear() +{ + spi = NULL; + cs = NULL; + rst = NULL; + irq = NULL; + irq_pin = NULL; + irq_thread = NULL; +} + +#if MBED_CONF_MCR20A_PROVIDE_DEFAULT + +NanostackRfPhy &NanostackRfPhy::get_default_instance() +{ + static NanostackRfPhyMcr20a rf_phy(MCR20A_SPI_MOSI, MCR20A_SPI_MISO, MCR20A_SPI_SCLK, MCR20A_SPI_CS, MCR20A_SPI_RST, MCR20A_SPI_IRQ); + return rf_phy; +} + +#endif // MBED_CONF_MCR20A_PROVIDE_DEFAULT + +#endif // MBED_CONF_NANOSTACK_CONFIGURATION diff --git a/source/XcvrSpi.h b/source/XcvrSpi.h new file mode 100644 index 0000000000..5b2f12b7eb --- /dev/null +++ b/source/XcvrSpi.h @@ -0,0 +1,90 @@ +/*! +* Copyright (c) 2015, Freescale Semiconductor, Inc. +* All rights reserved. +* SPDX-License-Identifier: BSD-3-Clause +* +* \file XcvrSpi.h +* +* Redistribution and use in source and binary forms, with or without modification, +* are permitted provided that the following conditions are met: +* +* o Redistributions of source code must retain the above copyright notice, this list +* of conditions and the following disclaimer. +* +* o 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. +* +* o Neither the name of Freescale Semiconductor, Inc. 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 HOLDER 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. +*/ + +#ifndef __XCVR_SPI_H__ +#define __XCVR_SPI_H__ + + +/***************************************************************************** + * INCLUDED HEADERS * + *---------------------------------------------------------------------------* + * Add to this section all the headers that this module needs to include. * + * Note that it is not a good practice to include header files into header * + * files, so use this section only if there is no other better solution. * + *---------------------------------------------------------------------------* + *****************************************************************************/ + + +/***************************************************************************** + * PUBLIC MACROS * + *---------------------------------------------------------------------------* + * Add to this section all the access macros, registers mappings, bit access * + * macros, masks, flags etc ... + *---------------------------------------------------------------------------* + *****************************************************************************/ +#define gXcvrSpiInstance_c 0 + +/***************************************************************************** + * PUBLIC FUNCTIONS * + *---------------------------------------------------------------------------* + * Add to this section all the global functions prototype preceded (as a * + * good practice) by the keyword 'extern' * + *---------------------------------------------------------------------------* + *****************************************************************************/ + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +void RF_RST_Set(int state); +void RF_CS_Set(int state); +void RF_IRQ_Init(void); +void RF_IRQ_Disable(void); +void RF_IRQ_Enable(void); +uint8_t RF_isIRQ_Pending(void); + +void gXcvrAssertCS_d(void); +void gXcvrDeassertCS_d(void); + +void xcvr_spi_init(uint32_t instance); +void xcvr_spi_configure_speed(uint32_t instance, uint32_t freq); +void xcvr_spi_transfer(uint32_t instance, + uint8_t *sendBuffer, + uint8_t *receiveBuffer, + uint32_t transferByteCount); + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ + +#endif /* __XCVR_SPI_H__ */ From 051f31a2d61e6ff40984a031ce655ea08bc959fe Mon Sep 17 00:00:00 2001 From: Arto Kinnunen Date: Wed, 23 Jun 2021 10:11:33 +0300 Subject: [PATCH 03/18] Restore CMakeLists.txt Original master repository does not have CMakeLists.txt, put it back as 'git subtree add' does not have it. --- .../802.15.4_RF/mcr20a-rf-driver/CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/CMakeLists.txt diff --git a/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/CMakeLists.txt b/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/CMakeLists.txt new file mode 100644 index 0000000000..a29383253d --- /dev/null +++ b/connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/CMakeLists.txt @@ -0,0 +1,14 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +target_include_directories(mbed-802.15.4-rf + INTERFACE + mcr20a-rf-driver + source +) + +target_sources(mbed-802.15.4-rf + INTERFACE + source/MCR20Drv.c + source/NanostackRfPhyMcr20a.cpp +) From d7b347653d04fbe196872d8296dace3a7568516f Mon Sep 17 00:00:00 2001 From: Arto Kinnunen Date: Wed, 23 Jun 2021 10:23:56 +0300 Subject: [PATCH 04/18] Remove existing stm-s2lp-rf-driver --- .../stm-s2lp-rf-driver/CMakeLists.txt | 15 - .../802.15.4_RF/stm-s2lp-rf-driver/README.md | 11 - .../stm-s2lp-rf-driver/mbed_lib.json | 73 - .../source/NanostackRfPhys2lp.cpp | 1479 ----------------- .../source/at24mac_s2lp.cpp | 72 - .../stm-s2lp-rf-driver/source/at24mac_s2lp.h | 71 - .../source/rf_configuration.c | 185 --- .../source/rf_configuration.h | 41 - .../stm-s2lp-rf-driver/source/s2lpReg.h | 343 ---- .../stm-s2lp-rf-driver/NanostackRfPhys2lp.h | 163 -- 10 files changed, 2453 deletions(-) delete mode 100644 connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/CMakeLists.txt delete mode 100644 connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/README.md delete mode 100644 connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/mbed_lib.json delete mode 100644 connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/NanostackRfPhys2lp.cpp delete mode 100644 connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/at24mac_s2lp.cpp delete mode 100644 connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/at24mac_s2lp.h delete mode 100644 connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/rf_configuration.c delete mode 100644 connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/rf_configuration.h delete mode 100644 connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/s2lpReg.h delete mode 100644 connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/stm-s2lp-rf-driver/NanostackRfPhys2lp.h diff --git a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/CMakeLists.txt b/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/CMakeLists.txt deleted file mode 100644 index d64ffa0134..0000000000 --- a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2020 ARM Limited. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -target_include_directories(mbed-802.15.4-rf - INTERFACE - stm-s2lp-rf-driver - source -) - -target_sources(mbed-802.15.4-rf - INTERFACE - source/NanostackRfPhys2lp.cpp - source/at24mac_s2lp.cpp - source/rf_configuration.c -) diff --git a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/README.md b/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/README.md deleted file mode 100644 index 51ece87ac3..0000000000 --- a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Example RF driver for STM 802.15.4 transceivers # - -Support for: - * S2-LP - -This driver is used with 6LoWPAN and Wi-SUN stacks. - -Driver is tested with X-Nucleo-S2868A1 RF expansion board. https://www.st.com/en/ecosystems/x-nucleo-s2868a1.html - -NOTE: Default SPI SCLK pin configuration is D13. On X-Nucleo-S2868A1, resistor R6 must be soldered instead of R11. For more information, see user manual UM2405. https://www.st.com/resource/en/user_manual/dm00498153.pdf - diff --git a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/mbed_lib.json b/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/mbed_lib.json deleted file mode 100644 index 55e4bf1748..0000000000 --- a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/mbed_lib.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "s2lp", - "config": { - "SPI_SDI": { - "help": "SPI_SDI pin for SPI connection. D11 assumed, needs to be set/overwritten otherwise", - "value": null - }, - "SPI_SDO": { - "help": "SPI_SDO pin for SPI connection. D12 assumed, needs to be set/overwritten otherwise", - "value": null - }, - "SPI_SCLK": { - "help": "SPI_SCLK pin for SPI connection, D13 assumed, needs to be set/overwritten otherwise", - "value": null - }, - "SPI_CS": { - "help": "SPI_CS pin for SPI connection, A1 assumed, needs to be set/overwritten otherwise", - "value": null - }, - "SPI_SDN": { - "help": "SPI_SDN pin for SPI connection, D7 assumed, needs to be set/overwritten otherwise", - "value": null - }, - "TEST_PIN_TX": { - "help": "TEST_PIN_TX pin for serial connection, D6 assumed, needs to be set/overwritten otherwise", - "value": null - }, - "TEST_PIN_RX": { - "help": "TEST_PIN_RX pin for serial connection, D5 assumed, needs to be set/overwritten otherwise", - "value": null - }, - "TEST_PIN_CSMA": { - "help": "TEST_PIN_CSMA pin for CSMA, D4 assumed, needs to be set/overwritten otherwise", - "value": null - }, - "TEST_PIN_SPARE_1": { - "help": "TEST_PIN_SPARE_1 pin for testing, D2 assumed, needs to be set/overwritten otherwise", - "value": null - }, - "TEST_PIN_SPARE_2": { - "help": "TEST_PIN_SPARE_2 pin for testing, D8 assumed, needs to be set/overwritten otherwise", - "value": null - }, - "SPI_GPIO0": { - "help": "SPI_GPIO0 pin for GPIO testing, A0 assumed, needs to be set/overwritten otherwise", - "value": null - }, - "SPI_GPIO1": { - "help": "SPI_GPIO1 pin for GPIO testing, A2 assumed, needs to be set/overwritten otherwise", - "value": null - }, - "SPI_GPIO2": { - "help": "SPI_GPIO2 pin for GPIO testing, A3 assumed, needs to be set/overwritten otherwise", - "value": null - }, - "SPI_GPIO3": { - "help": "SPI_GPIO3 pin for GPIO testing, A5 assumed, needs to be set/overwritten otherwise", - "value": null - }, - "I2C_SDA": { - "help": "I2C_SDA pin for I2C SDA, null assumed, needs to be set/overwritten otherwise", - "value": null - }, - "I2C_SCL": { - "help": "I2C_SCL pin for I2C SCL, null assumed, needs to be set/overwritten otherwise", - "value": null - }, - "provide-default": { - "help": "Provide default NanostackRfpy. [true/false]", - "value": false - } - } -} diff --git a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/NanostackRfPhys2lp.cpp b/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/NanostackRfPhys2lp.cpp deleted file mode 100644 index 4c613404fb..0000000000 --- a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/NanostackRfPhys2lp.cpp +++ /dev/null @@ -1,1479 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && DEVICE_INTERRUPTIN && defined(MBED_CONF_RTOS_PRESENT) - -#include "platform/arm_hal_interrupt.h" -#include "nanostack/platform/arm_hal_phy.h" -#include "ns_types.h" -#include "NanostackRfPhys2lp.h" -#include "s2lpReg.h" -#include "rf_configuration.h" -#include "randLIB.h" -#include "mbed_trace.h" -#include "mbed_toolchain.h" -#include "common_functions.h" -#include -#include "Timeout.h" -#include "Thread.h" -#include "mbed_wait_api.h" -#include "platform/mbed_error.h" -#include "platform/mbed_version.h" - -#if (MBED_VERSION > MBED_ENCODE_VERSION(6, 0, 0)) -/* Mbed OS 6.0 introduces support for chrono time management */ -using namespace std::chrono; -#define S2LP_USE_CHRONO -#define S2LP_TIME_50US 50us -#define S2LP_TIME_10MS 10ms -#else -#define S2LP_TIME_10MS 10 -#endif - -using namespace mbed; -using namespace rtos; - -#define TRACE_GROUP "s2lp" - -#define INTERRUPT_GPIO S2LP_GPIO3 - -#if INTERRUPT_GPIO == S2LP_GPIO0 -#define INT_IN_GPIO rf->RF_S2LP_GPIO0 -#elif INTERRUPT_GPIO == S2LP_GPIO1 -#define INT_IN_GPIO rf->RF_S2LP_GPIO1 -#elif INTERRUPT_GPIO == S2LP_GPIO2 -#define INT_IN_GPIO rf->RF_S2LP_GPIO2 -#else -#define INT_IN_GPIO rf->RF_S2LP_GPIO3 -#endif - -#ifdef TEST_GPIOS_ENABLED -#define TEST_TX_STARTED test_pins->TEST1 = 1; -#define TEST_TX_DONE test_pins->TEST1 = 0; -#define TEST_RX_STARTED test_pins->TEST2 = 1; -#define TEST_RX_DONE test_pins->TEST2 = 0; -#define TEST_CSMA_STARTED test_pins->TEST3 = 1; -#define TEST_CSMA_DONE test_pins->TEST3 = 0; -#define TEST_SPARE_1_ON test_pins->TEST4 = 1; -#define TEST_SPARE_1_OFF test_pins->TEST4 = 0; -#define TEST_SPARE_2_ON test_pins->TEST5 = 1; -#define TEST_SPARE_2_OFF test_pins->TEST5 = 0; -extern void (*fhss_uc_switch)(void); -extern void (*fhss_bc_switch)(void); -#else //TEST_GPIOS_ENABLED -#define TEST_TX_STARTED -#define TEST_TX_DONE -#define TEST_RX_STARTED -#define TEST_RX_DONE -#define TEST_CSMA_STARTED -#define TEST_CSMA_DONE -#define TEST_SPARE_1_ON -#define TEST_SPARE_1_OFF -#define TEST_SPARE_2_ON -#define TEST_SPARE_2_OFF -#endif //TEST_GPIOS_ENABLED - -#define MAC_FRAME_TYPE_MASK 0x07 -#define MAC_FRAME_BEACON (0) -#define MAC_TYPE_DATA (1) -#define MAC_TYPE_ACK (2) -#define MAC_TYPE_COMMAND (3) -#define MAC_DATA_PENDING 0x10 -#define FC_DST_MODE 0x0C -#define FC_SRC_MODE 0xC0 -#define FC_DST_ADDR_NONE 0x00 -#define FC_DST_16_BITS 0x08 -#define FC_DST_64_BITS 0x0C -#define FC_SRC_64_BITS 0xC0 -#define FC_SEQUENCE_COMPRESSION 0x01 -#define FC_AR 0x20 -#define FC_PAN_ID_COMPRESSION 0x40 -#define VERSION_FIELD_MASK 0x30 -#define SHIFT_SEQ_COMP_FIELD (0) -#define SHIFT_VERSION_FIELD (4) -#define SHIFT_PANID_COMP_FIELD (6) -#define OFFSET_DST_PAN_ID (3) -#define OFFSET_DST_ADDR (5) - -#define CS_SELECT() {rf->CS = 0;} -#define CS_RELEASE() {rf->CS = 1;} - -typedef enum { - RF_MODE_NORMAL = 0, - RF_MODE_SNIFFER = 1 -} rf_mode_e; - -class UnlockedSPI : public SPI { -public: - UnlockedSPI(PinName sdi, PinName sdo, PinName sclk) : - SPI(sdi, sdo, sclk) { } - virtual void lock() { } - virtual void unlock() { } -}; - -class RFPins { -public: - RFPins(PinName spi_sdi, PinName spi_sdo, - PinName spi_sclk, PinName spi_cs, PinName spi_sdn, - PinName spi_gpio0, PinName spi_gpio1, PinName spi_gpio2, - PinName spi_gpio3); - UnlockedSPI spi; - DigitalOut CS; - DigitalOut SDN; - InterruptIn RF_S2LP_GPIO0; - InterruptIn RF_S2LP_GPIO1; - InterruptIn RF_S2LP_GPIO2; - InterruptIn RF_S2LP_GPIO3; - Timeout cca_timer; - Timeout backup_timer; - Timer tx_timer; - Thread irq_thread; - Mutex mutex; - void rf_irq_task(); -}; - -RFPins::RFPins(PinName spi_sdi, PinName spi_sdo, - PinName spi_sclk, PinName spi_cs, PinName spi_sdn, - PinName spi_gpio0, PinName spi_gpio1, PinName spi_gpio2, - PinName spi_gpio3) - : spi(spi_sdi, spi_sdo, spi_sclk), - CS(spi_cs), - SDN(spi_sdn), - RF_S2LP_GPIO0(spi_gpio0), - RF_S2LP_GPIO1(spi_gpio1), - RF_S2LP_GPIO2(spi_gpio2), - RF_S2LP_GPIO3(spi_gpio3), - irq_thread(osPriorityRealtime, 1024) -{ - irq_thread.start(mbed::callback(this, &RFPins::rf_irq_task)); -} - -class TestPins_S2LP { -public: - TestPins_S2LP(PinName test_pin_1, PinName test_pin_2, PinName test_pin_3, PinName test_pin_4, PinName test_pin_5); - DigitalOut TEST1; - DigitalOut TEST2; - DigitalOut TEST3; - DigitalOut TEST4; - DigitalOut TEST5; -}; - -TestPins_S2LP::TestPins_S2LP(PinName test_pin_1, PinName test_pin_2, PinName test_pin_3, PinName test_pin_4, PinName test_pin_5) - : TEST1(test_pin_1), - TEST2(test_pin_2), - TEST3(test_pin_3), - TEST4(test_pin_4), - TEST5(test_pin_5) -{ -} - -static uint8_t rf_read_register(uint8_t addr); -static s2lp_states_e rf_read_state(void); -static void rf_write_register(uint8_t addr, uint8_t data); -static void rf_interrupt_handler(void); -static void rf_receive(uint8_t rx_channel); -static void rf_cca_timer_stop(void); -static void rf_backup_timer_start(uint32_t slots); -static void rf_backup_timer_stop(void); -static void rf_rx_ready_handler(void); -static uint32_t read_irq_status(void); -static bool rf_rx_filter(uint8_t *mac_header, uint8_t *mac_64bit_addr, uint8_t *mac_16bit_addr, uint8_t *pan_id); -static void rf_cca_timer_start(uint32_t slots); - -static RFPins *rf; -#ifdef TEST_GPIOS_ENABLED -static TestPins_S2LP *test_pins; -#endif -static phy_device_driver_s device_driver; -static int8_t rf_radio_driver_id = -1; -static uint8_t *tx_data_ptr; -static uint16_t tx_data_length; -static uint16_t rx_data_length; -static uint32_t enabled_interrupts; -static uint8_t mac_tx_handle; -static uint8_t rf_rx_channel; -static uint8_t rf_new_channel; -static uint8_t rx_buffer[RF_MTU]; -static rf_states_e rf_state = RF_IDLE; -// This will be used when given channel spacing cannot be supported by transceiver -static uint8_t rf_channel_multiplier = 1; -static uint16_t tx_sequence = 0xffff; -static uint32_t tx_time = 0; -static uint32_t rx_time = 0; -static uint32_t tx_finnish_time = 0; -static uint32_t rf_symbol_rate; -static bool cca_enabled = true; -static uint8_t s2lp_PAN_ID[2] = {0xff, 0xff}; -static uint8_t s2lp_short_address[2]; -static uint8_t s2lp_MAC[8]; -static rf_mode_e rf_mode = RF_MODE_NORMAL; -static bool rf_update_config = false; -static bool rf_update_cca_threshold = false; -static uint16_t cur_packet_len = 0xffff; -static uint32_t receiver_ready_timestamp; -static int16_t rssi_threshold = RSSI_THRESHOLD; -static uint32_t tx_start_time = 0; - -/* Channel configurations for sub-GHz */ -static phy_rf_channel_configuration_s phy_subghz = { - .channel_0_center_frequency = 868300000U, - .channel_spacing = 500000U, - .datarate = 250000U, - .number_of_channels = 11U, - .modulation = M_2FSK, - .modulation_index = MODULATION_INDEX_UNDEFINED -}; - - -static const phy_device_channel_page_s phy_channel_pages[] = { - { CHANNEL_PAGE_2, &phy_subghz}, - { CHANNEL_PAGE_0, NULL} -}; - - -#include "rtos.h" - -static void rf_irq_task_process_irq(); - -#define SIG_ALL (SIG_RADIO|SIG_TIMER_CCA|SIG_TIMER_BACKUP) -#define SIG_RADIO 1 -#define SIG_TIMER_CCA 2 -#define SIG_TIMER_BACKUP 4 - - -#define ACK_FRAME_LENGTH 3 -// Give some additional time for processing, PHY headers, CRC etc. -#define PACKET_SENDING_EXTRA_TIME 5000 -#define MAX_PACKET_SENDING_TIME (uint32_t)(8000000/phy_subghz.datarate)*FIFO_SIZE + PACKET_SENDING_EXTRA_TIME -#define ACK_SENDING_TIME (uint32_t)(8000000/phy_subghz.datarate)*ACK_FRAME_LENGTH + PACKET_SENDING_EXTRA_TIME - -#ifdef TEST_GPIOS_ENABLED -static void test1_toggle(void) -{ - if (test_pins->TEST4) { - test_pins->TEST4 = 0; - } else { - test_pins->TEST4 = 1; - } -} -static void test2_toggle(void) -{ - if (test_pins->TEST5) { - test_pins->TEST5 = 0; - } else { - test_pins->TEST5 = 1; - } -} -#endif //TEST_GPIOS_ENABLED - -static void rf_calculate_symbol_rate(uint32_t baudrate, phy_modulation_e modulation) -{ - (void) modulation; - uint8_t bits_in_symbols = 1; - rf_symbol_rate = baudrate / bits_in_symbols; -} - -static uint32_t rf_get_timestamp(void) -{ -#ifdef S2LP_USE_CHRONO - return (uint32_t)rf->tx_timer.elapsed_time().count(); -#else - return (uint32_t)rf->tx_timer.read_us(); -#endif -} - -static void rf_update_tx_active_time(void) -{ - if (device_driver.phy_rf_statistics) { - device_driver.phy_rf_statistics->tx_active_time += rf_get_timestamp() - tx_start_time; - } -} - -static void rf_update_rx_active_time(void) -{ - if (device_driver.phy_rf_statistics) { - device_driver.phy_rf_statistics->rx_active_time += rf_get_timestamp() - rx_time; - } -} - -static void rf_lock(void) -{ - platform_enter_critical(); -} - -static void rf_unlock(void) -{ - platform_exit_critical(); -} - -static void rf_cca_timer_signal(void) -{ - rf->irq_thread.flags_set(SIG_TIMER_CCA); -} - -static void rf_backup_timer_signal(void) -{ - rf->irq_thread.flags_set(SIG_TIMER_BACKUP); -} - -/* - * \brief Function writes/read data in SPI interface - */ -static void rf_spi_exchange(const void *tx, size_t tx_len, void *rx, size_t rx_len) -{ - rf->spi.write(static_cast(tx), tx_len, static_cast(rx), rx_len); -} - -static uint8_t rf_read_register(uint8_t addr) -{ - const uint8_t tx[2] = {SPI_RD_REG, addr}; - uint8_t rx[3]; - rf_lock(); - CS_SELECT(); - rf_spi_exchange(tx, sizeof(tx), rx, sizeof(rx)); - CS_RELEASE(); - rf_unlock(); - return rx[2]; -} - -static void rf_write_register(uint8_t addr, uint8_t data) -{ - const uint8_t tx[3] = {SPI_WR_REG, addr, data}; - rf_lock(); - CS_SELECT(); - rf_spi_exchange(tx, sizeof(tx), NULL, 0); - CS_RELEASE(); - rf_unlock(); -} - -static void rf_write_register_field(uint8_t addr, uint8_t field, uint8_t value) -{ - uint8_t reg_tmp = rf_read_register(addr); - reg_tmp &= ~field; - reg_tmp |= value; - rf_write_register(addr, reg_tmp); -} - -static s2lp_states_e rf_read_state(void) -{ - return (s2lp_states_e)(rf_read_register(MC_STATE0) >> 1); -} - -static void rf_poll_state_change(s2lp_states_e state) -{ - uint16_t break_counter = 0; - while (state != rf_read_state()) { - if (break_counter++ == 0xffff) { - tr_err("Failed to change state from %x to: %x", rf_read_state(), state); - break; - } - } -} - -static void rf_enable_gpio_signal(uint8_t gpio_pin, uint8_t interrupt_signal, uint8_t gpio_mode) -{ - rf_write_register(GPIO0_CONF + gpio_pin, (interrupt_signal << 3) | gpio_mode); -} - -static void rf_enable_interrupt(uint8_t event) -{ - if (enabled_interrupts & (1 << event)) { - return; - } - rf_write_register_field(IRQ_MASK0 - (event / 8), 1 << (event % 8), 1 << (event % 8)); - enabled_interrupts |= (1 << event); -} - -static void rf_disable_interrupt(uint8_t event) -{ - if (!(enabled_interrupts & (1 << event))) { - return; - } - rf_write_register_field(IRQ_MASK0 - (event / 8), 1 << (event % 8), 0 << (event % 8)); - enabled_interrupts &= ~(1 << event); -} - -static void rf_disable_all_interrupts(void) -{ - if ((uint8_t)enabled_interrupts & 0xff) { - rf_write_register(IRQ_MASK0, 0); - } - if ((uint8_t)(enabled_interrupts >> 8) & 0xff) { - rf_write_register(IRQ_MASK1, 0); - } - if ((uint8_t)(enabled_interrupts >> 16) & 0xff) { - rf_write_register(IRQ_MASK2, 0); - } - if ((uint8_t)(enabled_interrupts >> 24) & 0xff) { - rf_write_register(IRQ_MASK3, 0); - } - enabled_interrupts = 0; - read_irq_status(); -} - -static void rf_enable_gpio_interrupt(void) -{ - rf_enable_gpio_signal(INTERRUPT_GPIO, NIRQ, DIG_OUT_HIGH); - INT_IN_GPIO.mode(PullUp); - INT_IN_GPIO.fall(&rf_interrupt_handler); - INT_IN_GPIO.enable_irq(); -} - -static void rf_send_command(s2lp_commands_e command) -{ - const uint8_t tx[2] = {SPI_CMD, command}; - rf_lock(); - CS_SELECT(); - rf_spi_exchange(tx, sizeof(tx), NULL, 0); - CS_RELEASE(); - rf_unlock(); -} - -static void rf_state_change(s2lp_states_e state, bool lock_mode_tx) -{ - s2lp_commands_e command; - - if (S2LP_STATE_READY == state) { - s2lp_states_e cur_state = rf_read_state(); - if (S2LP_STATE_TX == cur_state || S2LP_STATE_RX == cur_state) { - command = S2LP_CMD_SABORT; - } else { - command = S2LP_CMD_READY; - } - } else if (S2LP_STATE_LOCK == state && lock_mode_tx) { - command = S2LP_CMD_LOCKTX; - } else if (S2LP_STATE_LOCK == state && !lock_mode_tx) { - command = S2LP_CMD_LOCKRX; - } else if (S2LP_STATE_RX == state) { - command = S2LP_CMD_RX; - } else if (S2LP_STATE_TX == state) { - command = S2LP_CMD_TX; - } else { - tr_err("Invalid state %x", state); - return; - } - rf_send_command(command); - rf_poll_state_change(state); -} - -static uint8_t rf_write_tx_fifo(uint8_t *ptr, uint16_t length) -{ - uint8_t free_bytes_in_fifo = FIFO_SIZE - rf_read_register(TX_FIFO_STATUS); - const uint8_t spi_header[SPI_HEADER_LENGTH] = {SPI_WR_REG, TX_FIFO}; - uint8_t written_length = length; - if (length > free_bytes_in_fifo) { - written_length = free_bytes_in_fifo; - } - CS_SELECT(); - rf_spi_exchange(spi_header, SPI_HEADER_LENGTH, NULL, 0); - rf_spi_exchange(ptr, written_length, NULL, 0); - CS_RELEASE(); - return written_length; -} - -static int rf_read_rx_fifo(uint16_t rx_index, uint16_t length) -{ - if ((rx_index + length) > RF_MTU) { - return -1; - } - uint8_t *ptr = &rx_buffer[rx_index]; - const uint8_t spi_header[SPI_HEADER_LENGTH] = {SPI_RD_REG, RX_FIFO}; - CS_SELECT(); - rf_spi_exchange(spi_header, SPI_HEADER_LENGTH, NULL, 0); - rf_spi_exchange(NULL, 0, ptr, length); - CS_RELEASE(); - return length; -} - -static void rf_flush_tx_fifo(void) -{ - if (rf_read_register(TX_FIFO_STATUS)) { - rf_send_command(S2LP_CMD_FLUSHTXFIFO); - } -} - -static void rf_flush_rx_fifo(void) -{ - if (rf_read_register(RX_FIFO_STATUS)) { - rf_send_command(S2LP_CMD_FLUSHRXFIFO); - } -} - -static void rf_write_packet_length(uint16_t packet_length) -{ - if ((uint8_t)(cur_packet_len >> 8) != (packet_length / 256)) { - rf_write_register(PCKTLEN1, packet_length / 256); - } - if ((uint8_t)cur_packet_len != (packet_length % 256)) { - rf_write_register(PCKTLEN0, packet_length % 256); - } - cur_packet_len = packet_length; -} - -static uint32_t read_irq_status(void) -{ - const uint8_t tx[2] = {SPI_RD_REG, IRQ_STATUS3}; - uint8_t rx[6]; - CS_SELECT(); - rf_spi_exchange(tx, sizeof(tx), rx, sizeof(rx)); - CS_RELEASE(); - return (((uint32_t)rx[2] << 24) | ((uint32_t)rx[3] << 16) | ((uint32_t)rx[4] << 8) | rx[5]); -} - -static void rf_set_channel_configuration_registers(void) -{ - // Set RSSI threshold - uint8_t rssi_th; - rf_conf_calculate_rssi_threshold_registers(rssi_threshold, &rssi_th); - rf_write_register(RSSI_TH, rssi_th); - // Set deviation - uint32_t deviation = rf_conf_calculate_deviation(phy_subghz.modulation_index, phy_subghz.datarate); - if (!deviation) { - deviation = DEFAULT_DEVIATION; - } - uint8_t fdev_m, fdev_e; - rf_conf_calculate_deviation_registers(deviation, &fdev_m, &fdev_e); - rf_write_register(MOD0, fdev_m); - rf_write_register_field(MOD1, FDEV_E_FIELD, fdev_e); - - // Set datarate - uint16_t datarate_m; - uint8_t datarate_e; - rf_conf_calculate_datarate_registers(phy_subghz.datarate, &datarate_m, &datarate_e); - rf_write_register_field(MOD2, DATARATE_E_FIELD, datarate_e); - rf_write_register(MOD3, (uint8_t)datarate_m); - rf_write_register(MOD4, datarate_m >> 8); - // Set RX filter bandwidth, using channel spacing as RX filter bandwidth - uint8_t chflt_m, chflt_e; - rf_conf_calculate_rx_filter_bandwidth_registers(phy_subghz.channel_spacing, &chflt_m, &chflt_e); - rf_write_register_field(CHFLT, CHFLT_M_FIELD, chflt_m << 4); - rf_write_register_field(CHFLT, CHFLT_E_FIELD, chflt_e); - // Set base frequency (Channel 0 center frequency) - uint8_t synt3, synt2, synt1, synt0; - rf_conf_calculate_base_frequency_registers(phy_subghz.channel_0_center_frequency, &synt3, &synt2, &synt1, &synt0); - rf_write_register_field(SYNT3, SYNT_FIELD, synt3); - rf_write_register(SYNT2, synt2); - rf_write_register(SYNT1, synt1); - rf_write_register(SYNT0, synt0); - // Set channel spacing - uint8_t ch_space; - uint8_t ch_space_divider = 1; - while (rf_conf_calculate_channel_spacing_registers(phy_subghz.channel_spacing / ch_space_divider, &ch_space)) { - ch_space_divider++; - rf_channel_multiplier++; - } - rf_write_register(CHSPACE, ch_space); - /* Preamble is set for S2-LP as repetitions of 01 or 10 pair - * - * For datarate < 150kbps, using phyFskPreambleLength = 8 repetitions of 01010101 - * For datarate >= 150kbps and datarate < 300kbps, using phyFskPreambleLength = 12 repetitions of 01010101 - * For datarate >= 300kbps, using phyFskPreambleLength = 24 repetitions of 01010101 - */ - uint8_t preamble_len = 24 * 4; - if (phy_subghz.datarate < 150000) { - preamble_len = 8 * 4; - } else if (phy_subghz.datarate < 300000) { - preamble_len = 12 * 4; - } - rf_write_register(PCKTCTRL5, preamble_len); -} - -static void rf_init_registers(void) -{ - rf_write_register_field(PCKTCTRL3, PCKT_FORMAT_FIELD, PCKT_FORMAT_802_15_4); - rf_write_register_field(MOD2, MOD_TYPE_FIELD, MOD_2FSK); - rf_write_register(PCKT_FLT_OPTIONS, 0); - rf_write_register_field(PCKTCTRL1, PCKT_CRCMODE_FIELD, PCKT_CRCMODE_0x04C11DB7); - rf_write_register_field(PCKTCTRL1, PCKT_TXSOURCE_FIELD, PCKT_TXSOURCE_NORMAL); - rf_write_register_field(PCKTCTRL1, PCKT_WHITENING_FIELD, PCKT_WHITENING_ENABLED); - rf_write_register_field(PCKTCTRL2, PCKT_FIXVARLEN_FIELD, PCKT_VARIABLE_LEN); - rf_write_register_field(PCKTCTRL2, PCKT_FCS_TYPE_FIELD, PCKT_FCS_TYPE_4_OCTET); - rf_write_register_field(PCKTCTRL3, PCKT_RXMODE_FIELD, PCKT_RXMODE_NORMAL); - rf_write_register_field(PCKTCTRL3, PCKT_BYTE_SWAP_FIELD, PCKT_BYTE_SWAP_LSB); - rf_write_register_field(PCKTCTRL6, PCKT_SYNCLEN_FIELD, PCKT_SYNCLEN); - rf_write_register_field(QI, PQI_TH_FIELD, PQI_TH); - rf_write_register_field(QI, SQI_EN_FIELD, SQI_EN); - rf_write_register(SYNC0, SFD0); - rf_write_register(SYNC1, SFD1); - rf_set_channel_configuration_registers(); -} - -static int8_t rf_address_write(phy_address_type_e address_type, uint8_t *address_ptr) -{ - int8_t ret_val = 0; - switch (address_type) { - /*Set 48-bit address*/ - case PHY_MAC_48BIT: - break; - /*Set 64-bit address*/ - case PHY_MAC_64BIT: - memcpy(s2lp_MAC, address_ptr, 8); - break; - /*Set 16-bit address*/ - case PHY_MAC_16BIT: - memcpy(s2lp_short_address, address_ptr, 2); - break; - /*Set PAN Id*/ - case PHY_MAC_PANID: - memcpy(s2lp_PAN_ID, address_ptr, 2); - break; - } - return ret_val; -} - -static int8_t rf_extension(phy_extension_type_e extension_type, uint8_t *data_ptr) -{ - int8_t retval = 0; - phy_csma_params_t *csma_params; - phy_rf_channel_configuration_s *channel_params; - uint32_t *timer_value; - switch (extension_type) { - case PHY_EXTENSION_SET_CHANNEL: - if (rf_state == RF_IDLE || rf_state == RF_CSMA_STARTED) { - rf_receive(*data_ptr); - } else { - // Store the new channel if couldn't change it yet. - rf_new_channel = *data_ptr; - retval = -1; - } - break; - case PHY_EXTENSION_CTRL_PENDING_BIT: - break; - /*Return frame pending status*/ - case PHY_EXTENSION_READ_LAST_ACK_PENDING_STATUS: - break; - case PHY_EXTENSION_ACCEPT_ANY_BEACON: - break; - case PHY_EXTENSION_SET_TX_TIME: - tx_time = common_read_32_bit(data_ptr); - break; - case PHY_EXTENSION_READ_RX_TIME: - common_write_32_bit(rx_time, data_ptr); - break; - case PHY_EXTENSION_DYNAMIC_RF_SUPPORTED: - *data_ptr = true; - break; - case PHY_EXTENSION_GET_TIMESTAMP: - timer_value = (uint32_t *)data_ptr; - *timer_value = rf_get_timestamp(); - break; - case PHY_EXTENSION_SET_CSMA_PARAMETERS: - csma_params = (phy_csma_params_t *)data_ptr; - if (csma_params->backoff_time == 0) { - rf_cca_timer_stop(); - if (rf_read_register(TX_FIFO_STATUS)) { - rf_send_command(S2LP_CMD_SABORT); - rf_poll_state_change(S2LP_STATE_READY); - rf_send_command(S2LP_CMD_FLUSHTXFIFO); - rf_poll_state_change(S2LP_STATE_READY); - } - if (rf_state == RF_TX_STARTED) { - rf_state = RF_IDLE; - rf_receive(rf_rx_channel); - } - tx_time = 0; - } else { - tx_time = csma_params->backoff_time; - cca_enabled = csma_params->cca_enabled; - } - break; - case PHY_EXTENSION_READ_TX_FINNISH_TIME: - timer_value = (uint32_t *)data_ptr; - *timer_value = tx_finnish_time; - break; - - case PHY_EXTENSION_GET_SYMBOLS_PER_SECOND: - timer_value = (uint32_t *)data_ptr; - *timer_value = rf_symbol_rate; - break; - case PHY_EXTENSION_SET_RF_CONFIGURATION: - channel_params = (phy_rf_channel_configuration_s *)data_ptr; - phy_subghz.datarate = channel_params->datarate; - phy_subghz.channel_spacing = channel_params->channel_spacing; - phy_subghz.channel_0_center_frequency = channel_params->channel_0_center_frequency; - phy_subghz.number_of_channels = channel_params->number_of_channels; - phy_subghz.modulation = channel_params->modulation; - phy_subghz.modulation_index = channel_params->modulation_index; - rf_calculate_symbol_rate(phy_subghz.datarate, phy_subghz.modulation); - rf_update_config = true; - if (rf_state == RF_IDLE) { - rf_receive(rf_rx_channel); - } - break; - case PHY_EXTENSION_SET_TX_POWER: - // TODO: Set TX output power - break; - case PHY_EXTENSION_SET_CCA_THRESHOLD: - rssi_threshold = rf_conf_cca_threshold_percent_to_rssi(*data_ptr); - rf_update_config = true; - if (rf_state == RF_IDLE) { - rf_receive(rf_rx_channel); - } - break; - case PHY_EXTENSION_SET_CHANNEL_CCA_THRESHOLD: - if ((rssi_threshold != (int8_t)*data_ptr) && (rf_state != RF_RX_STARTED)) { - rssi_threshold = (int8_t)*data_ptr; // *NOPAD* - rf_update_cca_threshold = true; - rf_receive(rf_rx_channel); - } - break; - default: - break; - } - - return retval; -} - - -static int8_t rf_interface_state_control(phy_interface_state_e new_state, uint8_t rf_channel) -{ - int8_t ret_val = 0; - switch (new_state) { - /*Reset PHY driver and set to idle*/ - case PHY_INTERFACE_RESET: - break; - /*Disable PHY Interface driver*/ - case PHY_INTERFACE_DOWN: - rf_lock(); - rf_send_command(S2LP_CMD_SABORT); - rf_disable_all_interrupts(); - rf_poll_state_change(S2LP_STATE_READY); - rf_flush_rx_fifo(); - rf_flush_tx_fifo(); - rf_state = RF_IDLE; - rf_unlock(); - break; - /*Enable PHY Interface driver*/ - case PHY_INTERFACE_UP: - rf_mode = RF_MODE_NORMAL; - rf_receive(rf_channel); - break; - /*Enable wireless interface ED scan mode*/ - case PHY_INTERFACE_RX_ENERGY_STATE: - break; - /*Enable Sniffer state*/ - case PHY_INTERFACE_SNIFFER_STATE: - rf_mode = RF_MODE_SNIFFER; - rf_receive(rf_channel); - break; - } - return ret_val; -} - -static void rf_tx_sent_handler(void) -{ - TEST_TX_DONE - rf_backup_timer_stop(); - rf_disable_interrupt(TX_DATA_SENT); - rf_update_tx_active_time(); - if (rf_state != RF_TX_ACK) { - tx_finnish_time = rf_get_timestamp(); - rf_state = RF_IDLE; - rf_receive(rf_rx_channel); - if (device_driver.phy_tx_done_cb) { - device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_TX_SUCCESS, 0, 0); - } - } else { - rf_receive(rf_rx_channel); - } -} - -static void rf_tx_threshold_handler(void) -{ - rf_backup_timer_stop(); - rf_disable_interrupt(TX_FIFO_ALMOST_EMPTY); - // TODO check the FIFO threshold. By default, threshold is half of the FIFO size - uint8_t written_length = rf_write_tx_fifo(tx_data_ptr, tx_data_length); - if (written_length < tx_data_length) { - tx_data_ptr += written_length; - tx_data_length -= written_length; - rf_enable_interrupt(TX_FIFO_ALMOST_EMPTY); - } - rf_backup_timer_start(MAX_PACKET_SENDING_TIME); -} - -static void rf_start_tx(void) -{ - rf_send_command(S2LP_CMD_SABORT); - rf_disable_all_interrupts(); - rf_poll_state_change(S2LP_STATE_READY); - rf_state_change(S2LP_STATE_TX, false); - tx_start_time = rf_get_timestamp(); - // More TX data to be written in FIFO when TX threshold interrupt occurs - if (tx_data_ptr) { - rf_enable_interrupt(TX_FIFO_ALMOST_EMPTY); - } - rf_enable_interrupt(TX_DATA_SENT); - rf_enable_interrupt(TX_FIFO_UNF_OVF); - rf_backup_timer_start(MAX_PACKET_SENDING_TIME); -} - -static int rf_cca_check(void) -{ - uint32_t time_from_receiver_ready = rf_get_timestamp() - receiver_ready_timestamp; - if (time_from_receiver_ready < RSSI_SETTLING_TIME) { - wait_us(RSSI_SETTLING_TIME - time_from_receiver_ready); - } - return (rf_read_register(LINK_QUALIF1) & CARRIER_SENSE); -} - -static void rf_cca_timer_interrupt(void) -{ - TEST_CSMA_DONE - int8_t status = device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_CCA_PREPARE, 0, 0); - if (status == PHY_TX_NOT_ALLOWED) { - rf_flush_tx_fifo(); - if (rf_state == RF_CSMA_STARTED) { - rf_state = RF_IDLE; - } - return; - } - if ((cca_enabled == true) && ((rf_state != RF_CSMA_STARTED && rf_state != RF_IDLE) || (read_irq_status() & (1 << SYNC_WORD)) || rf_cca_check())) { - if (rf_state == RF_CSMA_STARTED) { - rf_state = RF_IDLE; - } - rf_flush_tx_fifo(); - tx_finnish_time = rf_get_timestamp(); - if (device_driver.phy_tx_done_cb) { - if (rf_state == RF_RX_STARTED) { - device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_CCA_FAIL_RX, 0, 0); - } else { - device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_CCA_FAIL, 0, 0); - } - } - } else { - if (status == PHY_RESTART_CSMA) { - if (device_driver.phy_tx_done_cb) { - device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_CCA_OK, 0, 0); - } - if (tx_time) { - uint32_t backoff_time = tx_time - rf_get_timestamp(); - // Max. time to TX can be 65ms, otherwise time has passed already -> send immediately - if (backoff_time > 65000) { - backoff_time = 1; - } - rf_cca_timer_start(backoff_time); - } - } else { - rf_start_tx(); - rf_state = RF_TX_STARTED; - TEST_TX_STARTED - if (device_driver.phy_rf_statistics) { - device_driver.phy_rf_statistics->tx_bytes += tx_data_length; - } - } - } -} - -static void rf_cca_timer_stop(void) -{ - TEST_CSMA_DONE - rf->cca_timer.detach(); -} - -static void rf_cca_timer_start(uint32_t slots) -{ -#ifdef S2LP_USE_CHRONO - rf->cca_timer.attach(rf_cca_timer_signal, microseconds(slots)); -#else - rf->cca_timer.attach_us(rf_cca_timer_signal, slots); -#endif - TEST_CSMA_STARTED -} - -static void rf_backup_timer_interrupt(void) -{ - tx_finnish_time = rf_get_timestamp(); - if (rf_state == RF_RX_STARTED) { - rf_update_rx_active_time(); - if (device_driver.phy_rf_statistics) { - device_driver.phy_rf_statistics->rx_timeouts++; - } - } else { - rf_update_tx_active_time(); - if (device_driver.phy_rf_statistics) { - device_driver.phy_rf_statistics->tx_timeouts++; - } - } - if (rf_state == RF_TX_STARTED) { - if (device_driver.phy_tx_done_cb) { - device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_TX_SUCCESS, 0, 0); - } - } - rf_flush_tx_fifo(); - TEST_TX_DONE - TEST_RX_DONE - rf_state = RF_IDLE; - rf_receive(rf_rx_channel); -} - -static void rf_backup_timer_stop(void) -{ - rf->backup_timer.detach(); -} - -static void rf_backup_timer_start(uint32_t slots) -{ -#ifdef S2LP_USE_CHRONO - rf->backup_timer.attach(rf_backup_timer_signal, microseconds(slots)); -#else - rf->backup_timer.attach_us(rf_backup_timer_signal, slots); -#endif -} - -static int8_t rf_start_cca(uint8_t *data_ptr, uint16_t data_length, uint8_t tx_handle, data_protocol_e data_protocol) -{ - rf_lock(); - if (rf_state != RF_IDLE) { - rf_unlock(); - return -1; - } - rf_state = RF_CSMA_STARTED; - uint8_t written_length = rf_write_tx_fifo(data_ptr, data_length); - if (written_length < data_length) { - tx_data_ptr = data_ptr + written_length; - tx_data_length = data_length - written_length; - } else { - tx_data_ptr = NULL; - } - // If Ack is requested, store the MAC sequence. This will be compared with received Ack. - uint8_t version = ((*(data_ptr + 1) & VERSION_FIELD_MASK) >> SHIFT_VERSION_FIELD); - if ((version != MAC_FRAME_VERSION_2) && (*data_ptr & FC_AR)) { - tx_sequence = *(data_ptr + 2); - } - // TODO: Define this better - rf_write_packet_length(data_length + 4); - mac_tx_handle = tx_handle; - if (tx_time) { - uint32_t backoff_time = tx_time - rf_get_timestamp(); - // Max. time to TX can be 65ms, otherwise time has passed already -> send immediately - if (backoff_time <= 65000) { - rf_cca_timer_start(backoff_time); - rf_unlock(); - return 0; - } - } - // Short timeout to start CCA immediately. - rf_cca_timer_start(1); - rf_unlock(); - return 0; -} - -static void rf_send_ack(uint8_t seq) -{ - rf_state = RF_TX_ACK; - uint8_t ack_frame[3] = {MAC_TYPE_ACK, 0, seq}; - rf_write_tx_fifo(ack_frame, sizeof(ack_frame)); - rf_write_packet_length(sizeof(ack_frame) + 4); - tx_data_ptr = NULL; - rf_start_tx(); - TEST_TX_STARTED - rf_backup_timer_start(ACK_SENDING_TIME); - if (device_driver.phy_rf_statistics) { - device_driver.phy_rf_statistics->tx_bytes += sizeof(ack_frame); - } -} - -static void rf_handle_ack(uint8_t seq_number, uint8_t pending) -{ - phy_link_tx_status_e phy_status; - if (tx_sequence == (uint16_t)seq_number) { - tx_finnish_time = rf_get_timestamp(); - if (pending) { - phy_status = PHY_LINK_TX_DONE_PENDING; - } else { - phy_status = PHY_LINK_TX_DONE; - } - // No CCA attempts done, just waited Ack - device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, phy_status, 0, 0); - // Clear TX sequence when Ack is received to avoid duplicate Acks - tx_sequence = 0xffff; - } -} - -static void rf_rx_ready_handler(void) -{ - rf_backup_timer_stop(); - TEST_RX_DONE - rf_flush_tx_fifo(); - int rx_read_length = rf_read_rx_fifo(rx_data_length, rf_read_register(RX_FIFO_STATUS)); - if (rx_read_length < 0) { - rf_receive(rf_rx_channel); - return; - } - rx_data_length += rx_read_length; - if (rf_mode != RF_MODE_SNIFFER) { - rf_state = RF_IDLE; - uint8_t version = ((rx_buffer[1] & VERSION_FIELD_MASK) >> SHIFT_VERSION_FIELD); - if (((rx_buffer[0] & MAC_FRAME_TYPE_MASK) == MAC_TYPE_ACK) && (version < MAC_FRAME_VERSION_2)) { - rf_handle_ack(rx_buffer[2], rx_buffer[0] & MAC_DATA_PENDING); - } else if (rf_rx_filter(rx_buffer, s2lp_MAC, s2lp_short_address, s2lp_PAN_ID)) { - int8_t rssi = (rf_read_register(RSSI_LEVEL) - RSSI_OFFSET); - if (device_driver.phy_rx_cb) { - device_driver.phy_rx_cb(rx_buffer, rx_data_length, 0xf0, rssi, rf_radio_driver_id); - } - // Check Ack request - if ((version != MAC_FRAME_VERSION_2) && (rx_buffer[0] & FC_AR)) { - rf_send_ack(rx_buffer[2]); - } - } - if (device_driver.phy_rf_statistics) { - device_driver.phy_rf_statistics->rx_bytes += rx_data_length; - } - } else { - rf_state = RF_IDLE; - int8_t rssi = (rf_read_register(RSSI_LEVEL) - RSSI_OFFSET); - if (device_driver.phy_rx_cb) { - device_driver.phy_rx_cb(rx_buffer, rx_data_length, 0xf0, rssi, rf_radio_driver_id); - } - } - if ((rf_state != RF_TX_ACK) && (rf_state != RF_CSMA_STARTED)) { - rf_receive(rf_rx_channel); - } -} - -static void rf_rx_threshold_handler(void) -{ - rf_backup_timer_stop(); - int rx_read_length = rf_read_rx_fifo(rx_data_length, rf_read_register(RX_FIFO_STATUS)); - if (rx_read_length < 0) { - rf_receive(rf_rx_channel); - return; - } - rx_data_length += rx_read_length; - rf_backup_timer_start(MAX_PACKET_SENDING_TIME); -} - -static void rf_sync_detected_handler(void) -{ - rx_time = rf_get_timestamp(); - rf_state = RF_RX_STARTED; - TEST_RX_STARTED - rf_disable_interrupt(SYNC_WORD); - rf_enable_interrupt(RX_FIFO_ALMOST_FULL); - rf_enable_interrupt(RX_DATA_READY); - rf_backup_timer_start(MAX_PACKET_SENDING_TIME); -} - -static void rf_receive(uint8_t rx_channel) -{ - if (rf_state == RF_TX_STARTED) { - return; - } - rf_lock(); - rf_send_command(S2LP_CMD_SABORT); - rf_disable_all_interrupts(); - rf_poll_state_change(S2LP_STATE_READY); - rf_flush_rx_fifo(); - if (rf_update_config == true) { - rf_channel_multiplier = 1; - rf_update_config = false; - rf_set_channel_configuration_registers(); - } - if (rf_update_cca_threshold == true) { - rf_update_cca_threshold = false; - uint8_t rssi_th; - rf_conf_calculate_rssi_threshold_registers(rssi_threshold, &rssi_th); - rf_write_register(RSSI_TH, rssi_th); - } - if (rx_channel != rf_rx_channel) { - rf_write_register(CHNUM, rx_channel * rf_channel_multiplier); - rf_rx_channel = rf_new_channel = rx_channel; - } - rf_send_command(S2LP_CMD_RX); - rf_enable_interrupt(SYNC_WORD); - rf_enable_interrupt(RX_FIFO_UNF_OVF); - rx_data_length = 0; - if (rf_state != RF_CSMA_STARTED) { - rf_state = RF_IDLE; - } - rf_poll_state_change(S2LP_STATE_RX); - receiver_ready_timestamp = rf_get_timestamp(); - rf_unlock(); -} - -static void rf_interrupt_handler(void) -{ - rf->irq_thread.flags_set(SIG_RADIO); -} - -void RFPins::rf_irq_task(void) -{ - for (;;) { - uint32_t flags = ThisThread::flags_wait_any(SIG_ALL); - rf_lock(); - if (flags & SIG_RADIO) { - rf_irq_task_process_irq(); - } - if (flags & SIG_TIMER_CCA) { - rf_cca_timer_interrupt(); - } - if (flags & SIG_TIMER_BACKUP) { - rf_backup_timer_interrupt(); - } - rf_unlock(); - } -} - -static void rf_irq_task_process_irq(void) -{ - rf_lock(); - uint32_t irq_status = read_irq_status(); - if (rf_state == RF_TX_STARTED || rf_state == RF_TX_ACK) { - if ((irq_status & (1 << TX_DATA_SENT)) && (enabled_interrupts & (1 << TX_DATA_SENT))) { - rf_tx_sent_handler(); - } - } - if (rf_state == RF_TX_STARTED) { - if ((irq_status & (1 << TX_FIFO_ALMOST_EMPTY)) && (enabled_interrupts & (1 << TX_FIFO_ALMOST_EMPTY))) { - rf_tx_threshold_handler(); - } - } - if ((irq_status & (1 << TX_FIFO_UNF_OVF)) && (enabled_interrupts & (1 << TX_FIFO_UNF_OVF))) { - rf_backup_timer_stop(); - tx_finnish_time = rf_get_timestamp(); - rf_update_tx_active_time(); - TEST_TX_DONE - device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_CCA_FAIL_RX, 1, 0); - rf_send_command(S2LP_CMD_SABORT); - rf_poll_state_change(S2LP_STATE_READY); - rf_send_command(S2LP_CMD_FLUSHTXFIFO); - rf_poll_state_change(S2LP_STATE_READY); - rf_state = RF_IDLE; - rf_receive(rf_rx_channel); - } - if (rf_state == RF_IDLE || rf_state == RF_CSMA_STARTED || rf_state == RF_TX_STARTED) { - if ((irq_status & (1 << SYNC_WORD)) && (enabled_interrupts & (1 << SYNC_WORD))) { - rf_sync_detected_handler(); - } - } else if (rf_state == RF_RX_STARTED) { - if ((irq_status & (1 << RX_DATA_READY)) && (enabled_interrupts & (1 << RX_DATA_READY))) { - rf_update_rx_active_time(); - if (!(irq_status & (1 << CRC_ERROR))) { - rf_rx_ready_handler(); - } else { - TEST_RX_DONE - rf_backup_timer_stop(); - rf_flush_tx_fifo(); - rf_state = RF_IDLE; - // In case the channel change was called during reception, driver is responsible to change the channel if CRC failed. - rf_receive(rf_new_channel); - if (device_driver.phy_rf_statistics) { - device_driver.phy_rf_statistics->crc_fails++; - } - } - } - if ((irq_status & (1 << RX_FIFO_ALMOST_FULL)) && (enabled_interrupts & (1 << RX_FIFO_ALMOST_FULL))) { - rf_rx_threshold_handler(); - } - if ((irq_status & (1 << RX_DATA_DISCARDED)) && (enabled_interrupts & (1 << RX_DATA_DISCARDED))) { - - } - if ((irq_status & (1 << CRC_ERROR)) && (enabled_interrupts & (1 << CRC_ERROR))) { - - } - } - if ((irq_status & (1 << RX_FIFO_UNF_OVF)) && (enabled_interrupts & (1 << RX_FIFO_UNF_OVF))) { - rf_update_rx_active_time(); - TEST_RX_DONE - rf_backup_timer_stop(); - rf_send_command(S2LP_CMD_SABORT); - rf_poll_state_change(S2LP_STATE_READY); - rf_send_command(S2LP_CMD_FLUSHRXFIFO); - rf_poll_state_change(S2LP_STATE_READY); - rf_flush_tx_fifo(); - rf_state = RF_IDLE; - rf_receive(rf_rx_channel); - } - rf_unlock(); -} - -static void rf_reset(void) -{ - // Shutdown - rf->SDN = 1; - ThisThread::sleep_for(S2LP_TIME_10MS); - // Wake up - rf->SDN = 0; - ThisThread::sleep_for(S2LP_TIME_10MS); -} - -static void rf_init(void) -{ -#ifdef TEST_GPIOS_ENABLED - fhss_bc_switch = test1_toggle; - fhss_uc_switch = test2_toggle; -#endif //TEST_GPIOS_ENABLED - rf_reset(); - rf->spi.frequency(10000000); - CS_RELEASE(); - rf_init_registers(); - rf_enable_gpio_interrupt(); - rf_calculate_symbol_rate(phy_subghz.datarate, phy_subghz.modulation); - rf->tx_timer.start(); -} - -static int8_t rf_device_register(const uint8_t *mac_addr) -{ - rf_init(); - /*Set pointer to MAC address*/ - device_driver.PHY_MAC = (uint8_t *)mac_addr; - device_driver.driver_description = (char *)"S2LP_MAC"; - device_driver.link_type = PHY_LINK_15_4_SUBGHZ_TYPE; - device_driver.phy_channel_pages = phy_channel_pages; - device_driver.phy_MTU = RF_MTU; - /*No header in PHY*/ - device_driver.phy_header_length = 0; - /*No tail in PHY*/ - device_driver.phy_tail_length = 0; - /*Set address write function*/ - device_driver.address_write = &rf_address_write; - /*Set RF extension function*/ - device_driver.extension = &rf_extension; - /*Set RF state control function*/ - device_driver.state_control = &rf_interface_state_control; - /*Set transmit function*/ - device_driver.tx = &rf_start_cca; - /*NULLIFY rx and tx_done callbacks*/ - device_driver.phy_rx_cb = NULL; - device_driver.phy_tx_done_cb = NULL; - /*Register device driver*/ - rf_radio_driver_id = arm_net_phy_register(&device_driver); - return rf_radio_driver_id; -} - -static void rf_device_unregister() -{ - if (rf_radio_driver_id >= 0) { - arm_net_phy_unregister(rf_radio_driver_id); - rf_radio_driver_id = -1; - } -} - -void NanostackRfPhys2lp::get_mac_address(uint8_t *mac) -{ - rf_lock(); - - if (NULL == rf) { - error("NanostackRfPhys2lp Must be registered to read mac address"); - rf_unlock(); - return; - } - memcpy((void *)mac, (void *)_mac_addr, sizeof(_mac_addr)); - - rf_unlock(); -} - -void NanostackRfPhys2lp::set_mac_address(uint8_t *mac) -{ - rf_lock(); - - if (NULL != rf) { - error("NanostackRfPhys2lp cannot change mac address when running"); - rf_unlock(); - return; - } - memcpy((void *)_mac_addr, (void *)mac, sizeof(_mac_addr)); - _mac_set = true; - - rf_unlock(); -} - -int8_t NanostackRfPhys2lp::rf_register() -{ - if (NULL == _rf) { - return -1; - } - rf_lock(); - if (rf != NULL) { - rf_unlock(); - error("Multiple registrations of NanostackRfPhyAtmel not supported"); - return -1; - } - - if (!_mac_set) { -#ifdef AT24MAC - int ret = _mac.read_eui64((void *)s2lp_MAC); - if (ret < 0) { - rf = NULL; - rf_unlock(); - return -1; - } -#else - randLIB_seed_random(); - randLIB_get_n_bytes_random(s2lp_MAC, 8); - s2lp_MAC[0] |= 2; //Set Local Bit - s2lp_MAC[0] &= ~1; //Clear multicast bit -#endif - set_mac_address(s2lp_MAC); - } - - rf = _rf; -#ifdef TEST_GPIOS_ENABLED - test_pins = _test_pins; -#endif - - int8_t radio_id = rf_device_register(_mac_addr); - if (radio_id < 0) { - rf = NULL; - } - rf_unlock(); - return radio_id; -} - -void NanostackRfPhys2lp::rf_unregister() -{ - rf_lock(); - if (NULL == rf) { - rf_unlock(); - return; - } - rf_device_unregister(); - rf = NULL; - rf_unlock(); -} - -NanostackRfPhys2lp::NanostackRfPhys2lp(PinName spi_sdi, PinName spi_sdo, PinName spi_sclk, PinName spi_cs, PinName spi_sdn - , PinName spi_gpio0, PinName spi_gpio1, PinName spi_gpio2, PinName spi_gpio3 -#ifdef AT24MAC - , PinName i2c_sda, PinName i2c_scl -#endif //AT24MAC - ) - : -#ifdef AT24MAC - _mac(i2c_sda, i2c_scl), -#endif //AT24MAC - _mac_addr(), _rf(NULL), _test_pins(NULL), _mac_set(false), - _spi_sdi(spi_sdi), _spi_sdo(spi_sdo), _spi_sclk(spi_sclk), _spi_cs(spi_cs), _spi_sdn(spi_sdn), - _spi_gpio0(spi_gpio0), _spi_gpio1(spi_gpio1), _spi_gpio2(spi_gpio2), _spi_gpio3(spi_gpio3) -{ - _rf = new RFPins(_spi_sdi, _spi_sdo, _spi_sclk, _spi_cs, _spi_sdn, _spi_gpio0, _spi_gpio1, _spi_gpio2, _spi_gpio3); -#ifdef TEST_GPIOS_ENABLED - _test_pins = new TestPins_S2LP(TEST_PIN_TX, TEST_PIN_RX, TEST_PIN_CSMA, TEST_PIN_SPARE_1, TEST_PIN_SPARE_2); -#endif //TEST_GPIOS_ENABLED -} - -NanostackRfPhys2lp::~NanostackRfPhys2lp() -{ - delete _rf; -} - -static bool rf_panid_filter_common(uint8_t *panid_start, uint8_t *pan_id, uint8_t frame_type) -{ - // PHY driver shouldn't drop received Beacon frames as they might be used by load balancing - if (frame_type == MAC_FRAME_BEACON) { - return true; - } - bool retval = true; - uint8_t cmp_table[2] = {0xff, 0xff}; - if (!(pan_id[0] == 0xff && pan_id[1] == 0xff)) { - if (memcmp((uint8_t *)panid_start, (uint8_t *) cmp_table, 2)) { - retval = false; - } - if (!retval) { - for (uint8_t i = 0; i < 2; i++) { - cmp_table[1 - i] = panid_start[i]; - } - if (!memcmp(pan_id, cmp_table, 2)) { - retval = true; - } - } - } - return retval; -} - -static bool rf_panid_v1_v0_filter(uint8_t *ptr, uint8_t *pan_id, uint8_t frame_type) -{ - return rf_panid_filter_common(ptr, pan_id, frame_type); -} - -static bool rf_addr_filter_common(uint8_t *ptr, uint8_t addr_mode, uint8_t *mac_64bit_addr, uint8_t *mac_16bit_addr) -{ - uint8_t cmp_table[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - bool retval = true; - switch (addr_mode) { - case FC_DST_16_BITS: - if (memcmp((uint8_t *)ptr, (uint8_t *) cmp_table, 2)) { - retval = false; - } - if (!retval) { - for (uint8_t i = 0; i < 2; i++) { - cmp_table[1 - i] = ptr[i]; - } - - if (!memcmp((uint8_t *)mac_16bit_addr, (uint8_t *) cmp_table, 2)) { - retval = true; - } - } - break; - case FC_DST_64_BITS: - if (memcmp((uint8_t *)ptr, (uint8_t *) cmp_table, 8)) { - retval = false; - } - if (!retval) { - for (uint8_t i = 0; i < 8; i++) { - cmp_table[7 - i] = ptr[i]; - } - - if (!memcmp((uint8_t *)mac_64bit_addr, (uint8_t *) cmp_table, 8)) { - retval = true; - } - } - break; - case FC_DST_ADDR_NONE: - retval = true; - break; - default: - retval = false; - break; - } - return retval; -} - -static bool rf_addr_v1_v0_filter(uint8_t *ptr, uint8_t *mac_64bit_addr, uint8_t *mac_16bit_addr, uint8_t dst_mode) -{ - return rf_addr_filter_common(ptr, dst_mode, mac_64bit_addr, mac_16bit_addr); -} - -static bool rf_rx_filter(uint8_t *mac_header, uint8_t *mac_64bit_addr, uint8_t *mac_16bit_addr, uint8_t *pan_id) -{ - uint8_t dst_mode = (mac_header[1] & FC_DST_MODE); - uint8_t frame_type = mac_header[0] & MAC_FRAME_TYPE_MASK; - uint8_t version = ((mac_header[1] & VERSION_FIELD_MASK) >> SHIFT_VERSION_FIELD); - if (version != MAC_FRAME_VERSION_2) { - if (!rf_panid_v1_v0_filter(mac_header + OFFSET_DST_PAN_ID, pan_id, frame_type)) { - return false; - } - if (!rf_addr_v1_v0_filter(mac_header + OFFSET_DST_ADDR, mac_64bit_addr, mac_16bit_addr, dst_mode)) { - return false; - } - } - return true; -} - -#if MBED_CONF_S2LP_PROVIDE_DEFAULT -NanostackRfPhy &NanostackRfPhy::get_default_instance() -{ - static NanostackRfPhys2lp rf_phy(S2LP_SPI_SDI, S2LP_SPI_SDO, S2LP_SPI_SCLK, S2LP_SPI_CS, S2LP_SPI_SDN - , S2LP_SPI_GPIO0, S2LP_SPI_GPIO1, S2LP_SPI_GPIO2, S2LP_SPI_GPIO3 -#ifdef AT24MAC - , S2LP_I2C_SDA, S2LP_I2C_SCL -#endif //AT24MAC - ); - return rf_phy; -} -#endif // MBED_CONF_S2LP_PROVIDE_DEFAULT -#endif // MBED_CONF_NANOSTACK_CONFIGURATION && DEVICE_SPI diff --git a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/at24mac_s2lp.cpp b/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/at24mac_s2lp.cpp deleted file mode 100644 index 046b2b6a7b..0000000000 --- a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/at24mac_s2lp.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2019-2019 ARM Limited. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "NanostackRfPhys2lp.h" -#include "at24mac_s2lp.h" - - -#if DEVICE_I2C -#ifdef AT24MAC - -/* Device addressing */ -#define AT24MAC_EEPROM_ADDRESS (0x0A<<4) -#define AT24MAC_RW_PROTECT_ADDRESS (0x06<<4) -#define AT24MAC_SERIAL_ADDRESS (0x0B<<4) - -/* Known memory blocks */ -#define AT24MAC_SERIAL_OFFSET (0x80) -#define AT24MAC_EUI64_OFFSET (0x98) -#define AT24MAC_EUI48_OFFSET (0x9A) - -#define SERIAL_LEN 16 -#define EUI64_LEN 8 -#define EUI48_LEN 6 - -using namespace mbed; - -AT24Mac_s2lp::AT24Mac_s2lp(PinName sda, PinName scl) : _i2c(sda, scl) -{ - // Do nothing -} - -int AT24Mac_s2lp::read_serial(void *buf) -{ - char offset = AT24MAC_SERIAL_OFFSET; - if (_i2c.write(AT24MAC_SERIAL_ADDRESS, &offset, 1, true)) { - return -1; //No ACK - } - return _i2c.read(AT24MAC_SERIAL_ADDRESS, (char *)buf, SERIAL_LEN); -} - -int AT24Mac_s2lp::read_eui64(void *buf) -{ - char offset = AT24MAC_EUI64_OFFSET; - if (_i2c.write(AT24MAC_SERIAL_ADDRESS, &offset, 1, true)) { - return -1; //No ACK - } - return _i2c.read(AT24MAC_SERIAL_ADDRESS, (char *)buf, EUI64_LEN); -} - -int AT24Mac_s2lp::read_eui48(void *buf) -{ - char offset = AT24MAC_EUI48_OFFSET; - if (_i2c.write(AT24MAC_SERIAL_ADDRESS, &offset, 1, true)) { - return -1; //No ACK - } - return _i2c.read(AT24MAC_SERIAL_ADDRESS, (char *)buf, EUI48_LEN); -} - -#endif /* AT24MAC */ -#endif /* DEVICE_I2C */ diff --git a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/at24mac_s2lp.h b/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/at24mac_s2lp.h deleted file mode 100644 index dc31c0f570..0000000000 --- a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/at24mac_s2lp.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2019-2019 ARM Limited. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef AT24MAC_S2LP_H -#define AT24MAC_S2LP_H - -#include "PinNames.h" - -#if DEVICE_I2C -#ifdef AT24MAC - -#include "I2C.h" -#include "drivers/DigitalInOut.h" -#include "platform/mbed_wait_api.h" - -/* - * AT24MAC drivers. - * - * This is a EEPROM chip designed to contain factory programmed read-only EUI-64 or EUI-48, - * a 128bit serial number and some user programmable EEPROM. - * - * AT24MAC602 contains EUI-64, use read_eui64() - * AT24MAC402 contains EUI-64, use read_eui48() - * - * NOTE: You cannot use both EUI-64 and EUI-48. Chip contains only one of those. - */ - -class AT24Mac_s2lp { -public: - AT24Mac_s2lp(PinName sda, PinName scl); - - /** - * Read unique serial number from chip. - * \param buf pointer to write serial number to. Must have space for 16 bytes. - * \return zero on success, negative number on failure - */ - int read_serial(void *buf); - - /** - * Read EUI-64 from chip. - * \param buf pointer to write EUI-64 to. Must have space for 8 bytes. - * \return zero on success, negative number on failure - */ - int read_eui64(void *buf); - - /** - * Read EUI-48 from chip. - * \param buf pointer to write EUI-48 to. Must have space for 6 bytes. - * \return zero on success, negative number on failure - */ - int read_eui48(void *buf); - -private: - mbed::I2C _i2c; -}; - -#endif /* AT24MAC */ -#endif /* DEVICE_I2C */ -#endif /* AT24MAC_S2LP_H */ diff --git a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/rf_configuration.c b/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/rf_configuration.c deleted file mode 100644 index 9f261ee02d..0000000000 --- a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/rf_configuration.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && DEVICE_INTERRUPTIN && defined(MBED_CONF_RTOS_PRESENT) - -#include "nanostack/platform/arm_hal_phy.h" -#include "rf_configuration.h" - - -// Note that F_XO and F_DIG depends on the used clock frequency -#define F_XO 50000000 -#define F_DIG 25000000 -// Note that reference divider depends on REFDIV field in XO_RCO_CONF0 register -#define REF_DIVIDER 1 -// Note that band selector depends on BS field in SYNT3 register -#define BAND_SELECTOR 4 -#define DEF_2EXP33 8589934592 -#define DEF_2EXP20 1048576 -#define DEF_2EXP19 524288 -#define DEF_2EXP16 65536 -#define DEF_2EXP15 32768 -// Use multiplier for better resolution -#define RESOLUTION_MULTIPLIER 1000000 - -// RSSI_TH is a 8-bit register which can be converted to dBm using formula RSSI_TH-146 -#define MIN_RSSI_THRESHOLD -146 -#define MAX_RSSI_THRESHOLD 109 - -void rf_conf_calculate_datarate_registers(uint32_t datarate, uint16_t *datarate_mantissa, uint8_t *datarate_exponent) -{ - uint64_t datarate_m = (uint64_t)datarate * DEF_2EXP33; - uint8_t datarate_e = 1; - while (datarate_m >= DEF_2EXP16) { - datarate_e++; - uint16_t var_2exp_datarate_e = (uint32_t)2 << (datarate_e - 1); - datarate_m = (uint64_t)datarate * DEF_2EXP33; - datarate_m = datarate_m / ((uint64_t)var_2exp_datarate_e * F_DIG); - datarate_m -= DEF_2EXP16; - } - *datarate_mantissa = datarate_m; - *datarate_exponent = datarate_e; -} - -void rf_conf_calculate_base_frequency_registers(uint32_t frequency, uint8_t *synt3, uint8_t *synt2, uint8_t *synt1, uint8_t *synt0) -{ - uint64_t freq_tmp = (uint64_t)frequency * RESOLUTION_MULTIPLIER; - freq_tmp = (freq_tmp / (F_XO / ((BAND_SELECTOR / 2) * REF_DIVIDER))); - freq_tmp *= DEF_2EXP20; - freq_tmp /= RESOLUTION_MULTIPLIER; - *synt3 = (uint8_t)(freq_tmp >> 24); - *synt2 = (uint8_t)(freq_tmp >> 16); - *synt1 = (uint8_t)(freq_tmp >> 8); - *synt0 = (uint8_t)freq_tmp; -} - -void rf_conf_calculate_deviation_registers(uint32_t deviation, uint8_t *fdev_m, uint8_t *fdev_e) -{ - uint64_t fdev_m_tmp = 0xffff; - uint8_t fdev_e_tmp = 1; - - while (fdev_m_tmp > 255) { - fdev_e_tmp++; - uint16_t var_2exp_datarate_e_minus_1 = (uint16_t)2 << ((fdev_e_tmp - 1) - 1); - fdev_m_tmp = (uint64_t)deviation * RESOLUTION_MULTIPLIER; - fdev_m_tmp = (((fdev_m_tmp / F_XO) * DEF_2EXP19 * BAND_SELECTOR * REF_DIVIDER * (8 / BAND_SELECTOR)) / var_2exp_datarate_e_minus_1); - fdev_m_tmp += RESOLUTION_MULTIPLIER / 2; - fdev_m_tmp /= RESOLUTION_MULTIPLIER; - fdev_m_tmp -= 256; - } - *fdev_m = (uint8_t)fdev_m_tmp; - *fdev_e = fdev_e_tmp; -} - -int rf_conf_calculate_channel_spacing_registers(uint32_t channel_spacing, uint8_t *ch_space) -{ - uint64_t ch_space_tmp = (uint64_t)channel_spacing * RESOLUTION_MULTIPLIER; - ch_space_tmp /= F_XO; - ch_space_tmp *= DEF_2EXP15; - ch_space_tmp += RESOLUTION_MULTIPLIER / 2; - ch_space_tmp /= RESOLUTION_MULTIPLIER; - // Check if channel spacing is too high - if (ch_space_tmp > 255) { - return -1; - } - *ch_space = (uint8_t)ch_space_tmp; - return 0; -} - -/* Note: This function doesn't necessarily give the optimal RX filter settings. - * When accurate chflt_m and chflt_e settings are needed they must be computed manually. - * Function uses undefined values (900000, 852000, ...) - * to find the chflt_m and chflt_e settings from the RX filter table (see. S2-LP datasheet). - * - * E=0 E=1 E=2 E=3 E=4 E=5 E=6 E=7 E=8 E=9 - * M=0 800.1 450.9 224.7 112.3 56.1 28.0 14.0 7.0 3.5 1.8 - * M=1 795.1 425.9 212.4 106.2 53.0 26.5 13.3 6.6 3.3 1.7 - * M=2 768.4 403.2 201.1 100.5 50.2 25.1 12.6 6.3 3.1 1.6 - * M=3 736.8 380.8 190.0 95.0 47.4 23.7 11.9 5.9 3.0 1.5 - * M=4 705.1 362.1 180.7 90.3 45.1 22.6 11.3 5.6 2.8 1.4 - * M=5 670.9 341.7 170.6 85.3 42.6 21.3 10.6 5.3 2.7 1.3 - * M=6 642.3 325.4 162.4 81.2 40.6 20.3 10.1 5.1 2.5 1.3 - * M=7 586.7 294.5 147.1 73.5 36.7 18.4 9.2 4.6 2.3 1.2 - * M=8 541.4 270.3 135.0 67.5 33.7 16.9 8.4 4.2 2.1 1.1 - */ -void rf_conf_calculate_rx_filter_bandwidth_registers(uint32_t rx_bandwidth, uint8_t *chflt_m, uint8_t *chflt_e) -{ - uint8_t chflt_e_tmp = 0; - uint8_t chflt_m_tmp = 0; - - while (rx_bandwidth < 900000u / (2 << chflt_e_tmp)) { - chflt_e_tmp++; - } - uint32_t rx_bandwidth_tmp = rx_bandwidth; - if (chflt_e_tmp > 0) { - rx_bandwidth_tmp = rx_bandwidth * (2 << (chflt_e_tmp - 1)); - } - if (852000 > rx_bandwidth_tmp) { - chflt_m_tmp++; - } - if (806000 > rx_bandwidth_tmp) { - chflt_m_tmp++; - } - if (760000 > rx_bandwidth_tmp) { - chflt_m_tmp++; - } - if (724000 > rx_bandwidth_tmp) { - chflt_m_tmp++; - } - if (682000 > rx_bandwidth_tmp) { - chflt_m_tmp++; - } - if (650000 > rx_bandwidth_tmp) { - chflt_m_tmp++; - } - if (588000 > rx_bandwidth_tmp) { - chflt_m_tmp++; - } - if (542000 > rx_bandwidth_tmp) { - chflt_m_tmp++; - } - *chflt_m = chflt_m_tmp; - *chflt_e = chflt_e_tmp; -} - -int16_t rf_conf_cca_threshold_percent_to_rssi(uint8_t percent) -{ - uint8_t step = (MAX_RSSI_THRESHOLD - MIN_RSSI_THRESHOLD); - return MIN_RSSI_THRESHOLD + (step * percent) / 100; -} - -void rf_conf_calculate_rssi_threshold_registers(int16_t rssi_threshold, uint8_t *rssi_th) -{ - *rssi_th = rssi_threshold + RSSI_OFFSET; -} - -/* - * Function calculates deviation from given parameters for 2FSK and 2GFSK modulations. - * Calculated using formula Deviation=(modulation_index*datarate)/2 - */ -uint32_t rf_conf_calculate_deviation(phy_modulation_index_e modulation_index, uint32_t datarate) -{ - uint32_t deviation = 0; - if (modulation_index == MODULATION_INDEX_0_5) { - deviation = datarate / 4; - } else if (modulation_index == MODULATION_INDEX_1_0) { - deviation = datarate / 2; - } - return deviation; -} - -#endif // MBED_CONF_NANOSTACK_CONFIGURATION && DEVICE_SPI && DEVICE_INTERRUPTIN && defined(MBED_CONF_RTOS_PRESENT) - diff --git a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/rf_configuration.h b/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/rf_configuration.h deleted file mode 100644 index 2c2c8cc8ed..0000000000 --- a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/rf_configuration.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef RF_CONF_H_ -#define RF_CONF_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define RSSI_OFFSET 146 - -void rf_conf_calculate_datarate_registers(uint32_t datarate, uint16_t *datarate_mantissa, uint8_t *datarate_exponent); -void rf_conf_calculate_base_frequency_registers(uint32_t frequency, uint8_t *synt3, uint8_t *synt2, uint8_t *synt1, uint8_t *synt0); -void rf_conf_calculate_deviation_registers(uint32_t deviation, uint8_t *fdev_m, uint8_t *fdev_e); -int rf_conf_calculate_channel_spacing_registers(uint32_t channel_spacing, uint8_t *ch_space); -void rf_conf_calculate_rx_filter_bandwidth_registers(uint32_t rx_bandwidth, uint8_t *chflt_m, uint8_t *chflt_e); -void rf_conf_calculate_rssi_threshold_registers(int16_t rssi_threshold, uint8_t *rssi_th); -uint32_t rf_conf_calculate_deviation(phy_modulation_index_e modulation_index, uint32_t datarate); -int16_t rf_conf_cca_threshold_percent_to_rssi(uint8_t percent); - -#ifdef __cplusplus -} -#endif - -#endif /* RF_CONF_H_ */ diff --git a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/s2lpReg.h b/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/s2lpReg.h deleted file mode 100644 index 48dc513e54..0000000000 --- a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/source/s2lpReg.h +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef S2LPREG_H_ -#define S2LPREG_H_ -#ifdef __cplusplus -extern "C" { -#endif - -#define RF_MTU 2047 -#define PARTNUM 0x03 -#define VERSION 0xC1 -#define FIFO_SIZE 128 -#define SPI_HEADER_LENGTH 2 -#define RSSI_SETTLING_TIME 250 - -#define S2LP_GPIO0 0 -#define S2LP_GPIO1 1 -#define S2LP_GPIO2 2 -#define S2LP_GPIO3 3 - -// GPIO modes -#define DIG_IN 1 -#define DIG_OUT_LOW 2 -#define DIG_OUT_HIGH 3 - -// Interrupt events -#define RX_DATA_READY 0 -#define RX_DATA_DISCARDED 1 -#define TX_DATA_SENT 2 -#define MAX_RE_TX 3 -#define CRC_ERROR 4 -#define TX_FIFO_UNF_OVF 5 -#define RX_FIFO_UNF_OVF 6 -#define TX_FIFO_ALMOST_FULL 7 -#define TX_FIFO_ALMOST_EMPTY 8 -#define RX_FIFO_ALMOST_FULL 9 -#define RX_FIFO_ALMOST_EMPTY 10 -#define MAX_CCA_BACKOFFS 11 -#define VALID_PREAMBLE 12 -#define SYNC_WORD 13 -#define RSSI_ABOVE_THR 14 -#define WAKE_UP_TIMEOUT 15 -#define READY 16 -#define STANDBY_SWITCHING 17 -#define LOW_BATTERY_LVL 18 -#define POWER_ON_RESET 19 -#define RX_TIMER_TIMEOUT 28 -#define SNIFF_TIMER_TIMEOUT 29 - -// GPIO signals -#define NIRQ 0 -#define POR 1 -#define WUT_EXPIRE 2 -#define LOW_BATTERY 3 -#define TX_DATA_OUTPUT 4 -#define TX_STATE 5 -#define TXRX_FIFO_ALMOST_EMPTY 6 -#define TXRX_FIFO_ALMOST_FULL 7 -#define RX_DATA_OUTPUT 8 -#define RX_CLOCK_OUTPUT 9 -#define RX_STATE 10 -#define STATE_OTHER_THAN_SLEEP_OR_STANDBY 11 -#define STANDBY_STATE 12 -#define ANTENNA_SWITCH 13 -#define VALID_PREAMBLE_DETECTED 14 -#define SYNC_WORD_DETECTED 15 -#define RSSI_ABOVE_THRESHOLD 16 -#define TXRX_MODE_INDICATOR 18 -#define VDD 19 -#define GND 20 -#define SMPS_ENABLE 21 -#define SLEEP_STATE 22 -#define READY_STATE 23 -#define LOCK_STATE 24 -#define WAIT_LOCK_DETECTOR 25 -#define TX_DATA_OOK 26 -#define WAIT_READY 27 -#define WAIT_TIMER_EXPIRATION 28 -#define END_OF_CALIBRATION 29 -#define ENABLE_SYNTH_BLOCK 30 - -// RF registers -#define GPIO0_CONF 0x00 -#define GPIO1_CONF 0x01 -#define GPIO2_CONF 0x02 -#define GPIO3_CONF 0x03 -#define SYNT3 0x05 -#define SYNT2 0x06 -#define SYNT1 0x07 -#define SYNT0 0x08 -#define IF_OFFSET_ANA 0x09 -#define IF_OFFSET_DIG 0x0A -#define CHSPACE 0x0C -#define CHNUM 0x0D -#define MOD4 0x0E -#define MOD3 0x0F -#define MOD2 0x10 -#define MOD1 0x11 -#define MOD0 0x12 -#define CHFLT 0x13 -#define AFC2 0x14 -#define AFC1 0x15 -#define AFC0 0x16 -#define RSSI_FLT 0x17 -#define RSSI_TH 0x18 -#define AGCCTRL4 0x1A -#define AGCCTRL3 0x1B -#define AGCCTRL2 0x1C -#define AGCCTRL1 0x1D -#define AGCCTRL0 0x1E -#define ANT_SELECT_CONF 0x1F -#define CLOCKREC2 0x20 -#define CLOCKREC1 0x21 -#define PCKTCTRL6 0x2B -#define PCKTCTRL5 0x2C -#define PCKTCTRL4 0x2D -#define PCKTCTRL3 0x2E -#define PCKTCTRL2 0x2F -#define PCKTCTRL1 0x30 -#define PCKTLEN1 0x31 -#define PCKTLEN0 0x32 -#define SYNC3 0x33 -#define SYNC2 0x34 -#define SYNC1 0x35 -#define SYNC0 0x36 -#define QI 0x37 -#define PCKT_PSTMBL 0x38 -#define PROTOCOL2 0x39 -#define PROTOCOL1 0x3A -#define PROTOCOL0 0x3B -#define FIFO_CONFIG3 0x3C -#define FIFO_CONFIG2 0x3D -#define FIFO_CONFIG1 0x3E -#define FIFO_CONFIG0 0x3F -#define PCKT_FLT_OPTIONS 0x40 -#define PCKT_FLT_GOALS4 0x41 -#define PCKT_FLT_GOALS3 0x42 -#define PCKT_FLT_GOALS2 0x43 -#define PCKT_FLT_GOALS1 0x44 -#define PCKT_FLT_GOALS0 0x45 -#define TIMERS5 0x46 -#define TIMERS4 0x47 -#define TIMERS3 0x48 -#define TIMERS2 0x49 -#define TIMERS1 0x4A -#define TIMERS0 0x4B -#define CSMA_CONF3 0x4C -#define CSMA_CONF2 0x4D -#define CSMA_CONF1 0x4E -#define CSMA_CONF0 0x4F -#define IRQ_MASK3 0x50 -#define IRQ_MASK2 0x51 -#define IRQ_MASK1 0x52 -#define IRQ_MASK0 0x53 -#define FAST_RX_TIMER 0x54 -#define PA_POWER8 0x5A -#define PA_POWER7 0x5B -#define PA_POWER6 0x5C -#define PA_POWER5 0x5D -#define PA_POWER4 0x5E -#define PA_POWER3 0x5F -#define PA_POWER2 0x60 -#define PA_POWER1 0x61 -#define PA_POWER0 0x62 -#define PA_CONFIG1 0x63 -#define PA_CONFIG0 0x64 -#define SYNTH_CONFIG2 0x65 -#define VCO_CONFIG 0x68 -#define VCO_CALIBR_IN2 0x69 -#define VCO_CALIBR_IN1 0x6A -#define VCO_CALIBR_IN0 0x6B -#define XO_RCO_CONF1 0x6C -#define XO_RCO_CONF0 0x6D -#define RCO_CALIBR_CONF3 0x6E -#define RCO_CALIBR_CONF2 0x6F -#define PM_CONF4 0x75 -#define PM_CONF3 0x76 -#define PM_CONF2 0x77 -#define PM_CONF1 0x78 -#define PM_CONF0 0x79 -#define MC_STATE1 0x8D -#define MC_STATE0 0x8E -#define TX_FIFO_STATUS 0x8F -#define RX_FIFO_STATUS 0x90 -#define RCO_CALIBR_OUT4 0x94 -#define RCO_CALIBR_OUT3 0x95 -#define VCO_CALIBR_OUT1 0x99 -#define VCO_CALIBR_OUT0 0x9A -#define TX_PCKT_INFO 0x9C -#define RX_PCKT_INFO 0x9D -#define AFC_CORR 0x9E -#define LINK_QUALIF2 0x9F -#define LINK_QUALIF1 0xA0 -#define RSSI_LEVEL 0xA2 -#define RX_PCKT_LEN1 0xA4 -#define RX_PCKT_LEN0 0xA5 -#define CRC_FIELD3 0xA6 -#define CRC_FIELD2 0xA7 -#define CRC_FIELD1 0xA8 -#define CRC_FIELD0 0xA9 -#define RX_ADDRE_FIELD1 0xAA -#define RX_ADDRE_FIELD0 0xAB -#define RSSI_LEVEL_RUN 0xEF -#define DEVICE_INFO1 0xF0 -#define DEVICE_INFO0 0xF1 -#define IRQ_STATUS3 0xFA -#define IRQ_STATUS2 0xFB -#define IRQ_STATUS1 0xFC -#define IRQ_STATUS0 0xFD -#define TX_FIFO 0xFF -#define RX_FIFO 0xFF - -#define SFD0 0x90 -#define SFD1 0x4e - -#define DEFAULT_DEVIATION 125000 -#define RX_FILTER_BANDWIDTH 540000 -#define RSSI_THRESHOLD -85 - -// PCKTCTRL6 -#define PCKT_SYNCLEN_FIELD 0xFC -#define PCKT_SYNCLEN (16 << 2) - -// PCKTCTRL5 -#define PCKT_PREAMBLE_LEN 32 - -// PCKTCTRL3 -#define PCKT_FORMAT_FIELD 0xC0 -#define PCKT_FORMAT_802_15_4 (1 << 6) -#define PCKT_RXMODE_FIELD 0x30 -#define PCKT_RXMODE_NORMAL (0 << 4) -#define PCKT_BYTE_SWAP_FIELD 0x04 -#define PCKT_BYTE_SWAP_LSB (1 << 2) - -// PCKTCTRL2 -#define PCKT_FIXVARLEN_FIELD 0x01 -#define PCKT_VARIABLE_LEN (1 << 0) -#define PCKT_FCS_TYPE_FIELD 0x20 -#define PCKT_FCS_TYPE_4_OCTET (0 << 5) -#define PCKT_FCS_TYPE_2_OCTET (1 << 5) - -// PCKTCTRL1 -#define PCKT_CRCMODE_FIELD 0xE0 -#define PCKT_CRCMODE_0X1021 (3 << 5) -#define PCKT_CRCMODE_0x04C11DB7 (5 << 5) -#define PCKT_TXSOURCE_FIELD 0x0C -#define PCKT_TXSOURCE_NORMAL (0 << 2) -#define PCKT_WHITENING_FIELD 0x10 -#define PCKT_WHITENING_ENABLED (1 << 4) - -// MOD4 -#define DATARATE_M_MSB 0x47 -// MOD3 -#define DATARATE_M_LSB 0xAE - -// MOD2 -#define MOD_TYPE_FIELD 0xF0 -#define MOD_2FSK (0 << 4) -#define MOD_2GFSK (10 << 4) -#define DATARATE_E_FIELD 0x0F -#define DATARATE_E (10 << 0) - -// MOD1 -#define FDEV_E_FIELD 0x0F - -// QI -#define PQI_TH_FIELD 0x1E -#define PQI_TH (8 << 1) -#define SQI_EN_FIELD 0x01 -#define SQI_EN (1 << 0) - -// SYNT3 -#define SYNT_FIELD 0x0F - -// CHFLT -#define CHFLT_M_FIELD 0xF0 -#define CHFLT_E_FIELD 0x0F - -// LINK_QUALIF1 -#define CARRIER_SENSE (1 << 7) - -#define SPI_WR_REG 0x00 -#define SPI_RD_REG 0x01 -#define SPI_CMD 0x80 - -typedef enum { - S2LP_STATE_STANDBY = 0x02, - S2LP_STATE_SLEEPA = 0x01, - S2LP_STATE_SLEEPB = 0x03, - S2LP_STATE_READY = 0x00, - S2LP_STATE_LOCK = 0x0C, - S2LP_STATE_RX = 0x30, - S2LP_STATE_TX = 0x5C, - S2LP_STATE_SYNTH_SETUP = 0x50 -} s2lp_states_e; - -#if defined __cplusplus && __cplusplus >= 201103 -typedef enum : uint8_t { -#else -typedef enum { -#endif - S2LP_CMD_TX = 0x60, - S2LP_CMD_RX, - S2LP_CMD_READY, - S2LP_CMD_STANDBY, - S2LP_CMD_SLEEP, - S2LP_CMD_LOCKRX, - S2LP_CMD_LOCKTX, - S2LP_CMD_SABORT, - S2LP_CMD_LDC_RELOAD, - S2LP_CMD_SRES = 0x70, - S2LP_CMD_FLUSHRXFIFO, - S2LP_CMD_FLUSHTXFIFO, - S2LP_CMD_SEQUPDATE -} s2lp_commands_e; - -typedef enum { - RF_IDLE, - RF_CSMA_STARTED, - RF_TX_STARTED, - RF_RX_STARTED, - RF_TX_ACK -} rf_states_e; - -#ifdef __cplusplus -} -#endif - -#endif /* S2LPREG_H_ */ diff --git a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/stm-s2lp-rf-driver/NanostackRfPhys2lp.h b/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/stm-s2lp-rf-driver/NanostackRfPhys2lp.h deleted file mode 100644 index 280aa3ddba..0000000000 --- a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/stm-s2lp-rf-driver/NanostackRfPhys2lp.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2018 ARM Limited. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NANOSTACK_PHY_S2LP_H_ -#define NANOSTACK_PHY_S2LP_H_ - -#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && defined(MBED_CONF_RTOS_PRESENT) -#include "inttypes.h" -#include "NanostackRfPhy.h" -#include "DigitalIn.h" -#include "DigitalOut.h" -#include "InterruptIn.h" -#include "SPI.h" - -#if defined(MBED_CONF_S2LP_SPI_SDI) -#define S2LP_SPI_SDI MBED_CONF_S2LP_SPI_SDI -#else -#define S2LP_SPI_SDI D11 -#endif - -#if defined(MBED_CONF_S2LP_SPI_SDO) -#define S2LP_SPI_SDO MBED_CONF_S2LP_SPI_SDO -#else -#define S2LP_SPI_SDO D12 -#endif - -#if defined(MBED_CONF_S2LP_SPI_SCLK) -#define S2LP_SPI_SCLK MBED_CONF_S2LP_SPI_SCLK -#else -#define S2LP_SPI_SCLK D13 -#endif - -#if defined(MBED_CONF_S2LP_SPI_CS) -#define S2LP_SPI_CS MBED_CONF_S2LP_SPI_CS -#else -#define S2LP_SPI_CS A1 -#endif - -#if defined(MBED_CONF_S2LP_SPI_SDN) -#define S2LP_SPI_SDN MBED_CONF_S2LP_SPI_SDN -#else -#define S2LP_SPI_SDN D7 -#endif - -#if defined(MBED_CONF_S2LP_TEST_PIN_TX) -#define S2LP_TEST_PIN_TX MBED_CONF_S2LP_TEST_PIN_TX -#else -#define S2LP_TEST_PIN_TX D6 -#endif - -#if defined(MBED_CONF_S2LP_TEST_PIN_RX) -#define S2LP_TEST_PIN_RX MBED_CONF_S2LP_TEST_PIN_RX -#else -#define S2LP_TEST_PIN_RX D5 -#endif - -#if defined(MBED_CONF_S2LP_TEST_PIN_CSMA) -#define S2LP_TEST_PIN_CSMA MBED_CONF_S2LP_TEST_PIN_CSMA -#else -#define S2LP_TEST_PIN_CSMA D4 -#endif - -#if defined(MBED_CONF_S2LP_TEST_PIN_SPARE_1) -#define S2LP_TEST_PIN_SPARE_1 MBED_CONF_S2LP_TEST_PIN_SPARE_1 -#else -#define S2LP_TEST_PIN_SPARE_1 D2 -#endif - -#if defined(MBED_CONF_S2LP_TEST_PIN_SPARE_2) -#define S2LP_TEST_PIN_SPARE_2 MBED_CONF_S2LP_TEST_PIN_SPARE_2 -#else -#define S2LP_TEST_PIN_SPARE_2 D8 -#endif - -#if defined(MBED_CONF_S2LP_SPI_GPIO0) -#define S2LP_SPI_GPIO0 MBED_CONF_S2LP_SPI_GPIO0 -#else -#define S2LP_SPI_GPIO0 A0 -#endif - -#if defined(MBED_CONF_S2LP_SPI_GPIO1) -#define S2LP_SPI_GPIO1 MBED_CONF_S2LP_SPI_GPIO1 -#else -#define S2LP_SPI_GPIO1 A2 -#endif - -#if defined(MBED_CONF_S2LP_SPI_GPIO2) -#define S2LP_SPI_GPIO2 MBED_CONF_S2LP_SPI_GPIO2 -#else -#define S2LP_SPI_GPIO2 A3 -#endif - -#if defined(MBED_CONF_S2LP_SPI_GPIO3) -#define S2LP_SPI_GPIO3 MBED_CONF_S2LP_SPI_GPIO3 -#else -#define S2LP_SPI_GPIO3 A5 -#endif - -#if defined(MBED_CONF_S2LP_I2C_SDA) -#define S2LP_I2C_SDA MBED_CONF_S2LP_I2C_SDA -#else -#define S2LP_I2C_SDA null -#endif - -#if defined(MBED_CONF_S2LP_I2C_SCL) -#define S2LP_I2C_SCL MBED_CONF_S2LP_I2C_SCL -#else -#define S2LP_I2C_SCL null -#endif - -#include "at24mac_s2lp.h" - -class RFPins; -class TestPins_S2LP; - -class NanostackRfPhys2lp : public NanostackRfPhy { -public: - NanostackRfPhys2lp(PinName spi_sdi, PinName spi_sdo, PinName spi_sclk, PinName spi_cs, PinName spi_sdn - , PinName spi_gpio0, PinName spi_gpio1, PinName spi_gpio2, PinName spi_gpio3 -#ifdef AT24MAC - , PinName i2c_sda, PinName i2c_scl -#endif //AT24MAC - ); - virtual ~NanostackRfPhys2lp(); - virtual int8_t rf_register(); - virtual void rf_unregister(); - virtual void get_mac_address(uint8_t *mac); - virtual void set_mac_address(uint8_t *mac); - -private: -#ifdef AT24MAC - AT24Mac_s2lp _mac; -#endif //AT24MAC - uint8_t _mac_addr[8]; - RFPins *_rf; - TestPins_S2LP *_test_pins; - bool _mac_set; - - const PinName _spi_sdi; - const PinName _spi_sdo; - const PinName _spi_sclk; - const PinName _spi_cs; - const PinName _spi_sdn; - const PinName _spi_gpio0; - const PinName _spi_gpio1; - const PinName _spi_gpio2; - const PinName _spi_gpio3; -}; -#endif /* MBED_CONF_NANOSTACK_CONFIGURATION && DEVICE_SPI */ -#endif /* NANOSTACK_PHY_S2LP_H_ */ From 92e35b3a27554765a24703378be012d5b9023d6f Mon Sep 17 00:00:00 2001 From: Arto Kinnunen Date: Wed, 23 Jun 2021 10:24:25 +0300 Subject: [PATCH 05/18] Squashed 'connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/' content from commit f491d77de8 git-subtree-dir: connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver git-subtree-split: f491d77de847cd5358d53b5b4d975cb0d68d11f3 --- README.md | 11 + mbed_lib.json | 73 ++ source/NanostackRfPhys2lp.cpp | 1480 +++++++++++++++++++++++ source/at24mac_s2lp.cpp | 73 ++ source/at24mac_s2lp.h | 72 ++ source/rf_configuration.c | 186 +++ source/rf_configuration.h | 42 + source/s2lpReg.h | 344 ++++++ stm-s2lp-rf-driver/NanostackRfPhys2lp.h | 164 +++ 9 files changed, 2445 insertions(+) create mode 100644 README.md create mode 100644 mbed_lib.json create mode 100644 source/NanostackRfPhys2lp.cpp create mode 100644 source/at24mac_s2lp.cpp create mode 100644 source/at24mac_s2lp.h create mode 100644 source/rf_configuration.c create mode 100644 source/rf_configuration.h create mode 100644 source/s2lpReg.h create mode 100644 stm-s2lp-rf-driver/NanostackRfPhys2lp.h diff --git a/README.md b/README.md new file mode 100644 index 0000000000..51ece87ac3 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# Example RF driver for STM 802.15.4 transceivers # + +Support for: + * S2-LP + +This driver is used with 6LoWPAN and Wi-SUN stacks. + +Driver is tested with X-Nucleo-S2868A1 RF expansion board. https://www.st.com/en/ecosystems/x-nucleo-s2868a1.html + +NOTE: Default SPI SCLK pin configuration is D13. On X-Nucleo-S2868A1, resistor R6 must be soldered instead of R11. For more information, see user manual UM2405. https://www.st.com/resource/en/user_manual/dm00498153.pdf + diff --git a/mbed_lib.json b/mbed_lib.json new file mode 100644 index 0000000000..55e4bf1748 --- /dev/null +++ b/mbed_lib.json @@ -0,0 +1,73 @@ +{ + "name": "s2lp", + "config": { + "SPI_SDI": { + "help": "SPI_SDI pin for SPI connection. D11 assumed, needs to be set/overwritten otherwise", + "value": null + }, + "SPI_SDO": { + "help": "SPI_SDO pin for SPI connection. D12 assumed, needs to be set/overwritten otherwise", + "value": null + }, + "SPI_SCLK": { + "help": "SPI_SCLK pin for SPI connection, D13 assumed, needs to be set/overwritten otherwise", + "value": null + }, + "SPI_CS": { + "help": "SPI_CS pin for SPI connection, A1 assumed, needs to be set/overwritten otherwise", + "value": null + }, + "SPI_SDN": { + "help": "SPI_SDN pin for SPI connection, D7 assumed, needs to be set/overwritten otherwise", + "value": null + }, + "TEST_PIN_TX": { + "help": "TEST_PIN_TX pin for serial connection, D6 assumed, needs to be set/overwritten otherwise", + "value": null + }, + "TEST_PIN_RX": { + "help": "TEST_PIN_RX pin for serial connection, D5 assumed, needs to be set/overwritten otherwise", + "value": null + }, + "TEST_PIN_CSMA": { + "help": "TEST_PIN_CSMA pin for CSMA, D4 assumed, needs to be set/overwritten otherwise", + "value": null + }, + "TEST_PIN_SPARE_1": { + "help": "TEST_PIN_SPARE_1 pin for testing, D2 assumed, needs to be set/overwritten otherwise", + "value": null + }, + "TEST_PIN_SPARE_2": { + "help": "TEST_PIN_SPARE_2 pin for testing, D8 assumed, needs to be set/overwritten otherwise", + "value": null + }, + "SPI_GPIO0": { + "help": "SPI_GPIO0 pin for GPIO testing, A0 assumed, needs to be set/overwritten otherwise", + "value": null + }, + "SPI_GPIO1": { + "help": "SPI_GPIO1 pin for GPIO testing, A2 assumed, needs to be set/overwritten otherwise", + "value": null + }, + "SPI_GPIO2": { + "help": "SPI_GPIO2 pin for GPIO testing, A3 assumed, needs to be set/overwritten otherwise", + "value": null + }, + "SPI_GPIO3": { + "help": "SPI_GPIO3 pin for GPIO testing, A5 assumed, needs to be set/overwritten otherwise", + "value": null + }, + "I2C_SDA": { + "help": "I2C_SDA pin for I2C SDA, null assumed, needs to be set/overwritten otherwise", + "value": null + }, + "I2C_SCL": { + "help": "I2C_SCL pin for I2C SCL, null assumed, needs to be set/overwritten otherwise", + "value": null + }, + "provide-default": { + "help": "Provide default NanostackRfpy. [true/false]", + "value": false + } + } +} diff --git a/source/NanostackRfPhys2lp.cpp b/source/NanostackRfPhys2lp.cpp new file mode 100644 index 0000000000..63a5f90dde --- /dev/null +++ b/source/NanostackRfPhys2lp.cpp @@ -0,0 +1,1480 @@ +/* + * Copyright (c) 2018-2021, Pelion and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include +#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && DEVICE_INTERRUPTIN && defined(MBED_CONF_RTOS_PRESENT) + +#include "platform/arm_hal_interrupt.h" +#include "nanostack/platform/arm_hal_phy.h" +#include "ns_types.h" +#include "NanostackRfPhys2lp.h" +#include "s2lpReg.h" +#include "rf_configuration.h" +#include "randLIB.h" +#include "mbed_trace.h" +#include "mbed_toolchain.h" +#include "common_functions.h" +#include +#include "Timeout.h" +#include "Thread.h" +#include "mbed_wait_api.h" +#include "platform/mbed_error.h" +#include "platform/mbed_version.h" + +#if (MBED_VERSION > MBED_ENCODE_VERSION(6, 0, 0)) +/* Mbed OS 6.0 introduces support for chrono time management */ +using namespace std::chrono; +#define S2LP_USE_CHRONO +#define S2LP_TIME_50US 50us +#define S2LP_TIME_10MS 10ms +#else +#define S2LP_TIME_10MS 10 +#endif + +using namespace mbed; +using namespace rtos; + +#define TRACE_GROUP "s2lp" + +#define INTERRUPT_GPIO S2LP_GPIO3 + +#if INTERRUPT_GPIO == S2LP_GPIO0 +#define INT_IN_GPIO rf->RF_S2LP_GPIO0 +#elif INTERRUPT_GPIO == S2LP_GPIO1 +#define INT_IN_GPIO rf->RF_S2LP_GPIO1 +#elif INTERRUPT_GPIO == S2LP_GPIO2 +#define INT_IN_GPIO rf->RF_S2LP_GPIO2 +#else +#define INT_IN_GPIO rf->RF_S2LP_GPIO3 +#endif + +#ifdef TEST_GPIOS_ENABLED +#define TEST_TX_STARTED test_pins->TEST1 = 1; +#define TEST_TX_DONE test_pins->TEST1 = 0; +#define TEST_RX_STARTED test_pins->TEST2 = 1; +#define TEST_RX_DONE test_pins->TEST2 = 0; +#define TEST_CSMA_STARTED test_pins->TEST3 = 1; +#define TEST_CSMA_DONE test_pins->TEST3 = 0; +#define TEST_SPARE_1_ON test_pins->TEST4 = 1; +#define TEST_SPARE_1_OFF test_pins->TEST4 = 0; +#define TEST_SPARE_2_ON test_pins->TEST5 = 1; +#define TEST_SPARE_2_OFF test_pins->TEST5 = 0; +extern void (*fhss_uc_switch)(void); +extern void (*fhss_bc_switch)(void); +#else //TEST_GPIOS_ENABLED +#define TEST_TX_STARTED +#define TEST_TX_DONE +#define TEST_RX_STARTED +#define TEST_RX_DONE +#define TEST_CSMA_STARTED +#define TEST_CSMA_DONE +#define TEST_SPARE_1_ON +#define TEST_SPARE_1_OFF +#define TEST_SPARE_2_ON +#define TEST_SPARE_2_OFF +#endif //TEST_GPIOS_ENABLED + +#define MAC_FRAME_TYPE_MASK 0x07 +#define MAC_FRAME_BEACON (0) +#define MAC_TYPE_DATA (1) +#define MAC_TYPE_ACK (2) +#define MAC_TYPE_COMMAND (3) +#define MAC_DATA_PENDING 0x10 +#define FC_DST_MODE 0x0C +#define FC_SRC_MODE 0xC0 +#define FC_DST_ADDR_NONE 0x00 +#define FC_DST_16_BITS 0x08 +#define FC_DST_64_BITS 0x0C +#define FC_SRC_64_BITS 0xC0 +#define FC_SEQUENCE_COMPRESSION 0x01 +#define FC_AR 0x20 +#define FC_PAN_ID_COMPRESSION 0x40 +#define VERSION_FIELD_MASK 0x30 +#define SHIFT_SEQ_COMP_FIELD (0) +#define SHIFT_VERSION_FIELD (4) +#define SHIFT_PANID_COMP_FIELD (6) +#define OFFSET_DST_PAN_ID (3) +#define OFFSET_DST_ADDR (5) + +#define CS_SELECT() {rf->CS = 0;} +#define CS_RELEASE() {rf->CS = 1;} + +typedef enum { + RF_MODE_NORMAL = 0, + RF_MODE_SNIFFER = 1 +} rf_mode_e; + +class UnlockedSPI : public SPI { +public: + UnlockedSPI(PinName sdi, PinName sdo, PinName sclk) : + SPI(sdi, sdo, sclk) { } + virtual void lock() { } + virtual void unlock() { } +}; + +class RFPins { +public: + RFPins(PinName spi_sdi, PinName spi_sdo, + PinName spi_sclk, PinName spi_cs, PinName spi_sdn, + PinName spi_gpio0, PinName spi_gpio1, PinName spi_gpio2, + PinName spi_gpio3); + UnlockedSPI spi; + DigitalOut CS; + DigitalOut SDN; + InterruptIn RF_S2LP_GPIO0; + InterruptIn RF_S2LP_GPIO1; + InterruptIn RF_S2LP_GPIO2; + InterruptIn RF_S2LP_GPIO3; + Timeout cca_timer; + Timeout backup_timer; + Timer tx_timer; + Thread irq_thread; + Mutex mutex; + void rf_irq_task(); +}; + +RFPins::RFPins(PinName spi_sdi, PinName spi_sdo, + PinName spi_sclk, PinName spi_cs, PinName spi_sdn, + PinName spi_gpio0, PinName spi_gpio1, PinName spi_gpio2, + PinName spi_gpio3) + : spi(spi_sdi, spi_sdo, spi_sclk), + CS(spi_cs), + SDN(spi_sdn), + RF_S2LP_GPIO0(spi_gpio0), + RF_S2LP_GPIO1(spi_gpio1), + RF_S2LP_GPIO2(spi_gpio2), + RF_S2LP_GPIO3(spi_gpio3), + irq_thread(osPriorityRealtime, 1024) +{ + irq_thread.start(mbed::callback(this, &RFPins::rf_irq_task)); +} + +class TestPins_S2LP { +public: + TestPins_S2LP(PinName test_pin_1, PinName test_pin_2, PinName test_pin_3, PinName test_pin_4, PinName test_pin_5); + DigitalOut TEST1; + DigitalOut TEST2; + DigitalOut TEST3; + DigitalOut TEST4; + DigitalOut TEST5; +}; + +TestPins_S2LP::TestPins_S2LP(PinName test_pin_1, PinName test_pin_2, PinName test_pin_3, PinName test_pin_4, PinName test_pin_5) + : TEST1(test_pin_1), + TEST2(test_pin_2), + TEST3(test_pin_3), + TEST4(test_pin_4), + TEST5(test_pin_5) +{ +} + +static uint8_t rf_read_register(uint8_t addr); +static s2lp_states_e rf_read_state(void); +static void rf_write_register(uint8_t addr, uint8_t data); +static void rf_interrupt_handler(void); +static void rf_receive(uint8_t rx_channel); +static void rf_cca_timer_stop(void); +static void rf_backup_timer_start(uint32_t slots); +static void rf_backup_timer_stop(void); +static void rf_rx_ready_handler(void); +static uint32_t read_irq_status(void); +static bool rf_rx_filter(uint8_t *mac_header, uint8_t *mac_64bit_addr, uint8_t *mac_16bit_addr, uint8_t *pan_id); +static void rf_cca_timer_start(uint32_t slots); + +static RFPins *rf; +#ifdef TEST_GPIOS_ENABLED +static TestPins_S2LP *test_pins; +#endif +static phy_device_driver_s device_driver; +static int8_t rf_radio_driver_id = -1; +static uint8_t *tx_data_ptr; +static uint16_t tx_data_length; +static uint16_t rx_data_length; +static uint32_t enabled_interrupts; +static uint8_t mac_tx_handle; +static uint8_t rf_rx_channel; +static uint8_t rf_new_channel; +static uint8_t rx_buffer[RF_MTU]; +static rf_states_e rf_state = RF_IDLE; +// This will be used when given channel spacing cannot be supported by transceiver +static uint8_t rf_channel_multiplier = 1; +static uint16_t tx_sequence = 0xffff; +static uint32_t tx_time = 0; +static uint32_t rx_time = 0; +static uint32_t tx_finnish_time = 0; +static uint32_t rf_symbol_rate; +static bool cca_enabled = true; +static uint8_t s2lp_PAN_ID[2] = {0xff, 0xff}; +static uint8_t s2lp_short_address[2]; +static uint8_t s2lp_MAC[8]; +static rf_mode_e rf_mode = RF_MODE_NORMAL; +static bool rf_update_config = false; +static bool rf_update_cca_threshold = false; +static uint16_t cur_packet_len = 0xffff; +static uint32_t receiver_ready_timestamp; +static int16_t rssi_threshold = RSSI_THRESHOLD; +static uint32_t tx_start_time = 0; + +/* Channel configurations for sub-GHz */ +static phy_rf_channel_configuration_s phy_subghz = { + .channel_0_center_frequency = 868300000U, + .channel_spacing = 500000U, + .datarate = 250000U, + .number_of_channels = 11U, + .modulation = M_2FSK, + .modulation_index = MODULATION_INDEX_UNDEFINED +}; + + +static const phy_device_channel_page_s phy_channel_pages[] = { + { CHANNEL_PAGE_2, &phy_subghz}, + { CHANNEL_PAGE_0, NULL} +}; + + +#include "rtos.h" + +static void rf_irq_task_process_irq(); + +#define SIG_ALL (SIG_RADIO|SIG_TIMER_CCA|SIG_TIMER_BACKUP) +#define SIG_RADIO 1 +#define SIG_TIMER_CCA 2 +#define SIG_TIMER_BACKUP 4 + + +#define ACK_FRAME_LENGTH 3 +// Give some additional time for processing, PHY headers, CRC etc. +#define PACKET_SENDING_EXTRA_TIME 5000 +#define MAX_PACKET_SENDING_TIME (uint32_t)(8000000/phy_subghz.datarate)*FIFO_SIZE + PACKET_SENDING_EXTRA_TIME +#define ACK_SENDING_TIME (uint32_t)(8000000/phy_subghz.datarate)*ACK_FRAME_LENGTH + PACKET_SENDING_EXTRA_TIME + +#ifdef TEST_GPIOS_ENABLED +static void test1_toggle(void) +{ + if (test_pins->TEST4) { + test_pins->TEST4 = 0; + } else { + test_pins->TEST4 = 1; + } +} +static void test2_toggle(void) +{ + if (test_pins->TEST5) { + test_pins->TEST5 = 0; + } else { + test_pins->TEST5 = 1; + } +} +#endif //TEST_GPIOS_ENABLED + +static void rf_calculate_symbol_rate(uint32_t baudrate, phy_modulation_e modulation) +{ + (void) modulation; + uint8_t bits_in_symbols = 1; + rf_symbol_rate = baudrate / bits_in_symbols; +} + +static uint32_t rf_get_timestamp(void) +{ +#ifdef S2LP_USE_CHRONO + return (uint32_t)rf->tx_timer.elapsed_time().count(); +#else + return (uint32_t)rf->tx_timer.read_us(); +#endif +} + +static void rf_update_tx_active_time(void) +{ + if (device_driver.phy_rf_statistics) { + device_driver.phy_rf_statistics->tx_active_time += rf_get_timestamp() - tx_start_time; + } +} + +static void rf_update_rx_active_time(void) +{ + if (device_driver.phy_rf_statistics) { + device_driver.phy_rf_statistics->rx_active_time += rf_get_timestamp() - rx_time; + } +} + +static void rf_lock(void) +{ + platform_enter_critical(); +} + +static void rf_unlock(void) +{ + platform_exit_critical(); +} + +static void rf_cca_timer_signal(void) +{ + rf->irq_thread.flags_set(SIG_TIMER_CCA); +} + +static void rf_backup_timer_signal(void) +{ + rf->irq_thread.flags_set(SIG_TIMER_BACKUP); +} + +/* + * \brief Function writes/read data in SPI interface + */ +static void rf_spi_exchange(const void *tx, size_t tx_len, void *rx, size_t rx_len) +{ + rf->spi.write(static_cast(tx), tx_len, static_cast(rx), rx_len); +} + +static uint8_t rf_read_register(uint8_t addr) +{ + const uint8_t tx[2] = {SPI_RD_REG, addr}; + uint8_t rx[3]; + rf_lock(); + CS_SELECT(); + rf_spi_exchange(tx, sizeof(tx), rx, sizeof(rx)); + CS_RELEASE(); + rf_unlock(); + return rx[2]; +} + +static void rf_write_register(uint8_t addr, uint8_t data) +{ + const uint8_t tx[3] = {SPI_WR_REG, addr, data}; + rf_lock(); + CS_SELECT(); + rf_spi_exchange(tx, sizeof(tx), NULL, 0); + CS_RELEASE(); + rf_unlock(); +} + +static void rf_write_register_field(uint8_t addr, uint8_t field, uint8_t value) +{ + uint8_t reg_tmp = rf_read_register(addr); + reg_tmp &= ~field; + reg_tmp |= value; + rf_write_register(addr, reg_tmp); +} + +static s2lp_states_e rf_read_state(void) +{ + return (s2lp_states_e)(rf_read_register(MC_STATE0) >> 1); +} + +static void rf_poll_state_change(s2lp_states_e state) +{ + uint16_t break_counter = 0; + while (state != rf_read_state()) { + if (break_counter++ == 0xffff) { + tr_err("Failed to change state from %x to: %x", rf_read_state(), state); + break; + } + } +} + +static void rf_enable_gpio_signal(uint8_t gpio_pin, uint8_t interrupt_signal, uint8_t gpio_mode) +{ + rf_write_register(GPIO0_CONF + gpio_pin, (interrupt_signal << 3) | gpio_mode); +} + +static void rf_enable_interrupt(uint8_t event) +{ + if (enabled_interrupts & (1 << event)) { + return; + } + rf_write_register_field(IRQ_MASK0 - (event / 8), 1 << (event % 8), 1 << (event % 8)); + enabled_interrupts |= (1 << event); +} + +static void rf_disable_interrupt(uint8_t event) +{ + if (!(enabled_interrupts & (1 << event))) { + return; + } + rf_write_register_field(IRQ_MASK0 - (event / 8), 1 << (event % 8), 0 << (event % 8)); + enabled_interrupts &= ~(1 << event); +} + +static void rf_disable_all_interrupts(void) +{ + if ((uint8_t)enabled_interrupts & 0xff) { + rf_write_register(IRQ_MASK0, 0); + } + if ((uint8_t)(enabled_interrupts >> 8) & 0xff) { + rf_write_register(IRQ_MASK1, 0); + } + if ((uint8_t)(enabled_interrupts >> 16) & 0xff) { + rf_write_register(IRQ_MASK2, 0); + } + if ((uint8_t)(enabled_interrupts >> 24) & 0xff) { + rf_write_register(IRQ_MASK3, 0); + } + enabled_interrupts = 0; + read_irq_status(); +} + +static void rf_enable_gpio_interrupt(void) +{ + rf_enable_gpio_signal(INTERRUPT_GPIO, NIRQ, DIG_OUT_HIGH); + INT_IN_GPIO.mode(PullUp); + INT_IN_GPIO.fall(&rf_interrupt_handler); + INT_IN_GPIO.enable_irq(); +} + +static void rf_send_command(s2lp_commands_e command) +{ + const uint8_t tx[2] = {SPI_CMD, command}; + rf_lock(); + CS_SELECT(); + rf_spi_exchange(tx, sizeof(tx), NULL, 0); + CS_RELEASE(); + rf_unlock(); +} + +static void rf_state_change(s2lp_states_e state, bool lock_mode_tx) +{ + s2lp_commands_e command; + + if (S2LP_STATE_READY == state) { + s2lp_states_e cur_state = rf_read_state(); + if (S2LP_STATE_TX == cur_state || S2LP_STATE_RX == cur_state) { + command = S2LP_CMD_SABORT; + } else { + command = S2LP_CMD_READY; + } + } else if (S2LP_STATE_LOCK == state && lock_mode_tx) { + command = S2LP_CMD_LOCKTX; + } else if (S2LP_STATE_LOCK == state && !lock_mode_tx) { + command = S2LP_CMD_LOCKRX; + } else if (S2LP_STATE_RX == state) { + command = S2LP_CMD_RX; + } else if (S2LP_STATE_TX == state) { + command = S2LP_CMD_TX; + } else { + tr_err("Invalid state %x", state); + return; + } + rf_send_command(command); + rf_poll_state_change(state); +} + +static uint8_t rf_write_tx_fifo(uint8_t *ptr, uint16_t length) +{ + uint8_t free_bytes_in_fifo = FIFO_SIZE - rf_read_register(TX_FIFO_STATUS); + const uint8_t spi_header[SPI_HEADER_LENGTH] = {SPI_WR_REG, TX_FIFO}; + uint8_t written_length = length; + if (length > free_bytes_in_fifo) { + written_length = free_bytes_in_fifo; + } + CS_SELECT(); + rf_spi_exchange(spi_header, SPI_HEADER_LENGTH, NULL, 0); + rf_spi_exchange(ptr, written_length, NULL, 0); + CS_RELEASE(); + return written_length; +} + +static int rf_read_rx_fifo(uint16_t rx_index, uint16_t length) +{ + if ((rx_index + length) > RF_MTU) { + return -1; + } + uint8_t *ptr = &rx_buffer[rx_index]; + const uint8_t spi_header[SPI_HEADER_LENGTH] = {SPI_RD_REG, RX_FIFO}; + CS_SELECT(); + rf_spi_exchange(spi_header, SPI_HEADER_LENGTH, NULL, 0); + rf_spi_exchange(NULL, 0, ptr, length); + CS_RELEASE(); + return length; +} + +static void rf_flush_tx_fifo(void) +{ + if (rf_read_register(TX_FIFO_STATUS)) { + rf_send_command(S2LP_CMD_FLUSHTXFIFO); + } +} + +static void rf_flush_rx_fifo(void) +{ + if (rf_read_register(RX_FIFO_STATUS)) { + rf_send_command(S2LP_CMD_FLUSHRXFIFO); + } +} + +static void rf_write_packet_length(uint16_t packet_length) +{ + if ((uint8_t)(cur_packet_len >> 8) != (packet_length / 256)) { + rf_write_register(PCKTLEN1, packet_length / 256); + } + if ((uint8_t)cur_packet_len != (packet_length % 256)) { + rf_write_register(PCKTLEN0, packet_length % 256); + } + cur_packet_len = packet_length; +} + +static uint32_t read_irq_status(void) +{ + const uint8_t tx[2] = {SPI_RD_REG, IRQ_STATUS3}; + uint8_t rx[6]; + CS_SELECT(); + rf_spi_exchange(tx, sizeof(tx), rx, sizeof(rx)); + CS_RELEASE(); + return (((uint32_t)rx[2] << 24) | ((uint32_t)rx[3] << 16) | ((uint32_t)rx[4] << 8) | rx[5]); +} + +static void rf_set_channel_configuration_registers(void) +{ + // Set RSSI threshold + uint8_t rssi_th; + rf_conf_calculate_rssi_threshold_registers(rssi_threshold, &rssi_th); + rf_write_register(RSSI_TH, rssi_th); + // Set deviation + uint32_t deviation = rf_conf_calculate_deviation(phy_subghz.modulation_index, phy_subghz.datarate); + if (!deviation) { + deviation = DEFAULT_DEVIATION; + } + uint8_t fdev_m, fdev_e; + rf_conf_calculate_deviation_registers(deviation, &fdev_m, &fdev_e); + rf_write_register(MOD0, fdev_m); + rf_write_register_field(MOD1, FDEV_E_FIELD, fdev_e); + + // Set datarate + uint16_t datarate_m; + uint8_t datarate_e; + rf_conf_calculate_datarate_registers(phy_subghz.datarate, &datarate_m, &datarate_e); + rf_write_register_field(MOD2, DATARATE_E_FIELD, datarate_e); + rf_write_register(MOD3, (uint8_t)datarate_m); + rf_write_register(MOD4, datarate_m >> 8); + // Set RX filter bandwidth, using channel spacing as RX filter bandwidth + uint8_t chflt_m, chflt_e; + rf_conf_calculate_rx_filter_bandwidth_registers(phy_subghz.channel_spacing, &chflt_m, &chflt_e); + rf_write_register_field(CHFLT, CHFLT_M_FIELD, chflt_m << 4); + rf_write_register_field(CHFLT, CHFLT_E_FIELD, chflt_e); + // Set base frequency (Channel 0 center frequency) + uint8_t synt3, synt2, synt1, synt0; + rf_conf_calculate_base_frequency_registers(phy_subghz.channel_0_center_frequency, &synt3, &synt2, &synt1, &synt0); + rf_write_register_field(SYNT3, SYNT_FIELD, synt3); + rf_write_register(SYNT2, synt2); + rf_write_register(SYNT1, synt1); + rf_write_register(SYNT0, synt0); + // Set channel spacing + uint8_t ch_space; + uint8_t ch_space_divider = 1; + while (rf_conf_calculate_channel_spacing_registers(phy_subghz.channel_spacing / ch_space_divider, &ch_space)) { + ch_space_divider++; + rf_channel_multiplier++; + } + rf_write_register(CHSPACE, ch_space); + /* Preamble is set for S2-LP as repetitions of 01 or 10 pair + * + * For datarate < 150kbps, using phyFskPreambleLength = 8 repetitions of 01010101 + * For datarate >= 150kbps and datarate < 300kbps, using phyFskPreambleLength = 12 repetitions of 01010101 + * For datarate >= 300kbps, using phyFskPreambleLength = 24 repetitions of 01010101 + */ + uint8_t preamble_len = 24 * 4; + if (phy_subghz.datarate < 150000) { + preamble_len = 8 * 4; + } else if (phy_subghz.datarate < 300000) { + preamble_len = 12 * 4; + } + rf_write_register(PCKTCTRL5, preamble_len); +} + +static void rf_init_registers(void) +{ + rf_write_register_field(PCKTCTRL3, PCKT_FORMAT_FIELD, PCKT_FORMAT_802_15_4); + rf_write_register_field(MOD2, MOD_TYPE_FIELD, MOD_2FSK); + rf_write_register(PCKT_FLT_OPTIONS, 0); + rf_write_register_field(PCKTCTRL1, PCKT_CRCMODE_FIELD, PCKT_CRCMODE_0x04C11DB7); + rf_write_register_field(PCKTCTRL1, PCKT_TXSOURCE_FIELD, PCKT_TXSOURCE_NORMAL); + rf_write_register_field(PCKTCTRL1, PCKT_WHITENING_FIELD, PCKT_WHITENING_ENABLED); + rf_write_register_field(PCKTCTRL2, PCKT_FIXVARLEN_FIELD, PCKT_VARIABLE_LEN); + rf_write_register_field(PCKTCTRL2, PCKT_FCS_TYPE_FIELD, PCKT_FCS_TYPE_4_OCTET); + rf_write_register_field(PCKTCTRL3, PCKT_RXMODE_FIELD, PCKT_RXMODE_NORMAL); + rf_write_register_field(PCKTCTRL3, PCKT_BYTE_SWAP_FIELD, PCKT_BYTE_SWAP_LSB); + rf_write_register_field(PCKTCTRL6, PCKT_SYNCLEN_FIELD, PCKT_SYNCLEN); + rf_write_register_field(QI, PQI_TH_FIELD, PQI_TH); + rf_write_register_field(QI, SQI_EN_FIELD, SQI_EN); + rf_write_register(SYNC0, SFD0); + rf_write_register(SYNC1, SFD1); + rf_set_channel_configuration_registers(); +} + +static int8_t rf_address_write(phy_address_type_e address_type, uint8_t *address_ptr) +{ + int8_t ret_val = 0; + switch (address_type) { + /*Set 48-bit address*/ + case PHY_MAC_48BIT: + break; + /*Set 64-bit address*/ + case PHY_MAC_64BIT: + memcpy(s2lp_MAC, address_ptr, 8); + break; + /*Set 16-bit address*/ + case PHY_MAC_16BIT: + memcpy(s2lp_short_address, address_ptr, 2); + break; + /*Set PAN Id*/ + case PHY_MAC_PANID: + memcpy(s2lp_PAN_ID, address_ptr, 2); + break; + } + return ret_val; +} + +static int8_t rf_extension(phy_extension_type_e extension_type, uint8_t *data_ptr) +{ + int8_t retval = 0; + phy_csma_params_t *csma_params; + phy_rf_channel_configuration_s *channel_params; + uint32_t *timer_value; + switch (extension_type) { + case PHY_EXTENSION_SET_CHANNEL: + if (rf_state == RF_IDLE || rf_state == RF_CSMA_STARTED) { + rf_receive(*data_ptr); + } else { + // Store the new channel if couldn't change it yet. + rf_new_channel = *data_ptr; + retval = -1; + } + break; + case PHY_EXTENSION_CTRL_PENDING_BIT: + break; + /*Return frame pending status*/ + case PHY_EXTENSION_READ_LAST_ACK_PENDING_STATUS: + break; + case PHY_EXTENSION_ACCEPT_ANY_BEACON: + break; + case PHY_EXTENSION_SET_TX_TIME: + tx_time = common_read_32_bit(data_ptr); + break; + case PHY_EXTENSION_READ_RX_TIME: + common_write_32_bit(rx_time, data_ptr); + break; + case PHY_EXTENSION_DYNAMIC_RF_SUPPORTED: + *data_ptr = true; + break; + case PHY_EXTENSION_GET_TIMESTAMP: + timer_value = (uint32_t *)data_ptr; + *timer_value = rf_get_timestamp(); + break; + case PHY_EXTENSION_SET_CSMA_PARAMETERS: + csma_params = (phy_csma_params_t *)data_ptr; + if (csma_params->backoff_time == 0) { + rf_cca_timer_stop(); + if (rf_read_register(TX_FIFO_STATUS)) { + rf_send_command(S2LP_CMD_SABORT); + rf_poll_state_change(S2LP_STATE_READY); + rf_send_command(S2LP_CMD_FLUSHTXFIFO); + rf_poll_state_change(S2LP_STATE_READY); + } + if (rf_state == RF_TX_STARTED) { + rf_state = RF_IDLE; + rf_receive(rf_rx_channel); + } + tx_time = 0; + } else { + tx_time = csma_params->backoff_time; + cca_enabled = csma_params->cca_enabled; + } + break; + case PHY_EXTENSION_READ_TX_FINNISH_TIME: + timer_value = (uint32_t *)data_ptr; + *timer_value = tx_finnish_time; + break; + + case PHY_EXTENSION_GET_SYMBOLS_PER_SECOND: + timer_value = (uint32_t *)data_ptr; + *timer_value = rf_symbol_rate; + break; + case PHY_EXTENSION_SET_RF_CONFIGURATION: + channel_params = (phy_rf_channel_configuration_s *)data_ptr; + phy_subghz.datarate = channel_params->datarate; + phy_subghz.channel_spacing = channel_params->channel_spacing; + phy_subghz.channel_0_center_frequency = channel_params->channel_0_center_frequency; + phy_subghz.number_of_channels = channel_params->number_of_channels; + phy_subghz.modulation = channel_params->modulation; + phy_subghz.modulation_index = channel_params->modulation_index; + rf_calculate_symbol_rate(phy_subghz.datarate, phy_subghz.modulation); + rf_update_config = true; + if (rf_state == RF_IDLE) { + rf_receive(rf_rx_channel); + } + break; + case PHY_EXTENSION_SET_TX_POWER: + // TODO: Set TX output power + break; + case PHY_EXTENSION_SET_CCA_THRESHOLD: + rssi_threshold = rf_conf_cca_threshold_percent_to_rssi(*data_ptr); + rf_update_config = true; + if (rf_state == RF_IDLE) { + rf_receive(rf_rx_channel); + } + break; + case PHY_EXTENSION_SET_CHANNEL_CCA_THRESHOLD: + if ((rssi_threshold != (int8_t)*data_ptr) && (rf_state != RF_RX_STARTED)) { + rssi_threshold = (int8_t)*data_ptr; // *NOPAD* + rf_update_cca_threshold = true; + rf_receive(rf_rx_channel); + } + break; + default: + break; + } + + return retval; +} + + +static int8_t rf_interface_state_control(phy_interface_state_e new_state, uint8_t rf_channel) +{ + int8_t ret_val = 0; + switch (new_state) { + /*Reset PHY driver and set to idle*/ + case PHY_INTERFACE_RESET: + break; + /*Disable PHY Interface driver*/ + case PHY_INTERFACE_DOWN: + rf_lock(); + rf_send_command(S2LP_CMD_SABORT); + rf_disable_all_interrupts(); + rf_poll_state_change(S2LP_STATE_READY); + rf_flush_rx_fifo(); + rf_flush_tx_fifo(); + rf_state = RF_IDLE; + rf_unlock(); + break; + /*Enable PHY Interface driver*/ + case PHY_INTERFACE_UP: + rf_mode = RF_MODE_NORMAL; + rf_receive(rf_channel); + break; + /*Enable wireless interface ED scan mode*/ + case PHY_INTERFACE_RX_ENERGY_STATE: + break; + /*Enable Sniffer state*/ + case PHY_INTERFACE_SNIFFER_STATE: + rf_mode = RF_MODE_SNIFFER; + rf_receive(rf_channel); + break; + } + return ret_val; +} + +static void rf_tx_sent_handler(void) +{ + TEST_TX_DONE + rf_backup_timer_stop(); + rf_disable_interrupt(TX_DATA_SENT); + rf_update_tx_active_time(); + if (rf_state != RF_TX_ACK) { + tx_finnish_time = rf_get_timestamp(); + rf_state = RF_IDLE; + rf_receive(rf_rx_channel); + if (device_driver.phy_tx_done_cb) { + device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_TX_SUCCESS, 0, 0); + } + } else { + rf_receive(rf_rx_channel); + } +} + +static void rf_tx_threshold_handler(void) +{ + rf_backup_timer_stop(); + rf_disable_interrupt(TX_FIFO_ALMOST_EMPTY); + // TODO check the FIFO threshold. By default, threshold is half of the FIFO size + uint8_t written_length = rf_write_tx_fifo(tx_data_ptr, tx_data_length); + if (written_length < tx_data_length) { + tx_data_ptr += written_length; + tx_data_length -= written_length; + rf_enable_interrupt(TX_FIFO_ALMOST_EMPTY); + } + rf_backup_timer_start(MAX_PACKET_SENDING_TIME); +} + +static void rf_start_tx(void) +{ + rf_send_command(S2LP_CMD_SABORT); + rf_disable_all_interrupts(); + rf_poll_state_change(S2LP_STATE_READY); + rf_state_change(S2LP_STATE_TX, false); + tx_start_time = rf_get_timestamp(); + // More TX data to be written in FIFO when TX threshold interrupt occurs + if (tx_data_ptr) { + rf_enable_interrupt(TX_FIFO_ALMOST_EMPTY); + } + rf_enable_interrupt(TX_DATA_SENT); + rf_enable_interrupt(TX_FIFO_UNF_OVF); + rf_backup_timer_start(MAX_PACKET_SENDING_TIME); +} + +static int rf_cca_check(void) +{ + uint32_t time_from_receiver_ready = rf_get_timestamp() - receiver_ready_timestamp; + if (time_from_receiver_ready < RSSI_SETTLING_TIME) { + wait_us(RSSI_SETTLING_TIME - time_from_receiver_ready); + } + return (rf_read_register(LINK_QUALIF1) & CARRIER_SENSE); +} + +static void rf_cca_timer_interrupt(void) +{ + TEST_CSMA_DONE + int8_t status = device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_CCA_PREPARE, 0, 0); + if (status == PHY_TX_NOT_ALLOWED) { + rf_flush_tx_fifo(); + if (rf_state == RF_CSMA_STARTED) { + rf_state = RF_IDLE; + } + return; + } + if ((cca_enabled == true) && ((rf_state != RF_CSMA_STARTED && rf_state != RF_IDLE) || (read_irq_status() & (1 << SYNC_WORD)) || rf_cca_check())) { + if (rf_state == RF_CSMA_STARTED) { + rf_state = RF_IDLE; + } + rf_flush_tx_fifo(); + tx_finnish_time = rf_get_timestamp(); + if (device_driver.phy_tx_done_cb) { + if (rf_state == RF_RX_STARTED) { + device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_CCA_FAIL_RX, 0, 0); + } else { + device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_CCA_FAIL, 0, 0); + } + } + } else { + if (status == PHY_RESTART_CSMA) { + if (device_driver.phy_tx_done_cb) { + device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_CCA_OK, 0, 0); + } + if (tx_time) { + uint32_t backoff_time = tx_time - rf_get_timestamp(); + // Max. time to TX can be 65ms, otherwise time has passed already -> send immediately + if (backoff_time > 65000) { + backoff_time = 1; + } + rf_cca_timer_start(backoff_time); + } + } else { + rf_start_tx(); + rf_state = RF_TX_STARTED; + TEST_TX_STARTED + if (device_driver.phy_rf_statistics) { + device_driver.phy_rf_statistics->tx_bytes += tx_data_length; + } + } + } +} + +static void rf_cca_timer_stop(void) +{ + TEST_CSMA_DONE + rf->cca_timer.detach(); +} + +static void rf_cca_timer_start(uint32_t slots) +{ +#ifdef S2LP_USE_CHRONO + rf->cca_timer.attach(rf_cca_timer_signal, microseconds(slots)); +#else + rf->cca_timer.attach_us(rf_cca_timer_signal, slots); +#endif + TEST_CSMA_STARTED +} + +static void rf_backup_timer_interrupt(void) +{ + tx_finnish_time = rf_get_timestamp(); + if (rf_state == RF_RX_STARTED) { + rf_update_rx_active_time(); + if (device_driver.phy_rf_statistics) { + device_driver.phy_rf_statistics->rx_timeouts++; + } + } else { + rf_update_tx_active_time(); + if (device_driver.phy_rf_statistics) { + device_driver.phy_rf_statistics->tx_timeouts++; + } + } + if (rf_state == RF_TX_STARTED) { + if (device_driver.phy_tx_done_cb) { + device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_TX_SUCCESS, 0, 0); + } + } + rf_flush_tx_fifo(); + TEST_TX_DONE + TEST_RX_DONE + rf_state = RF_IDLE; + rf_receive(rf_rx_channel); +} + +static void rf_backup_timer_stop(void) +{ + rf->backup_timer.detach(); +} + +static void rf_backup_timer_start(uint32_t slots) +{ +#ifdef S2LP_USE_CHRONO + rf->backup_timer.attach(rf_backup_timer_signal, microseconds(slots)); +#else + rf->backup_timer.attach_us(rf_backup_timer_signal, slots); +#endif +} + +static int8_t rf_start_cca(uint8_t *data_ptr, uint16_t data_length, uint8_t tx_handle, data_protocol_e data_protocol) +{ + rf_lock(); + if (rf_state != RF_IDLE) { + rf_unlock(); + return -1; + } + rf_state = RF_CSMA_STARTED; + uint8_t written_length = rf_write_tx_fifo(data_ptr, data_length); + if (written_length < data_length) { + tx_data_ptr = data_ptr + written_length; + tx_data_length = data_length - written_length; + } else { + tx_data_ptr = NULL; + } + // If Ack is requested, store the MAC sequence. This will be compared with received Ack. + uint8_t version = ((*(data_ptr + 1) & VERSION_FIELD_MASK) >> SHIFT_VERSION_FIELD); + if ((version != MAC_FRAME_VERSION_2) && (*data_ptr & FC_AR)) { + tx_sequence = *(data_ptr + 2); + } + // TODO: Define this better + rf_write_packet_length(data_length + 4); + mac_tx_handle = tx_handle; + if (tx_time) { + uint32_t backoff_time = tx_time - rf_get_timestamp(); + // Max. time to TX can be 65ms, otherwise time has passed already -> send immediately + if (backoff_time <= 65000) { + rf_cca_timer_start(backoff_time); + rf_unlock(); + return 0; + } + } + // Short timeout to start CCA immediately. + rf_cca_timer_start(1); + rf_unlock(); + return 0; +} + +static void rf_send_ack(uint8_t seq) +{ + rf_state = RF_TX_ACK; + uint8_t ack_frame[3] = {MAC_TYPE_ACK, 0, seq}; + rf_write_tx_fifo(ack_frame, sizeof(ack_frame)); + rf_write_packet_length(sizeof(ack_frame) + 4); + tx_data_ptr = NULL; + rf_start_tx(); + TEST_TX_STARTED + rf_backup_timer_start(ACK_SENDING_TIME); + if (device_driver.phy_rf_statistics) { + device_driver.phy_rf_statistics->tx_bytes += sizeof(ack_frame); + } +} + +static void rf_handle_ack(uint8_t seq_number, uint8_t pending) +{ + phy_link_tx_status_e phy_status; + if (tx_sequence == (uint16_t)seq_number) { + tx_finnish_time = rf_get_timestamp(); + if (pending) { + phy_status = PHY_LINK_TX_DONE_PENDING; + } else { + phy_status = PHY_LINK_TX_DONE; + } + // No CCA attempts done, just waited Ack + device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, phy_status, 0, 0); + // Clear TX sequence when Ack is received to avoid duplicate Acks + tx_sequence = 0xffff; + } +} + +static void rf_rx_ready_handler(void) +{ + rf_backup_timer_stop(); + TEST_RX_DONE + rf_flush_tx_fifo(); + int rx_read_length = rf_read_rx_fifo(rx_data_length, rf_read_register(RX_FIFO_STATUS)); + if (rx_read_length < 0) { + rf_receive(rf_rx_channel); + return; + } + rx_data_length += rx_read_length; + if (rf_mode != RF_MODE_SNIFFER) { + rf_state = RF_IDLE; + uint8_t version = ((rx_buffer[1] & VERSION_FIELD_MASK) >> SHIFT_VERSION_FIELD); + if (((rx_buffer[0] & MAC_FRAME_TYPE_MASK) == MAC_TYPE_ACK) && (version < MAC_FRAME_VERSION_2)) { + rf_handle_ack(rx_buffer[2], rx_buffer[0] & MAC_DATA_PENDING); + } else if (rf_rx_filter(rx_buffer, s2lp_MAC, s2lp_short_address, s2lp_PAN_ID)) { + int8_t rssi = (rf_read_register(RSSI_LEVEL) - RSSI_OFFSET); + if (device_driver.phy_rx_cb) { + device_driver.phy_rx_cb(rx_buffer, rx_data_length, 0xf0, rssi, rf_radio_driver_id); + } + // Check Ack request + if ((version != MAC_FRAME_VERSION_2) && (rx_buffer[0] & FC_AR)) { + rf_send_ack(rx_buffer[2]); + } + } + if (device_driver.phy_rf_statistics) { + device_driver.phy_rf_statistics->rx_bytes += rx_data_length; + } + } else { + rf_state = RF_IDLE; + int8_t rssi = (rf_read_register(RSSI_LEVEL) - RSSI_OFFSET); + if (device_driver.phy_rx_cb) { + device_driver.phy_rx_cb(rx_buffer, rx_data_length, 0xf0, rssi, rf_radio_driver_id); + } + } + if ((rf_state != RF_TX_ACK) && (rf_state != RF_CSMA_STARTED)) { + rf_receive(rf_rx_channel); + } +} + +static void rf_rx_threshold_handler(void) +{ + rf_backup_timer_stop(); + int rx_read_length = rf_read_rx_fifo(rx_data_length, rf_read_register(RX_FIFO_STATUS)); + if (rx_read_length < 0) { + rf_receive(rf_rx_channel); + return; + } + rx_data_length += rx_read_length; + rf_backup_timer_start(MAX_PACKET_SENDING_TIME); +} + +static void rf_sync_detected_handler(void) +{ + rx_time = rf_get_timestamp(); + rf_state = RF_RX_STARTED; + TEST_RX_STARTED + rf_disable_interrupt(SYNC_WORD); + rf_enable_interrupt(RX_FIFO_ALMOST_FULL); + rf_enable_interrupt(RX_DATA_READY); + rf_backup_timer_start(MAX_PACKET_SENDING_TIME); +} + +static void rf_receive(uint8_t rx_channel) +{ + if (rf_state == RF_TX_STARTED) { + return; + } + rf_lock(); + rf_send_command(S2LP_CMD_SABORT); + rf_disable_all_interrupts(); + rf_poll_state_change(S2LP_STATE_READY); + rf_flush_rx_fifo(); + if (rf_update_config == true) { + rf_channel_multiplier = 1; + rf_update_config = false; + rf_set_channel_configuration_registers(); + } + if (rf_update_cca_threshold == true) { + rf_update_cca_threshold = false; + uint8_t rssi_th; + rf_conf_calculate_rssi_threshold_registers(rssi_threshold, &rssi_th); + rf_write_register(RSSI_TH, rssi_th); + } + if (rx_channel != rf_rx_channel) { + rf_write_register(CHNUM, rx_channel * rf_channel_multiplier); + rf_rx_channel = rf_new_channel = rx_channel; + } + rf_send_command(S2LP_CMD_RX); + rf_enable_interrupt(SYNC_WORD); + rf_enable_interrupt(RX_FIFO_UNF_OVF); + rx_data_length = 0; + if (rf_state != RF_CSMA_STARTED) { + rf_state = RF_IDLE; + } + rf_poll_state_change(S2LP_STATE_RX); + receiver_ready_timestamp = rf_get_timestamp(); + rf_unlock(); +} + +static void rf_interrupt_handler(void) +{ + rf->irq_thread.flags_set(SIG_RADIO); +} + +void RFPins::rf_irq_task(void) +{ + for (;;) { + uint32_t flags = ThisThread::flags_wait_any(SIG_ALL); + rf_lock(); + if (flags & SIG_RADIO) { + rf_irq_task_process_irq(); + } + if (flags & SIG_TIMER_CCA) { + rf_cca_timer_interrupt(); + } + if (flags & SIG_TIMER_BACKUP) { + rf_backup_timer_interrupt(); + } + rf_unlock(); + } +} + +static void rf_irq_task_process_irq(void) +{ + rf_lock(); + uint32_t irq_status = read_irq_status(); + if (rf_state == RF_TX_STARTED || rf_state == RF_TX_ACK) { + if ((irq_status & (1 << TX_DATA_SENT)) && (enabled_interrupts & (1 << TX_DATA_SENT))) { + rf_tx_sent_handler(); + } + } + if (rf_state == RF_TX_STARTED) { + if ((irq_status & (1 << TX_FIFO_ALMOST_EMPTY)) && (enabled_interrupts & (1 << TX_FIFO_ALMOST_EMPTY))) { + rf_tx_threshold_handler(); + } + } + if ((irq_status & (1 << TX_FIFO_UNF_OVF)) && (enabled_interrupts & (1 << TX_FIFO_UNF_OVF))) { + rf_backup_timer_stop(); + tx_finnish_time = rf_get_timestamp(); + rf_update_tx_active_time(); + TEST_TX_DONE + device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_CCA_FAIL_RX, 1, 0); + rf_send_command(S2LP_CMD_SABORT); + rf_poll_state_change(S2LP_STATE_READY); + rf_send_command(S2LP_CMD_FLUSHTXFIFO); + rf_poll_state_change(S2LP_STATE_READY); + rf_state = RF_IDLE; + rf_receive(rf_rx_channel); + } + if (rf_state == RF_IDLE || rf_state == RF_CSMA_STARTED || rf_state == RF_TX_STARTED) { + if ((irq_status & (1 << SYNC_WORD)) && (enabled_interrupts & (1 << SYNC_WORD))) { + rf_sync_detected_handler(); + } + } else if (rf_state == RF_RX_STARTED) { + if ((irq_status & (1 << RX_DATA_READY)) && (enabled_interrupts & (1 << RX_DATA_READY))) { + rf_update_rx_active_time(); + if (!(irq_status & (1 << CRC_ERROR))) { + rf_rx_ready_handler(); + } else { + TEST_RX_DONE + rf_backup_timer_stop(); + rf_flush_tx_fifo(); + rf_state = RF_IDLE; + // In case the channel change was called during reception, driver is responsible to change the channel if CRC failed. + rf_receive(rf_new_channel); + if (device_driver.phy_rf_statistics) { + device_driver.phy_rf_statistics->crc_fails++; + } + } + } + if ((irq_status & (1 << RX_FIFO_ALMOST_FULL)) && (enabled_interrupts & (1 << RX_FIFO_ALMOST_FULL))) { + rf_rx_threshold_handler(); + } + if ((irq_status & (1 << RX_DATA_DISCARDED)) && (enabled_interrupts & (1 << RX_DATA_DISCARDED))) { + + } + if ((irq_status & (1 << CRC_ERROR)) && (enabled_interrupts & (1 << CRC_ERROR))) { + + } + } + if ((irq_status & (1 << RX_FIFO_UNF_OVF)) && (enabled_interrupts & (1 << RX_FIFO_UNF_OVF))) { + rf_update_rx_active_time(); + TEST_RX_DONE + rf_backup_timer_stop(); + rf_send_command(S2LP_CMD_SABORT); + rf_poll_state_change(S2LP_STATE_READY); + rf_send_command(S2LP_CMD_FLUSHRXFIFO); + rf_poll_state_change(S2LP_STATE_READY); + rf_flush_tx_fifo(); + rf_state = RF_IDLE; + rf_receive(rf_rx_channel); + } + rf_unlock(); +} + +static void rf_reset(void) +{ + // Shutdown + rf->SDN = 1; + ThisThread::sleep_for(S2LP_TIME_10MS); + // Wake up + rf->SDN = 0; + ThisThread::sleep_for(S2LP_TIME_10MS); +} + +static void rf_init(void) +{ +#ifdef TEST_GPIOS_ENABLED + fhss_bc_switch = test1_toggle; + fhss_uc_switch = test2_toggle; +#endif //TEST_GPIOS_ENABLED + rf_reset(); + rf->spi.frequency(10000000); + CS_RELEASE(); + rf_init_registers(); + rf_enable_gpio_interrupt(); + rf_calculate_symbol_rate(phy_subghz.datarate, phy_subghz.modulation); + rf->tx_timer.start(); +} + +static int8_t rf_device_register(const uint8_t *mac_addr) +{ + rf_init(); + /*Set pointer to MAC address*/ + device_driver.PHY_MAC = (uint8_t *)mac_addr; + device_driver.driver_description = (char *)"S2LP_MAC"; + device_driver.link_type = PHY_LINK_15_4_SUBGHZ_TYPE; + device_driver.phy_channel_pages = phy_channel_pages; + device_driver.phy_MTU = RF_MTU; + /*No header in PHY*/ + device_driver.phy_header_length = 0; + /*No tail in PHY*/ + device_driver.phy_tail_length = 0; + /*Set address write function*/ + device_driver.address_write = &rf_address_write; + /*Set RF extension function*/ + device_driver.extension = &rf_extension; + /*Set RF state control function*/ + device_driver.state_control = &rf_interface_state_control; + /*Set transmit function*/ + device_driver.tx = &rf_start_cca; + /*NULLIFY rx and tx_done callbacks*/ + device_driver.phy_rx_cb = NULL; + device_driver.phy_tx_done_cb = NULL; + /*Register device driver*/ + rf_radio_driver_id = arm_net_phy_register(&device_driver); + return rf_radio_driver_id; +} + +static void rf_device_unregister() +{ + if (rf_radio_driver_id >= 0) { + arm_net_phy_unregister(rf_radio_driver_id); + rf_radio_driver_id = -1; + } +} + +void NanostackRfPhys2lp::get_mac_address(uint8_t *mac) +{ + rf_lock(); + + if (NULL == rf) { + error("NanostackRfPhys2lp Must be registered to read mac address"); + rf_unlock(); + return; + } + memcpy((void *)mac, (void *)_mac_addr, sizeof(_mac_addr)); + + rf_unlock(); +} + +void NanostackRfPhys2lp::set_mac_address(uint8_t *mac) +{ + rf_lock(); + + if (NULL != rf) { + error("NanostackRfPhys2lp cannot change mac address when running"); + rf_unlock(); + return; + } + memcpy((void *)_mac_addr, (void *)mac, sizeof(_mac_addr)); + _mac_set = true; + + rf_unlock(); +} + +int8_t NanostackRfPhys2lp::rf_register() +{ + if (NULL == _rf) { + return -1; + } + rf_lock(); + if (rf != NULL) { + rf_unlock(); + error("Multiple registrations of NanostackRfPhyAtmel not supported"); + return -1; + } + + if (!_mac_set) { +#ifdef AT24MAC + int ret = _mac.read_eui64((void *)s2lp_MAC); + if (ret < 0) { + rf = NULL; + rf_unlock(); + return -1; + } +#else + randLIB_seed_random(); + randLIB_get_n_bytes_random(s2lp_MAC, 8); + s2lp_MAC[0] |= 2; //Set Local Bit + s2lp_MAC[0] &= ~1; //Clear multicast bit +#endif + set_mac_address(s2lp_MAC); + } + + rf = _rf; +#ifdef TEST_GPIOS_ENABLED + test_pins = _test_pins; +#endif + + int8_t radio_id = rf_device_register(_mac_addr); + if (radio_id < 0) { + rf = NULL; + } + rf_unlock(); + return radio_id; +} + +void NanostackRfPhys2lp::rf_unregister() +{ + rf_lock(); + if (NULL == rf) { + rf_unlock(); + return; + } + rf_device_unregister(); + rf = NULL; + rf_unlock(); +} + +NanostackRfPhys2lp::NanostackRfPhys2lp(PinName spi_sdi, PinName spi_sdo, PinName spi_sclk, PinName spi_cs, PinName spi_sdn + , PinName spi_gpio0, PinName spi_gpio1, PinName spi_gpio2, PinName spi_gpio3 +#ifdef AT24MAC + , PinName i2c_sda, PinName i2c_scl +#endif //AT24MAC + ) + : +#ifdef AT24MAC + _mac(i2c_sda, i2c_scl), +#endif //AT24MAC + _mac_addr(), _rf(NULL), _test_pins(NULL), _mac_set(false), + _spi_sdi(spi_sdi), _spi_sdo(spi_sdo), _spi_sclk(spi_sclk), _spi_cs(spi_cs), _spi_sdn(spi_sdn), + _spi_gpio0(spi_gpio0), _spi_gpio1(spi_gpio1), _spi_gpio2(spi_gpio2), _spi_gpio3(spi_gpio3) +{ + _rf = new RFPins(_spi_sdi, _spi_sdo, _spi_sclk, _spi_cs, _spi_sdn, _spi_gpio0, _spi_gpio1, _spi_gpio2, _spi_gpio3); +#ifdef TEST_GPIOS_ENABLED + _test_pins = new TestPins_S2LP(TEST_PIN_TX, TEST_PIN_RX, TEST_PIN_CSMA, TEST_PIN_SPARE_1, TEST_PIN_SPARE_2); +#endif //TEST_GPIOS_ENABLED +} + +NanostackRfPhys2lp::~NanostackRfPhys2lp() +{ + delete _rf; +} + +static bool rf_panid_filter_common(uint8_t *panid_start, uint8_t *pan_id, uint8_t frame_type) +{ + // PHY driver shouldn't drop received Beacon frames as they might be used by load balancing + if (frame_type == MAC_FRAME_BEACON) { + return true; + } + bool retval = true; + uint8_t cmp_table[2] = {0xff, 0xff}; + if (!(pan_id[0] == 0xff && pan_id[1] == 0xff)) { + if (memcmp((uint8_t *)panid_start, (uint8_t *) cmp_table, 2)) { + retval = false; + } + if (!retval) { + for (uint8_t i = 0; i < 2; i++) { + cmp_table[1 - i] = panid_start[i]; + } + if (!memcmp(pan_id, cmp_table, 2)) { + retval = true; + } + } + } + return retval; +} + +static bool rf_panid_v1_v0_filter(uint8_t *ptr, uint8_t *pan_id, uint8_t frame_type) +{ + return rf_panid_filter_common(ptr, pan_id, frame_type); +} + +static bool rf_addr_filter_common(uint8_t *ptr, uint8_t addr_mode, uint8_t *mac_64bit_addr, uint8_t *mac_16bit_addr) +{ + uint8_t cmp_table[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + bool retval = true; + switch (addr_mode) { + case FC_DST_16_BITS: + if (memcmp((uint8_t *)ptr, (uint8_t *) cmp_table, 2)) { + retval = false; + } + if (!retval) { + for (uint8_t i = 0; i < 2; i++) { + cmp_table[1 - i] = ptr[i]; + } + + if (!memcmp((uint8_t *)mac_16bit_addr, (uint8_t *) cmp_table, 2)) { + retval = true; + } + } + break; + case FC_DST_64_BITS: + if (memcmp((uint8_t *)ptr, (uint8_t *) cmp_table, 8)) { + retval = false; + } + if (!retval) { + for (uint8_t i = 0; i < 8; i++) { + cmp_table[7 - i] = ptr[i]; + } + + if (!memcmp((uint8_t *)mac_64bit_addr, (uint8_t *) cmp_table, 8)) { + retval = true; + } + } + break; + case FC_DST_ADDR_NONE: + retval = true; + break; + default: + retval = false; + break; + } + return retval; +} + +static bool rf_addr_v1_v0_filter(uint8_t *ptr, uint8_t *mac_64bit_addr, uint8_t *mac_16bit_addr, uint8_t dst_mode) +{ + return rf_addr_filter_common(ptr, dst_mode, mac_64bit_addr, mac_16bit_addr); +} + +static bool rf_rx_filter(uint8_t *mac_header, uint8_t *mac_64bit_addr, uint8_t *mac_16bit_addr, uint8_t *pan_id) +{ + uint8_t dst_mode = (mac_header[1] & FC_DST_MODE); + uint8_t frame_type = mac_header[0] & MAC_FRAME_TYPE_MASK; + uint8_t version = ((mac_header[1] & VERSION_FIELD_MASK) >> SHIFT_VERSION_FIELD); + if (version != MAC_FRAME_VERSION_2) { + if (!rf_panid_v1_v0_filter(mac_header + OFFSET_DST_PAN_ID, pan_id, frame_type)) { + return false; + } + if (!rf_addr_v1_v0_filter(mac_header + OFFSET_DST_ADDR, mac_64bit_addr, mac_16bit_addr, dst_mode)) { + return false; + } + } + return true; +} + +#if MBED_CONF_S2LP_PROVIDE_DEFAULT +NanostackRfPhy &NanostackRfPhy::get_default_instance() +{ + static NanostackRfPhys2lp rf_phy(S2LP_SPI_SDI, S2LP_SPI_SDO, S2LP_SPI_SCLK, S2LP_SPI_CS, S2LP_SPI_SDN + , S2LP_SPI_GPIO0, S2LP_SPI_GPIO1, S2LP_SPI_GPIO2, S2LP_SPI_GPIO3 +#ifdef AT24MAC + , S2LP_I2C_SDA, S2LP_I2C_SCL +#endif //AT24MAC + ); + return rf_phy; +} +#endif // MBED_CONF_S2LP_PROVIDE_DEFAULT +#endif // MBED_CONF_NANOSTACK_CONFIGURATION && DEVICE_SPI diff --git a/source/at24mac_s2lp.cpp b/source/at24mac_s2lp.cpp new file mode 100644 index 0000000000..6a41ffd024 --- /dev/null +++ b/source/at24mac_s2lp.cpp @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2019, Pelion and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "NanostackRfPhys2lp.h" +#include "at24mac_s2lp.h" + + +#if DEVICE_I2C +#ifdef AT24MAC + +/* Device addressing */ +#define AT24MAC_EEPROM_ADDRESS (0x0A<<4) +#define AT24MAC_RW_PROTECT_ADDRESS (0x06<<4) +#define AT24MAC_SERIAL_ADDRESS (0x0B<<4) + +/* Known memory blocks */ +#define AT24MAC_SERIAL_OFFSET (0x80) +#define AT24MAC_EUI64_OFFSET (0x98) +#define AT24MAC_EUI48_OFFSET (0x9A) + +#define SERIAL_LEN 16 +#define EUI64_LEN 8 +#define EUI48_LEN 6 + +using namespace mbed; + +AT24Mac_s2lp::AT24Mac_s2lp(PinName sda, PinName scl) : _i2c(sda, scl) +{ + // Do nothing +} + +int AT24Mac_s2lp::read_serial(void *buf) +{ + char offset = AT24MAC_SERIAL_OFFSET; + if (_i2c.write(AT24MAC_SERIAL_ADDRESS, &offset, 1, true)) { + return -1; //No ACK + } + return _i2c.read(AT24MAC_SERIAL_ADDRESS, (char *)buf, SERIAL_LEN); +} + +int AT24Mac_s2lp::read_eui64(void *buf) +{ + char offset = AT24MAC_EUI64_OFFSET; + if (_i2c.write(AT24MAC_SERIAL_ADDRESS, &offset, 1, true)) { + return -1; //No ACK + } + return _i2c.read(AT24MAC_SERIAL_ADDRESS, (char *)buf, EUI64_LEN); +} + +int AT24Mac_s2lp::read_eui48(void *buf) +{ + char offset = AT24MAC_EUI48_OFFSET; + if (_i2c.write(AT24MAC_SERIAL_ADDRESS, &offset, 1, true)) { + return -1; //No ACK + } + return _i2c.read(AT24MAC_SERIAL_ADDRESS, (char *)buf, EUI48_LEN); +} + +#endif /* AT24MAC */ +#endif /* DEVICE_I2C */ diff --git a/source/at24mac_s2lp.h b/source/at24mac_s2lp.h new file mode 100644 index 0000000000..7f6ecaeb74 --- /dev/null +++ b/source/at24mac_s2lp.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2019, Pelion and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef AT24MAC_S2LP_H +#define AT24MAC_S2LP_H + +#include "PinNames.h" + +#if DEVICE_I2C +#ifdef AT24MAC + +#include "I2C.h" +#include "drivers/DigitalInOut.h" +#include "platform/mbed_wait_api.h" + +/* + * AT24MAC drivers. + * + * This is a EEPROM chip designed to contain factory programmed read-only EUI-64 or EUI-48, + * a 128bit serial number and some user programmable EEPROM. + * + * AT24MAC602 contains EUI-64, use read_eui64() + * AT24MAC402 contains EUI-64, use read_eui48() + * + * NOTE: You cannot use both EUI-64 and EUI-48. Chip contains only one of those. + */ + +class AT24Mac_s2lp { +public: + AT24Mac_s2lp(PinName sda, PinName scl); + + /** + * Read unique serial number from chip. + * \param buf pointer to write serial number to. Must have space for 16 bytes. + * \return zero on success, negative number on failure + */ + int read_serial(void *buf); + + /** + * Read EUI-64 from chip. + * \param buf pointer to write EUI-64 to. Must have space for 8 bytes. + * \return zero on success, negative number on failure + */ + int read_eui64(void *buf); + + /** + * Read EUI-48 from chip. + * \param buf pointer to write EUI-48 to. Must have space for 6 bytes. + * \return zero on success, negative number on failure + */ + int read_eui48(void *buf); + +private: + mbed::I2C _i2c; +}; + +#endif /* AT24MAC */ +#endif /* DEVICE_I2C */ +#endif /* AT24MAC_S2LP_H */ diff --git a/source/rf_configuration.c b/source/rf_configuration.c new file mode 100644 index 0000000000..7676790fbb --- /dev/null +++ b/source/rf_configuration.c @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2018-2020, Pelion and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && DEVICE_INTERRUPTIN && defined(MBED_CONF_RTOS_PRESENT) + +#include "nanostack/platform/arm_hal_phy.h" +#include "rf_configuration.h" + + +// Note that F_XO and F_DIG depends on the used clock frequency +#define F_XO 50000000 +#define F_DIG 25000000 +// Note that reference divider depends on REFDIV field in XO_RCO_CONF0 register +#define REF_DIVIDER 1 +// Note that band selector depends on BS field in SYNT3 register +#define BAND_SELECTOR 4 +#define DEF_2EXP33 8589934592 +#define DEF_2EXP20 1048576 +#define DEF_2EXP19 524288 +#define DEF_2EXP16 65536 +#define DEF_2EXP15 32768 +// Use multiplier for better resolution +#define RESOLUTION_MULTIPLIER 1000000 + +// RSSI_TH is a 8-bit register which can be converted to dBm using formula RSSI_TH-146 +#define MIN_RSSI_THRESHOLD -146 +#define MAX_RSSI_THRESHOLD 109 + +void rf_conf_calculate_datarate_registers(uint32_t datarate, uint16_t *datarate_mantissa, uint8_t *datarate_exponent) +{ + uint64_t datarate_m = (uint64_t)datarate * DEF_2EXP33; + uint8_t datarate_e = 1; + while (datarate_m >= DEF_2EXP16) { + datarate_e++; + uint16_t var_2exp_datarate_e = (uint32_t)2 << (datarate_e - 1); + datarate_m = (uint64_t)datarate * DEF_2EXP33; + datarate_m = datarate_m / ((uint64_t)var_2exp_datarate_e * F_DIG); + datarate_m -= DEF_2EXP16; + } + *datarate_mantissa = datarate_m; + *datarate_exponent = datarate_e; +} + +void rf_conf_calculate_base_frequency_registers(uint32_t frequency, uint8_t *synt3, uint8_t *synt2, uint8_t *synt1, uint8_t *synt0) +{ + uint64_t freq_tmp = (uint64_t)frequency * RESOLUTION_MULTIPLIER; + freq_tmp = (freq_tmp / (F_XO / ((BAND_SELECTOR / 2) * REF_DIVIDER))); + freq_tmp *= DEF_2EXP20; + freq_tmp /= RESOLUTION_MULTIPLIER; + *synt3 = (uint8_t)(freq_tmp >> 24); + *synt2 = (uint8_t)(freq_tmp >> 16); + *synt1 = (uint8_t)(freq_tmp >> 8); + *synt0 = (uint8_t)freq_tmp; +} + +void rf_conf_calculate_deviation_registers(uint32_t deviation, uint8_t *fdev_m, uint8_t *fdev_e) +{ + uint64_t fdev_m_tmp = 0xffff; + uint8_t fdev_e_tmp = 1; + + while (fdev_m_tmp > 255) { + fdev_e_tmp++; + uint16_t var_2exp_datarate_e_minus_1 = (uint16_t)2 << ((fdev_e_tmp - 1) - 1); + fdev_m_tmp = (uint64_t)deviation * RESOLUTION_MULTIPLIER; + fdev_m_tmp = (((fdev_m_tmp / F_XO) * DEF_2EXP19 * BAND_SELECTOR * REF_DIVIDER * (8 / BAND_SELECTOR)) / var_2exp_datarate_e_minus_1); + fdev_m_tmp += RESOLUTION_MULTIPLIER / 2; + fdev_m_tmp /= RESOLUTION_MULTIPLIER; + fdev_m_tmp -= 256; + } + *fdev_m = (uint8_t)fdev_m_tmp; + *fdev_e = fdev_e_tmp; +} + +int rf_conf_calculate_channel_spacing_registers(uint32_t channel_spacing, uint8_t *ch_space) +{ + uint64_t ch_space_tmp = (uint64_t)channel_spacing * RESOLUTION_MULTIPLIER; + ch_space_tmp /= F_XO; + ch_space_tmp *= DEF_2EXP15; + ch_space_tmp += RESOLUTION_MULTIPLIER / 2; + ch_space_tmp /= RESOLUTION_MULTIPLIER; + // Check if channel spacing is too high + if (ch_space_tmp > 255) { + return -1; + } + *ch_space = (uint8_t)ch_space_tmp; + return 0; +} + +/* Note: This function doesn't necessarily give the optimal RX filter settings. + * When accurate chflt_m and chflt_e settings are needed they must be computed manually. + * Function uses undefined values (900000, 852000, ...) + * to find the chflt_m and chflt_e settings from the RX filter table (see. S2-LP datasheet). + * + * E=0 E=1 E=2 E=3 E=4 E=5 E=6 E=7 E=8 E=9 + * M=0 800.1 450.9 224.7 112.3 56.1 28.0 14.0 7.0 3.5 1.8 + * M=1 795.1 425.9 212.4 106.2 53.0 26.5 13.3 6.6 3.3 1.7 + * M=2 768.4 403.2 201.1 100.5 50.2 25.1 12.6 6.3 3.1 1.6 + * M=3 736.8 380.8 190.0 95.0 47.4 23.7 11.9 5.9 3.0 1.5 + * M=4 705.1 362.1 180.7 90.3 45.1 22.6 11.3 5.6 2.8 1.4 + * M=5 670.9 341.7 170.6 85.3 42.6 21.3 10.6 5.3 2.7 1.3 + * M=6 642.3 325.4 162.4 81.2 40.6 20.3 10.1 5.1 2.5 1.3 + * M=7 586.7 294.5 147.1 73.5 36.7 18.4 9.2 4.6 2.3 1.2 + * M=8 541.4 270.3 135.0 67.5 33.7 16.9 8.4 4.2 2.1 1.1 + */ +void rf_conf_calculate_rx_filter_bandwidth_registers(uint32_t rx_bandwidth, uint8_t *chflt_m, uint8_t *chflt_e) +{ + uint8_t chflt_e_tmp = 0; + uint8_t chflt_m_tmp = 0; + + while (rx_bandwidth < 900000u / (2 << chflt_e_tmp)) { + chflt_e_tmp++; + } + uint32_t rx_bandwidth_tmp = rx_bandwidth; + if (chflt_e_tmp > 0) { + rx_bandwidth_tmp = rx_bandwidth * (2 << (chflt_e_tmp - 1)); + } + if (852000 > rx_bandwidth_tmp) { + chflt_m_tmp++; + } + if (806000 > rx_bandwidth_tmp) { + chflt_m_tmp++; + } + if (760000 > rx_bandwidth_tmp) { + chflt_m_tmp++; + } + if (724000 > rx_bandwidth_tmp) { + chflt_m_tmp++; + } + if (682000 > rx_bandwidth_tmp) { + chflt_m_tmp++; + } + if (650000 > rx_bandwidth_tmp) { + chflt_m_tmp++; + } + if (588000 > rx_bandwidth_tmp) { + chflt_m_tmp++; + } + if (542000 > rx_bandwidth_tmp) { + chflt_m_tmp++; + } + *chflt_m = chflt_m_tmp; + *chflt_e = chflt_e_tmp; +} + +int16_t rf_conf_cca_threshold_percent_to_rssi(uint8_t percent) +{ + uint8_t step = (MAX_RSSI_THRESHOLD - MIN_RSSI_THRESHOLD); + return MIN_RSSI_THRESHOLD + (step * percent) / 100; +} + +void rf_conf_calculate_rssi_threshold_registers(int16_t rssi_threshold, uint8_t *rssi_th) +{ + *rssi_th = rssi_threshold + RSSI_OFFSET; +} + +/* + * Function calculates deviation from given parameters for 2FSK and 2GFSK modulations. + * Calculated using formula Deviation=(modulation_index*datarate)/2 + */ +uint32_t rf_conf_calculate_deviation(phy_modulation_index_e modulation_index, uint32_t datarate) +{ + uint32_t deviation = 0; + if (modulation_index == MODULATION_INDEX_0_5) { + deviation = datarate / 4; + } else if (modulation_index == MODULATION_INDEX_1_0) { + deviation = datarate / 2; + } + return deviation; +} + +#endif // MBED_CONF_NANOSTACK_CONFIGURATION && DEVICE_SPI && DEVICE_INTERRUPTIN && defined(MBED_CONF_RTOS_PRESENT) + diff --git a/source/rf_configuration.h b/source/rf_configuration.h new file mode 100644 index 0000000000..19b6aad373 --- /dev/null +++ b/source/rf_configuration.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2018-2020, Pelion and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef RF_CONF_H_ +#define RF_CONF_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define RSSI_OFFSET 146 + +void rf_conf_calculate_datarate_registers(uint32_t datarate, uint16_t *datarate_mantissa, uint8_t *datarate_exponent); +void rf_conf_calculate_base_frequency_registers(uint32_t frequency, uint8_t *synt3, uint8_t *synt2, uint8_t *synt1, uint8_t *synt0); +void rf_conf_calculate_deviation_registers(uint32_t deviation, uint8_t *fdev_m, uint8_t *fdev_e); +int rf_conf_calculate_channel_spacing_registers(uint32_t channel_spacing, uint8_t *ch_space); +void rf_conf_calculate_rx_filter_bandwidth_registers(uint32_t rx_bandwidth, uint8_t *chflt_m, uint8_t *chflt_e); +void rf_conf_calculate_rssi_threshold_registers(int16_t rssi_threshold, uint8_t *rssi_th); +uint32_t rf_conf_calculate_deviation(phy_modulation_index_e modulation_index, uint32_t datarate); +int16_t rf_conf_cca_threshold_percent_to_rssi(uint8_t percent); + +#ifdef __cplusplus +} +#endif + +#endif /* RF_CONF_H_ */ diff --git a/source/s2lpReg.h b/source/s2lpReg.h new file mode 100644 index 0000000000..16c6f9aae7 --- /dev/null +++ b/source/s2lpReg.h @@ -0,0 +1,344 @@ +/* + * Copyright (c) 2018-2020, Pelion and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef S2LPREG_H_ +#define S2LPREG_H_ +#ifdef __cplusplus +extern "C" { +#endif + +#define RF_MTU 2047 +#define PARTNUM 0x03 +#define VERSION 0xC1 +#define FIFO_SIZE 128 +#define SPI_HEADER_LENGTH 2 +#define RSSI_SETTLING_TIME 250 + +#define S2LP_GPIO0 0 +#define S2LP_GPIO1 1 +#define S2LP_GPIO2 2 +#define S2LP_GPIO3 3 + +// GPIO modes +#define DIG_IN 1 +#define DIG_OUT_LOW 2 +#define DIG_OUT_HIGH 3 + +// Interrupt events +#define RX_DATA_READY 0 +#define RX_DATA_DISCARDED 1 +#define TX_DATA_SENT 2 +#define MAX_RE_TX 3 +#define CRC_ERROR 4 +#define TX_FIFO_UNF_OVF 5 +#define RX_FIFO_UNF_OVF 6 +#define TX_FIFO_ALMOST_FULL 7 +#define TX_FIFO_ALMOST_EMPTY 8 +#define RX_FIFO_ALMOST_FULL 9 +#define RX_FIFO_ALMOST_EMPTY 10 +#define MAX_CCA_BACKOFFS 11 +#define VALID_PREAMBLE 12 +#define SYNC_WORD 13 +#define RSSI_ABOVE_THR 14 +#define WAKE_UP_TIMEOUT 15 +#define READY 16 +#define STANDBY_SWITCHING 17 +#define LOW_BATTERY_LVL 18 +#define POWER_ON_RESET 19 +#define RX_TIMER_TIMEOUT 28 +#define SNIFF_TIMER_TIMEOUT 29 + +// GPIO signals +#define NIRQ 0 +#define POR 1 +#define WUT_EXPIRE 2 +#define LOW_BATTERY 3 +#define TX_DATA_OUTPUT 4 +#define TX_STATE 5 +#define TXRX_FIFO_ALMOST_EMPTY 6 +#define TXRX_FIFO_ALMOST_FULL 7 +#define RX_DATA_OUTPUT 8 +#define RX_CLOCK_OUTPUT 9 +#define RX_STATE 10 +#define STATE_OTHER_THAN_SLEEP_OR_STANDBY 11 +#define STANDBY_STATE 12 +#define ANTENNA_SWITCH 13 +#define VALID_PREAMBLE_DETECTED 14 +#define SYNC_WORD_DETECTED 15 +#define RSSI_ABOVE_THRESHOLD 16 +#define TXRX_MODE_INDICATOR 18 +#define VDD 19 +#define GND 20 +#define SMPS_ENABLE 21 +#define SLEEP_STATE 22 +#define READY_STATE 23 +#define LOCK_STATE 24 +#define WAIT_LOCK_DETECTOR 25 +#define TX_DATA_OOK 26 +#define WAIT_READY 27 +#define WAIT_TIMER_EXPIRATION 28 +#define END_OF_CALIBRATION 29 +#define ENABLE_SYNTH_BLOCK 30 + +// RF registers +#define GPIO0_CONF 0x00 +#define GPIO1_CONF 0x01 +#define GPIO2_CONF 0x02 +#define GPIO3_CONF 0x03 +#define SYNT3 0x05 +#define SYNT2 0x06 +#define SYNT1 0x07 +#define SYNT0 0x08 +#define IF_OFFSET_ANA 0x09 +#define IF_OFFSET_DIG 0x0A +#define CHSPACE 0x0C +#define CHNUM 0x0D +#define MOD4 0x0E +#define MOD3 0x0F +#define MOD2 0x10 +#define MOD1 0x11 +#define MOD0 0x12 +#define CHFLT 0x13 +#define AFC2 0x14 +#define AFC1 0x15 +#define AFC0 0x16 +#define RSSI_FLT 0x17 +#define RSSI_TH 0x18 +#define AGCCTRL4 0x1A +#define AGCCTRL3 0x1B +#define AGCCTRL2 0x1C +#define AGCCTRL1 0x1D +#define AGCCTRL0 0x1E +#define ANT_SELECT_CONF 0x1F +#define CLOCKREC2 0x20 +#define CLOCKREC1 0x21 +#define PCKTCTRL6 0x2B +#define PCKTCTRL5 0x2C +#define PCKTCTRL4 0x2D +#define PCKTCTRL3 0x2E +#define PCKTCTRL2 0x2F +#define PCKTCTRL1 0x30 +#define PCKTLEN1 0x31 +#define PCKTLEN0 0x32 +#define SYNC3 0x33 +#define SYNC2 0x34 +#define SYNC1 0x35 +#define SYNC0 0x36 +#define QI 0x37 +#define PCKT_PSTMBL 0x38 +#define PROTOCOL2 0x39 +#define PROTOCOL1 0x3A +#define PROTOCOL0 0x3B +#define FIFO_CONFIG3 0x3C +#define FIFO_CONFIG2 0x3D +#define FIFO_CONFIG1 0x3E +#define FIFO_CONFIG0 0x3F +#define PCKT_FLT_OPTIONS 0x40 +#define PCKT_FLT_GOALS4 0x41 +#define PCKT_FLT_GOALS3 0x42 +#define PCKT_FLT_GOALS2 0x43 +#define PCKT_FLT_GOALS1 0x44 +#define PCKT_FLT_GOALS0 0x45 +#define TIMERS5 0x46 +#define TIMERS4 0x47 +#define TIMERS3 0x48 +#define TIMERS2 0x49 +#define TIMERS1 0x4A +#define TIMERS0 0x4B +#define CSMA_CONF3 0x4C +#define CSMA_CONF2 0x4D +#define CSMA_CONF1 0x4E +#define CSMA_CONF0 0x4F +#define IRQ_MASK3 0x50 +#define IRQ_MASK2 0x51 +#define IRQ_MASK1 0x52 +#define IRQ_MASK0 0x53 +#define FAST_RX_TIMER 0x54 +#define PA_POWER8 0x5A +#define PA_POWER7 0x5B +#define PA_POWER6 0x5C +#define PA_POWER5 0x5D +#define PA_POWER4 0x5E +#define PA_POWER3 0x5F +#define PA_POWER2 0x60 +#define PA_POWER1 0x61 +#define PA_POWER0 0x62 +#define PA_CONFIG1 0x63 +#define PA_CONFIG0 0x64 +#define SYNTH_CONFIG2 0x65 +#define VCO_CONFIG 0x68 +#define VCO_CALIBR_IN2 0x69 +#define VCO_CALIBR_IN1 0x6A +#define VCO_CALIBR_IN0 0x6B +#define XO_RCO_CONF1 0x6C +#define XO_RCO_CONF0 0x6D +#define RCO_CALIBR_CONF3 0x6E +#define RCO_CALIBR_CONF2 0x6F +#define PM_CONF4 0x75 +#define PM_CONF3 0x76 +#define PM_CONF2 0x77 +#define PM_CONF1 0x78 +#define PM_CONF0 0x79 +#define MC_STATE1 0x8D +#define MC_STATE0 0x8E +#define TX_FIFO_STATUS 0x8F +#define RX_FIFO_STATUS 0x90 +#define RCO_CALIBR_OUT4 0x94 +#define RCO_CALIBR_OUT3 0x95 +#define VCO_CALIBR_OUT1 0x99 +#define VCO_CALIBR_OUT0 0x9A +#define TX_PCKT_INFO 0x9C +#define RX_PCKT_INFO 0x9D +#define AFC_CORR 0x9E +#define LINK_QUALIF2 0x9F +#define LINK_QUALIF1 0xA0 +#define RSSI_LEVEL 0xA2 +#define RX_PCKT_LEN1 0xA4 +#define RX_PCKT_LEN0 0xA5 +#define CRC_FIELD3 0xA6 +#define CRC_FIELD2 0xA7 +#define CRC_FIELD1 0xA8 +#define CRC_FIELD0 0xA9 +#define RX_ADDRE_FIELD1 0xAA +#define RX_ADDRE_FIELD0 0xAB +#define RSSI_LEVEL_RUN 0xEF +#define DEVICE_INFO1 0xF0 +#define DEVICE_INFO0 0xF1 +#define IRQ_STATUS3 0xFA +#define IRQ_STATUS2 0xFB +#define IRQ_STATUS1 0xFC +#define IRQ_STATUS0 0xFD +#define TX_FIFO 0xFF +#define RX_FIFO 0xFF + +#define SFD0 0x90 +#define SFD1 0x4e + +#define DEFAULT_DEVIATION 125000 +#define RX_FILTER_BANDWIDTH 540000 +#define RSSI_THRESHOLD -85 + +// PCKTCTRL6 +#define PCKT_SYNCLEN_FIELD 0xFC +#define PCKT_SYNCLEN (16 << 2) + +// PCKTCTRL5 +#define PCKT_PREAMBLE_LEN 32 + +// PCKTCTRL3 +#define PCKT_FORMAT_FIELD 0xC0 +#define PCKT_FORMAT_802_15_4 (1 << 6) +#define PCKT_RXMODE_FIELD 0x30 +#define PCKT_RXMODE_NORMAL (0 << 4) +#define PCKT_BYTE_SWAP_FIELD 0x04 +#define PCKT_BYTE_SWAP_LSB (1 << 2) + +// PCKTCTRL2 +#define PCKT_FIXVARLEN_FIELD 0x01 +#define PCKT_VARIABLE_LEN (1 << 0) +#define PCKT_FCS_TYPE_FIELD 0x20 +#define PCKT_FCS_TYPE_4_OCTET (0 << 5) +#define PCKT_FCS_TYPE_2_OCTET (1 << 5) + +// PCKTCTRL1 +#define PCKT_CRCMODE_FIELD 0xE0 +#define PCKT_CRCMODE_0X1021 (3 << 5) +#define PCKT_CRCMODE_0x04C11DB7 (5 << 5) +#define PCKT_TXSOURCE_FIELD 0x0C +#define PCKT_TXSOURCE_NORMAL (0 << 2) +#define PCKT_WHITENING_FIELD 0x10 +#define PCKT_WHITENING_ENABLED (1 << 4) + +// MOD4 +#define DATARATE_M_MSB 0x47 +// MOD3 +#define DATARATE_M_LSB 0xAE + +// MOD2 +#define MOD_TYPE_FIELD 0xF0 +#define MOD_2FSK (0 << 4) +#define MOD_2GFSK (10 << 4) +#define DATARATE_E_FIELD 0x0F +#define DATARATE_E (10 << 0) + +// MOD1 +#define FDEV_E_FIELD 0x0F + +// QI +#define PQI_TH_FIELD 0x1E +#define PQI_TH (8 << 1) +#define SQI_EN_FIELD 0x01 +#define SQI_EN (1 << 0) + +// SYNT3 +#define SYNT_FIELD 0x0F + +// CHFLT +#define CHFLT_M_FIELD 0xF0 +#define CHFLT_E_FIELD 0x0F + +// LINK_QUALIF1 +#define CARRIER_SENSE (1 << 7) + +#define SPI_WR_REG 0x00 +#define SPI_RD_REG 0x01 +#define SPI_CMD 0x80 + +typedef enum { + S2LP_STATE_STANDBY = 0x02, + S2LP_STATE_SLEEPA = 0x01, + S2LP_STATE_SLEEPB = 0x03, + S2LP_STATE_READY = 0x00, + S2LP_STATE_LOCK = 0x0C, + S2LP_STATE_RX = 0x30, + S2LP_STATE_TX = 0x5C, + S2LP_STATE_SYNTH_SETUP = 0x50 +} s2lp_states_e; + +#if defined __cplusplus && __cplusplus >= 201103 +typedef enum : uint8_t { +#else +typedef enum { +#endif + S2LP_CMD_TX = 0x60, + S2LP_CMD_RX, + S2LP_CMD_READY, + S2LP_CMD_STANDBY, + S2LP_CMD_SLEEP, + S2LP_CMD_LOCKRX, + S2LP_CMD_LOCKTX, + S2LP_CMD_SABORT, + S2LP_CMD_LDC_RELOAD, + S2LP_CMD_SRES = 0x70, + S2LP_CMD_FLUSHRXFIFO, + S2LP_CMD_FLUSHTXFIFO, + S2LP_CMD_SEQUPDATE +} s2lp_commands_e; + +typedef enum { + RF_IDLE, + RF_CSMA_STARTED, + RF_TX_STARTED, + RF_RX_STARTED, + RF_TX_ACK +} rf_states_e; + +#ifdef __cplusplus +} +#endif + +#endif /* S2LPREG_H_ */ diff --git a/stm-s2lp-rf-driver/NanostackRfPhys2lp.h b/stm-s2lp-rf-driver/NanostackRfPhys2lp.h new file mode 100644 index 0000000000..e1d6ff54bf --- /dev/null +++ b/stm-s2lp-rf-driver/NanostackRfPhys2lp.h @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2018-2020, Pelion and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef NANOSTACK_PHY_S2LP_H_ +#define NANOSTACK_PHY_S2LP_H_ + +#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && defined(MBED_CONF_RTOS_PRESENT) +#include "inttypes.h" +#include "NanostackRfPhy.h" +#include "DigitalIn.h" +#include "DigitalOut.h" +#include "InterruptIn.h" +#include "SPI.h" + +#if defined(MBED_CONF_S2LP_SPI_SDI) +#define S2LP_SPI_SDI MBED_CONF_S2LP_SPI_SDI +#else +#define S2LP_SPI_SDI D11 +#endif + +#if defined(MBED_CONF_S2LP_SPI_SDO) +#define S2LP_SPI_SDO MBED_CONF_S2LP_SPI_SDO +#else +#define S2LP_SPI_SDO D12 +#endif + +#if defined(MBED_CONF_S2LP_SPI_SCLK) +#define S2LP_SPI_SCLK MBED_CONF_S2LP_SPI_SCLK +#else +#define S2LP_SPI_SCLK D13 +#endif + +#if defined(MBED_CONF_S2LP_SPI_CS) +#define S2LP_SPI_CS MBED_CONF_S2LP_SPI_CS +#else +#define S2LP_SPI_CS A1 +#endif + +#if defined(MBED_CONF_S2LP_SPI_SDN) +#define S2LP_SPI_SDN MBED_CONF_S2LP_SPI_SDN +#else +#define S2LP_SPI_SDN D7 +#endif + +#if defined(MBED_CONF_S2LP_TEST_PIN_TX) +#define S2LP_TEST_PIN_TX MBED_CONF_S2LP_TEST_PIN_TX +#else +#define S2LP_TEST_PIN_TX D6 +#endif + +#if defined(MBED_CONF_S2LP_TEST_PIN_RX) +#define S2LP_TEST_PIN_RX MBED_CONF_S2LP_TEST_PIN_RX +#else +#define S2LP_TEST_PIN_RX D5 +#endif + +#if defined(MBED_CONF_S2LP_TEST_PIN_CSMA) +#define S2LP_TEST_PIN_CSMA MBED_CONF_S2LP_TEST_PIN_CSMA +#else +#define S2LP_TEST_PIN_CSMA D4 +#endif + +#if defined(MBED_CONF_S2LP_TEST_PIN_SPARE_1) +#define S2LP_TEST_PIN_SPARE_1 MBED_CONF_S2LP_TEST_PIN_SPARE_1 +#else +#define S2LP_TEST_PIN_SPARE_1 D2 +#endif + +#if defined(MBED_CONF_S2LP_TEST_PIN_SPARE_2) +#define S2LP_TEST_PIN_SPARE_2 MBED_CONF_S2LP_TEST_PIN_SPARE_2 +#else +#define S2LP_TEST_PIN_SPARE_2 D8 +#endif + +#if defined(MBED_CONF_S2LP_SPI_GPIO0) +#define S2LP_SPI_GPIO0 MBED_CONF_S2LP_SPI_GPIO0 +#else +#define S2LP_SPI_GPIO0 A0 +#endif + +#if defined(MBED_CONF_S2LP_SPI_GPIO1) +#define S2LP_SPI_GPIO1 MBED_CONF_S2LP_SPI_GPIO1 +#else +#define S2LP_SPI_GPIO1 A2 +#endif + +#if defined(MBED_CONF_S2LP_SPI_GPIO2) +#define S2LP_SPI_GPIO2 MBED_CONF_S2LP_SPI_GPIO2 +#else +#define S2LP_SPI_GPIO2 A3 +#endif + +#if defined(MBED_CONF_S2LP_SPI_GPIO3) +#define S2LP_SPI_GPIO3 MBED_CONF_S2LP_SPI_GPIO3 +#else +#define S2LP_SPI_GPIO3 A5 +#endif + +#if defined(MBED_CONF_S2LP_I2C_SDA) +#define S2LP_I2C_SDA MBED_CONF_S2LP_I2C_SDA +#else +#define S2LP_I2C_SDA null +#endif + +#if defined(MBED_CONF_S2LP_I2C_SCL) +#define S2LP_I2C_SCL MBED_CONF_S2LP_I2C_SCL +#else +#define S2LP_I2C_SCL null +#endif + +#include "at24mac_s2lp.h" + +class RFPins; +class TestPins_S2LP; + +class NanostackRfPhys2lp : public NanostackRfPhy { +public: + NanostackRfPhys2lp(PinName spi_sdi, PinName spi_sdo, PinName spi_sclk, PinName spi_cs, PinName spi_sdn + , PinName spi_gpio0, PinName spi_gpio1, PinName spi_gpio2, PinName spi_gpio3 +#ifdef AT24MAC + , PinName i2c_sda, PinName i2c_scl +#endif //AT24MAC + ); + virtual ~NanostackRfPhys2lp(); + virtual int8_t rf_register(); + virtual void rf_unregister(); + virtual void get_mac_address(uint8_t *mac); + virtual void set_mac_address(uint8_t *mac); + +private: +#ifdef AT24MAC + AT24Mac_s2lp _mac; +#endif //AT24MAC + uint8_t _mac_addr[8]; + RFPins *_rf; + TestPins_S2LP *_test_pins; + bool _mac_set; + + const PinName _spi_sdi; + const PinName _spi_sdo; + const PinName _spi_sclk; + const PinName _spi_cs; + const PinName _spi_sdn; + const PinName _spi_gpio0; + const PinName _spi_gpio1; + const PinName _spi_gpio2; + const PinName _spi_gpio3; +}; +#endif /* MBED_CONF_NANOSTACK_CONFIGURATION && DEVICE_SPI */ +#endif /* NANOSTACK_PHY_S2LP_H_ */ From fa0fe8a87f588437982baf209e1408f1f597b098 Mon Sep 17 00:00:00 2001 From: Arto Kinnunen Date: Wed, 23 Jun 2021 10:27:30 +0300 Subject: [PATCH 06/18] Restore CMakeLists.txt to stm-s2lp-rf-driver Restore CMakeLists.txt to stm-s2lp-rf-driver as it is not available in the source repository. --- .../802.15.4_RF/stm-s2lp-rf-driver/CMakeLists.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/CMakeLists.txt diff --git a/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/CMakeLists.txt b/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/CMakeLists.txt new file mode 100644 index 0000000000..d64ffa0134 --- /dev/null +++ b/connectivity/drivers/802.15.4_RF/stm-s2lp-rf-driver/CMakeLists.txt @@ -0,0 +1,15 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +target_include_directories(mbed-802.15.4-rf + INTERFACE + stm-s2lp-rf-driver + source +) + +target_sources(mbed-802.15.4-rf + INTERFACE + source/NanostackRfPhys2lp.cpp + source/at24mac_s2lp.cpp + source/rf_configuration.c +) From e8bf06aa4c8cd0b9133361c82669a83e53bc61a5 Mon Sep 17 00:00:00 2001 From: Arto Kinnunen Date: Wed, 23 Jun 2021 11:10:40 +0300 Subject: [PATCH 07/18] Squashed 'connectivity/drivers/802.15.4_RF/atmel-rf-driver/' changes from b1a8186d75..834c5357c6 834c5357c6 Update copyright (#107) 49bc608cea Merge pull request #106 from PelionIoT/IOTTHD-4607 19fed95972 Use CCA fail RX event when RX ongoing git-subtree-dir: connectivity/drivers/802.15.4_RF/atmel-rf-driver git-subtree-split: 834c5357c6c4c19da8da521707a4958957871341 --- atmel-rf-driver/NanostackRfPhyAtmel.h | 13 +++++++------ source/AT86RF215Reg.h | 13 +++++++------ source/AT86RFReg.h | 13 +++++++------ source/NanostackRfPhyAT86RF215.cpp | 17 +++++++++-------- source/NanostackRfPhyAtmel.cpp | 13 +++++++------ source/at24mac.cpp | 13 +++++++------ source/at24mac.h | 13 +++++++------ source/rfbits.h | 13 +++++++------ 8 files changed, 58 insertions(+), 50 deletions(-) diff --git a/atmel-rf-driver/NanostackRfPhyAtmel.h b/atmel-rf-driver/NanostackRfPhyAtmel.h index 67f710a05e..e6b6d6a3ad 100644 --- a/atmel-rf-driver/NanostackRfPhyAtmel.h +++ b/atmel-rf-driver/NanostackRfPhyAtmel.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/source/AT86RF215Reg.h b/source/AT86RF215Reg.h index 47b8a46fd4..678b7c01f2 100644 --- a/source/AT86RF215Reg.h +++ b/source/AT86RF215Reg.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2020 ARM Limited. All rights reserved. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/source/AT86RFReg.h b/source/AT86RFReg.h index fb86b7119b..378724484d 100644 --- a/source/AT86RFReg.h +++ b/source/AT86RFReg.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2017, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/source/NanostackRfPhyAT86RF215.cpp b/source/NanostackRfPhyAT86RF215.cpp index 149395490e..5aea0a7c22 100644 --- a/source/NanostackRfPhyAT86RF215.cpp +++ b/source/NanostackRfPhyAT86RF215.cpp @@ -1,15 +1,16 @@ /* - * Copyright (c) 2020 ARM Limited. All rights reserved. + * Copyright (c) 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ @@ -619,7 +620,7 @@ static void rf_handle_cca_ed_done(void) backup_time = 0; } rf_backup_timer_start(0, backup_time + PACKET_PROCESSING_TIME); - device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_CCA_FAIL, 0, 0); + device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_CCA_FAIL_RX, 0, 0); return; } if ((cca_enabled == true) && (((int8_t) rf_read_rf_register(RF_EDV, rf_module) > cca_threshold))) { @@ -997,7 +998,7 @@ static void rf_backup_timer_interrupt(void) } if ((rf_state == RF_CSMA_STARTED) || (rf_state == RF_CSMA_WHILE_RX)) { TEST_CSMA_DONE - device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_CCA_FAIL, 0, 0); + device_driver.phy_tx_done_cb(rf_radio_driver_id, mac_tx_handle, PHY_LINK_CCA_FAIL_RX, 0, 0); } TEST_TX_DONE TEST_RX_DONE diff --git a/source/NanostackRfPhyAtmel.cpp b/source/NanostackRfPhyAtmel.cpp index f2b266fab5..038a23a52a 100644 --- a/source/NanostackRfPhyAtmel.cpp +++ b/source/NanostackRfPhyAtmel.cpp @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/source/at24mac.cpp b/source/at24mac.cpp index cdb18a0cb7..08dc63b97f 100644 --- a/source/at24mac.cpp +++ b/source/at24mac.cpp @@ -1,15 +1,16 @@ /* - * Copyright (c) 2016-2016 ARM Limited. All rights reserved. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/source/at24mac.h b/source/at24mac.h index d89d24400f..6d6c88a3bf 100644 --- a/source/at24mac.h +++ b/source/at24mac.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/source/rfbits.h b/source/rfbits.h index 14970ffb30..4e976b2423 100644 --- a/source/rfbits.h +++ b/source/rfbits.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2020 ARM Limited. All rights reserved. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ From 16ad9f6f25a4bac7613e5a9acd1465d3650caab5 Mon Sep 17 00:00:00 2001 From: Arto Kinnunen Date: Wed, 23 Jun 2021 11:21:41 +0300 Subject: [PATCH 08/18] Squashed 'connectivity/libraries/nanostack-libservice/' changes from 260d80f42d..c343e4e2cc c343e4e2cc Merge pull request #99 from PelionIoT/remove_ns_trace 70c411b0f8 Remove ns_trace.h 60e99d2c02 Update copyright (#100) git-subtree-dir: connectivity/libraries/nanostack-libservice git-subtree-split: c343e4e2ccb1517881ac85140974f3eb8cd85d46 --- mbed-client-libservice/common_functions.h | 13 +++---- mbed-client-libservice/ip4string.h | 13 +++---- mbed-client-libservice/ip6string.h | 13 +++---- mbed-client-libservice/ip_fsc.h | 13 +++---- mbed-client-libservice/ns_list.h | 13 +++---- mbed-client-libservice/ns_nvm_helper.h | 13 +++---- mbed-client-libservice/ns_trace.h | 34 ------------------- mbed-client-libservice/ns_types.h | 13 +++---- mbed-client-libservice/nsdynmemLIB.h | 13 +++---- mbed-client-libservice/nsdynmem_tracker.h | 13 +++---- mbed-client-libservice/nsdynmem_tracker_lib.h | 13 +++---- .../platform/arm_hal_interrupt.h | 13 +++---- mbed-client-libservice/platform/arm_hal_nvm.h | 13 +++---- source/IPv6_fcf_lib/ip_fsc.c | 13 +++---- source/libBits/common_functions.c | 13 +++---- source/libList/ns_list.c | 13 +++---- source/libTrace/scripts/fetch_groups.sh | 13 +++---- source/libip4string/ip4tos.c | 13 +++---- source/libip4string/stoip4.c | 13 +++---- source/libip6string/ip6tos.c | 13 +++---- source/libip6string/stoip6.c | 13 +++---- source/nsdynmemLIB/nsdynmemLIB.c | 13 +++---- source/nsdynmemtracker/nsdynmem_tracker_lib.c | 13 +++---- source/nvmHelper/ns_nvm_helper.c | 13 +++---- .../unittest/ip6tos/ip6tos_test.cpp | 13 +++---- test/libService/unittest/ip6tos/main.cpp | 13 +++---- .../unittest/nsdynmem/dynmemtest.cpp | 13 +++---- .../unittest/nsdynmem/error_callback.c | 13 +++---- .../unittest/nsdynmem/error_callback.h | 13 +++---- test/libService/unittest/nsdynmem/main.cpp | 13 +++---- test/libService/unittest/nsnvmhelper/main.cpp | 2 +- .../unittest/nsnvmhelper/nsnvmhelpertest.cpp | 2 +- .../unittest/nsnvmhelper/test_ns_nvm_helper.c | 2 +- .../unittest/nsnvmhelper/test_ns_nvm_helper.h | 2 +- test/libService/unittest/stoip6/main.cpp | 13 +++---- .../libService/unittest/stoip6/stoip6test.cpp | 13 +++---- .../unittest/stubs/common_functions_stub.c | 13 +++---- test/libService/unittest/stubs/ip6tos_stub.c | 13 +++---- test/libService/unittest/stubs/ip6tos_stub.h | 13 +++---- .../unittest/stubs/ipv6_test_values.h | 13 +++---- .../unittest/stubs/mbed_trace_stub.c | 13 +++---- test/libService/unittest/stubs/ns_list_stub.c | 13 +++---- .../unittest/stubs/nsdynmemLIB_stub.c | 13 +++---- .../unittest/stubs/nsdynmemLIB_stub.h | 13 +++---- .../unittest/stubs/platform_critical.c | 13 +++---- .../unittest/stubs/platform_nvm_stub.c | 13 +++---- 46 files changed, 291 insertions(+), 284 deletions(-) delete mode 100644 mbed-client-libservice/ns_trace.h diff --git a/mbed-client-libservice/common_functions.h b/mbed-client-libservice/common_functions.h index c08ae59300..583298f9c5 100644 --- a/mbed-client-libservice/common_functions.h +++ b/mbed-client-libservice/common_functions.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/mbed-client-libservice/ip4string.h b/mbed-client-libservice/ip4string.h index 0c10bf0d8f..414e539b19 100644 --- a/mbed-client-libservice/ip4string.h +++ b/mbed-client-libservice/ip4string.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2018 ARM Limited. All rights reserved. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/mbed-client-libservice/ip6string.h b/mbed-client-libservice/ip6string.h index 34ee097b34..e1c79fa268 100644 --- a/mbed-client-libservice/ip6string.h +++ b/mbed-client-libservice/ip6string.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2016, 2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/mbed-client-libservice/ip_fsc.h b/mbed-client-libservice/ip_fsc.h index eb23ed75e3..f791101274 100644 --- a/mbed-client-libservice/ip_fsc.h +++ b/mbed-client-libservice/ip_fsc.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2015, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/mbed-client-libservice/ns_list.h b/mbed-client-libservice/ns_list.h index ca5baafa1b..7ef123aee9 100644 --- a/mbed-client-libservice/ns_list.h +++ b/mbed-client-libservice/ns_list.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2016, 2018-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/mbed-client-libservice/ns_nvm_helper.h b/mbed-client-libservice/ns_nvm_helper.h index aea476a0af..e16c12f3f4 100644 --- a/mbed-client-libservice/ns_nvm_helper.h +++ b/mbed-client-libservice/ns_nvm_helper.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2016-2017 ARM Limited. All rights reserved. + * Copyright (c) 2016-2017, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/mbed-client-libservice/ns_trace.h b/mbed-client-libservice/ns_trace.h deleted file mode 100644 index 2219f8b808..0000000000 --- a/mbed-client-libservice/ns_trace.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2015-2017 ARM Limited. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * \file ns_trace.h - * Trace interface abstraction for NanoStack library as well as application. - * - * Actual used trace library is mbed-trace. For usage details check mbed_trace.h. - * - */ -#ifndef NS_TRACE_H_ -#define NS_TRACE_H_ - -#if defined(HAVE_DEBUG) && !defined(FEA_TRACE_SUPPORT) -#define FEA_TRACE_SUPPORT -#endif - -#include "ns_types.h" -#include "mbed-trace/mbed_trace.h" - -#endif /* NS_TRACE_H_ */ diff --git a/mbed-client-libservice/ns_types.h b/mbed-client-libservice/ns_types.h index 994db323e8..2ec10b82f9 100644 --- a/mbed-client-libservice/ns_types.h +++ b/mbed-client-libservice/ns_types.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2016, 2018-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/mbed-client-libservice/nsdynmemLIB.h b/mbed-client-libservice/nsdynmemLIB.h index ee91bfc8b1..690a53bc60 100644 --- a/mbed-client-libservice/nsdynmemLIB.h +++ b/mbed-client-libservice/nsdynmemLIB.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2019 ARM Limited. All rights reserved. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/mbed-client-libservice/nsdynmem_tracker.h b/mbed-client-libservice/nsdynmem_tracker.h index c0fccdf97e..9f1d319723 100644 --- a/mbed-client-libservice/nsdynmem_tracker.h +++ b/mbed-client-libservice/nsdynmem_tracker.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2020 ARM Limited. All rights reserved. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/mbed-client-libservice/nsdynmem_tracker_lib.h b/mbed-client-libservice/nsdynmem_tracker_lib.h index aa76f390bf..3fafb0b524 100644 --- a/mbed-client-libservice/nsdynmem_tracker_lib.h +++ b/mbed-client-libservice/nsdynmem_tracker_lib.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2020 ARM Limited. All rights reserved. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/mbed-client-libservice/platform/arm_hal_interrupt.h b/mbed-client-libservice/platform/arm_hal_interrupt.h index 5ad6acae9e..51c85afd23 100644 --- a/mbed-client-libservice/platform/arm_hal_interrupt.h +++ b/mbed-client-libservice/platform/arm_hal_interrupt.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2016, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/mbed-client-libservice/platform/arm_hal_nvm.h b/mbed-client-libservice/platform/arm_hal_nvm.h index 8978d11300..237e40750e 100644 --- a/mbed-client-libservice/platform/arm_hal_nvm.h +++ b/mbed-client-libservice/platform/arm_hal_nvm.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2016 ARM Limited. All rights reserved. + * Copyright (c) 2016, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/source/IPv6_fcf_lib/ip_fsc.c b/source/IPv6_fcf_lib/ip_fsc.c index 0de3a16e62..50b81a6809 100644 --- a/source/IPv6_fcf_lib/ip_fsc.c +++ b/source/IPv6_fcf_lib/ip_fsc.c @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2015, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/source/libBits/common_functions.c b/source/libBits/common_functions.c index 2c4b8f3f94..440001958b 100644 --- a/source/libBits/common_functions.c +++ b/source/libBits/common_functions.c @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2015, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/source/libList/ns_list.c b/source/libList/ns_list.c index 7152281a18..f415e856fa 100644 --- a/source/libList/ns_list.c +++ b/source/libList/ns_list.c @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2015, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/source/libTrace/scripts/fetch_groups.sh b/source/libTrace/scripts/fetch_groups.sh index 433bde22eb..989a78acfd 100644 --- a/source/libTrace/scripts/fetch_groups.sh +++ b/source/libTrace/scripts/fetch_groups.sh @@ -1,15 +1,16 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/source/libip4string/ip4tos.c b/source/libip4string/ip4tos.c index afdd4f0208..ed4c9f179e 100644 --- a/source/libip4string/ip4tos.c +++ b/source/libip4string/ip4tos.c @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2018 ARM Limited. All rights reserved. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/source/libip4string/stoip4.c b/source/libip4string/stoip4.c index f7ea8642e6..0c0c678185 100644 --- a/source/libip4string/stoip4.c +++ b/source/libip4string/stoip4.c @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2018 ARM Limited. All rights reserved. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/source/libip6string/ip6tos.c b/source/libip6string/ip6tos.c index 5f3b147f2b..6bc65ce320 100644 --- a/source/libip6string/ip6tos.c +++ b/source/libip6string/ip6tos.c @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2016, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/source/libip6string/stoip6.c b/source/libip6string/stoip6.c index 5fda33b624..3a2f7689b1 100644 --- a/source/libip6string/stoip6.c +++ b/source/libip6string/stoip6.c @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/source/nsdynmemLIB/nsdynmemLIB.c b/source/nsdynmemLIB/nsdynmemLIB.c index 99ba624e05..a961b5a8ac 100644 --- a/source/nsdynmemLIB/nsdynmemLIB.c +++ b/source/nsdynmemLIB/nsdynmemLIB.c @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2019 ARM Limited. All rights reserved. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/source/nsdynmemtracker/nsdynmem_tracker_lib.c b/source/nsdynmemtracker/nsdynmem_tracker_lib.c index 9c2bcdfda4..fc83006d9f 100644 --- a/source/nsdynmemtracker/nsdynmem_tracker_lib.c +++ b/source/nsdynmemtracker/nsdynmem_tracker_lib.c @@ -1,15 +1,16 @@ /* - * Copyright (c) 2020 ARM Limited. All rights reserved. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/source/nvmHelper/ns_nvm_helper.c b/source/nvmHelper/ns_nvm_helper.c index eea820951e..b477f4244d 100644 --- a/source/nvmHelper/ns_nvm_helper.c +++ b/source/nvmHelper/ns_nvm_helper.c @@ -1,15 +1,16 @@ /* - * Copyright (c) 2016-2017 ARM Limited. All rights reserved. + * Copyright (c) 2016-2018, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/test/libService/unittest/ip6tos/ip6tos_test.cpp b/test/libService/unittest/ip6tos/ip6tos_test.cpp index a3c844507f..2b11649120 100644 --- a/test/libService/unittest/ip6tos/ip6tos_test.cpp +++ b/test/libService/unittest/ip6tos/ip6tos_test.cpp @@ -1,15 +1,16 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/test/libService/unittest/ip6tos/main.cpp b/test/libService/unittest/ip6tos/main.cpp index 6cc84c7675..072edf7e98 100644 --- a/test/libService/unittest/ip6tos/main.cpp +++ b/test/libService/unittest/ip6tos/main.cpp @@ -1,15 +1,16 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015-2016, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/test/libService/unittest/nsdynmem/dynmemtest.cpp b/test/libService/unittest/nsdynmem/dynmemtest.cpp index 8967d3cd2f..36be9104ad 100644 --- a/test/libService/unittest/nsdynmem/dynmemtest.cpp +++ b/test/libService/unittest/nsdynmem/dynmemtest.cpp @@ -1,15 +1,16 @@ /* - * Copyright (c) 2015-2018 ARM Limited. All rights reserved. + * Copyright (c) 2015-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/test/libService/unittest/nsdynmem/error_callback.c b/test/libService/unittest/nsdynmem/error_callback.c index 9705b6ee23..9640a20e0f 100644 --- a/test/libService/unittest/nsdynmem/error_callback.c +++ b/test/libService/unittest/nsdynmem/error_callback.c @@ -1,15 +1,16 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/test/libService/unittest/nsdynmem/error_callback.h b/test/libService/unittest/nsdynmem/error_callback.h index 9ee2268c00..1bbb1af497 100644 --- a/test/libService/unittest/nsdynmem/error_callback.h +++ b/test/libService/unittest/nsdynmem/error_callback.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015-2016, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/test/libService/unittest/nsdynmem/main.cpp b/test/libService/unittest/nsdynmem/main.cpp index 1c8d74a349..5844a2b85e 100644 --- a/test/libService/unittest/nsdynmem/main.cpp +++ b/test/libService/unittest/nsdynmem/main.cpp @@ -1,15 +1,16 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/test/libService/unittest/nsnvmhelper/main.cpp b/test/libService/unittest/nsnvmhelper/main.cpp index 1d4177e217..6501174929 100644 --- a/test/libService/unittest/nsnvmhelper/main.cpp +++ b/test/libService/unittest/nsnvmhelper/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015-2016, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/test/libService/unittest/nsnvmhelper/nsnvmhelpertest.cpp b/test/libService/unittest/nsnvmhelper/nsnvmhelpertest.cpp index df42b125bf..34aabd386f 100644 --- a/test/libService/unittest/nsnvmhelper/nsnvmhelpertest.cpp +++ b/test/libService/unittest/nsnvmhelper/nsnvmhelpertest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 ARM Limited. All rights reserved. + * Copyright (c) 2016, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/test/libService/unittest/nsnvmhelper/test_ns_nvm_helper.c b/test/libService/unittest/nsnvmhelper/test_ns_nvm_helper.c index a83eb87723..160cef7954 100644 --- a/test/libService/unittest/nsnvmhelper/test_ns_nvm_helper.c +++ b/test/libService/unittest/nsnvmhelper/test_ns_nvm_helper.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 ARM Limited. All rights reserved. + * Copyright (c) 2016, 2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/test/libService/unittest/nsnvmhelper/test_ns_nvm_helper.h b/test/libService/unittest/nsnvmhelper/test_ns_nvm_helper.h index 408a33f2d4..f93b7b194a 100644 --- a/test/libService/unittest/nsnvmhelper/test_ns_nvm_helper.h +++ b/test/libService/unittest/nsnvmhelper/test_ns_nvm_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 ARM Limited. All rights reserved. + * Copyright (c) 2016, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/test/libService/unittest/stoip6/main.cpp b/test/libService/unittest/stoip6/main.cpp index bfd7ec69c5..dd24579f2b 100644 --- a/test/libService/unittest/stoip6/main.cpp +++ b/test/libService/unittest/stoip6/main.cpp @@ -1,15 +1,16 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/test/libService/unittest/stoip6/stoip6test.cpp b/test/libService/unittest/stoip6/stoip6test.cpp index dfa8b0f192..7a9fdacd0a 100644 --- a/test/libService/unittest/stoip6/stoip6test.cpp +++ b/test/libService/unittest/stoip6/stoip6test.cpp @@ -1,15 +1,16 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/test/libService/unittest/stubs/common_functions_stub.c b/test/libService/unittest/stubs/common_functions_stub.c index e99f0c4656..77f3850102 100644 --- a/test/libService/unittest/stubs/common_functions_stub.c +++ b/test/libService/unittest/stubs/common_functions_stub.c @@ -1,15 +1,16 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/test/libService/unittest/stubs/ip6tos_stub.c b/test/libService/unittest/stubs/ip6tos_stub.c index c80a387547..328231463f 100644 --- a/test/libService/unittest/stubs/ip6tos_stub.c +++ b/test/libService/unittest/stubs/ip6tos_stub.c @@ -1,15 +1,16 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/test/libService/unittest/stubs/ip6tos_stub.h b/test/libService/unittest/stubs/ip6tos_stub.h index b404430ce0..2433a76565 100644 --- a/test/libService/unittest/stubs/ip6tos_stub.h +++ b/test/libService/unittest/stubs/ip6tos_stub.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/test/libService/unittest/stubs/ipv6_test_values.h b/test/libService/unittest/stubs/ipv6_test_values.h index 39a632d912..f409241f52 100644 --- a/test/libService/unittest/stubs/ipv6_test_values.h +++ b/test/libService/unittest/stubs/ipv6_test_values.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/test/libService/unittest/stubs/mbed_trace_stub.c b/test/libService/unittest/stubs/mbed_trace_stub.c index e762aee785..84f4bf3dc5 100644 --- a/test/libService/unittest/stubs/mbed_trace_stub.c +++ b/test/libService/unittest/stubs/mbed_trace_stub.c @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2017 ARM Limited. All rights reserved. + * Copyright (c) 2014-2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/test/libService/unittest/stubs/ns_list_stub.c b/test/libService/unittest/stubs/ns_list_stub.c index 6ef5d11a48..fc93e4be63 100644 --- a/test/libService/unittest/stubs/ns_list_stub.c +++ b/test/libService/unittest/stubs/ns_list_stub.c @@ -1,15 +1,16 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/test/libService/unittest/stubs/nsdynmemLIB_stub.c b/test/libService/unittest/stubs/nsdynmemLIB_stub.c index ba0af2542d..4643a1a697 100644 --- a/test/libService/unittest/stubs/nsdynmemLIB_stub.c +++ b/test/libService/unittest/stubs/nsdynmemLIB_stub.c @@ -1,15 +1,16 @@ /* - * Copyright (c) 2016, 2018 ARM Limited. All rights reserved. + * Copyright (c) 2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/test/libService/unittest/stubs/nsdynmemLIB_stub.h b/test/libService/unittest/stubs/nsdynmemLIB_stub.h index 36f7f9529f..869fe4f30e 100644 --- a/test/libService/unittest/stubs/nsdynmemLIB_stub.h +++ b/test/libService/unittest/stubs/nsdynmemLIB_stub.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2016, 2018 ARM Limited. All rights reserved. + * Copyright (c) 2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/test/libService/unittest/stubs/platform_critical.c b/test/libService/unittest/stubs/platform_critical.c index 583a28c2b7..e14749b686 100644 --- a/test/libService/unittest/stubs/platform_critical.c +++ b/test/libService/unittest/stubs/platform_critical.c @@ -1,15 +1,16 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015-2016, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/test/libService/unittest/stubs/platform_nvm_stub.c b/test/libService/unittest/stubs/platform_nvm_stub.c index 0e8195fecd..9da7fdf975 100644 --- a/test/libService/unittest/stubs/platform_nvm_stub.c +++ b/test/libService/unittest/stubs/platform_nvm_stub.c @@ -1,15 +1,16 @@ /* - * Copyright (c) 2016 ARM Limited. All rights reserved. + * Copyright (c) 2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ From 6effd3d3adc6e6cff94f759d70c6be4e666d2793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tero=20J=C3=A4=C3=A4sk=C3=B6?= Date: Wed, 17 Feb 2021 18:50:59 +0200 Subject: [PATCH 09/18] tr_array: fix use after free error after mbed_trace_free() is called If one called mbed_trace_free() but continued using the trace (which is a supported use case), the already freed tmp_data buffer was used by tr_array(). This was spotted by Valgrind on some unit tests which do enable the trace only temporarily for some of the tests. Error being fixed in this PR: --8<--8<--8<--- ==5865== Invalid write of size 1 ==5865== at 0x2639BB: mbed_trace_array (mbed_trace.c:569) <...> ==5865== Address 0x5dc79d0 is 0 bytes inside a block of size 128 free'd ==5865== at 0x4C32D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==5865== by 0x262723: mbed_trace_free (mbed_trace.c:192) <...> ==5865== Block was alloc'd at ==5865== at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==5865== by 0x262548: mbed_trace_init (mbed_trace.c:162) <...> --- platform/mbed-trace/source/mbed_trace.c | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/mbed-trace/source/mbed_trace.c b/platform/mbed-trace/source/mbed_trace.c index 4e1f16a49a..f085137fad 100644 --- a/platform/mbed-trace/source/mbed_trace.c +++ b/platform/mbed-trace/source/mbed_trace.c @@ -209,6 +209,7 @@ void mbed_trace_free(void) m_trace.line_length = DEFAULT_TRACE_LINE_LENGTH; m_trace.tmp_data = 0; m_trace.tmp_data_length = DEFAULT_TRACE_TMP_LINE_LEN; + m_trace.tmp_data_ptr = 0; m_trace.prefix_f = 0; m_trace.suffix_f = 0; m_trace.printf = mbed_trace_default_print; From 6014c830c38ea782b0ba0fbfe12a1d23aebcbda4 Mon Sep 17 00:00:00 2001 From: Antti Kauppila Date: Wed, 12 May 2021 14:03:59 +0300 Subject: [PATCH 10/18] Moved ns_trace.h from nanostack-libservice --- ns_trace.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 ns_trace.h diff --git a/ns_trace.h b/ns_trace.h new file mode 100644 index 0000000000..de9c6785ba --- /dev/null +++ b/ns_trace.h @@ -0,0 +1,37 @@ +// ---------------------------------------------------------------------------- +// Copyright 2015-2021 Pelion. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------- + +/** + * \file ns_trace.h + * Trace interface abstraction for NanoStack library as well as application. + * + * This file was moved to this library for legacy compatibility + * Actual used trace library is mbed-trace. For usage details check mbed_trace.h. + * + */ +#ifndef NS_TRACE_H_ +#define NS_TRACE_H_ + +#if defined(HAVE_DEBUG) && !defined(FEA_TRACE_SUPPORT) +#define FEA_TRACE_SUPPORT +#endif + +#include "ns_types.h" +#include "mbed-trace/mbed_trace.h" + +#endif /* NS_TRACE_H_ */ From a6d5d2c454e0487691fdec11a67cddd569a553ff Mon Sep 17 00:00:00 2001 From: Antti Kauppila Date: Fri, 14 May 2021 10:10:20 +0300 Subject: [PATCH 11/18] Moved ns_trace.h from nanostack-libservice --- ns_trace.h => mbed-client-libservice/ns_trace.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ns_trace.h => mbed-client-libservice/ns_trace.h (100%) diff --git a/ns_trace.h b/mbed-client-libservice/ns_trace.h similarity index 100% rename from ns_trace.h rename to mbed-client-libservice/ns_trace.h From 2874fa67c48ccc2e7e9f26f95937a30ed4e8f6e8 Mon Sep 17 00:00:00 2001 From: Antti Kauppila Date: Wed, 19 May 2021 12:40:09 +0300 Subject: [PATCH 12/18] Move ns_trace.h to mbed-trace folder --- .../mbed-trace/include/mbed-trace}/ns_trace.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {mbed-client-libservice => platform/mbed-trace/include/mbed-trace}/ns_trace.h (100%) diff --git a/mbed-client-libservice/ns_trace.h b/platform/mbed-trace/include/mbed-trace/ns_trace.h similarity index 100% rename from mbed-client-libservice/ns_trace.h rename to platform/mbed-trace/include/mbed-trace/ns_trace.h From 3a3c72878425e3e834c63ec2134d31fdc0536b54 Mon Sep 17 00:00:00 2001 From: Arto Kinnunen Date: Thu, 21 Jan 2021 12:53:18 +0200 Subject: [PATCH 13/18] Update license text in test files. (#14) --- platform/randlib/tests/unit/randlib/main.cpp | 2 +- platform/randlib/tests/unit/randlib/randlibtest.cpp | 2 +- platform/randlib/tests/unit/randlib/test_randlib.c | 2 +- platform/randlib/tests/unit/randlib/test_randlib.h | 2 +- platform/randlib/tests/unit/stubs/open_stub.c | 3 +++ 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/platform/randlib/tests/unit/randlib/main.cpp b/platform/randlib/tests/unit/randlib/main.cpp index 2ace856ecd..b8f54925ae 100644 --- a/platform/randlib/tests/unit/randlib/main.cpp +++ b/platform/randlib/tests/unit/randlib/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 ARM. All rights reserved. + * Copyright (c) 2015 ARM Limited. All rights reserved. */ #include "CppUTest/CommandLineTestRunner.h" diff --git a/platform/randlib/tests/unit/randlib/randlibtest.cpp b/platform/randlib/tests/unit/randlib/randlibtest.cpp index 309896d81d..1a9d1f9c07 100644 --- a/platform/randlib/tests/unit/randlib/randlibtest.cpp +++ b/platform/randlib/tests/unit/randlib/randlibtest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 ARM. All rights reserved. + * Copyright (c) 2016 ARM Limited. All rights reserved. */ #include "CppUTest/TestHarness.h" #include "test_randlib.h" diff --git a/platform/randlib/tests/unit/randlib/test_randlib.c b/platform/randlib/tests/unit/randlib/test_randlib.c index 3a9639f7b7..cc87ccb02e 100644 --- a/platform/randlib/tests/unit/randlib/test_randlib.c +++ b/platform/randlib/tests/unit/randlib/test_randlib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 ARM. All rights reserved. + * Copyright (c) 2016 ARM Limited. All rights reserved. */ #include "test_randlib.h" #include diff --git a/platform/randlib/tests/unit/randlib/test_randlib.h b/platform/randlib/tests/unit/randlib/test_randlib.h index 54909d470f..eaea37b713 100644 --- a/platform/randlib/tests/unit/randlib/test_randlib.h +++ b/platform/randlib/tests/unit/randlib/test_randlib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 ARM. All rights reserved. + * Copyright (c) 2016 ARM Limited. All rights reserved. */ #ifndef TEST_RANDLIB_H #define TEST_RANDLIB_H diff --git a/platform/randlib/tests/unit/stubs/open_stub.c b/platform/randlib/tests/unit/stubs/open_stub.c index 6fda589546..c57a44a02a 100644 --- a/platform/randlib/tests/unit/stubs/open_stub.c +++ b/platform/randlib/tests/unit/stubs/open_stub.c @@ -1,3 +1,6 @@ +/* + * Copyright (c) 2016 ARM Limited. All rights reserved. + */ #include #include #include From 6249aad249d91a84ab800079a4a81b889353472b Mon Sep 17 00:00:00 2001 From: Arto Kinnunen Date: Mon, 17 May 2021 13:28:43 +0300 Subject: [PATCH 14/18] Update copyright (#15) -Change company name from Arm Limited to Pelion -Update years --- .../mbed-client-randlib/platform/arm_hal_random.h | 13 +++++++------ .../randlib/include/mbed-client-randlib/randLIB.h | 13 +++++++------ platform/randlib/source/randLIB.c | 13 +++++++------ platform/randlib/tests/unit/randlib/main.cpp | 2 +- .../randlib/tests/unit/randlib/randlibtest.cpp | 2 +- .../randlib/tests/unit/randlib/test_randlib.c | 2 +- .../randlib/tests/unit/randlib/test_randlib.h | 2 +- platform/randlib/tests/unit/stubs/open_stub.c | 2 +- platform/randlib/tests/unit/stubs/random_stub.c | 15 +-------------- 9 files changed, 27 insertions(+), 37 deletions(-) diff --git a/platform/randlib/include/mbed-client-randlib/platform/arm_hal_random.h b/platform/randlib/include/mbed-client-randlib/platform/arm_hal_random.h index 337486dedd..75fd7f5709 100644 --- a/platform/randlib/include/mbed-client-randlib/platform/arm_hal_random.h +++ b/platform/randlib/include/mbed-client-randlib/platform/arm_hal_random.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2016, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/platform/randlib/include/mbed-client-randlib/randLIB.h b/platform/randlib/include/mbed-client-randlib/randLIB.h index a58af013c8..0b7def9a17 100644 --- a/platform/randlib/include/mbed-client-randlib/randLIB.h +++ b/platform/randlib/include/mbed-client-randlib/randLIB.h @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2016, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/platform/randlib/source/randLIB.c b/platform/randlib/source/randLIB.c index 274e9bc39b..ecd2aa2c59 100644 --- a/platform/randlib/source/randLIB.c +++ b/platform/randlib/source/randLIB.c @@ -1,15 +1,16 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ diff --git a/platform/randlib/tests/unit/randlib/main.cpp b/platform/randlib/tests/unit/randlib/main.cpp index b8f54925ae..55bfbfe6c7 100644 --- a/platform/randlib/tests/unit/randlib/main.cpp +++ b/platform/randlib/tests/unit/randlib/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015-2016, 2018, 2021, Pelion and affiliates. */ #include "CppUTest/CommandLineTestRunner.h" diff --git a/platform/randlib/tests/unit/randlib/randlibtest.cpp b/platform/randlib/tests/unit/randlib/randlibtest.cpp index 1a9d1f9c07..9812c6b570 100644 --- a/platform/randlib/tests/unit/randlib/randlibtest.cpp +++ b/platform/randlib/tests/unit/randlib/randlibtest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 ARM Limited. All rights reserved. + * Copyright (c) 2016, 2018, 2021, Pelion and affiliates. */ #include "CppUTest/TestHarness.h" #include "test_randlib.h" diff --git a/platform/randlib/tests/unit/randlib/test_randlib.c b/platform/randlib/tests/unit/randlib/test_randlib.c index cc87ccb02e..737ef1dcbf 100644 --- a/platform/randlib/tests/unit/randlib/test_randlib.c +++ b/platform/randlib/tests/unit/randlib/test_randlib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 ARM Limited. All rights reserved. + * Copyright (c) 2016, 2018, 2021, Pelion and affiliates. */ #include "test_randlib.h" #include diff --git a/platform/randlib/tests/unit/randlib/test_randlib.h b/platform/randlib/tests/unit/randlib/test_randlib.h index eaea37b713..089de9dcc6 100644 --- a/platform/randlib/tests/unit/randlib/test_randlib.h +++ b/platform/randlib/tests/unit/randlib/test_randlib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 ARM Limited. All rights reserved. + * Copyright (c) 2016, 2021, Pelion and affiliates. */ #ifndef TEST_RANDLIB_H #define TEST_RANDLIB_H diff --git a/platform/randlib/tests/unit/stubs/open_stub.c b/platform/randlib/tests/unit/stubs/open_stub.c index c57a44a02a..453b0ae8b4 100644 --- a/platform/randlib/tests/unit/stubs/open_stub.c +++ b/platform/randlib/tests/unit/stubs/open_stub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 ARM Limited. All rights reserved. + * Copyright (c) 2016, 2018, 2021, Pelion and affiliates. */ #include #include diff --git a/platform/randlib/tests/unit/stubs/random_stub.c b/platform/randlib/tests/unit/stubs/random_stub.c index 5d5a37c4c5..da520a67eb 100644 --- a/platform/randlib/tests/unit/stubs/random_stub.c +++ b/platform/randlib/tests/unit/stubs/random_stub.c @@ -1,18 +1,5 @@ /* - * Copyright (c) 2016 ARM Limited. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright (c) 2016, 2018, 2021, Pelion and affiliates. */ #include "ns_types.h" From 51247bfc103713ca19624eb68fa97961bc7d6192 Mon Sep 17 00:00:00 2001 From: Arto Kinnunen Date: Wed, 23 Jun 2021 12:56:59 +0300 Subject: [PATCH 15/18] Squashed 'connectivity/nanostack/coap-service/' changes from 4a126bd278..bbe01736bd bbe01736bd (via Mbed OS) mbedtls_stub: Add missing include (#134) c021690e3a Update copyright to Makefiles and scripts (#133) 5fb7a6c3b8 Update copyright (#132) git-subtree-dir: connectivity/nanostack/coap-service git-subtree-split: bbe01736bdafc808ee61c500223d0cf67953238d --- connectivity/nanostack/coap-service/Makefile | 2 +- connectivity/nanostack/coap-service/Makefile.test | 2 +- .../nanostack/coap-service/coap-service/coap_service_api.h | 2 +- connectivity/nanostack/coap-service/run_unit_tests.sh | 2 +- .../nanostack/coap-service/source/coap_connection_handler.c | 2 +- .../nanostack/coap-service/source/coap_message_handler.c | 2 +- .../nanostack/coap-service/source/coap_security_handler.c | 2 +- connectivity/nanostack/coap-service/source/coap_service_api.c | 2 +- .../coap-service/source/include/coap_connection_handler.h | 2 +- .../coap-service/source/include/coap_message_handler.h | 2 +- .../coap-service/source/include/coap_security_handler.h | 2 +- .../coap-service/source/include/coap_service_api_internal.h | 2 +- .../nanostack/coap-service/test/coap-service/unittest/Makefile | 2 +- .../coap-service/test/coap-service/unittest/MakefileWorker.mk | 2 +- .../test/coap-service/unittest/coap_connection_handler/Makefile | 2 +- .../coap_connection_handler/coap_connection_handlertest.cpp | 2 +- .../test/coap-service/unittest/coap_connection_handler/main.cpp | 2 +- .../coap_connection_handler/test_coap_connection_handler.c | 2 +- .../coap_connection_handler/test_coap_connection_handler.h | 2 +- .../test/coap-service/unittest/coap_message_handler/Makefile | 2 +- .../unittest/coap_message_handler/coap_message_handlertest.cpp | 2 +- .../test/coap-service/unittest/coap_message_handler/main.cpp | 2 +- .../unittest/coap_message_handler/test_coap_message_handler.c | 2 +- .../unittest/coap_message_handler/test_coap_message_handler.h | 2 +- .../test/coap-service/unittest/coap_security_handler/Makefile | 2 +- .../coap_security_handler/coap_security_handlertest.cpp | 2 +- .../test/coap-service/unittest/coap_security_handler/main.cpp | 2 +- .../unittest/coap_security_handler/test_coap_security_handler.c | 2 +- .../unittest/coap_security_handler/test_coap_security_handler.h | 2 +- .../test/coap-service/unittest/coap_service_api/Makefile | 2 +- .../unittest/coap_service_api/coap_service_apitest.cpp | 2 +- .../test/coap-service/unittest/coap_service_api/main.cpp | 2 +- .../unittest/coap_service_api/test_coap_service_api.c | 2 +- .../unittest/coap_service_api/test_coap_service_api.h | 2 +- .../test/coap-service/unittest/makefile_defines.txt | 2 +- .../nanostack/coap-service/test/coap-service/unittest/run_tests | 2 +- .../coap-service/unittest/stub/coap_connection_handler_stub.c | 2 +- .../coap-service/unittest/stub/coap_connection_handler_stub.h | 2 +- .../test/coap-service/unittest/stub/coap_message_handler_stub.c | 2 +- .../test/coap-service/unittest/stub/coap_message_handler_stub.h | 2 +- .../coap-service/unittest/stub/coap_security_handler_stub.c | 2 +- .../coap-service/unittest/stub/coap_security_handler_stub.h | 2 +- .../test/coap-service/unittest/stub/coap_service_api_stub.c | 2 +- .../test/coap-service/unittest/stub/common_functions_stub.c | 2 +- .../test/coap-service/unittest/stub/eventOS_event_stub.c | 2 +- .../test/coap-service/unittest/stub/eventOS_event_stub.h | 2 +- .../test/coap-service/unittest/stub/mbed_trace_stub.c | 2 +- .../coap-service/test/coap-service/unittest/stub/mbedtls_stub.c | 2 +- .../coap-service/test/coap-service/unittest/stub/mbedtls_stub.h | 2 +- .../coap-service/test/coap-service/unittest/stub/ns_list_stub.c | 2 +- .../test/coap-service/unittest/stub/ns_timer_stub.c | 2 +- .../test/coap-service/unittest/stub/ns_timer_stub.h | 2 +- .../test/coap-service/unittest/stub/nsdynmemLIB_stub.c | 2 +- .../test/coap-service/unittest/stub/nsdynmemLIB_stub.h | 2 +- .../coap-service/test/coap-service/unittest/stub/randLIB_stub.c | 2 +- .../test/coap-service/unittest/stub/sn_coap_builder_stub.c | 2 +- .../test/coap-service/unittest/stub/sn_coap_builder_stub.h | 2 +- .../test/coap-service/unittest/stub/sn_coap_parser_stub.c | 2 +- .../test/coap-service/unittest/stub/sn_coap_parser_stub.h | 2 +- .../test/coap-service/unittest/stub/sn_coap_protocol_stub.c | 2 +- .../test/coap-service/unittest/stub/sn_coap_protocol_stub.h | 2 +- .../test/coap-service/unittest/stub/socket_api_stub.c | 2 +- .../test/coap-service/unittest/stub/socket_api_stub.h | 2 +- .../test/coap-service/unittest/stub/system_timer_stub.c | 2 +- .../coap-service/test/coap-service/unittest/stub/timeout_stub.c | 2 +- connectivity/nanostack/coap-service/xsl_script.sh | 2 +- 66 files changed, 66 insertions(+), 66 deletions(-) diff --git a/connectivity/nanostack/coap-service/Makefile b/connectivity/nanostack/coap-service/Makefile index f104a78110..33852c057a 100644 --- a/connectivity/nanostack/coap-service/Makefile +++ b/connectivity/nanostack/coap-service/Makefile @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2017, Arm Limited and affiliates. +# Copyright (c) 2015-2017, Pelion and affiliates. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/Makefile.test b/connectivity/nanostack/coap-service/Makefile.test index 7887624ef5..cfaffb0fb4 100644 --- a/connectivity/nanostack/coap-service/Makefile.test +++ b/connectivity/nanostack/coap-service/Makefile.test @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2017, Arm Limited and affiliates. +# Copyright (c) 2015-2017, Pelion and affiliates. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/coap-service/coap_service_api.h b/connectivity/nanostack/coap-service/coap-service/coap_service_api.h index edacd971de..34a8a1ac59 100644 --- a/connectivity/nanostack/coap-service/coap-service/coap_service_api.h +++ b/connectivity/nanostack/coap-service/coap-service/coap_service_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/run_unit_tests.sh b/connectivity/nanostack/coap-service/run_unit_tests.sh index d2e7373e97..14957d9ad7 100755 --- a/connectivity/nanostack/coap-service/run_unit_tests.sh +++ b/connectivity/nanostack/coap-service/run_unit_tests.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 2015-2017, Arm Limited and affiliates. +# Copyright (c) 2015-2017, Pelion and affiliates. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/source/coap_connection_handler.c b/connectivity/nanostack/coap-service/source/coap_connection_handler.c index 4dca56c916..a749cac806 100644 --- a/connectivity/nanostack/coap-service/source/coap_connection_handler.c +++ b/connectivity/nanostack/coap-service/source/coap_connection_handler.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/source/coap_message_handler.c b/connectivity/nanostack/coap-service/source/coap_message_handler.c index d4cef6a5ea..708d69711f 100644 --- a/connectivity/nanostack/coap-service/source/coap_message_handler.c +++ b/connectivity/nanostack/coap-service/source/coap_message_handler.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/source/coap_security_handler.c b/connectivity/nanostack/coap-service/source/coap_security_handler.c index 5afd2abf02..61c514aae2 100644 --- a/connectivity/nanostack/coap-service/source/coap_security_handler.c +++ b/connectivity/nanostack/coap-service/source/coap_security_handler.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/source/coap_service_api.c b/connectivity/nanostack/coap-service/source/coap_service_api.c index ee467cf902..4ef682a042 100644 --- a/connectivity/nanostack/coap-service/source/coap_service_api.c +++ b/connectivity/nanostack/coap-service/source/coap_service_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/source/include/coap_connection_handler.h b/connectivity/nanostack/coap-service/source/include/coap_connection_handler.h index 2cc8f79011..b9017de5b4 100644 --- a/connectivity/nanostack/coap-service/source/include/coap_connection_handler.h +++ b/connectivity/nanostack/coap-service/source/include/coap_connection_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/source/include/coap_message_handler.h b/connectivity/nanostack/coap-service/source/include/coap_message_handler.h index a93a48b1cf..82e817ba66 100644 --- a/connectivity/nanostack/coap-service/source/include/coap_message_handler.h +++ b/connectivity/nanostack/coap-service/source/include/coap_message_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/source/include/coap_security_handler.h b/connectivity/nanostack/coap-service/source/include/coap_security_handler.h index 9529b53bec..1f25a310d3 100644 --- a/connectivity/nanostack/coap-service/source/include/coap_security_handler.h +++ b/connectivity/nanostack/coap-service/source/include/coap_security_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/source/include/coap_service_api_internal.h b/connectivity/nanostack/coap-service/source/include/coap_service_api_internal.h index d9e1aa7f30..c4168fcc66 100644 --- a/connectivity/nanostack/coap-service/source/include/coap_service_api_internal.h +++ b/connectivity/nanostack/coap-service/source/include/coap_service_api_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/Makefile b/connectivity/nanostack/coap-service/test/coap-service/unittest/Makefile index f42b2c6935..ac01bb6f35 100755 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/Makefile +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/Makefile @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2017, Arm Limited and affiliates. +# Copyright (c) 2015-2017, Pelion and affiliates. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/MakefileWorker.mk b/connectivity/nanostack/coap-service/test/coap-service/unittest/MakefileWorker.mk index 48b6a91995..71a07bf4c4 100755 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/MakefileWorker.mk +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/MakefileWorker.mk @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2017, Arm Limited and affiliates. +# Copyright (c) 2015-2017, Pelion and affiliates. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/Makefile b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/Makefile index 82f8bcda0e..63a71feb61 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/Makefile +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/Makefile @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2017, Arm Limited and affiliates. +# Copyright (c) 2015-2017, Pelion and affiliates. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/coap_connection_handlertest.cpp b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/coap_connection_handlertest.cpp index d74676b0dc..772f4ab118 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/coap_connection_handlertest.cpp +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/coap_connection_handlertest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/main.cpp b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/main.cpp index c70c3fec00..75c0d68f47 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/main.cpp +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/test_coap_connection_handler.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/test_coap_connection_handler.c index 7ac183c80c..7d52c10da1 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/test_coap_connection_handler.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/test_coap_connection_handler.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/test_coap_connection_handler.h b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/test_coap_connection_handler.h index 8cd7b0f0c7..39ad28def8 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/test_coap_connection_handler.h +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/test_coap_connection_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/Makefile b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/Makefile index 94558a8080..8d02228a5b 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/Makefile +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/Makefile @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2017, Arm Limited and affiliates. +# Copyright (c) 2015-2017, Pelion affiliates. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/coap_message_handlertest.cpp b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/coap_message_handlertest.cpp index 02489ad270..d0c946e8dd 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/coap_message_handlertest.cpp +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/coap_message_handlertest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/main.cpp b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/main.cpp index fa0c7f3c68..49192ba32c 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/main.cpp +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/test_coap_message_handler.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/test_coap_message_handler.c index 87f521e52c..90c4539b68 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/test_coap_message_handler.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/test_coap_message_handler.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/test_coap_message_handler.h b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/test_coap_message_handler.h index 18f5c0fca7..025b8496d6 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/test_coap_message_handler.h +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_message_handler/test_coap_message_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/Makefile b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/Makefile index 1375ed9282..0dfda47a40 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/Makefile +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/Makefile @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2017, Arm Limited and affiliates. +# Copyright (c) 2015-2017, Pelion and affiliates. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/coap_security_handlertest.cpp b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/coap_security_handlertest.cpp index 4b9a576b00..41cd9a02a4 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/coap_security_handlertest.cpp +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/coap_security_handlertest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/main.cpp b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/main.cpp index bd9cb57f65..29ae8a5894 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/main.cpp +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/test_coap_security_handler.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/test_coap_security_handler.c index 396d689f8e..9b3b1bfd20 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/test_coap_security_handler.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/test_coap_security_handler.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/test_coap_security_handler.h b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/test_coap_security_handler.h index 64bdbe4a11..87977548d0 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/test_coap_security_handler.h +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_security_handler/test_coap_security_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/Makefile b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/Makefile index e43eb174b0..24c2da8403 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/Makefile +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/Makefile @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2017, Arm Limited and affiliates. +# Copyright (c) 2015-2017, Pelion and affiliates. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/coap_service_apitest.cpp b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/coap_service_apitest.cpp index 0fd44bb515..ac853f7a5f 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/coap_service_apitest.cpp +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/coap_service_apitest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/main.cpp b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/main.cpp index 7e09b0cd0e..2d97cea355 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/main.cpp +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/test_coap_service_api.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/test_coap_service_api.c index 2af8ba6cc8..52ae07a084 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/test_coap_service_api.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/test_coap_service_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/test_coap_service_api.h b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/test_coap_service_api.h index 591cb94738..fcdc6cc7a1 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/test_coap_service_api.h +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/coap_service_api/test_coap_service_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/makefile_defines.txt b/connectivity/nanostack/coap-service/test/coap-service/unittest/makefile_defines.txt index dc1f53eb30..e95299376f 100755 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/makefile_defines.txt +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/makefile_defines.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2017, Arm Limited and affiliates. +# Copyright (c) 2015-2017, Pelion and affiliates. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/run_tests b/connectivity/nanostack/coap-service/test/coap-service/unittest/run_tests index 438b5d7007..685a151367 100755 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/run_tests +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/run_tests @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) 2015-2017, Arm Limited and affiliates. +# Copyright (c) 2015-2017, Pelion and affiliates. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_connection_handler_stub.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_connection_handler_stub.c index 022fb67dcf..b3b0dfb3ae 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_connection_handler_stub.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_connection_handler_stub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_connection_handler_stub.h b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_connection_handler_stub.h index 9379b9b6c2..4e343e4a0c 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_connection_handler_stub.h +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_connection_handler_stub.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_message_handler_stub.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_message_handler_stub.c index 91fa2a3f47..349f16970c 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_message_handler_stub.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_message_handler_stub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_message_handler_stub.h b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_message_handler_stub.h index 5ea68eff9f..2815634935 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_message_handler_stub.h +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_message_handler_stub.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_security_handler_stub.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_security_handler_stub.c index d62e162eed..74613ef35b 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_security_handler_stub.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_security_handler_stub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_security_handler_stub.h b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_security_handler_stub.h index c445c5d598..485cec4356 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_security_handler_stub.h +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_security_handler_stub.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_service_api_stub.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_service_api_stub.c index e2ab1f4074..767b67f577 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_service_api_stub.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/coap_service_api_stub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/common_functions_stub.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/common_functions_stub.c index 730594cdd8..0794a0ff46 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/common_functions_stub.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/common_functions_stub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/eventOS_event_stub.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/eventOS_event_stub.c index a461f38c16..0239748788 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/eventOS_event_stub.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/eventOS_event_stub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/eventOS_event_stub.h b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/eventOS_event_stub.h index 58880bff84..6d36812847 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/eventOS_event_stub.h +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/eventOS_event_stub.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/mbed_trace_stub.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/mbed_trace_stub.c index 04f452c0ff..dcb694eb57 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/mbed_trace_stub.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/mbed_trace_stub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/mbedtls_stub.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/mbedtls_stub.c index 7ebe517382..be8d31955b 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/mbedtls_stub.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/mbedtls_stub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/mbedtls_stub.h b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/mbedtls_stub.h index 1910f9c5f2..e636c37172 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/mbedtls_stub.h +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/mbedtls_stub.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/ns_list_stub.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/ns_list_stub.c index 6dab2fd75d..badd74b37d 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/ns_list_stub.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/ns_list_stub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/ns_timer_stub.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/ns_timer_stub.c index ae79433dac..5bf7f8a14a 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/ns_timer_stub.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/ns_timer_stub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/ns_timer_stub.h b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/ns_timer_stub.h index f7a53a40f1..c6bab974a2 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/ns_timer_stub.h +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/ns_timer_stub.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/nsdynmemLIB_stub.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/nsdynmemLIB_stub.c index 4228148e49..b73177ec3a 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/nsdynmemLIB_stub.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/nsdynmemLIB_stub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/nsdynmemLIB_stub.h b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/nsdynmemLIB_stub.h index e5dfa75186..01bb7fc2ec 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/nsdynmemLIB_stub.h +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/nsdynmemLIB_stub.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/randLIB_stub.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/randLIB_stub.c index 97154cf2ee..86e02ff16c 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/randLIB_stub.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/randLIB_stub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_builder_stub.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_builder_stub.c index 262da57522..7e02261f09 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_builder_stub.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_builder_stub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2017, Arm Limited and affiliates. + * Copyright (c) 2011-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_builder_stub.h b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_builder_stub.h index a81eaff7a0..732fc41269 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_builder_stub.h +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_builder_stub.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_parser_stub.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_parser_stub.c index 7747f5c639..4809c04e1c 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_parser_stub.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_parser_stub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2017, Arm Limited and affiliates. + * Copyright (c) 2011-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_parser_stub.h b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_parser_stub.h index 5665a2bb62..b24c01404c 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_parser_stub.h +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_parser_stub.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_protocol_stub.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_protocol_stub.c index 85ca20e9bb..121ae08767 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_protocol_stub.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_protocol_stub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2017, Arm Limited and affiliates. + * Copyright (c) 2011-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_protocol_stub.h b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_protocol_stub.h index dbf8521ad6..5c1f8eb726 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_protocol_stub.h +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/sn_coap_protocol_stub.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/socket_api_stub.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/socket_api_stub.c index 541a6e11ec..b8229e73c6 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/socket_api_stub.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/socket_api_stub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/socket_api_stub.h b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/socket_api_stub.h index 0ddb6e66de..d685c17ca2 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/socket_api_stub.h +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/socket_api_stub.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/system_timer_stub.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/system_timer_stub.c index 2f5262a118..035390be6b 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/system_timer_stub.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/system_timer_stub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/timeout_stub.c b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/timeout_stub.c index fcd63a86fc..f9c5744a8c 100644 --- a/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/timeout_stub.c +++ b/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/timeout_stub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/coap-service/xsl_script.sh b/connectivity/nanostack/coap-service/xsl_script.sh index 7d39e3d94f..ed5b142d85 100755 --- a/connectivity/nanostack/coap-service/xsl_script.sh +++ b/connectivity/nanostack/coap-service/xsl_script.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2015-2017, Arm Limited and affiliates. +# Copyright (c) 2015-2017, Pelion and affiliates. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); From 3b9a9c7fe3b26837db3af932b737c787010c976b Mon Sep 17 00:00:00 2001 From: Arto Kinnunen Date: Wed, 23 Jun 2021 12:59:27 +0300 Subject: [PATCH 16/18] Squashed 'connectivity/nanostack/sal-stack-nanostack/' changes from 0903b819c5..4a3c5c525b 4a3c5c525b Merge remote-tracking branch 'origin/release_internal' into release_external 2b8d2e1356 Do not reset radio when MAC data request timeouts (#2647) 95c506a276 Frame counters for nw keys are now stored to NVM only after send key is set (#2641) 3b3010a79b Adjusted stagger random to [min,min+max] and for small nw set the stagger value to 10 seconds 02bc33a242 Adjusted security protocol (EAP-TLS,4WH,2WH) retry timers eb26726020 High Priority timestamp compare overflow support fix. 928723a33e FHSS WS: Initialize broadcast channel count when enabling FHSS (#2642) 6040d703c8 Updated change log 667b191223 Changed initial EAPOL-key retries from trickle to exponential backup d925145d33 Add RTT calculation for DHCP Time calculation 0b82953567 Traceroute bug fix. 04de6e26d8 Merge pull request #2638 from PelionIoT/mbed_os_fix_ufsi_calculation 20123477c6 Fixed FHSS UFSI calculation unit tests 436f16e84f Handle timer rollover in calculate_ufsi 411cf5c7a4 coding style d6f44218d6 Correct ufsi timing calculation 560619d85d Add network time vendor data element to DHCPv6 reply message 6d290dc3c1 System time read/write callbacks (#2637) 7905df666d Restart or remove transmission when MAC data request timeouts (#2636) c97695cfc6 Bug fix: EAPOL parent compare fix e283e6285c Fixed channel mask usage with OFDM configurations (#2633) 24168f891b Do not send too old packets (#2632) dbd83be16d Fix copyrights (#2631) 7f0cffdbf7 Merge pull request #2630 from PelionIoT/use_pelion_copyright 511bd5a3ad Corrected coding style 57ec0281a8 Corrected comparison 7d853de862 When EAPOL waiting queue is full oldest entry is removed acf580fbd0 Update copyright in changed MDNS files 933c0bbf0a Update copyright 3aeb2af77c Statistics for data request latencies (#2629) 3f7eae64ef EAPOL FHSS temp entry discover 5200b666e7 DHCP time elapsed time write fix. 0536874f64 Removed empty EAPOL-key message send after 4WH completion to nodes on relay 8a2a683aef Fixed DHCP wrong time elapsed value write. 283f2ee685 DHCPv6 update: 99be7783ec EAPOL temp neighbour update 4f9e3d12ab Adaptation layer to remove oldest packet first 20f1f6492f Added ignoring of retry messages from RADIUS server when waiting EAP-TLS 8a8b407c47 Add RSL check for ETX Calculation for RPL parent selection c05e1da757 Fix DHCP server Uninitialized memory read 77229eefa6 Fix CPP error from domain prefix check 7e47889111 support filtering of EAPOL parents based device-min-sens configuration 618a19192c Wi-SUN Expedite forward state update 4371462d66 Fix NULL read from RPL header addition 7802c7ee97 Update CHANGELOG.md b2c810402c CHANGELOG for Nanostack v13.0.0 (#2615) git-subtree-dir: connectivity/nanostack/sal-stack-nanostack git-subtree-split: 4a3c5c525b2a62c19ecfb0ac64d09bd2a7f56ceb --- .../sal-stack-nanostack/LICENSE-Apache-2.0 | 2 +- .../sal-stack-nanostack/LICENSE-BSD-3-Clause | 2 +- .../sal-stack-nanostack/nanostack/cca_api.h | 2 +- .../sal-stack-nanostack/nanostack/ccmLIB.h | 2 +- .../nanostack/dhcp_service_api.h | 15 +- .../nanostack/ethernet_mac_api.h | 2 +- .../sal-stack-nanostack/nanostack/fhss_api.h | 2 +- .../nanostack/fhss_config.h | 2 +- .../nanostack/fhss_test_api.h | 2 +- .../nanostack/fhss_ws_extension.h | 2 +- .../sal-stack-nanostack/nanostack/mac_api.h | 3 +- .../nanostack/mac_common_defines.h | 2 +- .../nanostack/mac_filter_api.h | 2 +- .../sal-stack-nanostack/nanostack/mac_mcps.h | 2 +- .../sal-stack-nanostack/nanostack/mlme.h | 2 +- .../nanostack/multicast_api.h | 2 +- .../nanostack/net_6lowpan_parameter_api.h | 2 +- .../nanostack/net_address_extension.h | 2 +- .../sal-stack-nanostack/nanostack/net_fhss.h | 2 +- .../nanostack/net_interface.h | 2 +- .../nanostack/net_ipv6_api.h | 2 +- .../nanostack/net_load_balance_api.h | 2 +- .../nanostack/net_mle_api.h | 2 +- .../nanostack/net_nvm_api.h | 2 +- .../nanostack/net_nwk_scan.h | 2 +- .../nanostack/net_pana_parameters_api.h | 2 +- .../nanostack/net_polling_api.h | 2 +- .../sal-stack-nanostack/nanostack/net_rpl.h | 2 +- .../sal-stack-nanostack/nanostack/net_sleep.h | 2 +- .../nanostack/net_test_api.h | 2 +- .../nanostack/net_thread_test.h | 2 +- .../nanostack/net_ws_test.h | 2 +- .../nanostack/ns_address.h | 2 +- .../sal-stack-nanostack/nanostack/ns_conf.h | 2 +- .../nanostack/ns_file_system.h | 2 +- .../nanostack/ns_mdns_api.h | 2 +- .../sal-stack-nanostack/nanostack/ns_sha256.h | 2 +- .../nanostack/ns_time_api.h | 32 ++- .../nanostack/ns_virtual_rf_api.h | 2 +- .../nanostack/nwk_stats_api.h | 3 +- .../nanostack/platform/arm_hal_aes.h | 2 +- .../nanostack/platform/arm_hal_phy.h | 2 +- .../nanostack/platform/os_whiteboard.h | 2 +- .../nanostack/platform/topo_trace.h | 2 +- .../nanostack/serial_mac_api.h | 2 +- .../sal-stack-nanostack/nanostack/shalib.h | 2 +- .../nanostack/socket_api.h | 2 +- .../sal-stack-nanostack/nanostack/sw_mac.h | 2 +- .../nanostack/thread_bbr_api.h | 2 +- .../nanostack/thread_border_router_api.h | 2 +- .../nanostack/thread_commissioning_api.h | 2 +- .../nanostack/thread_dhcpv6_server.h | 2 +- .../nanostack/thread_diagcop_lib.h | 2 +- .../nanostack/thread_lowpower_api.h | 2 +- .../nanostack/thread_management_api.h | 2 +- .../nanostack/thread_management_if.h | 2 +- .../nanostack/thread_meshcop_lib.h | 2 +- .../nanostack/thread_net_config_api.h | 2 +- .../nanostack/whiteboard_api.h | 2 +- .../nanostack/ws_bbr_api.h | 2 +- .../nanostack/ws_management_api.h | 12 +- .../6LoWPAN/Bootstraps/Generic/network_lib.c | 2 +- .../Bootstraps/Generic/protocol_6lowpan.c | 11 +- .../Generic/protocol_6lowpan_bootstrap.c | 2 +- .../Generic/protocol_6lowpan_interface.c | 2 +- .../source/6LoWPAN/Bootstraps/network_lib.h | 2 +- .../6LoWPAN/Bootstraps/protocol_6lowpan.h | 2 +- .../Bootstraps/protocol_6lowpan_bootstrap.h | 2 +- .../Bootstraps/protocol_6lowpan_interface.h | 2 +- .../6LoWPAN/Fragmentation/cipv6_fragmenter.c | 2 +- .../6LoWPAN/Fragmentation/cipv6_fragmenter.h | 2 +- .../source/6LoWPAN/IPHC_Decode/6lowpan_iphc.c | 2 +- .../source/6LoWPAN/IPHC_Decode/cipv6.h | 2 +- .../6LoWPAN/IPHC_Decode/iphc_compress.c | 2 +- .../6LoWPAN/IPHC_Decode/iphc_compress.h | 2 +- .../6LoWPAN/IPHC_Decode/iphc_decompress.c | 2 +- .../6LoWPAN/IPHC_Decode/iphc_decompress.h | 2 +- .../6LoWPAN/IPHC_Decode/lowpan_context.c | 2 +- .../6LoWPAN/IPHC_Decode/lowpan_context.h | 2 +- .../source/6LoWPAN/MAC/beacon_handler.c | 2 +- .../source/6LoWPAN/MAC/beacon_handler.h | 2 +- .../source/6LoWPAN/MAC/mac_data_poll.c | 2 +- .../source/6LoWPAN/MAC/mac_data_poll.h | 2 +- .../source/6LoWPAN/MAC/mac_helper.c | 2 +- .../source/6LoWPAN/MAC/mac_helper.h | 2 +- .../source/6LoWPAN/MAC/mac_ie_lib.c | 2 +- .../source/6LoWPAN/MAC/mac_ie_lib.h | 2 +- .../source/6LoWPAN/MAC/mac_pairwise_key.c | 2 +- .../source/6LoWPAN/MAC/mac_pairwise_key.h | 2 +- .../source/6LoWPAN/MAC/mac_response_handler.c | 2 +- .../source/6LoWPAN/MAC/mac_response_handler.h | 2 +- .../source/6LoWPAN/MAC/mpx_api.h | 2 +- .../source/6LoWPAN/Mesh/mesh.c | 2 +- .../source/6LoWPAN/Mesh/mesh.h | 2 +- .../source/6LoWPAN/ND/nd_defines.h | 2 +- .../source/6LoWPAN/ND/nd_router_object.c | 2 +- .../source/6LoWPAN/ND/nd_router_object.h | 2 +- .../source/6LoWPAN/NVM/nwk_nvm.c | 2 +- .../source/6LoWPAN/NVM/nwk_nvm.h | 2 +- .../source/6LoWPAN/Thread/thread_bbr_api.c | 2 +- .../6LoWPAN/Thread/thread_bbr_api_internal.h | 2 +- .../6LoWPAN/Thread/thread_bbr_commercial.c | 4 +- .../6LoWPAN/Thread/thread_bbr_commercial.h | 2 +- .../source/6LoWPAN/Thread/thread_beacon.c | 2 +- .../source/6LoWPAN/Thread/thread_beacon.h | 2 +- .../source/6LoWPAN/Thread/thread_bootstrap.c | 2 +- .../source/6LoWPAN/Thread/thread_bootstrap.h | 2 +- .../6LoWPAN/Thread/thread_border_router_api.c | 2 +- .../thread_border_router_api_internal.h | 2 +- .../source/6LoWPAN/Thread/thread_ccm.c | 2 +- .../source/6LoWPAN/Thread/thread_ccm.h | 2 +- .../6LoWPAN/Thread/thread_commissioning_api.c | 2 +- .../6LoWPAN/Thread/thread_commissioning_if.c | 2 +- .../6LoWPAN/Thread/thread_commissioning_if.h | 2 +- .../source/6LoWPAN/Thread/thread_common.c | 2 +- .../source/6LoWPAN/Thread/thread_common.h | 2 +- .../source/6LoWPAN/Thread/thread_config.h | 2 +- .../source/6LoWPAN/Thread/thread_constants.h | 2 +- .../6LoWPAN/Thread/thread_dhcpv6_server.c | 2 +- .../6LoWPAN/Thread/thread_dhcpv6_server.h | 2 +- .../source/6LoWPAN/Thread/thread_diagnostic.c | 2 +- .../source/6LoWPAN/Thread/thread_diagnostic.h | 2 +- .../source/6LoWPAN/Thread/thread_discovery.c | 2 +- .../source/6LoWPAN/Thread/thread_discovery.h | 2 +- .../6LoWPAN/Thread/thread_host_bootstrap.c | 2 +- .../6LoWPAN/Thread/thread_host_bootstrap.h | 2 +- .../Thread/thread_joiner_application.c | 2 +- .../Thread/thread_joiner_application.h | 2 +- .../6LoWPAN/Thread/thread_leader_service.c | 2 +- .../6LoWPAN/Thread/thread_leader_service.h | 2 +- .../6LoWPAN/Thread/thread_lowpower_api.c | 2 +- .../Thread/thread_lowpower_private_api.c | 2 +- .../Thread/thread_lowpower_private_api.h | 2 +- .../6LoWPAN/Thread/thread_management_api.c | 2 +- .../6LoWPAN/Thread/thread_management_client.c | 2 +- .../6LoWPAN/Thread/thread_management_client.h | 2 +- .../6LoWPAN/Thread/thread_management_if.c | 2 +- .../Thread/thread_management_internal.h | 2 +- .../6LoWPAN/Thread/thread_management_server.c | 2 +- .../6LoWPAN/Thread/thread_management_server.h | 2 +- .../source/6LoWPAN/Thread/thread_mdns.c | 2 +- .../source/6LoWPAN/Thread/thread_mdns.h | 2 +- .../6LoWPAN/Thread/thread_meshcop_lib.c | 2 +- .../Thread/thread_mle_message_handler.c | 2 +- .../Thread/thread_mle_message_handler.h | 2 +- .../source/6LoWPAN/Thread/thread_nd.c | 2 +- .../source/6LoWPAN/Thread/thread_nd.h | 2 +- .../6LoWPAN/Thread/thread_neighbor_class.c | 2 +- .../6LoWPAN/Thread/thread_neighbor_class.h | 2 +- .../6LoWPAN/Thread/thread_net_config_api.c | 2 +- .../6LoWPAN/Thread/thread_network_data_lib.c | 2 +- .../6LoWPAN/Thread/thread_network_data_lib.h | 2 +- .../Thread/thread_network_data_storage.c | 2 +- .../Thread/thread_network_data_storage.h | 2 +- .../6LoWPAN/Thread/thread_network_synch.c | 2 +- .../6LoWPAN/Thread/thread_network_synch.h | 2 +- .../source/6LoWPAN/Thread/thread_nvm_store.c | 2 +- .../source/6LoWPAN/Thread/thread_nvm_store.h | 2 +- .../6LoWPAN/Thread/thread_resolution_client.c | 2 +- .../6LoWPAN/Thread/thread_resolution_client.h | 2 +- .../6LoWPAN/Thread/thread_resolution_server.c | 2 +- .../6LoWPAN/Thread/thread_resolution_server.h | 2 +- .../6LoWPAN/Thread/thread_router_bootstrap.c | 2 +- .../6LoWPAN/Thread/thread_router_bootstrap.h | 2 +- .../source/6LoWPAN/Thread/thread_routing.c | 2 +- .../source/6LoWPAN/Thread/thread_routing.h | 2 +- .../source/6LoWPAN/Thread/thread_test_api.c | 2 +- .../source/6LoWPAN/Thread/thread_tmfcop_lib.h | 2 +- .../source/6LoWPAN/adaptation_interface.c | 190 ++++++++----- .../6LoWPAN/lowpan_adaptation_interface.h | 4 +- .../source/6LoWPAN/ws/ws_bbr_api.c | 50 +++- .../source/6LoWPAN/ws/ws_bbr_api_internal.h | 2 +- .../source/6LoWPAN/ws/ws_bootstrap.c | 186 +++++++------ .../source/6LoWPAN/ws/ws_bootstrap.h | 6 +- .../source/6LoWPAN/ws/ws_cfg_settings.c | 56 ++-- .../source/6LoWPAN/ws/ws_cfg_settings.h | 10 +- .../source/6LoWPAN/ws/ws_common.c | 29 +- .../source/6LoWPAN/ws/ws_common.h | 10 +- .../source/6LoWPAN/ws/ws_common_defines.h | 2 +- .../source/6LoWPAN/ws/ws_config.h | 76 ++++-- .../source/6LoWPAN/ws/ws_eapol_auth_relay.c | 9 +- .../source/6LoWPAN/ws/ws_eapol_auth_relay.h | 2 +- .../source/6LoWPAN/ws/ws_eapol_pdu.c | 2 +- .../source/6LoWPAN/ws/ws_eapol_pdu.h | 2 +- .../source/6LoWPAN/ws/ws_eapol_relay.c | 2 +- .../source/6LoWPAN/ws/ws_eapol_relay.h | 2 +- .../source/6LoWPAN/ws/ws_eapol_relay_lib.c | 2 +- .../source/6LoWPAN/ws/ws_eapol_relay_lib.h | 2 +- .../source/6LoWPAN/ws/ws_empty_functions.c | 7 +- .../source/6LoWPAN/ws/ws_ie_lib.c | 2 +- .../source/6LoWPAN/ws/ws_ie_lib.h | 2 +- .../source/6LoWPAN/ws/ws_llc.h | 6 +- .../source/6LoWPAN/ws/ws_llc_data_service.c | 202 +++++++++----- .../source/6LoWPAN/ws/ws_management_api.c | 2 +- .../source/6LoWPAN/ws/ws_mpx_header.c | 2 +- .../source/6LoWPAN/ws/ws_mpx_header.h | 2 +- .../source/6LoWPAN/ws/ws_neighbor_class.c | 2 +- .../source/6LoWPAN/ws/ws_neighbor_class.h | 2 +- .../source/6LoWPAN/ws/ws_pae_auth.c | 27 +- .../source/6LoWPAN/ws/ws_pae_auth.h | 2 +- .../source/6LoWPAN/ws/ws_pae_controller.c | 56 ++-- .../source/6LoWPAN/ws/ws_pae_controller.h | 2 +- .../source/6LoWPAN/ws/ws_pae_key_storage.c | 2 +- .../source/6LoWPAN/ws/ws_pae_key_storage.h | 2 +- .../source/6LoWPAN/ws/ws_pae_lib.c | 2 +- .../source/6LoWPAN/ws/ws_pae_lib.h | 2 +- .../source/6LoWPAN/ws/ws_pae_nvm_data.c | 2 +- .../source/6LoWPAN/ws/ws_pae_nvm_data.h | 2 +- .../source/6LoWPAN/ws/ws_pae_nvm_store.c | 2 +- .../source/6LoWPAN/ws/ws_pae_nvm_store.h | 2 +- .../source/6LoWPAN/ws/ws_pae_supp.c | 250 +++++++++--------- .../source/6LoWPAN/ws/ws_pae_supp.h | 2 +- .../source/6LoWPAN/ws/ws_pae_time.c | 22 +- .../source/6LoWPAN/ws/ws_pae_time.h | 2 +- .../source/6LoWPAN/ws/ws_pae_timers.c | 2 +- .../source/6LoWPAN/ws/ws_pae_timers.h | 2 +- .../source/6LoWPAN/ws/ws_stats.c | 2 +- .../source/6LoWPAN/ws/ws_stats.h | 2 +- .../source/6LoWPAN/ws/ws_test_api.c | 2 +- .../source/BorderRouter/border_router.c | 2 +- .../source/BorderRouter/border_router.h | 2 +- .../source/Common_Protocols/icmpv6.c | 2 +- .../source/Common_Protocols/icmpv6.h | 2 +- .../source/Common_Protocols/icmpv6_prefix.c | 2 +- .../source/Common_Protocols/icmpv6_prefix.h | 2 +- .../source/Common_Protocols/icmpv6_radv.c | 2 +- .../source/Common_Protocols/icmpv6_radv.h | 2 +- .../source/Common_Protocols/ip.h | 2 +- .../source/Common_Protocols/ipv6.c | 2 +- .../source/Common_Protocols/ipv6.h | 2 +- .../source/Common_Protocols/ipv6_constants.h | 2 +- .../source/Common_Protocols/ipv6_flow.c | 2 +- .../source/Common_Protocols/ipv6_flow.h | 2 +- .../Common_Protocols/ipv6_fragmentation.c | 2 +- .../Common_Protocols/ipv6_fragmentation.h | 2 +- .../source/Common_Protocols/ipv6_resolution.c | 2 +- .../source/Common_Protocols/ipv6_resolution.h | 2 +- .../source/Common_Protocols/mld.c | 2 +- .../source/Common_Protocols/mld.h | 2 +- .../source/Common_Protocols/tcp.c | 2 +- .../source/Common_Protocols/tcp.h | 2 +- .../source/Common_Protocols/udp.c | 2 +- .../source/Common_Protocols/udp.h | 2 +- .../source/Core/buffer_dyn.c | 2 +- .../source/Core/include/ns_address_internal.h | 2 +- .../source/Core/include/ns_buffer.h | 3 +- .../source/Core/include/ns_error_types.h | 2 +- .../source/Core/include/ns_monitor.h | 2 +- .../source/Core/include/ns_socket.h | 2 +- .../source/Core/include/sockbuf.h | 2 +- .../source/Core/ns_address_internal.c | 2 +- .../source/Core/ns_monitor.c | 2 +- .../source/Core/ns_socket.c | 2 +- .../sal-stack-nanostack/source/Core/sockbuf.c | 2 +- .../DHCPv6_Server/DHCPv6_Server_service.c | 43 +-- .../DHCPv6_Server/DHCPv6_server_service.h | 6 +- .../source/DHCPv6_client/dhcpv6_client_api.h | 6 +- .../DHCPv6_client/dhcpv6_client_service.c | 25 +- .../MAC/IEEE802_15_4/mac_cca_threshold.c | 2 +- .../MAC/IEEE802_15_4/mac_cca_threshold.h | 2 +- .../source/MAC/IEEE802_15_4/mac_data_buffer.h | 3 +- .../source/MAC/IEEE802_15_4/mac_defines.h | 2 +- .../MAC/IEEE802_15_4/mac_fhss_callbacks.c | 2 +- .../MAC/IEEE802_15_4/mac_fhss_callbacks.h | 2 +- .../source/MAC/IEEE802_15_4/mac_filter.c | 2 +- .../source/MAC/IEEE802_15_4/mac_filter.h | 2 +- .../mac_header_helper_functions.c | 2 +- .../mac_header_helper_functions.h | 2 +- .../MAC/IEEE802_15_4/mac_indirect_data.c | 2 +- .../MAC/IEEE802_15_4/mac_indirect_data.h | 2 +- .../source/MAC/IEEE802_15_4/mac_mcps_sap.c | 69 +++-- .../source/MAC/IEEE802_15_4/mac_mcps_sap.h | 4 +- .../source/MAC/IEEE802_15_4/mac_mlme.c | 4 +- .../source/MAC/IEEE802_15_4/mac_mlme.h | 2 +- .../source/MAC/IEEE802_15_4/mac_pd_sap.c | 2 +- .../source/MAC/IEEE802_15_4/mac_pd_sap.h | 2 +- .../MAC/IEEE802_15_4/mac_security_mib.c | 2 +- .../MAC/IEEE802_15_4/mac_security_mib.h | 2 +- .../source/MAC/IEEE802_15_4/mac_timer.c | 2 +- .../source/MAC/IEEE802_15_4/mac_timer.h | 2 +- .../source/MAC/IEEE802_15_4/sw_mac.c | 7 +- .../source/MAC/IEEE802_15_4/sw_mac_internal.h | 3 +- .../source/MAC/ethernet/ethernet_mac_api.c | 2 +- .../source/MAC/rf_driver_storage.c | 2 +- .../source/MAC/rf_driver_storage.h | 2 +- .../source/MAC/serial/serial_mac_api.c | 2 +- .../source/MAC/virtual_rf/virtual_rf_client.c | 2 +- .../MAC/virtual_rf/virtual_rf_defines.h | 2 +- .../source/MAC/virtual_rf/virtual_rf_driver.c | 2 +- .../sal-stack-nanostack/source/MLE/mle.c | 2 +- .../sal-stack-nanostack/source/MLE/mle.h | 2 +- .../sal-stack-nanostack/source/MLE/mle_tlv.c | 2 +- .../sal-stack-nanostack/source/MLE/mle_tlv.h | 2 +- .../sal-stack-nanostack/source/MPL/mpl.c | 2 +- .../sal-stack-nanostack/source/MPL/mpl.h | 2 +- .../source/NWK_INTERFACE/Include/protocol.h | 2 +- .../NWK_INTERFACE/Include/protocol_abstract.h | 2 +- .../NWK_INTERFACE/Include/protocol_stats.h | 5 +- .../NWK_INTERFACE/Include/protocol_timer.h | 2 +- .../source/NWK_INTERFACE/protocol_core.c | 2 +- .../NWK_INTERFACE/protocol_core_sleep.c | 2 +- .../source/NWK_INTERFACE/protocol_stats.c | 7 +- .../source/NWK_INTERFACE/protocol_timer.c | 2 +- .../source/RPL/rpl_control.c | 2 +- .../source/RPL/rpl_control.h | 2 +- .../sal-stack-nanostack/source/RPL/rpl_data.c | 10 +- .../sal-stack-nanostack/source/RPL/rpl_data.h | 2 +- .../source/RPL/rpl_downward.c | 2 +- .../source/RPL/rpl_downward.h | 2 +- .../source/RPL/rpl_mrhof.c | 2 +- .../source/RPL/rpl_mrhof.h | 2 +- .../source/RPL/rpl_objective.c | 2 +- .../source/RPL/rpl_objective.h | 2 +- .../sal-stack-nanostack/source/RPL/rpl_of0.c | 2 +- .../sal-stack-nanostack/source/RPL/rpl_of0.h | 2 +- .../source/RPL/rpl_policy.c | 2 +- .../source/RPL/rpl_policy.h | 2 +- .../source/RPL/rpl_protocol.h | 2 +- .../source/RPL/rpl_structures.h | 2 +- .../source/RPL/rpl_upward.c | 5 +- .../source/RPL/rpl_upward.h | 2 +- .../source/Security/Common/sec_lib.h | 2 +- .../Security/Common/sec_lib_definitions.h | 2 +- .../source/Security/Common/security_lib.c | 2 +- .../source/Security/PANA/eap_protocol.c | 2 +- .../source/Security/PANA/eap_protocol.h | 2 +- .../source/Security/PANA/pana.c | 2 +- .../source/Security/PANA/pana.h | 2 +- .../source/Security/PANA/pana_avp.c | 2 +- .../source/Security/PANA/pana_avp.h | 2 +- .../source/Security/PANA/pana_client.c | 2 +- .../source/Security/PANA/pana_eap_header.c | 2 +- .../source/Security/PANA/pana_eap_header.h | 2 +- .../source/Security/PANA/pana_header.c | 2 +- .../source/Security/PANA/pana_header.h | 2 +- .../source/Security/PANA/pana_internal_api.h | 2 +- .../source/Security/PANA/pana_nvm.h | 2 +- .../source/Security/PANA/pana_relay_table.c | 2 +- .../source/Security/PANA/pana_relay_table.h | 2 +- .../source/Security/PANA/pana_server.c | 2 +- .../source/Security/TLS/tls_ccm_crypt.c | 2 +- .../source/Security/TLS/tls_ccm_crypt.h | 2 +- .../source/Security/TLS/tls_lib.c | 2 +- .../source/Security/TLS/tls_lib.h | 2 +- .../source/Security/eapol/eapol_helper.c | 2 +- .../source/Security/eapol/eapol_helper.h | 2 +- .../source/Security/eapol/kde_helper.c | 2 +- .../source/Security/eapol/kde_helper.h | 2 +- .../source/Security/kmp/kmp_addr.c | 2 +- .../source/Security/kmp/kmp_addr.h | 2 +- .../source/Security/kmp/kmp_api.c | 2 +- .../source/Security/kmp/kmp_api.h | 3 +- .../source/Security/kmp/kmp_eapol_pdu_if.c | 2 +- .../source/Security/kmp/kmp_eapol_pdu_if.h | 2 +- .../source/Security/kmp/kmp_socket_if.c | 2 +- .../source/Security/kmp/kmp_socket_if.h | 2 +- .../eap_tls_sec_prot/auth_eap_tls_sec_prot.c | 2 +- .../eap_tls_sec_prot/auth_eap_tls_sec_prot.h | 2 +- .../eap_tls_sec_prot/eap_tls_sec_prot_lib.c | 2 +- .../eap_tls_sec_prot/eap_tls_sec_prot_lib.h | 2 +- .../radius_eap_tls_sec_prot.c | 2 +- .../radius_eap_tls_sec_prot.h | 2 +- .../eap_tls_sec_prot/supp_eap_tls_sec_prot.c | 2 +- .../eap_tls_sec_prot/supp_eap_tls_sec_prot.h | 2 +- .../fwh_sec_prot/auth_fwh_sec_prot.c | 2 +- .../fwh_sec_prot/auth_fwh_sec_prot.h | 2 +- .../fwh_sec_prot/supp_fwh_sec_prot.c | 2 +- .../fwh_sec_prot/supp_fwh_sec_prot.h | 2 +- .../gkh_sec_prot/auth_gkh_sec_prot.c | 2 +- .../gkh_sec_prot/auth_gkh_sec_prot.h | 2 +- .../gkh_sec_prot/supp_gkh_sec_prot.c | 2 +- .../gkh_sec_prot/supp_gkh_sec_prot.h | 2 +- .../protocols/key_sec_prot/key_sec_prot.c | 2 +- .../protocols/key_sec_prot/key_sec_prot.h | 2 +- .../protocols/msg_sec_prot/msg_sec_prot.c | 148 +++++++++++ .../protocols/msg_sec_prot/msg_sec_prot.h | 37 +++ .../protocols/radius_sec_prot/avp_helper.c | 2 +- .../protocols/radius_sec_prot/avp_helper.h | 2 +- .../radius_sec_prot/radius_client_sec_prot.c | 22 +- .../radius_sec_prot/radius_client_sec_prot.h | 2 +- .../source/Security/protocols/sec_prot.h | 2 +- .../Security/protocols/sec_prot_certs.c | 2 +- .../Security/protocols/sec_prot_certs.h | 2 +- .../source/Security/protocols/sec_prot_cfg.h | 7 +- .../source/Security/protocols/sec_prot_keys.c | 2 +- .../source/Security/protocols/sec_prot_keys.h | 3 +- .../source/Security/protocols/sec_prot_lib.c | 4 +- .../source/Security/protocols/sec_prot_lib.h | 2 +- .../protocols/tls_sec_prot/tls_sec_prot.c | 2 +- .../protocols/tls_sec_prot/tls_sec_prot.h | 2 +- .../protocols/tls_sec_prot/tls_sec_prot_lib.c | 2 +- .../protocols/tls_sec_prot/tls_sec_prot_lib.h | 2 +- .../Service_Libs/CCM_lib/ccm_security.c | 2 +- .../Service_Libs/CCM_lib/mbedOS/aes_mbedtls.c | 2 +- .../CCM_lib/mbedOS/aes_mbedtls_adapter.c | 2 +- .../Neighbor_cache/neighbor_cache.c | 2 +- .../neighbor_table_definition.h | 2 +- .../Service_Libs/SHA256_Lib/ns_sha256.c | 2 +- .../source/Service_Libs/SHA256_Lib/shalib.c | 2 +- .../source/Service_Libs/Trickle/trickle.c | 2 +- .../source/Service_Libs/Trickle/trickle.h | 2 +- .../source/Service_Libs/blacklist/blacklist.c | 2 +- .../source/Service_Libs/blacklist/blacklist.h | 2 +- .../source/Service_Libs/etx/etx.c | 7 +- .../source/Service_Libs/etx/etx.h | 2 +- .../Service_Libs/fhss/channel_functions.c | 2 +- .../Service_Libs/fhss/channel_functions.h | 2 +- .../source/Service_Libs/fhss/channel_list.c | 2 +- .../source/Service_Libs/fhss/channel_list.h | 2 +- .../source/Service_Libs/fhss/fhss.c | 2 +- .../source/Service_Libs/fhss/fhss.h | 2 +- .../source/Service_Libs/fhss/fhss_channel.c | 2 +- .../source/Service_Libs/fhss/fhss_channel.h | 2 +- .../source/Service_Libs/fhss/fhss_common.c | 2 +- .../source/Service_Libs/fhss/fhss_common.h | 2 +- .../fhss/fhss_configuration_interface.c | 2 +- .../Service_Libs/fhss/fhss_statistics.c | 2 +- .../Service_Libs/fhss/fhss_statistics.h | 2 +- .../source/Service_Libs/fhss/fhss_test_api.c | 2 +- .../source/Service_Libs/fhss/fhss_ws.c | 14 +- .../source/Service_Libs/fhss/fhss_ws.h | 2 +- .../fhss/fhss_ws_empty_functions.c | 2 +- .../source/Service_Libs/fnv_hash/fnv_hash.c | 2 +- .../source/Service_Libs/fnv_hash/fnv_hash.h | 2 +- .../source/Service_Libs/hmac/hmac_md.c | 2 +- .../source/Service_Libs/hmac/hmac_md.h | 2 +- .../Service_Libs/ieee_802_11/ieee_802_11.c | 2 +- .../Service_Libs/ieee_802_11/ieee_802_11.h | 2 +- .../Service_Libs/load_balance/load_balance.c | 2 +- .../load_balance/load_balance_api.h | 2 +- .../mac_neighbor_table/mac_neighbor_table.c | 2 +- .../mac_neighbor_table/mac_neighbor_table.h | 2 +- .../mdns/fnet/fnet_stack/fnet_config.h | 2 +- .../fnet/fnet_stack/port/compiler/fnet_comp.h | 2 +- .../port/compiler/fnet_comp_config.h | 2 +- .../fnet/fnet_stack/services/fnet_services.h | 2 +- .../services/fnet_services_config.h | 2 +- .../fnet/fnet_stack/services/mdns/fnet_mdns.c | 184 ++++++------- .../fnet/fnet_stack/services/mdns/fnet_mdns.h | 10 +- .../fnet/fnet_stack/services/poll/fnet_poll.c | 2 +- .../fnet_stack/services/serial/fnet_serial.h | 2 +- .../mdns/fnet/fnet_stack/stack/fnet_debug.h | 2 +- .../mdns/fnet/fnet_stack/stack/fnet_stdlib.c | 2 +- .../Service_Libs/mdns/fnet_user_config.h | 2 +- .../source/Service_Libs/mdns/ns_fnet_events.c | 2 +- .../source/Service_Libs/mdns/ns_fnet_events.h | 2 +- .../source/Service_Libs/mdns/ns_fnet_port.c | 2 +- .../source/Service_Libs/mdns/ns_fnet_types.h | 2 +- .../source/Service_Libs/mdns/ns_mdns_api.c | 2 +- .../Service_Libs/mle_service/mle_service.c | 2 +- .../mle_service/mle_service_api.h | 2 +- .../mle_service/mle_service_buffer.c | 2 +- .../mle_service/mle_service_buffer.h | 2 +- .../mle_service_frame_counter_table.c | 2 +- .../mle_service_frame_counter_table.h | 2 +- .../mle_service/mle_service_interface.c | 2 +- .../mle_service/mle_service_interface.h | 2 +- .../mle_service/mle_service_security.c | 2 +- .../mle_service/mle_service_security.h | 2 +- .../source/Service_Libs/nd_proxy/nd_proxy.c | 2 +- .../source/Service_Libs/nd_proxy/nd_proxy.h | 2 +- .../Service_Libs/nist_aes_kw/nist_aes_kw.c | 2 +- .../Service_Libs/nist_aes_kw/nist_aes_kw.h | 2 +- .../pan_blacklist/pan_blacklist.c | 2 +- .../pan_blacklist/pan_blacklist_api.h | 2 +- .../random_early_detection.c | 2 +- .../random_early_detection.h | 2 +- .../random_early_detection_api.h | 2 +- .../source/Service_Libs/utils/isqrt.c | 2 +- .../source/Service_Libs/utils/isqrt.h | 2 +- .../source/Service_Libs/utils/ns_conf.c | 2 +- .../source/Service_Libs/utils/ns_crc.c | 2 +- .../source/Service_Libs/utils/ns_crc.h | 2 +- .../source/Service_Libs/utils/ns_file.h | 2 +- .../Service_Libs/utils/ns_file_system.c | 2 +- .../source/Service_Libs/utils/ns_time.c | 55 ++++ .../source/Service_Libs/utils/ns_time.h | 56 ++++ .../Service_Libs/whiteboard/whiteboard.c | 2 +- .../Service_Libs/whiteboard/whiteboard.h | 2 +- .../source/configs/base/cfg_ethernet.h | 2 +- .../source/configs/base/cfg_local_socket.h | 2 +- .../configs/base/cfg_lowpan_border_router.h | 2 +- .../source/configs/base/cfg_lowpan_host.h | 2 +- .../source/configs/base/cfg_lowpan_router.h | 2 +- .../source/configs/base/cfg_rf_tunnel.h | 2 +- .../configs/base/cfg_thread_border_router.h | 2 +- .../configs/base/cfg_thread_end_device.h | 2 +- .../configs/base/cfg_thread_full_end_device.h | 2 +- .../source/configs/base/cfg_thread_router.h | 2 +- .../configs/base/cfg_ws_border_router.h | 2 +- .../source/configs/base/cfg_ws_router.h | 2 +- .../source/configs/cfg_ethernet_host.h | 2 +- .../source/configs/cfg_generic.h | 2 +- .../source/configs/cfg_lowpan_border_router.h | 2 +- .../cfg_lowpan_border_router_rf_tunnel.h | 2 +- .../cfg_lowpan_border_router_rf_tunnel_ecc.h | 2 +- ...wpan_border_router_rf_tunnel_ecc_release.h | 2 +- .../source/configs/cfg_lowpan_host.h | 2 +- .../source/configs/cfg_lowpan_router.h | 2 +- .../source/configs/cfg_lowpan_router_ecc.h | 2 +- .../configs/cfg_lowpan_router_ecc_release.h | 2 +- .../source/configs/cfg_nanostack_full.h | 2 +- .../source/configs/cfg_nanostack_full_debug.h | 2 +- .../source/configs/cfg_rf_interface.h | 2 +- .../source/configs/cfg_thread_border_router.h | 2 +- .../source/configs/cfg_thread_end_device.h | 2 +- .../configs/cfg_thread_full_end_device.h | 2 +- .../source/configs/cfg_thread_router.h | 2 +- .../source/configs/cfg_thread_thci.h | 2 +- .../source/configs/cfg_ws_border_router.h | 2 +- .../source/configs/cfg_ws_router.h | 2 +- .../source/ipv6_stack/ipv6_routing_table.c | 2 +- .../source/ipv6_stack/ipv6_routing_table.h | 2 +- .../source/ipv6_stack/protocol_ipv6.c | 2 +- .../source/ipv6_stack/protocol_ipv6.h | 2 +- .../source/libDHCPv6/dhcp_service_api.c | 59 ++++- .../source/libDHCPv6/libDHCPv6.c | 2 +- .../source/libDHCPv6/libDHCPv6.h | 2 +- .../source/libDHCPv6/libDHCPv6_server.c | 27 +- .../source/libDHCPv6/libDHCPv6_server.h | 7 +- .../source/libDHCPv6/libDHCPv6_vendordata.c | 60 ++++- .../source/libDHCPv6/libDHCPv6_vendordata.h | 40 ++- .../source/libNET/src/multicast_api.c | 2 +- .../libNET/src/net_6lowpan_parameter_api.c | 2 +- .../source/libNET/src/net_dns.c | 2 +- .../source/libNET/src/net_dns_internal.h | 2 +- .../source/libNET/src/net_ipv6.c | 2 +- .../source/libNET/src/net_load_balance.c | 2 +- .../libNET/src/net_load_balance_internal.h | 2 +- .../source/libNET/src/net_mle.c | 2 +- .../source/libNET/src/net_rpl.c | 2 +- .../libNET/src/net_short_address_extension.c | 2 +- .../source/libNET/src/net_test.c | 2 +- .../source/libNET/src/ns_net.c | 2 +- .../source/libNET/src/socket_api.c | 2 +- .../sal-stack-nanostack/source/nsconfig.h | 2 +- .../nanostack/sal-stack-nanostack/sources.mk | 2 + 537 files changed, 1994 insertions(+), 1183 deletions(-) create mode 100644 connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/msg_sec_prot/msg_sec_prot.c create mode 100644 connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/msg_sec_prot/msg_sec_prot.h create mode 100644 connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_time.c create mode 100644 connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_time.h diff --git a/connectivity/nanostack/sal-stack-nanostack/LICENSE-Apache-2.0 b/connectivity/nanostack/sal-stack-nanostack/LICENSE-Apache-2.0 index ae3cb70b6b..a7155e2dc7 100644 --- a/connectivity/nanostack/sal-stack-nanostack/LICENSE-Apache-2.0 +++ b/connectivity/nanostack/sal-stack-nanostack/LICENSE-Apache-2.0 @@ -1,4 +1,4 @@ -Copyright 2017 Arm Limited and its affiliates +Copyright 2017, Pelion and affiliates. SPDX-License-Identifier: Apache-2.0 Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/LICENSE-BSD-3-Clause b/connectivity/nanostack/sal-stack-nanostack/LICENSE-BSD-3-Clause index a6fe7d9a0a..5c59c7c596 100644 --- a/connectivity/nanostack/sal-stack-nanostack/LICENSE-BSD-3-Clause +++ b/connectivity/nanostack/sal-stack-nanostack/LICENSE-BSD-3-Clause @@ -1,4 +1,4 @@ -Copyright 2017 Arm Limited and affiliates. +Copyright 2017, Pelion and affiliates. SPDX-License-Identifier: BSD-3-Clause Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/cca_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/cca_api.h index 6f276b62ed..3abe66093a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/cca_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/cca_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/ccmLIB.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/ccmLIB.h index d168a6ed00..3ef95fe7d9 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/ccmLIB.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/ccmLIB.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/dhcp_service_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/dhcp_service_api.h index 88a5150458..0a576c1d6c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/dhcp_service_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/dhcp_service_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -197,11 +197,12 @@ int dhcp_service_send_resp(uint32_t msg_tr_id, uint8_t options, uint8_t *msg_ptr * \param msg_ptr An allocated message pointer. This pointer is the responsibility of the service after this call. * \param msg_len The length of the message. * \param receive_resp_cb Callback pointer + * \param delay_tx Transmit may be delayed and this parameter define that * * \return Transaction ID of the DHCP transaction * \return 0, if error occurred. */ -uint32_t dhcp_service_send_req(uint16_t instance_id, uint8_t options, void *ptr, const uint8_t addr[static 16], uint8_t *msg_ptr, uint16_t msg_len, dhcp_service_receive_resp_cb *receive_resp_cb); +uint32_t dhcp_service_send_req(uint16_t instance_id, uint8_t options, void *ptr, const uint8_t addr[static 16], uint8_t *msg_ptr, uint16_t msg_len, dhcp_service_receive_resp_cb *receive_resp_cb, uint16_t delay_tx); /** * \brief Setting retransmission parameters. @@ -225,6 +226,16 @@ void dhcp_service_set_retry_timers(uint32_t msg_tr_id, uint16_t timeout_init, ui */ void dhcp_service_update_server_address(uint32_t msg_tr_id, uint8_t *server_address); +/** + * \brief Get Round Trip time of the request + * + * get the elapsed time of the request from last message sent to server. + * + * \param msg_tr_id The message transaction ID. + * + */ +uint32_t dhcp_service_rtt_get(uint32_t msg_tr_id); + /** * \brief Stops transactions for a message (retransmissions). * diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/ethernet_mac_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/ethernet_mac_api.h index 8460da680d..22d40ca67c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/ethernet_mac_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/ethernet_mac_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/fhss_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/fhss_api.h index e6aa23270e..6060fd67df 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/fhss_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/fhss_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/fhss_config.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/fhss_config.h index 545cb98cda..fddd216b64 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/fhss_config.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/fhss_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/fhss_test_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/fhss_test_api.h index e6a93cc2c0..1094b8c344 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/fhss_test_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/fhss_test_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/fhss_ws_extension.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/fhss_ws_extension.h index d98b5ace97..7516b10f74 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/fhss_ws_extension.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/fhss_ws_extension.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/mac_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/mac_api.h index bc5b13fcef..8cc4da258e 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/mac_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/mac_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -325,6 +325,7 @@ typedef struct mac_statistics_s { uint32_t mac_retry_count; /**< MAC TX retry count. */ uint32_t mac_cca_attempts_count; /**< MAC CCA attempts count. */ uint32_t mac_failed_cca_count; /**< MAC failed CCA count. */ + uint32_t mac_tx_latency_max; /**< MAC data request max latency. */ } mac_statistics_t; #ifdef __cplusplus diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/mac_common_defines.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/mac_common_defines.h index e64015c1bd..082b5b4c34 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/mac_common_defines.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/mac_common_defines.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/mac_filter_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/mac_filter_api.h index 0b7fe0349a..a667901f1a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/mac_filter_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/mac_filter_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/mac_mcps.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/mac_mcps.h index 8e99c2f431..9f56881945 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/mac_mcps.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/mac_mcps.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/mlme.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/mlme.h index 992046dfde..2bd14e2bc8 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/mlme.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/mlme.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/multicast_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/multicast_api.h index a24f958fd8..1fa999bbbb 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/multicast_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/multicast_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2018, Arm Limited and affiliates. + * Copyright (c) 2012-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_6lowpan_parameter_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_6lowpan_parameter_api.h index 0783ac9aae..9e21bde1a5 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_6lowpan_parameter_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_6lowpan_parameter_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2014-2015, 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_address_extension.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_address_extension.h index 8f1ece0b70..5bbac60da7 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_address_extension.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_address_extension.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_fhss.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_fhss.h index 6d6003c986..6f64496673 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_fhss.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_fhss.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_interface.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_interface.h index 89c942ccb1..eb87675af5 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_interface.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_ipv6_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_ipv6_api.h index 7132d9057f..9f23448ee5 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_ipv6_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_ipv6_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_load_balance_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_load_balance_api.h index d198bd8315..c72b1e89dd 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_load_balance_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_load_balance_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_mle_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_mle_api.h index 2dde4426e9..66eb9586f0 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_mle_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_mle_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_nvm_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_nvm_api.h index e790f63a87..98c108e37d 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_nvm_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_nvm_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_nwk_scan.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_nwk_scan.h index f5b09126ff..f12a397998 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_nwk_scan.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_nwk_scan.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_pana_parameters_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_pana_parameters_api.h index c3f63ff7eb..924bf417e5 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_pana_parameters_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_pana_parameters_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_polling_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_polling_api.h index de22f7db7d..ea98ee7d3f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_polling_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_polling_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_rpl.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_rpl.h index c65308130e..d78bc80001 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_rpl.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_rpl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_sleep.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_sleep.h index 3eb8ba3d44..da7b85d50b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_sleep.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_sleep.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_test_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_test_api.h index 35322069b5..3ebe3eec4e 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_test_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_test_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_thread_test.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_thread_test.h index f88e19a56c..0ab970a77c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_thread_test.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_thread_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_ws_test.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_ws_test.h index 6bd20c658a..234c12e0b1 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/net_ws_test.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/net_ws_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_address.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_address.h index 0a820fb551..50e7e96ba5 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_address.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_address.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2017, Arm Limited and affiliates. + * Copyright (c) 2010-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_conf.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_conf.h index c8e6d50602..56b0787517 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_conf.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_conf.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_file_system.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_file_system.h index 031e3a1657..45a92f1efd 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_file_system.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_file_system.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_mdns_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_mdns_api.h index 7a92fb2c36..bba6d2608a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_mdns_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_mdns_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_sha256.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_sha256.h index d088188608..fccded2cfa 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_sha256.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_sha256.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, Arm Limited and affiliates. + * Copyright (c) 2006-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_time_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_time_api.h index a306bad718..4b1907cfc9 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_time_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_time_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,7 +29,7 @@ #include "ns_types.h" /** - * System time callback. + * System time read callback. * * Callback shall return the system time in seconds after 1970. * @@ -39,13 +39,33 @@ typedef uint64_t ns_time_api_system_time_callback(void); /** - * System time callback set. + * System time write callback. * - * Sets callback for the system time. + * Callback will write the time in seconds after 1970. * - * \param callback system time callback + * \param seconds system time in seconds * */ -void ns_time_api_system_time_callback_set(ns_time_api_system_time_callback callback); +typedef void ns_time_api_system_time_write_callback(uint64_t write_time); + +/** + * System time read callback set. + * + * Sets callback for the system time read. + * + * \param callback_rd system time read callback + * + */ +void ns_time_api_system_time_callback_set(ns_time_api_system_time_callback callback_rd); + +/** + * Set system time write callback. + * + * Sets system time write callback. + * + * \param callback_wr system time write callback. + * + */ +void ns_time_api_system_time_write_callback_set(ns_time_api_system_time_write_callback callback_wr); #endif /* NS_TIME_API_H_ */ diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_virtual_rf_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_virtual_rf_api.h index 6d64d2b3b3..877709509a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_virtual_rf_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/ns_virtual_rf_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/nwk_stats_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/nwk_stats_api.h index a59d062e43..a53104a0b9 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/nwk_stats_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/nwk_stats_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -74,6 +74,7 @@ typedef struct nwk_stats_t { uint16_t adapt_layer_tx_queue_size; /**< Adaptation layer direct TX queue size. */ uint16_t adapt_layer_tx_queue_peak; /**< Adaptation layer direct TX queue size peak. */ uint32_t adapt_layer_tx_congestion_drop; /**< Adaptation layer direct TX randon early detection drop packet. */ + uint16_t adapt_layer_tx_latency_max; /**< Adaptation layer latency between TX request and TX ready in seconds (MAX). */ } nwk_stats_t; /** diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/platform/arm_hal_aes.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/platform/arm_hal_aes.h index e64c12050e..60e7be7d26 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/platform/arm_hal_aes.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/platform/arm_hal_aes.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/platform/arm_hal_phy.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/platform/arm_hal_phy.h index 62c46f8552..b4a1913742 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/platform/arm_hal_phy.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/platform/arm_hal_phy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/platform/os_whiteboard.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/platform/os_whiteboard.h index 8709bc351a..8348f754f4 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/platform/os_whiteboard.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/platform/os_whiteboard.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/platform/topo_trace.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/platform/topo_trace.h index b8615ffc11..80c837ff73 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/platform/topo_trace.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/platform/topo_trace.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/serial_mac_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/serial_mac_api.h index 2b202e39bd..dd5dc14f08 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/serial_mac_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/serial_mac_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/shalib.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/shalib.h index 5aaa7f9d1a..3883830c7f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/shalib.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/shalib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/socket_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/socket_api.h index 0b5db6c825..7cf8b57748 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/socket_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/socket_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2018, Arm Limited and affiliates. + * Copyright (c) 2010-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/sw_mac.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/sw_mac.h index 894b8b75c4..d150718110 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/sw_mac.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/sw_mac.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_bbr_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_bbr_api.h index 55a8e9f97d..2bfc2b1267 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_bbr_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_bbr_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_border_router_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_border_router_api.h index c5083a598c..cbdaafc9a5 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_border_router_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_border_router_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_commissioning_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_commissioning_api.h index fbba8b355e..7235d415bb 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_commissioning_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_commissioning_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_dhcpv6_server.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_dhcpv6_server.h index e0b1fab14c..70df15d310 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_dhcpv6_server.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_dhcpv6_server.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_diagcop_lib.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_diagcop_lib.h index abad9775ce..f1d92d9820 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_diagcop_lib.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_diagcop_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_lowpower_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_lowpower_api.h index bf078280dc..74033cbef2 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_lowpower_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_lowpower_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_management_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_management_api.h index 42def140d6..cbc6693443 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_management_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_management_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_management_if.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_management_if.h index 9256e6149f..0332d7faaf 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_management_if.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_management_if.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_meshcop_lib.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_meshcop_lib.h index 583721d4d6..67dab7150b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_meshcop_lib.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_meshcop_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_net_config_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_net_config_api.h index c92f0c0b2c..7830ef6d8c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_net_config_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/thread_net_config_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/whiteboard_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/whiteboard_api.h index 62cc5c7d2e..61164a7252 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/whiteboard_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/whiteboard_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2017, Arm Limited and affiliates. + * Copyright (c) 2011-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/ws_bbr_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/ws_bbr_api.h index 6347e2c95c..a1c15aa061 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/ws_bbr_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/ws_bbr_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/nanostack/ws_management_api.h b/connectivity/nanostack/sal-stack-nanostack/nanostack/ws_management_api.h index 7094d09077..ddab5d40e5 100644 --- a/connectivity/nanostack/sal-stack-nanostack/nanostack/ws_management_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/nanostack/ws_management_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -857,9 +857,13 @@ int ws_neighbor_info_get( * * Setting a value that is not suitable for Radio might prevent the device joining to the network. * - * NOTE: Currently lower EAPOL parents are accepted if there is no parents higher than - * DEVICE_MIN_SENS + CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERESIS - * NOTE: Currently not using this value to limit parents as it is only RECOMENDED in specification. + * This configuration limits the EAPOL parents accepted for Authentication and device must hear signal + * level higher than device_min_sens + CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERESIS + * to start authentication. + * + * ETX Calculation gives a maximum ETX if two way EWMA RSL is less than + * device_min_sens + CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERESIS to + * prevent selecting parents with poor signal quality * * \param interface_id Network interface ID. * \param device_min_sens value used in the parent selections. diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/network_lib.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/network_lib.c index 208b091b8a..86d2d353b3 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/network_lib.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/network_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan.c index 6c6a0ca445..3069e00a56 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -870,7 +870,12 @@ bool protocol_6lowpan_stagger_estimate_get(int8_t interface_id, uint32_t data_am datarate = STAGGER_DATARATE_FOR_APPL(datarate); } - stagger_value = 1 + ((data_amount * 1024 * 8 * network_size) / datarate); + // For small networks sets 10 seconds stagger + if (network_size <= 100 && ws_info(cur_interface)) { + stagger_value = 10; + } else { + stagger_value = 1 + ((data_amount * 1024 * 8 * network_size) / datarate); + } /** * Example: * Maximum stagger value to send 1kB to 100 device network using data rate of 50kbs: @@ -882,7 +887,7 @@ bool protocol_6lowpan_stagger_estimate_get(int8_t interface_id, uint32_t data_am if (stagger_value > 0xFFFF) { *stagger_max = 0xFFFF; } else { - *stagger_max = (uint16_t)stagger_value; + *stagger_max = (uint16_t)stagger_value + *stagger_min; } // Randomize stagger value diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_bootstrap.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_bootstrap.c index 11a2a8d989..fa7ecae8b1 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_bootstrap.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_bootstrap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_interface.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_interface.c index 92ea3ce738..0ac784303a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_interface.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_interface.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/network_lib.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/network_lib.h index 2b856fd5a5..9bcbc515bc 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/network_lib.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/network_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/protocol_6lowpan.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/protocol_6lowpan.h index 95515c1fd4..ced19fdcb1 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/protocol_6lowpan.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/protocol_6lowpan.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h index 14bb828496..0768034d03 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/protocol_6lowpan_interface.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/protocol_6lowpan_interface.h index 017805735c..175c6a696f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/protocol_6lowpan_interface.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Bootstraps/protocol_6lowpan_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2015, 2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Fragmentation/cipv6_fragmenter.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Fragmentation/cipv6_fragmenter.c index df2b4404e3..ca4710241f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Fragmentation/cipv6_fragmenter.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Fragmentation/cipv6_fragmenter.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Fragmentation/cipv6_fragmenter.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Fragmentation/cipv6_fragmenter.h index 28c3384a1d..42baadeeda 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Fragmentation/cipv6_fragmenter.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Fragmentation/cipv6_fragmenter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/6lowpan_iphc.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/6lowpan_iphc.c index b02b372fc1..45c91e5ba7 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/6lowpan_iphc.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/6lowpan_iphc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/cipv6.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/cipv6.h index 28f55fd112..764d042fb3 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/cipv6.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/cipv6.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/iphc_compress.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/iphc_compress.c index 735955aca9..326cfd49ed 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/iphc_compress.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/iphc_compress.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/iphc_compress.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/iphc_compress.h index b64074fb0d..6061063225 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/iphc_compress.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/iphc_compress.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/iphc_decompress.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/iphc_decompress.c index eeeb48c2e1..988be70257 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/iphc_decompress.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/iphc_decompress.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/iphc_decompress.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/iphc_decompress.h index e2cd8d55dc..7949fae709 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/iphc_decompress.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/iphc_decompress.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/lowpan_context.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/lowpan_context.c index 1d9a68904a..6a2d4e644f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/lowpan_context.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/lowpan_context.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/lowpan_context.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/lowpan_context.h index 0b8daf32cc..e9eb21be77 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/lowpan_context.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/lowpan_context.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/beacon_handler.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/beacon_handler.c index 34c7b3c98b..d3d9a37f35 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/beacon_handler.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/beacon_handler.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/beacon_handler.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/beacon_handler.h index c08680f60f..11f7164b00 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/beacon_handler.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/beacon_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_data_poll.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_data_poll.c index 04491a4832..c7af05a97e 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_data_poll.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_data_poll.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_data_poll.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_data_poll.h index 877e370862..8d31424ae2 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_data_poll.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_data_poll.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_helper.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_helper.c index 73d6690f97..515c16ce18 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_helper.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_helper.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_helper.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_helper.h index f85916bcf7..ee04da6e96 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_helper.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_ie_lib.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_ie_lib.c index a4fab39a44..e6329bfbca 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_ie_lib.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_ie_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_ie_lib.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_ie_lib.h index cd00984dce..6cd0f5f82e 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_ie_lib.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_ie_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_pairwise_key.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_pairwise_key.c index a9e61f77d4..34eaae5482 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_pairwise_key.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_pairwise_key.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_pairwise_key.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_pairwise_key.h index a28cac60a7..dc7a7ba4de 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_pairwise_key.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_pairwise_key.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_response_handler.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_response_handler.c index 68054aa1ce..7b36644952 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_response_handler.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_response_handler.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_response_handler.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_response_handler.h index dc58042ee7..7aa5a91c58 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_response_handler.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mac_response_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mpx_api.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mpx_api.h index b210e4a395..0a3042ce2b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mpx_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/MAC/mpx_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Mesh/mesh.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Mesh/mesh.c index 4cdbbb138c..5ee8d2cf45 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Mesh/mesh.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Mesh/mesh.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, 2019, Arm Limited and affiliates. + * Copyright (c) 2014-2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Mesh/mesh.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Mesh/mesh.h index 469d19f7aa..32ef979f08 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Mesh/mesh.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Mesh/mesh.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ND/nd_defines.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ND/nd_defines.h index 6cc37bd17c..36f381e0a3 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ND/nd_defines.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ND/nd_defines.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, 2019, Arm Limited and affiliates. + * Copyright (c) 2014-2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ND/nd_router_object.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ND/nd_router_object.c index 25441af0a3..40aa092de5 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ND/nd_router_object.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ND/nd_router_object.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ND/nd_router_object.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ND/nd_router_object.h index 78d494fbf4..a369ed84c3 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ND/nd_router_object.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ND/nd_router_object.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/NVM/nwk_nvm.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/NVM/nwk_nvm.c index 1da43f28cf..4a57e129a9 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/NVM/nwk_nvm.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/NVM/nwk_nvm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/NVM/nwk_nvm.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/NVM/nwk_nvm.h index 5b4c82dc41..6950f4d2a1 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/NVM/nwk_nvm.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/NVM/nwk_nvm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bbr_api.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bbr_api.c index bab9f73d6f..bae8e8a3c7 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bbr_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bbr_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2020, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bbr_api_internal.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bbr_api_internal.h index e9074ebd67..ca71446a21 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bbr_api_internal.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bbr_api_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bbr_commercial.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bbr_commercial.c index 17eb7096c9..3abd7735e2 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bbr_commercial.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bbr_commercial.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without @@ -1351,7 +1351,7 @@ void thread_bbr_commercial_route_update(protocol_interface_info_entry_t *cur) // remove with info and add valid domain prefix again to back bone interface ipv6_route_table_remove_info(this->backbone_interface_id, ROUTE_THREAD_BBR, NULL); - if (!addr_is_ipv6_unspecified(this->domain_prefix)) { + if (memcmp(this->domain_prefix, ADDR_UNSPECIFIED, 8) != 0) { // add dua route to backbone, delete dua from on-mesh route ipv6_route_add_with_info(this->domain_prefix, 64, this->backbone_interface_id, NULL, ROUTE_THREAD_BBR, NULL, 0, 0xffffffff, 0); tr_info("Hosting pBBR for DUA prefix"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bbr_commercial.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bbr_commercial.h index ebe3aa7705..eedf71cbce 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bbr_commercial.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bbr_commercial.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_beacon.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_beacon.c index 115cf02134..e9e8bf91d2 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_beacon.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_beacon.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_beacon.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_beacon.h index bd50f1a15a..69a924ad08 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_beacon.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_beacon.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bootstrap.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bootstrap.c index 1d0537d343..af16058f13 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bootstrap.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bootstrap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bootstrap.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bootstrap.h index c1e155a504..13383e8a18 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bootstrap.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_bootstrap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_border_router_api.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_border_router_api.c index fc7a009bf9..d035b16d08 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_border_router_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_border_router_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_border_router_api_internal.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_border_router_api_internal.h index 53db69b22b..88d9494aca 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_border_router_api_internal.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_border_router_api_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_ccm.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_ccm.c index e4da36ce64..0795599e8b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_ccm.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_ccm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_ccm.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_ccm.h index ca84cb6dfe..72958da2f6 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_ccm.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_ccm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_commissioning_api.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_commissioning_api.c index 2b498bb151..f9939a1cc2 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_commissioning_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_commissioning_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_commissioning_if.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_commissioning_if.c index af327f6cb3..29274f10b3 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_commissioning_if.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_commissioning_if.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_commissioning_if.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_commissioning_if.h index 448c0ce3c4..3aba2c31e4 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_commissioning_if.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_commissioning_if.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_common.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_common.c index 8e843f5673..a5146cc29b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_common.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_common.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2015, 2017-2020, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_common.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_common.h index 9e3d6a971f..2850c9481f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_common.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_config.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_config.h index 4b8d41db18..574b5d69e1 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_config.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_constants.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_constants.h index 2ad12b4271..12cd1ee8d9 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_constants.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_constants.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_dhcpv6_server.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_dhcpv6_server.c index c01e385bb0..951ed6b100 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_dhcpv6_server.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_dhcpv6_server.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2015, 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_dhcpv6_server.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_dhcpv6_server.h index b8e56a63f0..ed17352db5 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_dhcpv6_server.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_dhcpv6_server.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_diagnostic.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_diagnostic.c index 4dafbd34bd..23f627dea5 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_diagnostic.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_diagnostic.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_diagnostic.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_diagnostic.h index 5e787e4401..fe217ed7d7 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_diagnostic.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_diagnostic.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_discovery.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_discovery.c index 278e69a541..61dfe6e2c2 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_discovery.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_discovery.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_discovery.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_discovery.h index 1e44c1b2be..336173d273 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_discovery.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_discovery.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_host_bootstrap.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_host_bootstrap.c index 35a95c6227..64f48b7b3d 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_host_bootstrap.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_host_bootstrap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_host_bootstrap.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_host_bootstrap.h index b541154527..b76bcc2e5c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_host_bootstrap.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_host_bootstrap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_joiner_application.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_joiner_application.c index e880b7e0a8..481dc23775 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_joiner_application.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_joiner_application.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_joiner_application.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_joiner_application.h index 9f5dc88a4c..90646ae813 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_joiner_application.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_joiner_application.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_leader_service.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_leader_service.c index 73a6000893..404b701c8e 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_leader_service.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_leader_service.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_leader_service.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_leader_service.h index a28bb9202f..b1a0cc212e 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_leader_service.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_leader_service.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_lowpower_api.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_lowpower_api.c index bfae858d6b..c953d323ca 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_lowpower_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_lowpower_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_lowpower_private_api.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_lowpower_private_api.c index 06ba84d684..0d78c4f361 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_lowpower_private_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_lowpower_private_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_lowpower_private_api.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_lowpower_private_api.h index faed87cbba..9a1c3d614e 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_lowpower_private_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_lowpower_private_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_api.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_api.c index 60e02e3aee..9b41ad0e9b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_client.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_client.c index 50950f5b2b..fb8ea1138c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_client.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_client.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_client.h index 7822b5757c..86d61de2c8 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_client.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_client.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_if.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_if.c index 2a35d85dfe..76fd5739a6 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_if.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_if.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_internal.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_internal.h index 3e3dac832f..e4e3891d8a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_internal.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_server.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_server.c index 5d602813ad..cbab57d3ab 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_server.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_server.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_server.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_server.h index 8f3552791a..c2d41dfc97 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_server.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_management_server.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_mdns.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_mdns.c index 168bff5e81..4607f3f722 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_mdns.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_mdns.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_mdns.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_mdns.h index 0f9a1547f9..a9a603db10 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_mdns.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_mdns.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_meshcop_lib.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_meshcop_lib.c index 09a70ce682..acd798c2c3 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_meshcop_lib.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_meshcop_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_mle_message_handler.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_mle_message_handler.c index 9a465fbc27..716aa2ef02 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_mle_message_handler.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_mle_message_handler.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_mle_message_handler.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_mle_message_handler.h index 6eb6dd7dbc..5ea3e327bc 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_mle_message_handler.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_mle_message_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_nd.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_nd.c index ceff56d07f..89429438a5 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_nd.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_nd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_nd.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_nd.h index 60277db436..bcc47c599d 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_nd.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_nd.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_neighbor_class.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_neighbor_class.c index bf0eead1b6..95f2a43cc6 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_neighbor_class.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_neighbor_class.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_neighbor_class.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_neighbor_class.h index 5244441741..4d82195cf2 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_neighbor_class.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_neighbor_class.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_net_config_api.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_net_config_api.c index 62831be013..84ad064604 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_net_config_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_net_config_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_data_lib.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_data_lib.c index c7167e5937..8f1d9865ea 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_data_lib.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_data_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_data_lib.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_data_lib.h index 5c37901111..144af502d9 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_data_lib.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_data_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_data_storage.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_data_storage.c index 38576ac17e..2b43176ce7 100755 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_data_storage.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_data_storage.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_data_storage.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_data_storage.h index 54bef09e9b..8269821f3b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_data_storage.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_data_storage.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_synch.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_synch.c index 1ffbdc8da9..19c858e648 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_synch.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_synch.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_synch.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_synch.h index eb85ae0a03..36adc78b69 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_synch.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_network_synch.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_nvm_store.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_nvm_store.c index 876639933c..bc97297094 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_nvm_store.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_nvm_store.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2020, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_nvm_store.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_nvm_store.h index bba95038a5..5c03f9f716 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_nvm_store.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_nvm_store.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_resolution_client.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_resolution_client.c index 79740a0296..7ff3549871 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_resolution_client.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_resolution_client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_resolution_client.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_resolution_client.h index aec6f3911a..4f42a527a5 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_resolution_client.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_resolution_client.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_resolution_server.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_resolution_server.c index bbf2821eff..e21c71d9d4 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_resolution_server.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_resolution_server.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_resolution_server.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_resolution_server.h index 77fa611045..ea003a0bab 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_resolution_server.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_resolution_server.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_router_bootstrap.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_router_bootstrap.c index df32d174f6..29066cf88f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_router_bootstrap.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_router_bootstrap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2020, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_router_bootstrap.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_router_bootstrap.h index 6874a01b0b..b32982aa93 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_router_bootstrap.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_router_bootstrap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_routing.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_routing.c index 18a6f04f6a..1bb410f6f0 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_routing.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_routing.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_routing.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_routing.h index 720cecbe3e..ef53fcc1e8 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_routing.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_routing.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_test_api.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_test_api.c index 79a3972425..ac9faec896 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_test_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_test_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_tmfcop_lib.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_tmfcop_lib.h index d6ab869f50..7827a019f9 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_tmfcop_lib.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_tmfcop_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/adaptation_interface.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/adaptation_interface.c index 0374731751..4423636e03 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/adaptation_interface.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/adaptation_interface.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -120,6 +120,10 @@ typedef struct { #define LOWPAN_MEM_LIMIT_REMOVE_MAX 10000 // Remove when at memory limit #define LOWPAN_MEM_LIMIT_REMOVE_EF_MODE 20000 // Remove when out of memory and we are in EF mode +#define LOWPAN_TX_BUFFER_AGE_LIMIT_LOW_PRIORITY 30 // Remove low priority packets older than limit (seconds) +#define LOWPAN_TX_BUFFER_AGE_LIMIT_HIGH_PRIORITY 60 // Remove high priority packets older than limit (seconds) +#define LOWPAN_TX_BUFFER_AGE_LIMIT_EF_PRIORITY 120 // Remove expedited forwarding packets older than limit (seconds) + static NS_LIST_DEFINE(fragmenter_interface_list, fragmenter_interface_t, link); @@ -128,8 +132,8 @@ static NS_LIST_DEFINE(fragmenter_interface_list, fragmenter_interface_t, link); static fragmenter_interface_t *lowpan_adaptation_interface_discover(int8_t interfaceId); /* Interface direct message pending queue functions */ -static void lowpan_adaptation_tx_queue_write(fragmenter_interface_t *interface_ptr, buffer_t *buf); -static buffer_t *lowpan_adaptation_tx_queue_read(fragmenter_interface_t *interface_ptr); +static void lowpan_adaptation_tx_queue_write(protocol_interface_info_entry_t *cur, fragmenter_interface_t *interface_ptr, buffer_t *buf); +static buffer_t *lowpan_adaptation_tx_queue_read(protocol_interface_info_entry_t *cur, fragmenter_interface_t *interface_ptr); /* Data direction and message length validation */ static bool lowpan_adaptation_indirect_data_request(mac_neighbor_table_entry_t *mle_entry); @@ -223,8 +227,11 @@ static struct protocol_interface_info_entry *lowpan_adaptation_network_interface } -static void lowpan_adaptation_tx_queue_level_update(fragmenter_interface_t *interface_ptr) +static void lowpan_adaptation_tx_queue_level_update(protocol_interface_info_entry_t *cur, fragmenter_interface_t *interface_ptr) { + random_early_detetction_aq_calc(cur->random_early_detection, interface_ptr->directTxQueue_size); + protocol_stats_update(STATS_AL_TX_QUEUE_SIZE, interface_ptr->directTxQueue_size); + if (interface_ptr->directTxQueue_size == interface_ptr->directTxQueue_level + ADAPTION_DIRECT_TX_QUEUE_SIZE_THRESHOLD_TRACE || interface_ptr->directTxQueue_size == interface_ptr->directTxQueue_level - ADAPTION_DIRECT_TX_QUEUE_SIZE_THRESHOLD_TRACE) { interface_ptr->directTxQueue_level = interface_ptr->directTxQueue_size; @@ -233,14 +240,14 @@ static void lowpan_adaptation_tx_queue_level_update(fragmenter_interface_t *inte } -static void lowpan_adaptation_tx_queue_write(fragmenter_interface_t *interface_ptr, buffer_t *buf) +static void lowpan_adaptation_tx_queue_write(protocol_interface_info_entry_t *cur, fragmenter_interface_t *interface_ptr, buffer_t *buf) { buffer_t *lower_priority_buf = NULL; - ns_list_foreach(buffer_t, cur, &interface_ptr->directTxQueue) { + ns_list_foreach(buffer_t, entry, &interface_ptr->directTxQueue) { - if (cur->priority < buf->priority) { - lower_priority_buf = cur; + if (entry->priority < buf->priority) { + lower_priority_buf = entry; break; } } @@ -251,18 +258,17 @@ static void lowpan_adaptation_tx_queue_write(fragmenter_interface_t *interface_p ns_list_add_to_end(&interface_ptr->directTxQueue, buf); } interface_ptr->directTxQueue_size++; - lowpan_adaptation_tx_queue_level_update(interface_ptr); - protocol_stats_update(STATS_AL_TX_QUEUE_SIZE, interface_ptr->directTxQueue_size); + lowpan_adaptation_tx_queue_level_update(cur, interface_ptr); } -static void lowpan_adaptation_tx_queue_write_to_front(fragmenter_interface_t *interface_ptr, buffer_t *buf) +static void lowpan_adaptation_tx_queue_write_to_front(protocol_interface_info_entry_t *cur, fragmenter_interface_t *interface_ptr, buffer_t *buf) { buffer_t *lower_priority_buf = NULL; - ns_list_foreach(buffer_t, cur, &interface_ptr->directTxQueue) { + ns_list_foreach(buffer_t, entry, &interface_ptr->directTxQueue) { - if (cur->priority <= buf->priority) { - lower_priority_buf = cur; + if (entry->priority <= buf->priority) { + lower_priority_buf = entry; break; } } @@ -273,11 +279,10 @@ static void lowpan_adaptation_tx_queue_write_to_front(fragmenter_interface_t *in ns_list_add_to_end(&interface_ptr->directTxQueue, buf); } interface_ptr->directTxQueue_size++; - lowpan_adaptation_tx_queue_level_update(interface_ptr); - protocol_stats_update(STATS_AL_TX_QUEUE_SIZE, interface_ptr->directTxQueue_size); + lowpan_adaptation_tx_queue_level_update(cur, interface_ptr); } -static buffer_t *lowpan_adaptation_tx_queue_read(fragmenter_interface_t *interface_ptr) +static buffer_t *lowpan_adaptation_tx_queue_read(protocol_interface_info_entry_t *cur, fragmenter_interface_t *interface_ptr) { // Currently this function is called only when data confirm is received for previously sent packet. if (!interface_ptr->directTxQueue_size) { @@ -293,8 +298,7 @@ static buffer_t *lowpan_adaptation_tx_queue_read(fragmenter_interface_t *interfa if (lowpan_buffer_tx_allowed(interface_ptr, buf)) { ns_list_remove(&interface_ptr->directTxQueue, buf); interface_ptr->directTxQueue_size--; - lowpan_adaptation_tx_queue_level_update(interface_ptr); - protocol_stats_update(STATS_AL_TX_QUEUE_SIZE, interface_ptr->directTxQueue_size); + lowpan_adaptation_tx_queue_level_update(cur, interface_ptr); return buf; } } @@ -561,12 +565,24 @@ void lowpan_adaptation_free_heap(bool full_gc) lowpan_adaptation_free_low_priority_packets(interface_ptr->interface_id, priority, amount); } } +buffer_t *lowpan_adaptation_get_oldest_packet(fragmenter_interface_t *interface_ptr, buffer_priority_t priority) +{ + ns_list_foreach(buffer_t, entry, &interface_ptr->directTxQueue) { + if (entry->priority == priority) { + // Only Higher priority packets left no need to go through list anymore + return entry; + } + } + return NULL; + +} int8_t lowpan_adaptation_free_low_priority_packets(int8_t interface_id, buffer_priority_t max_priority, uint32_t requested_amount) { fragmenter_interface_t *interface_ptr = lowpan_adaptation_interface_discover(interface_id); + protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id); - if (!interface_ptr) { + if (!interface_ptr || !cur) { return -1; } uint32_t adaptation_memory = 0; @@ -592,21 +608,36 @@ int8_t lowpan_adaptation_free_low_priority_packets(int8_t interface_id, buffer_p requested_amount = adaptation_memory - LOWPAN_MEM_LIMIT_MIN_MEMORY; } - //Only remove last entries from TX queue with low priority - ns_list_foreach_reverse_safe(buffer_t, entry, &interface_ptr->directTxQueue) { - if (entry->priority <= max_priority) { - memory_freed += sizeof(buffer_t) + entry->size; - packets_freed++; - ns_list_remove(&interface_ptr->directTxQueue, entry); - interface_ptr->directTxQueue_size--; - lowpan_adaptation_tx_queue_level_update(interface_ptr); - socket_tx_buffer_event_and_free(entry, SOCKET_TX_FAIL); - } - if (memory_freed > requested_amount) { - // Enough memory freed + /* Order of packets is + * priority 4 oldest to newest + * priority 3 oldest to newest + * priority 2 oldest to newest + * priority 1 oldest to newest + * priority 0 oldest to newest + * So we search oldest for lowest priority and delete that until that priority is empty + * and then start deleting one higher priority packets from oldest first + */ + + buffer_priority_t priority = QOS_NORMAL; + do { + buffer_t *entry = lowpan_adaptation_get_oldest_packet(interface_ptr, priority); + if (!entry) { + if (priority < max_priority) { + priority++; + continue; + } + // No more packets available break; } - } + // This packet can be deleted + memory_freed += sizeof(buffer_t) + entry->size; + packets_freed++; + ns_list_remove(&interface_ptr->directTxQueue, entry); + interface_ptr->directTxQueue_size--; + lowpan_adaptation_tx_queue_level_update(cur, interface_ptr); + socket_tx_buffer_event_and_free(entry, SOCKET_TX_FAIL); + } while (memory_freed < requested_amount); + tr_info("Adaptation Free low priority packets memory: %" PRIi32 " queue: %d deallocated %" PRIi32 " bytes, %d packets, %" PRIi32 " requested", adaptation_memory, adaptation_packets, memory_freed, packets_freed, requested_amount); return 0; } @@ -1155,17 +1186,9 @@ static bool lowpan_buffer_tx_allowed(fragmenter_interface_t *interface_ptr, buff return true; } -static uint32_t lowpan_adaptation_time_stamp_diff(uint32_t compare_stamp) -{ - if (protocol_core_monotonic_time < compare_stamp) { - return compare_stamp - protocol_core_monotonic_time; - } - return protocol_core_monotonic_time - compare_stamp; -} - static bool lowpan_adaptation_high_priority_state_exit(fragmenter_interface_t *interface_ptr) { - if (!interface_ptr->last_rx_high_priority || lowpan_adaptation_time_stamp_diff(interface_ptr->last_rx_high_priority) < LOWPAN_HIGH_PRIORITY_STATE_LENGTH) { + if (!interface_ptr->last_rx_high_priority || ((protocol_core_monotonic_time - interface_ptr->last_rx_high_priority) < LOWPAN_HIGH_PRIORITY_STATE_LENGTH)) { return false; } @@ -1210,8 +1233,7 @@ static void lowpan_adaptation_high_priority_state_enable(protocol_interface_info interface_ptr->activeTxList_size--; ns_dyn_mem_free(entry); //Add message to tx queue front based on priority. Now same priority at buf is prioritised at order - lowpan_adaptation_tx_queue_write_to_front(interface_ptr, buf); - random_early_detetction_aq_calc(cur->random_early_detection, interface_ptr->directTxQueue_size); + lowpan_adaptation_tx_queue_write_to_front(cur, interface_ptr, buf); } } } @@ -1242,6 +1264,15 @@ void lowpan_adaptation_expedite_forward_enable(protocol_interface_info_entry_t * lowpan_adaptation_high_priority_state_enable(cur, interface_ptr); } +bool lowpan_adaptation_expedite_forward_state_get(protocol_interface_info_entry_t *cur) +{ + fragmenter_interface_t *interface_ptr = lowpan_adaptation_interface_discover(cur->id); + if (!interface_ptr || !interface_ptr->last_rx_high_priority) { + return false; + } + return true; +} + void lowpan_adaptation_interface_slow_timer(protocol_interface_info_entry_t *cur) { fragmenter_interface_t *interface_ptr = lowpan_adaptation_interface_discover(cur->id); @@ -1251,16 +1282,31 @@ void lowpan_adaptation_interface_slow_timer(protocol_interface_info_entry_t *cur if (lowpan_adaptation_high_priority_state_exit(interface_ptr)) { //Activate Packets from TX queue - buffer_t *buf_from_queue = lowpan_adaptation_tx_queue_read(interface_ptr); + buffer_t *buf_from_queue = lowpan_adaptation_tx_queue_read(cur, interface_ptr); while (buf_from_queue) { lowpan_adaptation_interface_tx(cur, buf_from_queue); - buf_from_queue = lowpan_adaptation_tx_queue_read(interface_ptr); + buf_from_queue = lowpan_adaptation_tx_queue_read(cur, interface_ptr); } - //Update Average QUEUE - random_early_detetction_aq_calc(cur->random_early_detection, interface_ptr->directTxQueue_size); } } +static bool lowpan_adaptation_interface_check_buffer_timeout(buffer_t *buf) +{ + // Convert from 100ms slots to seconds + uint32_t buffer_age_s = (protocol_core_monotonic_time - buf->adaptation_timestamp) / 10; + + if ((buf->priority == QOS_NORMAL) && (buffer_age_s > LOWPAN_TX_BUFFER_AGE_LIMIT_LOW_PRIORITY)) { + return true; + } else if ((buf->priority == QOS_HIGH) && (buffer_age_s > LOWPAN_TX_BUFFER_AGE_LIMIT_HIGH_PRIORITY)) { + return true; + } else if ((buf->priority == QOS_NETWORK_CTRL) && (buffer_age_s > LOWPAN_TX_BUFFER_AGE_LIMIT_HIGH_PRIORITY)) { + return true; + } else if ((buf->priority == QOS_EXPEDITE_FORWARD) && (buffer_age_s > LOWPAN_TX_BUFFER_AGE_LIMIT_EF_PRIORITY)) { + return true; + } + return false; +} + int8_t lowpan_adaptation_interface_tx(protocol_interface_info_entry_t *cur, buffer_t *buf) { bool is_room_for_new_message; @@ -1288,6 +1334,18 @@ int8_t lowpan_adaptation_interface_tx(protocol_interface_info_entry_t *cur, buff buffer_priority_set(buf, QOS_HIGH); } + if (!buf->adaptation_timestamp) { + // Set TX start timestamp + buf->adaptation_timestamp = protocol_core_monotonic_time; + if (!buf->adaptation_timestamp) { + buf->adaptation_timestamp--; + } + } else if (lowpan_adaptation_interface_check_buffer_timeout(buf)) { + // Remove old buffers + socket_tx_buffer_event_and_free(buf, SOCKET_TX_FAIL); + return -1; + } + //Update priority status lowpan_adaptation_priority_status_update(cur, interface_ptr, buf->priority); @@ -1310,17 +1368,17 @@ int8_t lowpan_adaptation_interface_tx(protocol_interface_info_entry_t *cur, buff if (!lowpan_buffer_tx_allowed(interface_ptr, buf)) { - if (buf->priority == QOS_NORMAL) { - - if (random_early_detection_congestion_check(cur->random_early_detection)) { - random_early_detetction_aq_calc(cur->random_early_detection, interface_ptr->directTxQueue_size); + if (random_early_detection_congestion_check(cur->random_early_detection)) { + // If we need to drop packet we drop oldest normal Priority packet. + buffer_t *dropped = lowpan_adaptation_get_oldest_packet(interface_ptr, QOS_NORMAL); + if (dropped) { + ns_list_remove(&interface_ptr->directTxQueue, dropped); + interface_ptr->directTxQueue_size--; + socket_tx_buffer_event_and_free(dropped, SOCKET_TX_FAIL); protocol_stats_update(STATS_AL_TX_CONGESTION_DROP, 1); - goto tx_error_handler; } } - - lowpan_adaptation_tx_queue_write(interface_ptr, buf); - random_early_detetction_aq_calc(cur->random_early_detection, interface_ptr->directTxQueue_size); + lowpan_adaptation_tx_queue_write(cur, interface_ptr, buf); return 0; } @@ -1516,9 +1574,13 @@ int8_t lowpan_adaptation_interface_tx_confirm(protocol_interface_info_entry_t *c tr_error("No data request for this confirmation %u", confirm->msduHandle); return -1; } - //Check status for buffer_t *buf = tx_ptr->buf; + // Update adaptation layer latency for unicast packets. Given as seconds. + if (buf->link_specific.ieee802_15_4.requestAck && buf->adaptation_timestamp) { + protocol_stats_update(STATS_AL_TX_LATENCY, ((protocol_core_monotonic_time - buf->adaptation_timestamp) + 5) / 10); + } + //Indirect data expiration if (confirm->status == MLME_TRANSACTION_EXPIRED && !active_direct_confirm) { if (buf->link_specific.ieee802_15_4.indirectTTL > 7000) { @@ -1561,6 +1623,11 @@ int8_t lowpan_adaptation_interface_tx_confirm(protocol_interface_info_entry_t *c } } else if ((confirm->status == MLME_BUSY_CHAN) && !ws_info(cur)) { lowpan_data_request_to_mac(cur, buf, tx_ptr, interface_ptr); + } else if ((buf->link_specific.ieee802_15_4.requestAck) && (confirm->status == MLME_TRANSACTION_EXPIRED)) { + lowpan_adaptation_tx_queue_write_to_front(cur, interface_ptr, buf); + ns_list_remove(&interface_ptr->activeUnicastList, tx_ptr); + ns_dyn_mem_free(tx_ptr); + interface_ptr->activeTxList_size--; } else { @@ -1596,13 +1663,11 @@ int8_t lowpan_adaptation_interface_tx_confirm(protocol_interface_info_entry_t *c if (active_direct_confirm == true) { //Check Possibility for exit from High Priority state lowpan_adaptation_high_priority_state_exit(interface_ptr); - buffer_t *buf_from_queue = lowpan_adaptation_tx_queue_read(interface_ptr); + buffer_t *buf_from_queue = lowpan_adaptation_tx_queue_read(cur, interface_ptr); while (buf_from_queue) { lowpan_adaptation_interface_tx(cur, buf_from_queue); - buf_from_queue = lowpan_adaptation_tx_queue_read(interface_ptr); + buf_from_queue = lowpan_adaptation_tx_queue_read(cur, interface_ptr); } - //Update Average QUEUE - random_early_detetction_aq_calc(cur->random_early_detection, interface_ptr->directTxQueue_size); } return 0; } @@ -1806,8 +1871,7 @@ int8_t lowpan_adaptation_free_messages_from_queues_by_address(struct protocol_in ns_list_remove(&interface_ptr->directTxQueue, entry); interface_ptr->directTxQueue_size--; //Update Average QUEUE - random_early_detetction_aq_calc(cur->random_early_detection, interface_ptr->directTxQueue_size); - lowpan_adaptation_tx_queue_level_update(interface_ptr); + lowpan_adaptation_tx_queue_level_update(cur, interface_ptr); socket_tx_buffer_event_and_free(entry, SOCKET_TX_FAIL); } } diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/lowpan_adaptation_interface.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/lowpan_adaptation_interface.h index 5b88e28723..7e8227bb25 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/lowpan_adaptation_interface.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/lowpan_adaptation_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -64,6 +64,8 @@ int8_t lowpan_adaptation_indirect_queue_params_set(struct protocol_interface_inf void lowpan_adaptation_expedite_forward_enable(struct protocol_interface_info_entry *cur); +bool lowpan_adaptation_expedite_forward_state_get(struct protocol_interface_info_entry *cur); + void lowpan_adaptation_interface_slow_timer(struct protocol_interface_info_entry *cur); #endif /* LOWPAN_ADAPTATION_INTERFACE_H_ */ diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bbr_api.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bbr_api.c index 1fc5a5940c..051fca51ad 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bbr_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bbr_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2021, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -42,6 +42,7 @@ #include "ws_management_api.h" #include "net_rpl.h" #include "Service_Libs/nd_proxy/nd_proxy.h" +#include "Service_Libs/utils/ns_time.h" #include "6LoWPAN/ws/ws_bbr_api_internal.h" #include "6LoWPAN/ws/ws_pae_controller.h" #include "6LoWPAN/lowpan_adaptation_interface.h" @@ -96,9 +97,6 @@ static uint8_t current_global_prefix[16] = {0}; // DHCP requires 16 bytes prefix static uint32_t bbr_delay_timer = BBR_CHECK_INTERVAL; // initial delay. static uint32_t global_prefix_unavailable_timer = 0; // initial delay. -static uint8_t *dhcp_vendor_data_ptr = NULL; -static uint8_t dhcp_vendor_data_len = 0; - static rpl_dodag_conf_t rpl_conf = { // Lifetime values .default_lifetime = 120, @@ -485,9 +483,38 @@ static bool wisun_dhcp_address_add_cb(int8_t interfaceId, dhcp_address_cache_upd return true; } +static uint8_t *ws_bbr_dhcp_server_dynamic_vendor_data_write(int8_t interfaceId, uint8_t *ptr, uint16_t *data_len) +{ + // If local time is not available vendor data is not written and data_len is not modified + (void)interfaceId; + + uint64_t time_read; + + if (0 != ns_time_system_time_read(&time_read)) { + return ptr; + } + + if (data_len) { + *data_len += net_vendor_option_current_time_length(); + } + if (!ptr) { + return ptr; + } + time_read += 2208988800; // Time starts now from the 0 era instead of First day of Unix (1 Jan 1970) + + uint32_t era = time_read / (uint64_t)(4294967296); + uint32_t timestamp = time_read - (era * (uint64_t)(4294967296)); + ptr = net_vendor_option_current_time_write(ptr, era, timestamp, 0); + + return ptr; +} + + static void ws_bbr_dhcp_server_dns_info_update(protocol_interface_info_entry_t *cur, uint8_t *global_id) { //add DNS server information to DHCP server that is learned from the backbone interface. + uint8_t *dhcp_vendor_data_ptr = NULL; + uint8_t dhcp_vendor_data_len = 0; uint8_t dns_server_address[16]; uint8_t *dns_search_list_ptr = NULL; uint8_t dns_search_list_len = 0; @@ -497,33 +524,40 @@ static void ws_bbr_dhcp_server_dns_info_update(protocol_interface_info_entry_t * DHCPv6_server_service_set_dns_server(cur->id, global_id, dns_server_address, dns_search_list_ptr, dns_search_list_len); } - //TODO Generate vendor data in Wi-SUN network include the cached DNS query results in some sort of TLV format + //Generate ARM specific vendor data in Wi-SUN network + // Cached DNS query results + // Network Time + int vendor_data_len = 0; for (int n = 0; n < MAX_DNS_RESOLUTIONS; n++) { if (pre_resolved_dns_queries[n].domain_name != NULL) { vendor_data_len += net_dns_option_vendor_option_data_dns_query_length(pre_resolved_dns_queries[n].domain_name); } } + if (vendor_data_len) { - ns_dyn_mem_free(dhcp_vendor_data_ptr); - dhcp_vendor_data_ptr = ns_dyn_mem_alloc(vendor_data_len); + dhcp_vendor_data_ptr = ns_dyn_mem_temporary_alloc(vendor_data_len); if (!dhcp_vendor_data_ptr) { tr_warn("Vendor info set fail"); return; } dhcp_vendor_data_len = vendor_data_len; } + // Write ARM vendor data + uint8_t *ptr = dhcp_vendor_data_ptr; + if (dhcp_vendor_data_ptr) { // Write vendor data - uint8_t *ptr = dhcp_vendor_data_ptr; for (int n = 0; n < MAX_DNS_RESOLUTIONS; n++) { if (pre_resolved_dns_queries[n].domain_name != NULL) { ptr = net_dns_option_vendor_option_data_dns_query_write(ptr, pre_resolved_dns_queries[n].address, pre_resolved_dns_queries[n].domain_name); } } } + DHCPv6_server_service_set_vendor_data_callback(cur->id, global_id, ARM_ENTERPRISE_NUMBER, ws_bbr_dhcp_server_dynamic_vendor_data_write); DHCPv6_server_service_set_vendor_data(cur->id, global_id, ARM_ENTERPRISE_NUMBER, dhcp_vendor_data_ptr, dhcp_vendor_data_len); + ns_dyn_mem_free(dhcp_vendor_data_ptr); } static void wisun_dhcp_address_remove_cb(int8_t interfaceId, uint8_t *targetAddress, void *prefix_info) diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bbr_api_internal.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bbr_api_internal.h index 24779fdc22..dab05547eb 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bbr_api_internal.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bbr_api_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bootstrap.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bootstrap.c index 013c3c6e99..b3f97518c3 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bootstrap.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bootstrap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -49,6 +49,7 @@ #include "Common_Protocols/ip.h" #include "Service_Libs/Trickle/trickle.h" #include "Service_Libs/fhss/channel_list.h" +#include "Service_Libs/utils/ns_time.h" #include "6LoWPAN/ws/ws_common_defines.h" #include "6LoWPAN/ws/ws_common_defines.h" #include "6LoWPAN/ws/ws_config.h" @@ -199,57 +200,10 @@ static void ws_bootstrap_neighbor_delete(struct protocol_interface_info_entry *i ws_neighbor_class_entry_remove(&interface->ws_info->neighbor_storage, entry_ptr->index); } -static void ws_bootstap_eapol_neigh_entry_allocate(struct protocol_interface_info_entry *interface) -{ - uint8_t mac_64[8]; - memset(mac_64, 0, sizeof(mac_64)); - - mac_neighbor_table_entry_t *mac_entry = ws_bootstrap_mac_neighbor_add(interface, mac_64); - - if (!mac_entry) { - return; - } - mac_entry->lifetime = 0xffffffff; - mac_entry->link_lifetime = 0xffffffff; - ws_neighbor_class_entry_t *ws_neigh = ws_neighbor_class_entry_get(&interface->ws_info->neighbor_storage, mac_entry->index); - if (!ws_neigh) { - return; - } - - interface->ws_info->eapol_tx_index = mac_entry->index; -} - -ws_neighbor_class_entry_t *ws_bootstrap_eapol_tx_temporary_set(struct protocol_interface_info_entry *interface, const uint8_t *src64) -{ - mlme_device_descriptor_t device_desc; - mac_neighbor_table_entry_t *mac_entry = mac_neighbor_table_attribute_discover(mac_neighbor_info(interface), interface->ws_info->eapol_tx_index); - if (!mac_entry) { - return NULL; - } - - memcpy(mac_entry->mac64, src64, 8); - mac_helper_device_description_write(interface, &device_desc, src64, 0xffff, 0, false); - mac_helper_devicetable_direct_set(interface->mac_api, &device_desc, interface->ws_info->eapol_tx_index); - return ws_neighbor_class_entry_get(&interface->ws_info->neighbor_storage, mac_entry->index); -} - -void ws_bootstrap_eapol_tx_temporary_clear(struct protocol_interface_info_entry *interface) -{ - mac_neighbor_table_entry_t *mac_entry = mac_neighbor_table_attribute_discover(mac_neighbor_info(interface), interface->ws_info->eapol_tx_index); - if (!mac_entry) { - return; - } - - memset(mac_entry->mac64, 0xff, 8); - mac_helper_devicetable_remove(interface->mac_api, interface->ws_info->eapol_tx_index, NULL); -} - static void ws_bootstrap_neighbor_list_clean(struct protocol_interface_info_entry *interface) { mac_neighbor_table_neighbor_list_clean(mac_neighbor_info(interface)); - //Allocate EAPOL TX temporary neigh entry - ws_bootstap_eapol_neigh_entry_allocate(interface); } static void ws_address_reregister_trig(struct protocol_interface_info_entry *interface) @@ -561,14 +515,19 @@ static fhss_ws_neighbor_timing_info_t *ws_get_neighbor_info(const fhss_api_t *ap return NULL; } mac_neighbor_table_entry_t *mac_neighbor = mac_neighbor_table_address_discover(mac_neighbor_info(cur), eui64, MAC_ADDR_MODE_64_BIT); - if (!mac_neighbor) { + if (mac_neighbor) { + ws_neighbor_class_entry_t *ws_neighbor = ws_neighbor_class_entry_get(&cur->ws_info->neighbor_storage, mac_neighbor->index); + if (!ws_neighbor) { + return NULL; + } + return &ws_neighbor->fhss_data; + } + //Discover temporary entry + ws_neighbor_temp_class_t *temp_entry = ws_llc_get_eapol_temp_entry(cur, eui64); + if (!temp_entry) { return NULL; } - ws_neighbor_class_entry_t *ws_neighbor = ws_neighbor_class_entry_get(&cur->ws_info->neighbor_storage, mac_neighbor->index); - if (!ws_neighbor) { - return NULL; - } - return &ws_neighbor->fhss_data; + return &temp_entry->neigh_info_list.fhss_data; } static void ws_bootstrap_llc_hopping_update(struct protocol_interface_info_entry *cur, const fhss_ws_configuration_t *fhss_configuration) { @@ -909,17 +868,17 @@ static void ws_bootstrap_ll_address_validate(struct protocol_interface_info_entr * \return 0x0000 address unknown or other error * \return 0x0001 no ETX statistics on this interface */ -uint16_t ws_etx_read(protocol_interface_info_entry_t *interface, addrtype_t addr_type, const uint8_t *addr_ptr) +uint16_t ws_local_etx_read(protocol_interface_info_entry_t *interface, addrtype_t addr_type, const uint8_t *mac_adddress) { uint16_t etx; - if (!addr_ptr || !interface) { + if (!mac_adddress || !interface) { return 0; } uint8_t attribute_index; - mac_neighbor_table_entry_t *mac_neighbor = mac_neighbor_table_address_discover(mac_neighbor_info(interface), addr_ptr + PAN_ID_LEN, addr_type); + mac_neighbor_table_entry_t *mac_neighbor = mac_neighbor_table_address_discover(mac_neighbor_info(interface), mac_adddress, addr_type); if (!mac_neighbor) { return 0xffff; } @@ -933,6 +892,12 @@ uint16_t ws_etx_read(protocol_interface_info_entry_t *interface, addrtype_t addr etx = etx_local_etx_read(interface->id, attribute_index); + // if we have a measurement ready then we will check the RSL validity + if (etx != 0xffff && !ws_neighbour->candidate_parent) { + // RSL value measured is lower than acceptable ETX will be given as MAX + return WS_ETX_MAX << 1; // We use 8 bit fraction and ETX is usually 7 bit fraction + } + // If we dont have valid ETX for children we assume good ETX. // After enough packets is sent to children real calculated ETX is given. // This might result in ICMP source route errors returned to Border router causing secondary route uses @@ -942,6 +907,15 @@ uint16_t ws_etx_read(protocol_interface_info_entry_t *interface, addrtype_t addr return etx; } + +uint16_t ws_etx_read(protocol_interface_info_entry_t *interface, addrtype_t addr_type, const uint8_t *addr_ptr) +{ + if (!addr_ptr || !interface) { + return 0; + } + return ws_local_etx_read(interface, addr_type, addr_ptr + PAN_ID_LEN); +} + bool ws_bootstrap_nd_ns_transmit(protocol_interface_info_entry_t *cur, ipv6_neighbour_t *entry, bool unicast, uint8_t seq) { (void)cur; @@ -1026,6 +1000,41 @@ static void ws_bootstrap_dhcp_info_notify_cb(int8_t interface, dhcp_option_notif net_dns_query_result_set(interface, address, domain, server_info->life_time); } } + if (option_type == ARM_DHCP_VENDOR_DATA_NETWORK_TIME) { + // Process ARM Network Time + // Get Current time + // Get Round trip time of the DHCP request + // Estimated error is elapsed time of request + // If current time difference is larger than estimated error update current time + // set the time for server time + *.5 RTT + int32_t era; + uint32_t offset; + if (net_vendor_option_current_time_read(options->option.vendor_spesific.data, options->option.vendor_spesific.data_length, &era, &offset, NULL)) { + uint64_t current_time; + uint64_t network_time = (era * (uint64_t)(4294967296)) + offset - 2208988800; //Convert to First day of Unix (1 Jan 1970) + + tr_debug("Network Time option Era:%"PRId32" Offset:%"PRIu32" rtt: %"PRId32" time: %"PRIu64, era, offset, server_info->rtt, network_time); + if (0 == ns_time_system_time_read(¤t_time)) { + uint64_t difference; + // We only adjust clock if time has drifted more than 10 seconds to avoid constant changing of time + // If Round trip time is very high the accuracy is reduced. + uint32_t estimated_error = 10 + server_info->rtt / 10; + // Take into account the round trip time it took the response to arrive from the time server Write the time. + network_time += server_info->rtt / 20; + + if (current_time > network_time) { + difference = current_time - network_time; + } else { + difference = network_time - current_time; + } + if (difference > estimated_error) { + // Larger than 10 second difference update the time + int ret = ns_time_system_time_write(network_time); + tr_info("Network Time %s: Era:%"PRId32" Offset:%"PRIu32" old time: %"PRIu64" time: %"PRIu64, ret == 0 ? "updated" : "update FAILED", era, offset, current_time, network_time); + } + } + } + } options->option.vendor_spesific.data_length -= option_len; options->option.vendor_spesific.data += option_len; @@ -1126,7 +1135,8 @@ static int8_t ws_bootstrap_up(protocol_interface_info_entry_t *cur) dhcp_client_init(cur->id, DHCPV6_DUID_HARDWARE_IEEE_802_NETWORKS_TYPE); dhcp_service_link_local_rx_cb_set(cur->id, ws_bootstrap_dhcp_neighbour_update_cb); dhcp_client_configure(cur->id, true, true, true); //RENEW uses SOLICIT, Interface will use 1 instance for address get, IAID address hint is not used. - dhcp_client_solicit_timeout_set(cur->id, WS_DHCP_SOLICIT_TIMEOUT, WS_DHCP_SOLICIT_MAX_RT, WS_DHCP_SOLICIT_MAX_RC); + + dhcp_client_solicit_timeout_set(cur->id, WS_DHCP_SOLICIT_TIMEOUT, WS_DHCP_SOLICIT_MAX_RT, WS_DHCP_SOLICIT_MAX_RC, WS_DHCP_SOLICIT_MAX_DELAY); dhcp_client_option_notification_cb_set(cur->id, ws_bootstrap_dhcp_info_notify_cb); // Configure memory limits and garbage collection values; @@ -1387,6 +1397,12 @@ static void ws_bootstrap_candidate_parent_store(parent_info_t *parent, const str parent->signal_dbm = data->signal_dbm; memcpy(parent->addr, data->SrcAddr, 8); + if (ws_neighbor_class_rsl_from_dbm_calculate(parent->signal_dbm) > (DEVICE_MIN_SENS + CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERISIS)) { + parent->link_acceptable = true; + } + if (ws_neighbor_class_rsl_from_dbm_calculate(parent->signal_dbm) < (DEVICE_MIN_SENS + CAND_PARENT_THRESHOLD - CAND_PARENT_HYSTERISIS)) { + parent->link_acceptable = false; + } parent->age = protocol_core_monotonic_time; } @@ -1421,6 +1437,7 @@ static parent_info_t *ws_bootstrap_candidate_parent_allocate(protocol_interface_ } if (entry) { entry->tx_fail = 0; + entry->link_acceptable = false; } return entry; } @@ -1442,13 +1459,11 @@ static void ws_bootstrap_candidate_parent_mark_failure(protocol_interface_info_e { parent_info_t *entry = ws_bootstrap_candidate_parent_get(cur, addr, false); if (entry) { - ns_list_remove(&cur->ws_info->parent_list_reserved, entry); if (entry->tx_fail >= 2) { + ns_list_remove(&cur->ws_info->parent_list_reserved, entry); ns_list_add_to_end(&cur->ws_info->parent_list_free, entry); } else { entry->tx_fail++; - //New last - ns_list_add_to_end(&cur->ws_info->parent_list_reserved, entry); ws_bootstrap_candidate_parent_sort(cur, entry); } @@ -1466,14 +1481,16 @@ static bool ws_bootstrap_candidate_parent_compare(parent_info_t *p1, parent_info return false; } - if (ws_neighbor_class_rsl_from_dbm_calculate(p1->signal_dbm) < (DEVICE_MIN_SENS + CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERISIS) && - ws_neighbor_class_rsl_from_dbm_calculate(p2->signal_dbm) > (DEVICE_MIN_SENS + CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERISIS)) { - // above threshold is always better than not. + if (p2->tx_fail < p1->tx_fail) { return true; } - if (ws_neighbor_class_rsl_from_dbm_calculate(p2->signal_dbm) < (DEVICE_MIN_SENS + CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERISIS) && - ws_neighbor_class_rsl_from_dbm_calculate(p1->signal_dbm) > (DEVICE_MIN_SENS + CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERISIS)) { - // P2 is less than threshold and P1 is larger so P1 is always better. + + if (p1->link_acceptable && !p2->link_acceptable) { + // Link acceptable is always better than not + return true; + } + if (!p1->link_acceptable && p2->link_acceptable) { + // Link acceptable is always better than not return false; } @@ -1498,6 +1515,7 @@ static void ws_bootstrap_candidate_list_clean(struct protocol_interface_info_ent int pan_count = 0; ns_list_foreach_safe(parent_info_t, entry, &cur->ws_info->parent_list_reserved) { + if ((current_time - entry->age) > WS_PARENT_LIST_MAX_AGE) { ns_list_remove(&cur->ws_info->parent_list_reserved, entry); ns_list_add_to_end(&cur->ws_info->parent_list_free, entry); @@ -1534,6 +1552,9 @@ static void ws_bootstrap_candidate_parent_sort(struct protocol_interface_info_en return; } } + // This is the last entry + ns_list_remove(&cur->ws_info->parent_list_reserved, new_entry); + ns_list_add_to_end(&cur->ws_info->parent_list_reserved, new_entry); } static void ws_bootstrap_pan_information_store(struct protocol_interface_info_entry *cur, const struct mcps_data_ind_s *data, ws_utt_ie_t *ws_utt, ws_us_ie_t *ws_us, ws_pan_information_t *pan_information) @@ -1560,6 +1581,14 @@ static void ws_bootstrap_pan_information_store(struct protocol_interface_info_en } // Safe the information ws_bootstrap_candidate_parent_store(new_entry, data, ws_utt, ws_us, pan_information); + if (!new_entry->link_acceptable) { + // This entry is either poor quality or changed to poor quality link so we will remove this + // Todo in future possibility to try poor link parents if we have not found any good link parents + tr_info("neighbour not accepted: addr:%s panid:%x rsl:%d device_min_sens: %d", trace_array(new_entry->addr, 8), new_entry->pan_id, ws_neighbor_class_rsl_from_dbm_calculate(new_entry->signal_dbm), DEVICE_MIN_SENS); + ns_list_remove(&cur->ws_info->parent_list_reserved, new_entry); + ns_list_add_to_end(&cur->ws_info->parent_list_free, new_entry); + return; + } // set to the correct place in list ws_bootstrap_candidate_parent_sort(cur, new_entry); @@ -2052,10 +2081,6 @@ static void ws_bootstrap_neighbor_table_clean(struct protocol_interface_info_ent ns_list_foreach_safe(mac_neighbor_table_entry_t, cur, &mac_neighbor_info(interface)->neighbour_list) { ws_neighbor_class_entry_t *ws_neighbor = ws_neighbor_class_entry_get(&interface->ws_info->neighbor_storage, cur->index); - if (cur->index == interface->ws_info->eapol_tx_index) { - continue; - } - if (cur->link_role == PRIORITY_PARENT_NEIGHBOUR) { //This is our primary parent we cannot delete continue; @@ -2204,6 +2229,11 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr, return false; } + if (lowpan_adaptation_expedite_forward_state_get(cur)) { + //Do not send any probe or NUD when Expedite forward state is enabled + return false; + } + ws_bootsrap_create_ll_address(ll_address, entry_ptr->mac64); if (time_from_start > WS_NEIGHBOR_NUD_TIMEOUT) { @@ -2981,17 +3011,17 @@ static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle, return false; } // +2 Is for PAN ID space - memcpy(mac64 + 2, replacing + 8, 8); - mac64[2] ^= 2; + memcpy(mac64, replacing + 8, 8); + mac64[0] ^= 2; - if (ws_etx_read(cur, ADDR_802_15_4_LONG, mac64) == 0xffff) { - //Not proped yet because ETX is 0xffff + if (ws_local_etx_read(cur, ADDR_802_15_4_LONG, mac64) == 0xffff) { + //Not probed yet because ETX is 0xffff return false; } uint16_t etx = 0; if (neigh_buffer.neighbor) { - etx = etx_local_etx_read(cur->id, neigh_buffer.neighbor->index); + etx = ws_local_etx_read(cur, ADDR_802_15_4_LONG, neigh_buffer.neighbor->mac64); } // Accept now only better one's when max candidates selected and max candidate list size is reached @@ -3534,7 +3564,7 @@ static uint16_t ws_bootstrap_routing_cost_calculate(protocol_interface_info_entr return 0xffff; } - uint16_t etx = etx_local_etx_read(cur->id, mac_neighbor->index); + uint16_t etx = ws_local_etx_read(cur, ADDR_802_15_4_LONG, mac_neighbor->mac64); if (etx == 0) { etx = WS_ETX_MAX; //SET maximum value here if ETX is unknown } else { @@ -4234,7 +4264,7 @@ int ws_bootstrap_neighbor_info_get(protocol_interface_info_entry_t *cur, ws_neig neighbor_ptr[count].rsl_out = ws_neighbor_class_rsl_out_get(ws_neighbor); // ETX is shown calculated as 8 bit integer, but more common way is to use 7 bit such that 128 means ETX:1.0 - neighbor_ptr[count].etx = etx_local_etx_read(cur->id, mac_entry->index); + neighbor_ptr[count].etx = ws_local_etx_read(cur, ADDR_802_15_4_LONG, mac_entry->mac64); if (neighbor_ptr[count].etx != 0xffff) { neighbor_ptr[count].etx = neighbor_ptr[count].etx >> 1; } diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bootstrap.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bootstrap.h index 535092501d..1d41c80a75 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bootstrap.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bootstrap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -91,10 +91,6 @@ bool ws_bootstrap_validate_channel_plan(struct ws_us_ie *ws_us, struct protocol_ bool ws_bootstrap_validate_channel_function(struct ws_us_ie *ws_us, struct ws_bs_ie *ws_bs); -struct ws_neighbor_class_entry *ws_bootstrap_eapol_tx_temporary_set(struct protocol_interface_info_entry *interface, const uint8_t *src64); - -void ws_bootstrap_eapol_tx_temporary_clear(struct protocol_interface_info_entry *interface); - void ws_bootstrap_neighbor_set_stable(struct protocol_interface_info_entry *interface, const uint8_t *src64); int ws_bootstrap_stack_info_get(protocol_interface_info_entry_t *cur, struct ws_stack_info *info_ptr); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_cfg_settings.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_cfg_settings.c index 32254b214b..d01601da20 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_cfg_settings.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_cfg_settings.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -467,10 +467,10 @@ static void ws_cfg_network_size_config_set_small(ws_cfg_nw_size_t *cfg) cfg->sec_prot.sec_prot_trickle_timer_exp = SEC_PROT_TIMER_EXPIRATIONS; cfg->sec_prot.sec_prot_retry_timeout = SEC_PROT_RETRY_TIMEOUT_SMALL; - cfg->sec_prot.initial_key_retry_delay = DEFAULT_INITIAL_KEY_RETRY_TIMER; - cfg->sec_prot.initial_key_imin = SMALL_NW_INITIAL_KEY_TRICKLE_IMIN_SECS; - cfg->sec_prot.initial_key_imax = SMALL_NW_INITIAL_KEY_TRICKLE_IMAX_SECS; - cfg->sec_prot.initial_key_retry_cnt = DEFAULT_INITIAL_KEY_RETRY_COUNT; + cfg->sec_prot.initial_key_retry_min = SMALL_NW_INITIAL_KEY_RETRY_MIN_SECS; + cfg->sec_prot.initial_key_retry_max = SMALL_NW_INITIAL_KEY_RETRY_MAX_SECS; + cfg->sec_prot.initial_key_retry_max_limit = SMALL_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS; + cfg->sec_prot.initial_key_retry_cnt = SMALL_NW_INITIAL_KEY_RETRY_COUNT; // Multicast timing configuration cfg->mpl.mpl_trickle_imin = MPL_SMALL_IMIN; @@ -510,10 +510,10 @@ static void ws_cfg_network_size_config_set_medium(ws_cfg_nw_size_t *cfg) cfg->sec_prot.sec_prot_trickle_timer_exp = SEC_PROT_TIMER_EXPIRATIONS; cfg->sec_prot.sec_prot_retry_timeout = SEC_PROT_RETRY_TIMEOUT_SMALL; - cfg->sec_prot.initial_key_retry_delay = DEFAULT_INITIAL_KEY_RETRY_TIMER; - cfg->sec_prot.initial_key_imin = MEDIUM_NW_INITIAL_KEY_TRICKLE_IMIN_SECS; - cfg->sec_prot.initial_key_imax = MEDIUM_NW_INITIAL_KEY_TRICKLE_IMAX_SECS; - cfg->sec_prot.initial_key_retry_cnt = DEFAULT_INITIAL_KEY_RETRY_COUNT; + cfg->sec_prot.initial_key_retry_min = MEDIUM_NW_INITIAL_KEY_RETRY_MIN_SECS; + cfg->sec_prot.initial_key_retry_max = MEDIUM_NW_INITIAL_KEY_RETRY_MAX_SECS; + cfg->sec_prot.initial_key_retry_max_limit = MEDIUM_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS; + cfg->sec_prot.initial_key_retry_cnt = MEDIUM_NW_INITIAL_KEY_RETRY_COUNT; // Multicast timing configuration cfg->mpl.mpl_trickle_imin = MPL_MEDIUM_IMIN; @@ -552,9 +552,9 @@ static void ws_cfg_network_size_config_set_large(ws_cfg_nw_size_t *cfg) cfg->sec_prot.sec_prot_trickle_timer_exp = SEC_PROT_TIMER_EXPIRATIONS; cfg->sec_prot.sec_prot_retry_timeout = SEC_PROT_RETRY_TIMEOUT_LARGE; - cfg->sec_prot.initial_key_retry_delay = NONE_INITIAL_KEY_RETRY_TIMER; - cfg->sec_prot.initial_key_imin = LARGE_NW_INITIAL_KEY_TRICKLE_IMIN_SECS; - cfg->sec_prot.initial_key_imax = LARGE_NW_INITIAL_KEY_TRICKLE_IMAX_SECS; + cfg->sec_prot.initial_key_retry_min = LARGE_NW_INITIAL_KEY_RETRY_MIN_SECS; + cfg->sec_prot.initial_key_retry_max = LARGE_NW_INITIAL_KEY_RETRY_MAX_SECS; + cfg->sec_prot.initial_key_retry_max_limit = LARGE_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS; cfg->sec_prot.initial_key_retry_cnt = LARGE_NW_INITIAL_KEY_RETRY_COUNT; // Multicast timing configuration @@ -595,9 +595,9 @@ static void ws_cfg_network_size_config_set_xlarge(ws_cfg_nw_size_t *cfg) cfg->sec_prot.sec_prot_trickle_timer_exp = SEC_PROT_TIMER_EXPIRATIONS; cfg->sec_prot.sec_prot_retry_timeout = SEC_PROT_RETRY_TIMEOUT_LARGE; - cfg->sec_prot.initial_key_retry_delay = NONE_INITIAL_KEY_RETRY_TIMER; - cfg->sec_prot.initial_key_imin = EXTRA_LARGE_NW_INITIAL_KEY_TRICKLE_IMIN_SECS; - cfg->sec_prot.initial_key_imax = EXTRA_LARGE_NW_INITIAL_KEY_TRICKLE_IMAX_SECS; + cfg->sec_prot.initial_key_retry_min = EXTRA_LARGE_NW_INITIAL_KEY_RETRY_MIN_SECS; + cfg->sec_prot.initial_key_retry_max = EXTRA_LARGE_NW_INITIAL_KEY_RETRY_MAX_SECS; + cfg->sec_prot.initial_key_retry_max_limit = EXTRA_LARGE_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS; cfg->sec_prot.initial_key_retry_cnt = EXTRA_LARGE_NW_INITIAL_KEY_RETRY_COUNT; // Multicast timing configuration @@ -637,10 +637,10 @@ static void ws_cfg_network_size_config_set_certificate(ws_cfg_nw_size_t *cfg) cfg->sec_prot.sec_prot_trickle_timer_exp = SEC_PROT_TIMER_EXPIRATIONS; cfg->sec_prot.sec_prot_retry_timeout = SEC_PROT_RETRY_TIMEOUT_SMALL; - cfg->sec_prot.initial_key_retry_delay = DEFAULT_INITIAL_KEY_RETRY_TIMER; - cfg->sec_prot.initial_key_imin = SMALL_NW_INITIAL_KEY_TRICKLE_IMIN_SECS; - cfg->sec_prot.initial_key_imax = SMALL_NW_INITIAL_KEY_TRICKLE_IMAX_SECS; - cfg->sec_prot.initial_key_retry_cnt = DEFAULT_INITIAL_KEY_RETRY_COUNT; + cfg->sec_prot.initial_key_retry_min = SMALL_NW_INITIAL_KEY_RETRY_MIN_SECS; + cfg->sec_prot.initial_key_retry_max = SMALL_NW_INITIAL_KEY_RETRY_MAX_SECS; + cfg->sec_prot.initial_key_retry_max_limit = SMALL_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS; + cfg->sec_prot.initial_key_retry_cnt = SMALL_NW_INITIAL_KEY_RETRY_COUNT; // Multicast timing configuration for certification uses the LARGE values as it is the one mentioned ins specification cfg->mpl.mpl_trickle_imin = MPL_XLARGE_IMIN; @@ -1237,14 +1237,14 @@ static int8_t ws_cfg_sec_prot_default_set(ws_sec_prot_cfg_t *cfg) { cfg->sec_prot_trickle_imin = SEC_PROT_SMALL_IMIN; cfg->sec_prot_trickle_imax = SEC_PROT_SMALL_IMAX; - cfg->sec_prot_trickle_timer_exp = 2; + cfg->sec_prot_trickle_timer_exp = SEC_PROT_TIMER_EXPIRATIONS; cfg->sec_prot_retry_timeout = SEC_PROT_RETRY_TIMEOUT_SMALL; cfg->max_simult_sec_neg_tx_queue_min = MAX_SIMULTANEOUS_SECURITY_NEGOTIATIONS_TX_QUEUE_MIN; cfg->max_simult_sec_neg_tx_queue_max = MAX_SIMULTANEOUS_SECURITY_NEGOTIATIONS_TX_QUEUE_MAX; - cfg->initial_key_retry_delay = DEFAULT_INITIAL_KEY_RETRY_TIMER; - cfg->initial_key_imin = MEDIUM_NW_INITIAL_KEY_TRICKLE_IMIN_SECS; - cfg->initial_key_imax = MEDIUM_NW_INITIAL_KEY_TRICKLE_IMAX_SECS; - cfg->initial_key_retry_cnt = DEFAULT_INITIAL_KEY_RETRY_COUNT; + cfg->initial_key_retry_min = MEDIUM_NW_INITIAL_KEY_RETRY_MIN_SECS; + cfg->initial_key_retry_max = MEDIUM_NW_INITIAL_KEY_RETRY_MAX_SECS; + cfg->initial_key_retry_max_limit = MEDIUM_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS; + cfg->initial_key_retry_cnt = MEDIUM_NW_INITIAL_KEY_RETRY_COUNT; return CFG_SETTINGS_OK; } @@ -1268,10 +1268,10 @@ int8_t ws_cfg_sec_prot_validate(ws_sec_prot_cfg_t *cfg, ws_sec_prot_cfg_t *new_c cfg->sec_prot_retry_timeout != new_cfg->sec_prot_retry_timeout || cfg->max_simult_sec_neg_tx_queue_min != new_cfg->max_simult_sec_neg_tx_queue_min || cfg->max_simult_sec_neg_tx_queue_max != new_cfg->max_simult_sec_neg_tx_queue_max || - cfg->initial_key_retry_delay != new_cfg->initial_key_retry_delay || - cfg->initial_key_imin != new_cfg->initial_key_retry_delay || - cfg->initial_key_imax != new_cfg->initial_key_retry_delay || - cfg->initial_key_retry_cnt != new_cfg->initial_key_retry_delay) { + cfg->initial_key_retry_min != new_cfg->initial_key_retry_min || + cfg->initial_key_retry_max != new_cfg->initial_key_retry_max || + cfg->initial_key_retry_max_limit != new_cfg->initial_key_retry_max_limit || + cfg->initial_key_retry_cnt != new_cfg->initial_key_retry_cnt) { return CFG_SETTINGS_CHANGED; } diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_cfg_settings.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_cfg_settings.h index 6b5dd98bce..827b45aeff 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_cfg_settings.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_cfg_settings.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -117,10 +117,10 @@ typedef struct ws_sec_prot_cfg_s { uint8_t sec_prot_trickle_timer_exp; /**< Security protocol trickle timer expirations; default 2 */ uint16_t max_simult_sec_neg_tx_queue_min; /**< PAE authenticator max simultaneous security negotiations TX queue minimum */ uint16_t max_simult_sec_neg_tx_queue_max; /**< PAE authenticator max simultaneous security negotiations TX queue maximum */ - uint16_t initial_key_retry_delay; /**< Delay before starting initial key trickle; seconds; default 120 */ - uint16_t initial_key_imin; /**< Initial key trickle Imin; seconds; default 360 */ - uint16_t initial_key_imax; /**< Initial key trickle Imax; seconds; default 720 */ - uint8_t initial_key_retry_cnt; /**< Number of initial key retries; default 2 */ + uint16_t initial_key_retry_min; /**< Initial EAPOL-Key retry exponential backoff min; seconds; default 180 */ + uint16_t initial_key_retry_max; /**< Initial EAPOL-Key retry exponential backoff max; seconds; default 420 */ + uint16_t initial_key_retry_max_limit; /**< Initial EAPOL-Key retry exponential backoff max limit; seconds; default 720 */ + uint8_t initial_key_retry_cnt; /**< Number of initial key retries; default 4 */ } ws_sec_prot_cfg_t; /** diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_common.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_common.c index 4a77f37bab..42a9ceb764 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_common.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_common.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -75,13 +75,6 @@ int8_t ws_generate_channel_list(uint32_t *channel_mask, uint16_t number_of_chann channel_mask[0 + (i / 32)] |= (1 << (i % 32)); } // Disable unsupported channels per regional frequency bands - if (regulatory_domain == REG_DOMAIN_NA) { - if (channel_plan_id == 1) { - ws_disable_channels_in_range(channel_mask, number_of_channels, 1, 7); - } else if (channel_plan_id == 5) { - ws_disable_channels_in_range(channel_mask, number_of_channels, 5, 7); - } - } if (regulatory_domain == REG_DOMAIN_BZ) { if (channel_plan_id == 255) { if (operating_class == 1) { @@ -93,17 +86,11 @@ int8_t ws_generate_channel_list(uint32_t *channel_mask, uint16_t number_of_chann } } else { if (channel_plan_id == 1) { - ws_disable_channels_in_range(channel_mask, number_of_channels, 1, 7); - ws_disable_channels_in_range(channel_mask, number_of_channels, 64, 64); - ws_disable_channels_in_range(channel_mask, number_of_channels, 72, 103); - ws_disable_channels_in_range(channel_mask, number_of_channels, 106, 111); + ws_disable_channels_in_range(channel_mask, number_of_channels, 26, 64); } else if (channel_plan_id == 2) { - ws_disable_channels_in_range(channel_mask, number_of_channels, 24, 24); - ws_disable_channels_in_range(channel_mask, number_of_channels, 32, 47); - ws_disable_channels_in_range(channel_mask, number_of_channels, 52, 55); + ws_disable_channels_in_range(channel_mask, number_of_channels, 12, 32); } else if (channel_plan_id == 5) { - ws_disable_channels_in_range(channel_mask, number_of_channels, 5, 10); - ws_disable_channels_in_range(channel_mask, number_of_channels, 19, 23); + ws_disable_channels_in_range(channel_mask, number_of_channels, 3, 10); } } } @@ -424,11 +411,11 @@ uint16_t ws_common_channel_number_calc(uint8_t regulatory_domain, uint8_t operat } } else { if (channel_plan_id == 1) { - return 136; + return 129; } else if (channel_plan_id == 2) { return 64; } else if (channel_plan_id == 5) { - return 24; + return 21; } } } else if (regulatory_domain == REG_DOMAIN_JP) { @@ -450,11 +437,11 @@ uint16_t ws_common_channel_number_calc(uint8_t regulatory_domain, uint8_t operat } } else { if (channel_plan_id == 1) { - return 136; + return 129; } else if (channel_plan_id == 2) { return 64; } else if (channel_plan_id == 5) { - return 24; + return 21; } } } else if (regulatory_domain == REG_DOMAIN_WW) { diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_common.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_common.h index 2dda3beac8..40fbd0a16d 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_common.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -47,9 +47,10 @@ typedef struct parent_info_s { ws_pan_information_t pan_information; ws_utt_ie_t ws_utt; ws_us_ie_t ws_us; - uint32_t timestamp; /**< Timestamp when packet was received */ - uint32_t age; /**< Age of entry in 100ms ticks */ - uint8_t excluded_channel_data[32]; //Channel mask Max length and it accept 8 different range + uint32_t timestamp; /**< Timestamp when packet was received */ + uint32_t age; /**< Age of entry in 100ms ticks */ + uint8_t excluded_channel_data[32]; /**< Channel mask Max length and it accept 8 different range*/ + bool link_acceptable: 1; /**< True when Link quality is in acceptable level*/ ns_list_link_t link; } parent_info_t; @@ -88,7 +89,6 @@ typedef struct ws_info_s { trickle_params_t trickle_params_pan_discovery; uint8_t rpl_state; // state from rpl_event_t uint8_t pas_requests; // Amount of PAN solicits sent - uint8_t eapol_tx_index; uint8_t device_min_sens; // Device min sensitivity set by the application int8_t weakest_received_rssi; // Weakest received signal (dBm) parent_info_t parent_info[WS_PARENT_LIST_SIZE]; diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_common_defines.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_common_defines.h index 1657d9ee6b..8ea6ab3f06 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_common_defines.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_common_defines.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_config.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_config.h index fb2e23ca27..49723f009b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_config.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -173,6 +173,7 @@ extern uint8_t DEVICE_MIN_SENS; #define WS_DHCP_SOLICIT_TIMEOUT 60 #define WS_DHCP_SOLICIT_MAX_RT 900 #define WS_DHCP_SOLICIT_MAX_RC 0 +#define WS_DHCP_SOLICIT_MAX_DELAY 5 /* Neighbour table configuration @@ -241,17 +242,19 @@ extern uint8_t DEVICE_MIN_SENS; #define WISUN_1_0_ERRATA_FIX /* - * Security protocol message retry configuration parameters + * Security protocol message retry configuration parameters + * + * Trickle is reset on start (inconsistent heard is set) */ -#define SEC_PROT_SMALL_IMIN 30 // Retries done in 30 seconds -#define SEC_PROT_SMALL_IMAX 90 // Largest value 90 seconds -#define SEC_PROT_RETRY_TIMEOUT_SMALL 330 // Retry timeout for small network additional 30 seconds for authenticator delay +#define SEC_PROT_SMALL_IMIN 60 // Retries done in 60 seconds +#define SEC_PROT_SMALL_IMAX 120 // Largest value 120 seconds +#define SEC_PROT_RETRY_TIMEOUT_SMALL 450 // Retry timeout for small network additional 30 seconds for authenticator delay #define SEC_PROT_LARGE_IMIN 60 // Retries done in 60 seconds #define SEC_PROT_LARGE_IMAX 240 // Largest value 240 seconds #define SEC_PROT_RETRY_TIMEOUT_LARGE 750 // Retry timeout for large network additional 30 seconds for authenticator delay -#define SEC_PROT_TIMER_EXPIRATIONS 2 // Number of retries +#define SEC_PROT_TIMER_EXPIRATIONS 4 // Number of retries // Maximum number of simultaneous security negotiations #define MAX_SIMULTANEOUS_SECURITY_NEGOTIATIONS_TX_QUEUE_MIN 64 @@ -273,32 +276,51 @@ extern uint8_t DEVICE_MIN_SENS; /* * Security protocol initial EAPOL-key parameters + * + * Retry time is randomized between minimum and maximum retry time: rand(min,max). + * For each subsequent retry the maximum retry time is doubled until the maximum + * limit is reached. */ -// How long the wait is before the first initial EAPOL-key retry -#define DEFAULT_INITIAL_KEY_RETRY_TIMER 120 -#define NONE_INITIAL_KEY_RETRY_TIMER 0 +/* Small network initial EAPOL-key retry exponential backoff parameters + * 1st backoff 3 to 7 minutes, max 7 minutes, retries 2 + * Minimum time for sequence is 3 + 3 = 6 minutes + * Maximum time for sequence is 7 + 7 = 14 minutes + */ +#define SMALL_NW_INITIAL_KEY_RETRY_MIN_SECS 180 // 3 +#define SMALL_NW_INITIAL_KEY_RETRY_MAX_SECS 420 // 7 +#define SMALL_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS 420 // 7 +#define SMALL_NW_INITIAL_KEY_RETRY_COUNT 2 -// Small network Default trickle values for sending of initial EAPOL-key -#define SMALL_NW_INITIAL_KEY_TRICKLE_IMIN_SECS 360 /* 6 to 8.3 minutes */ -#define SMALL_NW_INITIAL_KEY_TRICKLE_IMAX_SECS 500 +/* Medium network initial EAPOL-key retry exponential backoff parameters + * 1st backoff 3 to 7 minutes, max 12 minutes, retries 4 + * Minimum time for sequence is 3 + 3 + 3 + 3 = 12 minutes + * Maximum time for sequence is 7 + 12 + 12 + 12 = 43 minutes + */ +#define MEDIUM_NW_INITIAL_KEY_RETRY_MIN_SECS 180 // 3 +#define MEDIUM_NW_INITIAL_KEY_RETRY_MAX_SECS 420 // 7 +#define MEDIUM_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS 720 // 12 +#define MEDIUM_NW_INITIAL_KEY_RETRY_COUNT 4 -// Small network Default trickle values for sending of initial EAPOL-key -#define MEDIUM_NW_INITIAL_KEY_TRICKLE_IMIN_SECS 360 /* 6 to 12 minutes */ -#define MEDIUM_NW_INITIAL_KEY_TRICKLE_IMAX_SECS 720 +/* Large network initial EAPOL-key retry exponential backoff parameters + * 1st backoff 5 to 10 minutes, max 15 minutes, retries 4 + * Minimum time for sequence is 5 + 5 + 5 + 5 = 20 minutes + * Maximum time for sequence is 10 + 15 + 15 + 15 = 55 minutes + */ +#define LARGE_NW_INITIAL_KEY_RETRY_MIN_SECS 300 // 5 +#define LARGE_NW_INITIAL_KEY_RETRY_MAX_SECS 600 // 10 +#define LARGE_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS 900 // 15 +#define LARGE_NW_INITIAL_KEY_RETRY_COUNT 4 -// Large network trickle values for sending of initial EAPOL-key -#define LARGE_NW_INITIAL_KEY_TRICKLE_IMIN_SECS 600 /* 10 to 20 minutes */ -#define LARGE_NW_INITIAL_KEY_TRICKLE_IMAX_SECS 1200 -#define LARGE_NW_INITIAL_KEY_RETRY_COUNT 3 - -// Very slow network values for sending of initial EAPOL-key -#define EXTRA_LARGE_NW_INITIAL_KEY_TRICKLE_IMIN_SECS 600 /* 10 to 20 minutes */ -#define EXTRA_LARGE_NW_INITIAL_KEY_TRICKLE_IMAX_SECS 1200 -#define EXTRA_LARGE_NW_INITIAL_KEY_RETRY_COUNT 4 - -// How many times sending of initial EAPOL-key is retried -#define DEFAULT_INITIAL_KEY_RETRY_COUNT 2 +/* Extra large network initial EAPOL-key retry exponential backoff parameters + * 1st backoff 5 to 10 minutes, max 20 minutes, retries 4 + * Minimum time for sequence is 5 + 5 + 5 + 5 = 20 minutes + * Maximum time for sequence is 10 + 20 + 20 + 20 = 70 minutes + */ +#define EXTRA_LARGE_NW_INITIAL_KEY_RETRY_MIN_SECS 300 // 5 +#define EXTRA_LARGE_NW_INITIAL_KEY_RETRY_MAX_SECS 600 // 10 +#define EXTRA_LARGE_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS 1200 // 20 +#define EXTRA_LARGE_NW_INITIAL_KEY_RETRY_COUNT 4 /* * RADIUS client retry timer defaults diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_auth_relay.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_auth_relay.c index 76f6221a74..f3ef62c969 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_auth_relay.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_auth_relay.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -165,6 +165,13 @@ static void ws_eapol_auth_relay_socket_cb(void *cb) eui_64 = ptr; ptr += 8; uint16_t data_len = cb_data->d_len - 26; + /* If EAPOL PDU data length is zero (message contains only supplicant EUI-64 and KMP ID) + * i.e. is purge message and is not going to authenticator local relay then ignores message + */ + if (data_len == 1 && !addr_ipv6_equal(relay_ip_addr.address, eapol_auth_relay->relay_addr.address)) { + ns_dyn_mem_free(socket_pdu); + return; + } ws_eapol_relay_lib_send_to_relay(eapol_auth_relay->socket_id, eui_64, &relay_ip_addr, ptr, data_len); ns_dyn_mem_free(socket_pdu); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_auth_relay.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_auth_relay.h index d0a7aa6c09..6f517500ce 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_auth_relay.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_auth_relay.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_pdu.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_pdu.c index e5c2f64c84..6ca3287e26 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_pdu.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_pdu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_pdu.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_pdu.h index 5c5320c0a8..48a4cfe50a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_pdu.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_pdu.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_relay.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_relay.c index 2c2a6a3b93..e1cfbf8d08 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_relay.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_relay.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_relay.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_relay.h index dbbfbc584a..94a8f44c56 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_relay.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_relay.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_relay_lib.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_relay_lib.c index 4352d77149..17fb0e221a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_relay_lib.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_relay_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_relay_lib.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_relay_lib.h index b1c387951a..36ff5584ae 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_relay_lib.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_eapol_relay_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_empty_functions.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_empty_functions.c index 3f6279685d..f7e14fdb79 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_empty_functions.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_empty_functions.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -440,11 +440,6 @@ int ws_statistics_stop(int8_t interface_id) return -1; } -void ns_time_api_system_time_callback_set(ns_time_api_system_time_callback callback) -{ - (void) callback; -} - int ws_stack_info_get(int8_t interface_id, ws_stack_info_t *info_ptr) { (void) interface_id; diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_ie_lib.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_ie_lib.c index 633b01c60e..5edd436dbc 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_ie_lib.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_ie_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_ie_lib.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_ie_lib.h index 3be8bff8b5..3198763c07 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_ie_lib.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_ie_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_llc.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_llc.h index e7df162ae4..9e905b7bbc 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_llc.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_llc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -232,6 +232,10 @@ bool ws_llc_eapol_relay_forward_filter(struct protocol_interface_info_entry *int ws_neighbor_temp_class_t *ws_llc_get_multicast_temp_entry(struct protocol_interface_info_entry *interface, const uint8_t *mac64); +ws_neighbor_temp_class_t *ws_llc_get_eapol_temp_entry(struct protocol_interface_info_entry *interface, const uint8_t *mac64); + + + void ws_llc_free_multicast_temp_entry(struct protocol_interface_info_entry *interface, ws_neighbor_temp_class_t *neighbor); #endif /* WS_LLC_H_ */ diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_llc_data_service.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_llc_data_service.c index c83f9b89b1..35e87582e7 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_llc_data_service.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_llc_data_service.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -102,9 +102,24 @@ typedef struct { typedef NS_LIST_HEAD(llc_message_t, link) llc_message_list_t; #define MAX_NEIGH_TEMPORARY_MULTICAST_SIZE 5 -#define MAX_NEIGH_TEMPORRY_EAPOL_SIZE 20 +#define MAX_NEIGH_TEMPORRY_EAPOL_SIZE 5 #define MAX_NEIGH_TEMPORAY_LIST_SIZE (MAX_NEIGH_TEMPORARY_MULTICAST_SIZE + MAX_NEIGH_TEMPORRY_EAPOL_SIZE) +#define WS_LLC_EAPOL_DYNAMIC_ALLOCATE_MIN 10 +#define WS_LLC_EAPOL_DYNAMIC_ALLOCATE_MAX 100 +#define WS_LLC_EAPOL_DYNAMIC_HEAP_PERCENT 7 +/** + * 7 % from total heap take about + * + * How to max entry is defined: (Total heap / 100 * 7) / size of temporary entry + * + * 32 kBytes define 14 entry + * 64 kBytes define 29 entry + * 128 kBytes define 58 entry + * + */ + + typedef struct { ws_neighbor_temp_class_t neighbour_temporary_table[MAX_NEIGH_TEMPORAY_LIST_SIZE]; ws_neighbor_temp_list_t active_multicast_temp_neigh; @@ -112,6 +127,7 @@ typedef struct { ws_neighbor_temp_list_t free_temp_neigh; llc_message_list_t llc_eap_pending_list; /**< Active Message list */ uint16_t llc_eap_pending_list_size; /**< EAPOL active Message list size */ + uint16_t dynamic_alloc_max; /**< How big EAPOL temp entry list can be extend */ bool active_eapol_session: 1; /**< Indicating active EAPOL message */ } temp_entriest_t; @@ -171,9 +187,11 @@ static void ws_llc_mpx_init(mpx_class_t *mpx_class); static void ws_llc_temp_neigh_info_table_reset(temp_entriest_t *base); static ws_neighbor_temp_class_t *ws_allocate_multicast_temp_entry(temp_entriest_t *base, const uint8_t *mac64); -static ws_neighbor_temp_class_t *ws_llc_discover_eapol_temp_entry(temp_entriest_t *base, const uint8_t *mac64); -static void ws_llc_release_eapol_temp_entry(temp_entriest_t *base, const uint8_t *mac64); static ws_neighbor_temp_class_t *ws_allocate_eapol_temp_entry(temp_entriest_t *base, const uint8_t *mac64); +static void ws_llc_temp_entry_free(temp_entriest_t *base, ws_neighbor_temp_class_t *entry); +static ws_neighbor_temp_class_t *ws_llc_discover_temp_entry(ws_neighbor_temp_list_t *list, const uint8_t *mac64); +static void ws_llc_release_eapol_temp_entry(temp_entriest_t *base, const uint8_t *mac64); + static void ws_llc_mpx_eapol_send(llc_data_base_t *base, llc_message_t *message); @@ -432,6 +450,11 @@ static llc_data_base_t *ws_llc_base_allocate(void) ns_list_init(&temp_entries->active_eapol_temp_neigh); ns_list_init(&temp_entries->free_temp_neigh); ns_list_init(&temp_entries->llc_eap_pending_list); + + //Add to free list to full from static + for (int i = 0; i < MAX_NEIGH_TEMPORAY_LIST_SIZE; i++) { + ns_list_add_to_end(&temp_entries->free_temp_neigh, &temp_entries->neighbour_temporary_table[i]); + } base->temp_entries = temp_entries; ns_list_init(&base->llc_message_list); @@ -440,6 +463,15 @@ static llc_data_base_t *ws_llc_base_allocate(void) return base; } +static void ws_llc_mac_eapol_clear(llc_data_base_t *base) +{ + //Clear active EAPOL Session + if (base->temp_entries->active_eapol_session) { + base->temp_entries->active_eapol_session = false; + } +} + + /** WS LLC MAC data extension confirmation */ static void ws_llc_mac_confirm_cb(const mac_api_t *api, const mcps_data_conf_t *data, const mcps_data_conf_payload_t *conf_data) { @@ -458,12 +490,10 @@ static void ws_llc_mac_confirm_cb(const mac_api_t *api, const mcps_data_conf_t * uint8_t messsage_type = message->messsage_type; uint8_t mpx_user_handle = message->mpx_user_handle; if (message->eapol_temporary) { - //Clear - ws_bootstrap_eapol_tx_temporary_clear(interface); if (data->status == MLME_SUCCESS || data->status == MLME_NO_DATA) { //Update timeout - ws_neighbor_temp_class_t *temp_entry = ws_llc_discover_eapol_temp_entry(base->temp_entries, message->dst_address); + ws_neighbor_temp_class_t *temp_entry = ws_llc_discover_temp_entry(&base->temp_entries->active_eapol_temp_neigh, message->dst_address); if (temp_entry) { //Update Temporary Lifetime temp_entry->eapol_temp_info.eapol_timeout = interface->ws_info->cfg->timing.temp_eapol_min_timeout + 1; @@ -490,8 +520,11 @@ static void ws_llc_mac_confirm_cb(const mac_api_t *api, const mcps_data_conf_t * } if (neighbor_info.ws_neighbor && neighbor_info.neighbor && neighbor_info.neighbor->link_lifetime == WS_NEIGHBOR_LINK_TIMEOUT) { - etx_transm_attempts_update(interface->id, 1 + data->tx_retries, success, neighbor_info.neighbor->index, neighbor_info.neighbor->mac64); - //TODO discover RSL from Enchanced ACK Header IE elements + + if (!base->high_priority_mode) { + //Update ETX only when High priority state is not activated + etx_transm_attempts_update(interface->id, 1 + data->tx_retries, success, neighbor_info.neighbor->index, neighbor_info.neighbor->mac64); + } ws_utt_ie_t ws_utt; if (ws_wh_utt_read(conf_data->headerIeList, conf_data->headerIeListLength, &ws_utt)) { //UTT header @@ -1110,24 +1143,6 @@ static void ws_llc_lowpan_mpx_data_request(llc_data_base_t *base, mpx_user_t *us base->interface_ptr->mac_api->mcps_data_req_ext(base->interface_ptr->mac_api, &data_req, &message->ie_ext, NULL, message->priority); } -static bool ws_llc_eapol_temp_entry_set(llc_data_base_t *base, const uint8_t *mac64) -{ - //Discover Temporary entry - ws_neighbor_temp_class_t *temp_neigh = ws_llc_discover_eapol_temp_entry(base->temp_entries, mac64); - - if (!temp_neigh) { - return false; - } - ws_neighbor_class_entry_t *entry = ws_bootstrap_eapol_tx_temporary_set(base->interface_ptr, mac64); - if (!entry) { - return false; - } - *entry = temp_neigh->neigh_info_list; - return true; - -} - - static void ws_llc_eapol_data_req_init(mcps_data_req_t *data_req, llc_message_t *message) { memset(data_req, 0, sizeof(mcps_data_req_t)); @@ -1155,11 +1170,21 @@ static void ws_llc_eapol_data_req_init(mcps_data_req_t *data_req, llc_message_t static void ws_llc_mpx_eapol_send(llc_data_base_t *base, llc_message_t *message) { mcps_data_req_t data_req; + + //Discover Temporary entry + ws_neighbor_temp_class_t *temp_neigh = ws_llc_discover_temp_entry(&base->temp_entries->active_eapol_temp_neigh, message->dst_address); + + if (temp_neigh) { + message->eapol_temporary = true; + } else { + message->eapol_temporary = false; + } + + //Allocate message ID llc_message_id_allocate(message, base, true); base->llc_message_list_size++; random_early_detetction_aq_calc(base->interface_ptr->llc_random_early_detection, base->llc_message_list_size); ns_list_add_to_end(&base->llc_message_list, message); - message->eapol_temporary = ws_llc_eapol_temp_entry_set(base, message->dst_address); ws_llc_eapol_data_req_init(&data_req, message); base->temp_entries->active_eapol_session = true; base->interface_ptr->mac_api->mcps_data_req_ext(base->interface_ptr->mac_api, &data_req, &message->ie_ext, NULL, message->priority); @@ -1342,6 +1367,9 @@ static uint8_t ws_llc_mpx_data_purge_request(const mpx_api_t *api, struct mcps_p purge_req.msduHandle = message->msg_handle; purge_status = base->interface_ptr->mac_api->mcps_purge_req(base->interface_ptr->mac_api, &purge_req); if (purge_status == 0) { + if (message->messsage_type == WS_FT_EAPOL) { + ws_llc_mac_eapol_clear(base); + } llc_message_free(message, base); } @@ -1376,6 +1404,9 @@ static void ws_llc_clean(llc_data_base_t *base) mcps_purge_t purge_req; ns_list_foreach_safe(llc_message_t, message, &base->llc_message_list) { purge_req.msduHandle = message->msg_handle; + if (message->messsage_type == WS_FT_EAPOL) { + ws_llc_mac_eapol_clear(base); + } llc_message_free(message, base); base->interface_ptr->mac_api->mcps_purge_req(base->interface_ptr->mac_api, &purge_req); @@ -1394,32 +1425,34 @@ static void ws_llc_clean(llc_data_base_t *base) base->high_priority_mode = false; } +static void ws_llc_temp_entry_free(temp_entriest_t *base, ws_neighbor_temp_class_t *entry) +{ + //Pointer is static add to free list + if (entry >= &base->neighbour_temporary_table[0] && entry <= &base->neighbour_temporary_table[MAX_NEIGH_TEMPORAY_LIST_SIZE - 1]) { + ns_list_add_to_end(&base->free_temp_neigh, entry); + } else { + ns_dyn_mem_free(entry); + } +} + + static void ws_llc_temp_neigh_info_table_reset(temp_entriest_t *base) { - //Empty active list - ns_list_init(&base->active_multicast_temp_neigh); - ns_list_init(&base->active_eapol_temp_neigh); - ns_list_init(&base->free_temp_neigh); + //Empty active list eapol list + ns_list_foreach_safe(ws_neighbor_temp_class_t, entry, &base->active_eapol_temp_neigh) { + ns_list_remove(&base->active_eapol_temp_neigh, entry); + ws_llc_temp_entry_free(base, entry); + } - //Add to free list to full - for (int i = 0; i < MAX_NEIGH_TEMPORAY_LIST_SIZE; i++) { - ns_list_add_to_end(&base->free_temp_neigh, &base->neighbour_temporary_table[i]); + ns_list_foreach_safe(ws_neighbor_temp_class_t, entry, &base->active_multicast_temp_neigh) { + ns_list_remove(&base->active_multicast_temp_neigh, entry); + ws_llc_temp_entry_free(base, entry); } } -static ws_neighbor_temp_class_t *ws_llc_discover_mc_temp_entry(temp_entriest_t *base, const uint8_t *mac64) +static ws_neighbor_temp_class_t *ws_llc_discover_temp_entry(ws_neighbor_temp_list_t *list, const uint8_t *mac64) { - ns_list_foreach(ws_neighbor_temp_class_t, entry, &base->active_multicast_temp_neigh) { - if (memcmp(entry->mac64, mac64, 8) == 0) { - return entry; - } - } - return NULL; -} - -static ws_neighbor_temp_class_t *ws_llc_discover_eapol_temp_entry(temp_entriest_t *base, const uint8_t *mac64) -{ - ns_list_foreach(ws_neighbor_temp_class_t, entry, &base->active_eapol_temp_neigh) { + ns_list_foreach(ws_neighbor_temp_class_t, entry, list) { if (memcmp(entry->mac64, mac64, 8) == 0) { return entry; } @@ -1429,13 +1462,14 @@ static ws_neighbor_temp_class_t *ws_llc_discover_eapol_temp_entry(temp_entriest_ static void ws_llc_release_eapol_temp_entry(temp_entriest_t *base, const uint8_t *mac64) { - ws_neighbor_temp_class_t *neighbor = ws_llc_discover_eapol_temp_entry(base, mac64); + ws_neighbor_temp_class_t *neighbor = ws_llc_discover_temp_entry(&base->active_eapol_temp_neigh, mac64); if (!neighbor) { return; } ns_list_remove(&base->active_eapol_temp_neigh, neighbor); - ns_list_add_to_end(&base->free_temp_neigh, neighbor); + ws_llc_temp_entry_free(base, neighbor); + } ws_neighbor_temp_class_t *ws_llc_get_multicast_temp_entry(protocol_interface_info_entry_t *interface, const uint8_t *mac64) @@ -1445,7 +1479,17 @@ ws_neighbor_temp_class_t *ws_llc_get_multicast_temp_entry(protocol_interface_inf return NULL; } - return ws_llc_discover_mc_temp_entry(base->temp_entries, mac64); + return ws_llc_discover_temp_entry(&base->temp_entries->active_multicast_temp_neigh, mac64); +} + +ws_neighbor_temp_class_t *ws_llc_get_eapol_temp_entry(struct protocol_interface_info_entry *interface, const uint8_t *mac64) +{ + llc_data_base_t *base = ws_llc_discover_by_interface(interface); + if (!base) { + return NULL; + } + + return ws_llc_discover_temp_entry(&base->temp_entries->active_eapol_temp_neigh, mac64); } @@ -1464,7 +1508,7 @@ static void ws_init_temporary_neigh_data(ws_neighbor_temp_class_t *entry, const static ws_neighbor_temp_class_t *ws_allocate_multicast_temp_entry(temp_entriest_t *base, const uint8_t *mac64) { - ws_neighbor_temp_class_t *entry = ws_llc_discover_mc_temp_entry(base, mac64); + ws_neighbor_temp_class_t *entry = ws_llc_discover_temp_entry(&base->active_multicast_temp_neigh, mac64); if (entry) { ns_list_remove(&base->active_multicast_temp_neigh, entry); ns_list_add_to_start(&base->active_multicast_temp_neigh, entry); @@ -1492,25 +1536,30 @@ static ws_neighbor_temp_class_t *ws_allocate_multicast_temp_entry(temp_entriest_ static ws_neighbor_temp_class_t *ws_allocate_eapol_temp_entry(temp_entriest_t *base, const uint8_t *mac64) { - ws_neighbor_temp_class_t *entry = ws_llc_discover_eapol_temp_entry(base, mac64); + ws_neighbor_temp_class_t *entry = ws_llc_discover_temp_entry(&base->active_eapol_temp_neigh, mac64); if (entry) { //TODO referesh Timer here return entry; } - if (ns_list_count(&base->active_eapol_temp_neigh) < MAX_NEIGH_TEMPORRY_EAPOL_SIZE) { + //Take static if there is still space for multicast + if (ns_list_count(&base->free_temp_neigh) > (MAX_NEIGH_TEMPORARY_MULTICAST_SIZE - ns_list_count(&base->active_multicast_temp_neigh))) { entry = ns_list_get_first(&base->free_temp_neigh); + ns_list_remove(&base->free_temp_neigh, entry); + } else { + //Allocate Dynamic entry + //validate Can we allocate more + if (ns_list_count(&base->active_eapol_temp_neigh) < base->dynamic_alloc_max) { + entry = ns_dyn_mem_temporary_alloc(sizeof(ws_neighbor_temp_class_t)); + } } - if (!entry) { - return NULL; - } - - ns_list_remove(&base->free_temp_neigh, entry); //Add to list - ns_list_add_to_start(&base->active_eapol_temp_neigh, entry); - //Clear Old data - ws_init_temporary_neigh_data(entry, mac64); + if (entry) { + ns_list_add_to_start(&base->active_eapol_temp_neigh, entry); + //Clear Old data + ws_init_temporary_neigh_data(entry, mac64); + } return entry; } @@ -1622,12 +1671,40 @@ static void ws_llc_mcps_edfe_handler(const mac_api_t *api, mcps_edfe_response_t } +static uint16_t ws_llc_calculate_dynamic_entries_max(uint16_t min_entry, uint16_t max_entry, uint8_t dynamic_heap_percent) +{ + const mem_stat_t *mem_stats = ns_dyn_mem_get_mem_stat(); + if (!mem_stats) { + return min_entry; + } + + uint32_t total_heap_size = mem_stats->heap_sector_size; + total_heap_size = (total_heap_size / 100) * dynamic_heap_percent; + + uint16_t sizeof_entry = sizeof(ws_neighbor_temp_class_t) + 2 * sizeof(int); + + if (total_heap_size > (sizeof_entry * max_entry)) { + //Use given MAX entry size + return max_entry; + } + + if (total_heap_size < (sizeof_entry * min_entry)) { + //Use given Min entry size + return min_entry; + } + + uint16_t max_entry_possible = (uint16_t)total_heap_size / sizeof_entry; + tr_debug("Dynamic EAPOL entry max %d", max_entry_possible); + return max_entry_possible; +} + int8_t ws_llc_create(struct protocol_interface_info_entry *interface, ws_asynch_ind *asynch_ind_cb, ws_asynch_confirm *asynch_cnf_cb, ws_neighbor_info_request *ws_neighbor_info_request_cb) { llc_data_base_t *base = ws_llc_discover_by_interface(interface); if (base) { ws_llc_clean(base); + base->temp_entries->dynamic_alloc_max = ws_llc_calculate_dynamic_entries_max(WS_LLC_EAPOL_DYNAMIC_ALLOCATE_MIN, WS_LLC_EAPOL_DYNAMIC_ALLOCATE_MAX, WS_LLC_EAPOL_DYNAMIC_HEAP_PERCENT); return 0; } @@ -1647,6 +1724,7 @@ int8_t ws_llc_create(struct protocol_interface_info_entry *interface, ws_asynch_ //Init MPX class ws_llc_mpx_init(&base->mpx_data_base); ws_llc_temp_neigh_info_table_reset(base->temp_entries); + base->temp_entries->dynamic_alloc_max = ws_llc_calculate_dynamic_entries_max(WS_LLC_EAPOL_DYNAMIC_ALLOCATE_MIN, WS_LLC_EAPOL_DYNAMIC_ALLOCATE_MAX, WS_LLC_EAPOL_DYNAMIC_HEAP_PERCENT); return 0; } @@ -1948,7 +2026,7 @@ bool ws_llc_eapol_relay_forward_filter(struct protocol_interface_info_entry *int return false; } - ws_neighbor_temp_class_t *neighbor = ws_llc_discover_eapol_temp_entry(base->temp_entries, joiner_eui64); + ws_neighbor_temp_class_t *neighbor = ws_llc_discover_temp_entry(&base->temp_entries->active_eapol_temp_neigh, joiner_eui64); if (!neighbor) { llc_neighbour_req_t neighbor_info; //Discover here Normal Neighbour diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_management_api.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_management_api.c index d1bb845d8e..61c9e4b6e5 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_management_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_management_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_mpx_header.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_mpx_header.c index 6d0ad5ae56..14a805c207 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_mpx_header.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_mpx_header.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_mpx_header.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_mpx_header.h index 2e64b0571b..ee1d48d669 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_mpx_header.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_mpx_header.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_neighbor_class.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_neighbor_class.c index ab24bf0ed8..20d29cbc4d 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_neighbor_class.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_neighbor_class.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_neighbor_class.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_neighbor_class.h index 516196abdf..1bb82adb28 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_neighbor_class.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_neighbor_class.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_auth.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_auth.c index 452f3c5015..da2c3cf104 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_auth.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_auth.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -44,6 +44,7 @@ #include "Security/protocols/fwh_sec_prot/auth_fwh_sec_prot.h" #include "Security/protocols/gkh_sec_prot/auth_gkh_sec_prot.h" #include "Security/protocols/radius_sec_prot/radius_client_sec_prot.h" +#include "Security/protocols/msg_sec_prot/msg_sec_prot.h" #include "6LoWPAN/ws/ws_cfg_settings.h" #include "6LoWPAN/ws/ws_pae_controller.h" #include "6LoWPAN/ws/ws_pae_timers.h" @@ -237,6 +238,10 @@ int8_t ws_pae_auth_init(protocol_interface_info_entry_t *interface_ptr, sec_prot goto error; } + if (msg_sec_prot_register(pae_auth->kmp_service) < 0) { + goto error; + } + if (tasklet_id < 0) { tasklet_id = eventOS_event_handler_create(ws_pae_auth_tasklet_handler, PAE_TASKLET_INIT); if (tasklet_id < 0) { @@ -964,10 +969,20 @@ static supp_entry_t *ws_pae_auth_waiting_supp_list_add(pae_auth_t *pae_auth, sup ns_list_add_to_start(&pae_auth->waiting_supp_list, supp_entry); pae_auth->waiting_supp_list_size++; } else { - // Create a new supplicant entry if not at limit - if (pae_auth->waiting_supp_list_size > WAITING_SUPPLICANT_LIST_MAX_SIZE) { - tr_info("PAE: waiting list full, eui-64: %s", trace_array(addr->eui_64, 8)); - return NULL; + // If the waiting list if full removes the oldest entry from the list + if (pae_auth->waiting_supp_list_size >= WAITING_SUPPLICANT_LIST_MAX_SIZE) { + supp_entry_t *delete_supp = ns_list_get_last(&pae_auth->waiting_supp_list); + if (!delete_supp) { + return NULL; + } + tr_info("PAE: waiting list full, eui-64: %s, deleted eui-64: %s", trace_array(addr->eui_64, 8), trace_array(delete_supp->addr.eui_64, 8)); + // Create new instance + kmp_api_t *new_kmp = ws_pae_auth_kmp_create_and_start(pae_auth->kmp_service, MSG_PROT, pae_auth->relay_socked_msg_if_instance_id, delete_supp, pae_auth->sec_cfg); + if (!new_kmp) { + return NULL; + } + kmp_api_create_request(new_kmp, MSG_PROT, &delete_supp->addr, &delete_supp->sec_keys); + (void) ws_pae_lib_supp_list_remove(pae_auth, &pae_auth->waiting_supp_list, delete_supp, ws_pae_auth_waiting_supp_deleted); } supp_entry = ws_pae_lib_supp_list_add(&pae_auth->waiting_supp_list, addr); if (!supp_entry) { @@ -981,7 +996,7 @@ static supp_entry_t *ws_pae_auth_waiting_supp_list_add(pae_auth_t *pae_auth, sup // 90 percent of the EAPOL temporary entry lifetime (10 ticks per second) supp_entry->waiting_ticks = pae_auth->sec_cfg->timing_cfg.temp_eapol_min_timeout * 900 / 100; - tr_debug("PAE: to waiting, list size %i, retry %i, eui-64: %s", pae_auth->waiting_supp_list_size, supp_entry->waiting_ticks, trace_array(supp_entry->addr.eui_64, 8)); + tr_info("PAE: to waiting, list size %i, retry %i, eui-64: %s", pae_auth->waiting_supp_list_size, supp_entry->waiting_ticks, trace_array(supp_entry->addr.eui_64, 8)); return supp_entry; } diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_auth.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_auth.h index 506ee4ee7b..4b6dd07432 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_auth.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_auth.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_controller.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_controller.c index 0f299ce55d..805cb07d8b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_controller.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_controller.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -122,7 +122,6 @@ static bool ws_pae_controller_auth_congestion_get(protocol_interface_info_entry_ #endif static pae_controller_t *ws_pae_controller_get(protocol_interface_info_entry_t *interface_ptr); static void ws_pae_controller_frame_counter_timer(uint16_t seconds, pae_controller_t *entry); -static void ws_pae_controller_frame_counter_timer_trigger(uint16_t seconds, pae_controller_t *entry); static void ws_pae_controller_frame_counter_store(pae_controller_t *entry, bool use_threshold); static void ws_pae_controller_nvm_frame_counter_write(frame_cnt_nvm_tlv_t *tlv_entry); static int8_t ws_pae_controller_nvm_frame_counter_read(uint32_t *restart_cnt, uint64_t *stored_time, uint16_t *pan_version, frame_counters_t *counters); @@ -516,10 +515,6 @@ static int8_t ws_pae_controller_nw_key_check_and_insert(protocol_interface_info_ controller->nw_frame_counter_set(controller->interface_ptr, curr_frame_counter, i); } } - /* Trigger storing of frame counters; there is 5 seconds delay to give time for the - other keys to be inserted, so that frame counters for several keys are updated on - a same time. */ - ws_pae_controller_frame_counter_timer_trigger(FRAME_COUNTER_STORE_TRIGGER, controller); } } @@ -614,6 +609,8 @@ static void ws_pae_controller_frame_counter_store_and_nw_keys_remove(protocol_in tr_info("NW keys remove"); + controller->gtk_index = -1; + nw_key_t *nw_key = controller->nw_key; for (uint8_t i = 0; i < GTK_NUM; i++) { // Deletes the key if it is set @@ -637,9 +634,12 @@ static void ws_pae_controller_nw_key_index_check_and_set(protocol_interface_info } if (controller->nw_send_key_index_set) { + controller->gtk_index = index; + /* Checks if frame counters needs to be stored for the new GTK that is taken into + use; this is the last check that stored counters are in sync before activating key */ + ws_pae_controller_frame_counter_store(controller, true); tr_info("NW send key index set: %i", index + 1); controller->nw_send_key_index_set(interface_ptr, index); - controller->gtk_index = index; } // Do not update PAN version for initial key index set @@ -661,13 +661,14 @@ static void ws_pae_controller_active_nw_key_set(protocol_interface_info_entry_t } if (controller->nw_send_key_index_set) { + controller->gtk_index = index; /* Checks if frame counters needs to be stored for the new GTK that is taken into use; this is the last check that stored counters are in sync before activating key */ ws_pae_controller_frame_counter_store(controller, true); // Activates key on MAC controller->nw_send_key_index_set(controller->interface_ptr, index); tr_info("NW send key index set: %i", index + 1); - controller->gtk_index = index; + } } @@ -721,11 +722,9 @@ int8_t ws_pae_controller_configure(protocol_interface_info_entry_t *interface_pt controller->sec_cfg.prot_cfg.sec_prot_trickle_params.k = 0; controller->sec_cfg.prot_cfg.sec_prot_trickle_params.TimerExpirations = sec_prot_cfg->sec_prot_trickle_timer_exp; controller->sec_cfg.prot_cfg.sec_prot_retry_timeout = sec_prot_cfg->sec_prot_retry_timeout * 10; - controller->sec_cfg.prot_cfg.initial_key_retry_delay = sec_prot_cfg->initial_key_retry_delay; - controller->sec_cfg.prot_cfg.initial_key_trickle_params.Imin = sec_prot_cfg->initial_key_imin; - controller->sec_cfg.prot_cfg.initial_key_trickle_params.Imax = sec_prot_cfg->initial_key_imax; - controller->sec_cfg.prot_cfg.initial_key_trickle_params.k = 0; - controller->sec_cfg.prot_cfg.initial_key_trickle_params.TimerExpirations = 2; + controller->sec_cfg.prot_cfg.initial_key_retry_min = sec_prot_cfg->initial_key_retry_min; + controller->sec_cfg.prot_cfg.initial_key_retry_max = sec_prot_cfg->initial_key_retry_max; + controller->sec_cfg.prot_cfg.initial_key_retry_max_limit = sec_prot_cfg->initial_key_retry_max_limit; controller->sec_cfg.prot_cfg.initial_key_retry_cnt = sec_prot_cfg->initial_key_retry_cnt; } @@ -803,7 +802,6 @@ static int8_t ws_pae_controller_frame_counter_read(pae_controller_t *controller) // Increments PAN version to ensure that it is fresh controller->sec_keys_nw_info.pan_version += PAN_VERSION_STORAGE_READ_INCREMENT; - bool updated = false; // Checks frame counters for (uint8_t index = 0; index < GTK_NUM; index++) { if (controller->frame_counters.counter[index].set) { @@ -819,15 +817,8 @@ static int8_t ws_pae_controller_frame_counter_read(pae_controller_t *controller) controller->frame_counters.counter[index].frame_counter; tr_info("Read frame counter: index %i value %"PRIu32"", index, controller->frame_counters.counter[index].frame_counter); - - updated = true; } } - if (updated) { - // Writes incremented frame counters - ws_pae_nvm_store_frame_counter_tlv_create((frame_cnt_nvm_tlv_t *) &controller->pae_nvm_buffer, controller->restart_cnt, controller->sec_keys_nw_info.pan_version, &controller->frame_counters); - ws_pae_controller_nvm_frame_counter_write((frame_cnt_nvm_tlv_t *) &controller->pae_nvm_buffer); - } } return ret_value; @@ -838,6 +829,7 @@ static void ws_pae_controller_frame_counter_reset(frame_counters_t *frame_counte for (uint8_t index = 0; index < GTK_NUM; index++) { ws_pae_controller_frame_counter_index_reset(frame_counters, index); } + frame_counters->active_gtk_index = -1; } static void ws_pae_controller_frame_counter_index_reset(frame_counters_t *frame_counters, uint8_t index) @@ -1714,13 +1706,6 @@ static void ws_pae_controller_frame_counter_timer(uint16_t seconds, pae_controll } } -static void ws_pae_controller_frame_counter_timer_trigger(uint16_t seconds, pae_controller_t *entry) -{ - if (entry->frame_cnt_store_timer > seconds) { - entry->frame_cnt_store_timer = seconds; - } -} - static void ws_pae_controller_frame_counter_store(pae_controller_t *entry, bool use_threshold) { bool update_needed = false; @@ -1733,7 +1718,7 @@ static void ws_pae_controller_frame_counter_store(pae_controller_t *entry, bool * frame counters will be still valid. */ if (entry->nw_key[i].installed) { - // Reads frame counter for the key + // Reads MAC frame counter for the key uint32_t curr_frame_counter; entry->nw_frame_counter_read(entry->interface_ptr, &curr_frame_counter, i); @@ -1754,13 +1739,22 @@ static void ws_pae_controller_frame_counter_store(pae_controller_t *entry, bool tr_debug("Stored updated frame counter: index %i value %"PRIu32"", i, frame_counter); } } else { - // For new or modified network keys, stores the frame counter value + // New or modified network key entry->frame_counters.counter[i].set = true; memcpy(entry->frame_counters.counter[i].gtk, entry->nw_key[i].gtk, GTK_LEN); entry->frame_counters.counter[i].frame_counter = curr_frame_counter; entry->frame_counters.counter[i].stored_frame_counter = curr_frame_counter; + tr_debug("Pending to store new frame counter: index %i value %"PRIu32"", i, curr_frame_counter); + } + + /* If currently active key is changed or active key is set for the first time, + stores the frame counter value */ + if (entry->gtk_index == i && entry->frame_counters.active_gtk_index != i) { + entry->frame_counters.active_gtk_index = entry->gtk_index; update_needed = true; - tr_debug("Stored new frame counter: index %i value %"PRIu32"", i, curr_frame_counter); + // Updates MAC frame counter for the key + entry->nw_frame_counter_set(entry->interface_ptr, entry->frame_counters.counter[i].frame_counter, i); + tr_debug("Stored frame counters, active key set: index %i value %"PRIu32"", i, entry->frame_counters.counter[i].frame_counter); } } } diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_controller.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_controller.h index 516a6cf22d..40cd01fb0b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_controller.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_controller.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_key_storage.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_key_storage.c index e8026364a3..373f2c0619 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_key_storage.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_key_storage.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_key_storage.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_key_storage.h index c0ca7cac04..39e6df60e0 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_key_storage.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_key_storage.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_lib.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_lib.c index fb635e7741..bc14ba93ab 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_lib.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_lib.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_lib.h index e29ef5bd0f..3d1c8a148e 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_lib.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_nvm_data.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_nvm_data.c index ba575c2acb..27eacbc45f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_nvm_data.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_nvm_data.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_nvm_data.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_nvm_data.h index 3d6e643231..9194e2b5b9 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_nvm_data.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_nvm_data.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_nvm_store.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_nvm_store.c index b4a9108bca..065d9d0598 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_nvm_store.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_nvm_store.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_nvm_store.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_nvm_store.h index bf18915c1b..32fd0bafde 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_nvm_store.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_nvm_store.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_supp.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_supp.c index d73de75a2b..6aab0d9cae 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_supp.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_supp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -78,8 +78,8 @@ #define STORED_KEYS_MAXIMUM_USE_COUNT 1 // Delay for sending the initial EAPOL-Key -#define INITIAL_KEY_TIMER_MIN 3 -#define INITIAL_KEY_TIMER_MAX 30 +#define INITIAL_KEY_TIMER_MIN 1 +#define INITIAL_KEY_TIMER_MAX 3 typedef struct { ns_list_link_t link; /**< Link */ @@ -94,16 +94,17 @@ typedef struct { supp_entry_t entry; /**< Supplicant data */ kmp_addr_t target_addr; /**< EAPOL target (parent) address */ uint16_t initial_key_timer; /**< Timer to trigger initial EAPOL-Key */ - uint16_t initial_key_retry_timer; /**< Timer to trigger initial EAPOL-Key 1st retry */ - trickle_t auth_trickle_timer; /**< Trickle timer for re-sending initial EAPOL-key or for GTK mismatch */ - trickle_params_t auth_trickle_params; /**< Trickle parameters for initial EAPOL-key or for GTK mismatch */ + trickle_t gtk_req_trickle_timer; /**< Trickle timer for re-sending initial EAPOL-key on GTK mismatch */ + trickle_params_t gtk_req_trickle_params; /**< Trickle parameters for initial EAPOL-key on GTK mismatch */ uint8_t new_br_eui_64[8]; /**< Border router EUI-64 indicated by bootstrap after bootstrap start */ uint8_t comp_br_eui_64[8]; /**< Border router EUI-64 indicated by bootstrap after bootstrap completed */ sec_prot_keys_nw_info_t *sec_keys_nw_info; /**< Security keys network information */ sec_cfg_t *sec_cfg; /**< Security configuration */ uint8_t nw_keys_used_cnt; /**< How many times bootstrap has been tried with current keys */ + uint16_t initial_key_retry_max_value; /**< Initial EAPOL-Key retry exponential backoff max value */ + uint16_t initial_key_retry_timer; /**< Initial EAPOL-Key retry exponential backoff timer */ uint8_t initial_key_retry_cnt; /**< initial EAPOL-Key retry counter */ - bool auth_trickle_running : 1; /**< Initial EAPOL-Key Trickle timer running */ + bool gtk_update_trickle_running : 1; /**< GTK update Initial EAPOL-Key Trickle timer running */ bool auth_requested : 1; /**< Authentication has been requested by the bootstrap */ bool timer_running : 1; /**< Timer is running */ bool new_br_eui_64_set : 1; /**< Border router address has been set after bootstrap start */ @@ -117,9 +118,9 @@ typedef struct { #define KEY_UPDATE_RETRY_COUNT 3 #define LIFETIME_MISMATCH_RETRY_COUNT 1 /* No retries */ -// Trickle timer on how long to wait response after last retry before failing authentication -#define LAST_INTERVAL_TRICKLE_IMIN_SECS 240 /* 4 minutes */ -#define LAST_INTERVAL_TRICKLE_IMAX_SECS 240 +// Timer on how long to wait response after last retry before failing authentication +#define LAST_INTERVAL_MIN_SECS 120 /* 2 minutes */ +#define LAST_INTERVAL_MAX_SECS 240 /* 4 minutes */ static void ws_pae_supp_free(pae_supp_t *pae_supp); static void ws_pae_supp_authenticate_response(pae_supp_t *pae_supp, auth_result_e result); @@ -131,8 +132,6 @@ static int8_t ws_pae_supp_nvm_keys_write(pae_supp_t *pae_supp); static pae_supp_t *ws_pae_supp_get(protocol_interface_info_entry_t *interface_ptr); static int8_t ws_pae_supp_event_send(kmp_service_t *service, void *data); static void ws_pae_supp_tasklet_handler(arm_event_s *event); -static void ws_pae_supp_initial_trickle_timer_start(pae_supp_t *pae_supp); -static void ws_pae_supp_initial_last_interval_trickle_timer_start(pae_supp_t *pae_supp); static void ws_pae_supp_initial_key_update_trickle_timer_start(pae_supp_t *pae_supp, uint8_t timer_expirations); static bool ws_pae_supp_authentication_ongoing(pae_supp_t *pae_supp); static int8_t ws_pae_supp_timer_if_start(kmp_service_t *service, kmp_api_t *kmp); @@ -220,7 +219,7 @@ int8_t ws_pae_supp_authenticate(protocol_interface_info_entry_t *interface_ptr, pae_supp->auth_requested = true; - // Randomizes the sending of initial EAPOL-Key messsage + // Randomizes the sending of initial EAPOL-Key message pae_supp->initial_key_timer = randLIB_get_random_in_range(INITIAL_KEY_TIMER_MIN, INITIAL_KEY_TIMER_MAX); // Starts supplicant timer @@ -322,7 +321,7 @@ int8_t ws_pae_supp_gtk_hash_update(protocol_interface_info_entry_t *interface_pt /* Mismatch, initiate EAPOL (if authentication not already ongoing or if not on wait time for the authenticator to answer) */ - if (!pae_supp->auth_trickle_running || pae_supp->initial_key_retry_cnt == 0) { + if (!pae_supp->gtk_update_trickle_running || pae_supp->initial_key_retry_cnt == 0) { uint8_t timer_expirations = KEY_UPDATE_RETRY_COUNT; // For GTK lifetime mismatch send only once if (mismatch == GTK_LIFETIME_MISMATCH) { @@ -334,7 +333,7 @@ int8_t ws_pae_supp_gtk_hash_update(protocol_interface_info_entry_t *interface_pt // Starts supplicant timer ws_pae_supp_timer_start(pae_supp); - tr_info("GTK update start imin: %i, imax: %i, max mismatch: %i, tr time: %i", pae_supp->sec_cfg->timer_cfg.gtk_request_imin, pae_supp->sec_cfg->timer_cfg.gtk_request_imax, pae_supp->sec_cfg->timer_cfg.gtk_max_mismatch, pae_supp->auth_trickle_timer.t); + tr_info("GTK update start imin: %i, imax: %i, max mismatch: %i, tr time: %i", pae_supp->sec_cfg->timer_cfg.gtk_request_imin, pae_supp->sec_cfg->timer_cfg.gtk_request_imax, pae_supp->sec_cfg->timer_cfg.gtk_max_mismatch, pae_supp->gtk_req_trickle_timer.t); } } @@ -426,7 +425,7 @@ static int8_t ws_pae_supp_nvm_keys_read(pae_supp_t *pae_supp) static void ws_pae_supp_authenticate_response(pae_supp_t *pae_supp, auth_result_e result) { - pae_supp->auth_trickle_running = false; + pae_supp->initial_key_retry_timer = 0; if (pae_supp->auth_requested && pae_supp->auth_completed) { pae_supp->auth_requested = false; pae_supp->auth_completed(pae_supp->interface_ptr, result, pae_supp->target_addr.eui_64); @@ -576,18 +575,19 @@ int8_t ws_pae_supp_init(protocol_interface_info_entry_t *interface_ptr, const se pae_supp->nw_key_index_set = NULL; pae_supp->gtk_hash_ptr_get = NULL; pae_supp->initial_key_timer = 0; - pae_supp->initial_key_retry_timer = 0; pae_supp->nw_keys_used_cnt = 0; - pae_supp->initial_key_retry_cnt = DEFAULT_INITIAL_KEY_RETRY_COUNT; + pae_supp->initial_key_retry_cnt = MEDIUM_NW_INITIAL_KEY_RETRY_COUNT; pae_supp->sec_keys_nw_info = sec_keys_nw_info; pae_supp->sec_cfg = sec_cfg; - pae_supp->auth_trickle_running = false; + pae_supp->gtk_update_trickle_running = false; pae_supp->auth_requested = false; pae_supp->timer_running = false; pae_supp->new_br_eui_64_set = false; pae_supp->new_br_eui_64_fresh = false; pae_supp->comp_br_eui_64_set = false; pae_supp->entry_address_active = false; + pae_supp->initial_key_retry_max_value = 0; + pae_supp->initial_key_retry_timer = 0; ws_pae_lib_supp_init(&pae_supp->entry); @@ -787,7 +787,7 @@ void ws_pae_supp_fast_timer(uint16_t ticks) static bool ws_pae_supp_authentication_ongoing(pae_supp_t *pae_supp) { /* When either bootstrap initial authentication or re-authentication is ongoing */ - if (pae_supp->initial_key_timer || pae_supp->auth_trickle_running || + if (pae_supp->initial_key_timer || pae_supp->initial_key_retry_timer || pae_supp->gtk_update_trickle_running || ws_pae_lib_supp_timer_is_running(&pae_supp->entry)) { return true; } @@ -799,67 +799,79 @@ void ws_pae_supp_slow_timer(uint16_t seconds) { ns_list_foreach(pae_supp_t, pae_supp, &pae_supp_list) { - // Checks whether initial EAPOL-Key message needs to be re-send or new GTK request to be sent - if (pae_supp->auth_trickle_running) { - if (pae_supp->initial_key_retry_timer > 0) { - if (pae_supp->initial_key_retry_timer > seconds) { - pae_supp->initial_key_retry_timer -= seconds; - } else { - pae_supp->initial_key_retry_timer = 0; - tr_info("initial key retry timer expired"); + bool key_expired = false; + + if (pae_supp->initial_key_retry_timer > seconds) { + pae_supp->initial_key_retry_timer -= seconds; + } else if (pae_supp->initial_key_retry_timer != 0) { + pae_supp->initial_key_retry_timer = 0; + key_expired = true; + } + + if (pae_supp->gtk_update_trickle_running) { + if (trickle_timer(&pae_supp->gtk_req_trickle_timer, &pae_supp->gtk_req_trickle_params, seconds)) { + key_expired = true; + } + } + + if (key_expired) { + if (pae_supp->initial_key_retry_cnt > 0) { + // On initial EAPOL-key TX failure, check for other parents + if (pae_supp->auth_requested && pae_supp->tx_failure_on_initial_key) { + // Returns same target if no other valid targets found + const uint8_t *next_target = pae_supp->auth_next_target(pae_supp->interface_ptr, kmp_address_eui_64_get(&pae_supp->target_addr), &pae_supp->sec_keys_nw_info->key_pan_id); + kmp_address_eui_64_set(&pae_supp->target_addr, next_target); + ws_pae_supp_address_set(pae_supp, &pae_supp->target_addr); + } + pae_supp->tx_failure_on_initial_key = false; + // Sends initial EAPOL-key + if (ws_pae_supp_initial_key_send(pae_supp) < 0) { + tr_info("EAPOL-Key send failed"); + } + } + + /* Wait time for the authenticator to answer the last re-transmit expires; + fails authentication */ + if (pae_supp->initial_key_retry_cnt == 0) { + bool retry = false; + // If making key update and GTKs do not match to GTK hash + if (!pae_supp->auth_requested && ws_pae_supp_gtk_hash_mismatch_check(pae_supp) < 0) { + tr_info("GTKs do not match to GTK hash"); + retry = true; + } + auth_result_e result = AUTH_RESULT_ERR_UNSPEC; + if (pae_supp->tx_failure_on_initial_key) { + result = AUTH_RESULT_ERR_TX_ERR; + pae_supp->tx_failure_on_initial_key = false; + } + ws_pae_supp_authenticate_response(pae_supp, result); + if (retry) { + // Start trickle timer to try re-authentication + ws_pae_supp_initial_key_update_trickle_timer_start(pae_supp, KEY_UPDATE_RETRY_COUNT); } } else { - // Checks if trickle timer expires - if (trickle_timer(&pae_supp->auth_trickle_timer, &pae_supp->auth_trickle_params, seconds)) { - if (pae_supp->initial_key_retry_cnt > 0) { - // On initial EAPOL-key TX failure, check for other parents - if (pae_supp->auth_requested && pae_supp->tx_failure_on_initial_key) { - // Returns same target if no other valid targets found - const uint8_t *next_target = pae_supp->auth_next_target(pae_supp->interface_ptr, kmp_address_eui_64_get(&pae_supp->target_addr), &pae_supp->sec_keys_nw_info->key_pan_id); - kmp_address_eui_64_set(&pae_supp->target_addr, next_target); - ws_pae_supp_address_set(pae_supp, &pae_supp->target_addr); - } - pae_supp->tx_failure_on_initial_key = false; - // Sends initial EAPOL-key - if (ws_pae_supp_initial_key_send(pae_supp) < 0) { - tr_info("EAPOL-Key send failed"); - } - } + if (pae_supp->initial_key_retry_cnt > 1) { + pae_supp->initial_key_retry_cnt--; - /* Wait time for the authenticator to answer the last re-transmit expires; - fails authentication */ - if (pae_supp->initial_key_retry_cnt == 0) { - bool retry = false; - // If making key update and GTKs do not match to GTK hash - if (!pae_supp->auth_requested && ws_pae_supp_gtk_hash_mismatch_check(pae_supp) < 0) { - tr_info("GTKs do not match to GTK hash"); - retry = true; - } - auth_result_e result = AUTH_RESULT_ERR_UNSPEC; - if (pae_supp->tx_failure_on_initial_key) { - result = AUTH_RESULT_ERR_TX_ERR; - pae_supp->tx_failure_on_initial_key = false; - } - ws_pae_supp_authenticate_response(pae_supp, result); - if (retry) { - // Start trickle timer to try re-authentication - ws_pae_supp_initial_key_update_trickle_timer_start(pae_supp, KEY_UPDATE_RETRY_COUNT); - } - } else { - if (pae_supp->initial_key_retry_cnt > 0) { - pae_supp->initial_key_retry_cnt--; - } - if (pae_supp->initial_key_retry_cnt == 0) { - // Starts wait time for the authenticator to answer - tr_info("Initial EAPOL-Key wait for last re-transmit answer"); - ws_pae_supp_initial_last_interval_trickle_timer_start(pae_supp); - } + pae_supp->initial_key_retry_max_value *= 2; + if (pae_supp->initial_key_retry_max_value > pae_supp->sec_cfg->prot_cfg.initial_key_retry_max_limit) { + pae_supp->initial_key_retry_max_value = pae_supp->sec_cfg->prot_cfg.initial_key_retry_max_limit; } - } + pae_supp->initial_key_retry_timer = randLIB_get_random_in_range( + pae_supp->sec_cfg->prot_cfg.initial_key_retry_min, + pae_supp->initial_key_retry_max_value); - // Sanity check, should be running until authentication failure - if (!trickle_running(&pae_supp->auth_trickle_timer, &pae_supp->auth_trickle_params)) { - ws_pae_supp_authenticate_response(pae_supp, AUTH_RESULT_ERR_UNSPEC); + tr_info("Initial EAPOL-Key retry timer %i seconds (range [%i,%i] seconds)", + pae_supp->initial_key_retry_timer, + pae_supp->sec_cfg->prot_cfg.initial_key_retry_min, + pae_supp->initial_key_retry_max_value); + } else if (pae_supp->initial_key_retry_cnt > 0) { + pae_supp->initial_key_retry_cnt = 0; + // Starts wait time for the authenticator to answer + pae_supp->initial_key_retry_timer = randLIB_get_random_in_range( + LAST_INTERVAL_MIN_SECS, LAST_INTERVAL_MAX_SECS); + tr_info("Initial EAPOL-Key wait for last re-transmit answer %i seconds (range [120,240] seconds)", + pae_supp->initial_key_retry_timer); } } } @@ -879,71 +891,37 @@ void ws_pae_supp_slow_timer(uint16_t seconds) } else { pae_supp->initial_key_timer = 0; pae_supp->tx_failure_on_initial_key = false; + pae_supp->initial_key_retry_cnt = pae_supp->sec_cfg->prot_cfg.initial_key_retry_cnt; // Sends initial EAPOL-Key message if (ws_pae_supp_initial_key_send(pae_supp) < 0) { tr_info("EAPOL-Key send failed"); } - // Start trickle timer - ws_pae_supp_initial_trickle_timer_start(pae_supp); + // Starts initial EAPOL-key retry exponential backoff timer + pae_supp->initial_key_retry_max_value = pae_supp->sec_cfg->prot_cfg.initial_key_retry_max; + pae_supp->initial_key_retry_timer = randLIB_get_random_in_range( + pae_supp->sec_cfg->prot_cfg.initial_key_retry_min, + pae_supp->initial_key_retry_max_value); + + tr_info("Initial EAPOL-Key retry timer %i seconds (range [%i,%i] seconds)", + pae_supp->initial_key_retry_timer, + pae_supp->sec_cfg->prot_cfg.initial_key_retry_min, + pae_supp->initial_key_retry_max_value); } } } } -static void ws_pae_supp_initial_trickle_timer_start(pae_supp_t *pae_supp) -{ - /* Starts trickle for initial EAPOL-key. Default sequence has fixed delay of 2 minutes, - * one re-transmit interval, last re-transmit interval transmit time and a wait time - * for the authenticator to answer the last re-transmit. - * - * Interval I [6,12] minutes. Sequence: - * - * fixed 2 minutes delay + I + last I transmit time t + wait for answer [2,4] minutes - * - * There are two retries. Minimum time that sequence takes before authentication failure - * is 16 minutes and maximum is 30 minutes. - * - * - * Extremely slow network - * - * Starts trickle for initial EAPOL-key, Interval I [10,60] minutes. Sequence: - * I + last I transmit time t + wait for answer [2,4] minutes - * There are two retries. Minimum time that sequence takes before authentication failure - * is 22 minutes and maximum is 124 minutes. - */ - pae_supp->auth_trickle_params = pae_supp->sec_cfg->prot_cfg.initial_key_trickle_params; - pae_supp->initial_key_retry_timer = pae_supp->sec_cfg->prot_cfg.initial_key_retry_delay; - - trickle_start(&pae_supp->auth_trickle_timer, &pae_supp->auth_trickle_params); - tr_info("Initial EAPOL-Key trickle I: [%i,%i] %i, t: %i", pae_supp->auth_trickle_params.Imin, pae_supp->auth_trickle_params.Imax, pae_supp->auth_trickle_timer.I, pae_supp->auth_trickle_timer.t); - pae_supp->auth_trickle_running = true; - pae_supp->initial_key_retry_cnt = pae_supp->sec_cfg->prot_cfg.initial_key_retry_cnt; -} - -static void ws_pae_supp_initial_last_interval_trickle_timer_start(pae_supp_t *pae_supp) -{ - // Starts trickle last to wait response after last retry before failing authentication - pae_supp->auth_trickle_params.Imin = LAST_INTERVAL_TRICKLE_IMIN_SECS; - pae_supp->auth_trickle_params.Imax = LAST_INTERVAL_TRICKLE_IMAX_SECS; - pae_supp->auth_trickle_params.k = 0; - pae_supp->auth_trickle_params.TimerExpirations = 1; - // Set I to [iMin,iMax] (4 to 4 minutes) -> t is [I/2 - I] (2 minutes to 4 minutes) - trickle_start(&pae_supp->auth_trickle_timer, &pae_supp->auth_trickle_params); - tr_info("Initial EAPOL-Key trickle I: [%i,%i] %i, t: %i", pae_supp->auth_trickle_params.Imin, pae_supp->auth_trickle_params.Imax, pae_supp->auth_trickle_timer.I, pae_supp->auth_trickle_timer.t); -} - static void ws_pae_supp_initial_key_update_trickle_timer_start(pae_supp_t *pae_supp, uint8_t timer_expirations) { // Starts trickle for the key update - pae_supp->auth_trickle_params.Imin = pae_supp->sec_cfg->timer_cfg.gtk_request_imin; - pae_supp->auth_trickle_params.Imax = pae_supp->sec_cfg->timer_cfg.gtk_request_imax; - pae_supp->auth_trickle_params.k = 0; - pae_supp->auth_trickle_params.TimerExpirations = timer_expirations; + pae_supp->gtk_req_trickle_params.Imin = pae_supp->sec_cfg->timer_cfg.gtk_request_imin; + pae_supp->gtk_req_trickle_params.Imax = pae_supp->sec_cfg->timer_cfg.gtk_request_imax; + pae_supp->gtk_req_trickle_params.k = 0; + pae_supp->gtk_req_trickle_params.TimerExpirations = timer_expirations; - trickle_start(&pae_supp->auth_trickle_timer, &pae_supp->auth_trickle_params); - tr_info("Initial EAPOL-Key trickle I: [%i,%i] %i, t: %i", pae_supp->auth_trickle_params.Imin, pae_supp->auth_trickle_params.Imax, pae_supp->auth_trickle_timer.I, pae_supp->auth_trickle_timer.t); - pae_supp->initial_key_retry_timer = NONE_INITIAL_KEY_RETRY_TIMER; // 0 seconds - pae_supp->auth_trickle_running = true; + trickle_start(&pae_supp->gtk_req_trickle_timer, &pae_supp->gtk_req_trickle_params); + tr_info("Initial EAPOL-Key trickle I: [%i,%i] %i, t: %i", pae_supp->gtk_req_trickle_params.Imin, pae_supp->gtk_req_trickle_params.Imax, pae_supp->gtk_req_trickle_timer.I, pae_supp->gtk_req_trickle_timer.t); + pae_supp->gtk_update_trickle_running = true; pae_supp->initial_key_retry_cnt = timer_expirations; } @@ -1216,7 +1194,8 @@ static void ws_pae_supp_kmp_api_create_indication(kmp_api_t *kmp, kmp_type_e typ } // Incoming KMP protocol has started, no longer runs trickle timer for re-sending EAPOL-key message - pae_supp->auth_trickle_running = false; + pae_supp->gtk_update_trickle_running = false; + pae_supp->initial_key_retry_timer = 0; // For now, accept every KMP-CREATE.indication kmp_api_create_response(kmp, KMP_RESULT_OK); @@ -1258,6 +1237,19 @@ static bool ws_pae_supp_kmp_api_finished_indication(kmp_api_t *kmp, kmp_result_e // Continues with trickle but selects different parent pae_supp->tx_failure_on_initial_key = true; } + + } else if ((type == IEEE_802_1X_MKA || type == IEEE_802_11_4WH || type == IEEE_802_11_GKH) && result != KMP_RESULT_OK) { + + if (!pae_supp->auth_requested && ws_pae_supp_gtk_hash_mismatch_check(pae_supp) < 0) { + // Start trickle timer + ws_pae_supp_initial_key_update_trickle_timer_start(pae_supp, KEY_UPDATE_RETRY_COUNT); + + // Starts supplicant timer + ws_pae_supp_timer_start(pae_supp); + + tr_info("GTK update re-start imin: %i, imax: %i, max mismatch: %i, tr time: %i", pae_supp->sec_cfg->timer_cfg.gtk_request_imin, pae_supp->sec_cfg->timer_cfg.gtk_request_imax, pae_supp->sec_cfg->timer_cfg.gtk_max_mismatch, pae_supp->gtk_req_trickle_timer.t); + } + } return false; diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_supp.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_supp.h index 0642872896..1ccd78c21e 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_supp.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_supp.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.c index a962b9415d..55a3e8b5c6 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,6 +25,7 @@ #include "6LoWPAN/ws/ws_pae_time.h" #include "Security/protocols/sec_prot_certs.h" #include "Security/protocols/sec_prot_keys.h" +#include "Service_Libs/utils/ns_time.h" #ifdef HAVE_WS @@ -34,7 +35,6 @@ #define CURRENT_TIME_INIT_VALUE 1577836800 static uint64_t current_time = CURRENT_TIME_INIT_VALUE; -static ns_time_api_system_time_callback *system_time_callback = NULL; uint16_t ws_pae_time_to_short_convert(uint32_t time) { @@ -148,8 +148,9 @@ int8_t ws_pae_time_diff_calc(uint64_t curr_time, uint64_t comp_time, uint32_t *t uint64_t ws_pae_current_time_get(void) { - if (system_time_callback) { - return system_time_callback(); + uint64_t new_time; + if (ns_time_system_time_read(&new_time) == 0) { + return new_time; } return current_time; @@ -162,15 +163,15 @@ void ws_pae_current_time_update(uint16_t seconds) int8_t ws_pae_current_time_set(uint64_t time) { + uint64_t new_system_time; current_time = time; tr_debug("Current time set: %"PRIi64, time); - if (system_time_callback) { - uint64_t system_time = system_time_callback(); + if (ns_time_system_time_read(&new_system_time) == 0) { // System time has gone backwards - if (system_time < current_time || system_time > current_time + SYSTEM_TIME_MAXIMUM_DIFF) { - tr_error("FATAL: system time less than reference time or more than 12 months in future: %"PRIi64" reference time: %"PRIi64, system_time, current_time); + if (new_system_time < current_time || new_system_time > current_time + SYSTEM_TIME_MAXIMUM_DIFF) { + tr_error("FATAL: system time less than reference time or more than 12 months in future: %"PRIi64" reference time: %"PRIi64, new_system_time, current_time); return -1; } } @@ -178,10 +179,5 @@ int8_t ws_pae_current_time_set(uint64_t time) return 0; } -void ns_time_api_system_time_callback_set(ns_time_api_system_time_callback callback) -{ - system_time_callback = callback; -} - #endif /* HAVE_WS */ diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.h index 12655e2c2a..41f77ef9fe 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_time.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_timers.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_timers.c index fb1abbe275..735917102b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_timers.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_timers.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_timers.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_timers.h index 57fceb97cb..ba8fe1141f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_timers.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_pae_timers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_stats.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_stats.c index a6e794e4b5..d2351c6e34 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_stats.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_stats.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_stats.h b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_stats.h index 5a315556f8..2d7dd93882 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_stats.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_stats.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_test_api.c b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_test_api.c index 682bbf7dd1..9dd322a752 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_test_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_test_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/BorderRouter/border_router.c b/connectivity/nanostack/sal-stack-nanostack/source/BorderRouter/border_router.c index dd12919d02..02836da0d8 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/BorderRouter/border_router.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/BorderRouter/border_router.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2018, Arm Limited and affiliates. + * Copyright (c) 2012-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/BorderRouter/border_router.h b/connectivity/nanostack/sal-stack-nanostack/source/BorderRouter/border_router.h index f8bbaba7a6..e693fbc302 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/BorderRouter/border_router.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/BorderRouter/border_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2015, 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6.c b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6.c index ba9bb0b684..b3721de742 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6.h b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6.h index 1e70594554..14eaf1941c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6_prefix.c b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6_prefix.c index 2c63ddd7b2..62c7602b70 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6_prefix.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6_prefix.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6_prefix.h b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6_prefix.h index 81baeb0887..ae7f365d04 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6_prefix.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6_prefix.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6_radv.c b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6_radv.c index 446d05f38e..9ad0544322 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6_radv.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6_radv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6_radv.h b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6_radv.h index c526bdc441..2d6035a5c0 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6_radv.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/icmpv6_radv.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2014-2015, 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ip.h b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ip.h index 110ddd4b28..1007fb6d6f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ip.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ip.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2015, 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6.c b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6.c index 045e6c471c..161845b7c1 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6.h b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6.h index 0927891c59..8890d9448f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_constants.h b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_constants.h index fec095738c..524e97e4c1 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_constants.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_constants.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_flow.c b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_flow.c index 60e1657881..574b8094a9 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_flow.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_flow.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_flow.h b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_flow.h index 88edccfce4..34c9fd7179 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_flow.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_flow.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_fragmentation.c b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_fragmentation.c index 1386b398ea..9fcec3e379 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_fragmentation.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_fragmentation.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_fragmentation.h b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_fragmentation.h index 7adbe0148f..1ef642b64f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_fragmentation.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_fragmentation.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_resolution.c b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_resolution.c index 790b226b8a..20294caeac 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_resolution.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_resolution.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_resolution.h b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_resolution.h index 63b6d4b5bc..34b204c895 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_resolution.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/ipv6_resolution.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, 2019, Arm Limited and affiliates. + * Copyright (c) 2015-2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/mld.c b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/mld.c index 9a90d66da0..dddfe0baa7 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/mld.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/mld.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/mld.h b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/mld.h index 2661dea68d..aa12ba17bd 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/mld.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/mld.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/tcp.c b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/tcp.c index 2a0b6d498a..18d25146b4 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/tcp.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/tcp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/tcp.h b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/tcp.h index dbe0cb345c..cfd4cc5b40 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/tcp.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/tcp.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/udp.c b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/udp.c index 0159f450d1..0be6e0a1da 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/udp.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/udp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, 2019, Arm Limited and affiliates. + * Copyright (c) 2013-2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/udp.h b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/udp.h index f32a42a0f5..c45a1d3bb6 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/udp.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Common_Protocols/udp.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Core/buffer_dyn.c b/connectivity/nanostack/sal-stack-nanostack/source/Core/buffer_dyn.c index 268ee815ab..89fbd44b9f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Core/buffer_dyn.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Core/buffer_dyn.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2019, Arm Limited and affiliates. + * Copyright (c) 2011-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_address_internal.h b/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_address_internal.h index 79bf398b70..cc4398ad9e 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_address_internal.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_address_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010-2019, Arm Limited and affiliates. + * Copyright (c) 2008, 2010-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_buffer.h b/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_buffer.h index 42defbc3cd..c24749407c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_buffer.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2019, Arm Limited and affiliates. + * Copyright (c) 2008-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -218,6 +218,7 @@ typedef struct buffer { bool rpl_instance_known: 1; bool ip_routed_up: 1; uint8_t rpl_flag_error; + uint32_t adaptation_timestamp; /*!< Timestamp when buffer pushed to adaptation interface. Unit 100ms */ //uint8_t bc_sending_superframe; /*FHSS uses this randomly chosen superframe to send this packet (if broadcast)*/ //uint8_t fhss_channel_retries_left; //uint8_t ip_transmission_prev_seq; /*!< XXX: this stores the data packet seq. number, which is needed for re-transmission. */ diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_error_types.h b/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_error_types.h index 31d15d3f32..a43af9dfe6 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_error_types.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_error_types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2014-2015, 2017, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_monitor.h b/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_monitor.h index 867cff47fc..13724dcfe0 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_monitor.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_monitor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_socket.h b/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_socket.h index 4af22a4249..ba5d1b6286 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_socket.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Core/include/ns_socket.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2017, 2019, Arm Limited and affiliates. + * Copyright (c) 2008-2017, 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Core/include/sockbuf.h b/connectivity/nanostack/sal-stack-nanostack/source/Core/include/sockbuf.h index b02d00bf9f..6e5d802701 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Core/include/sockbuf.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Core/include/sockbuf.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Core/ns_address_internal.c b/connectivity/nanostack/sal-stack-nanostack/source/Core/ns_address_internal.c index 6131df7a01..c7c69d2d39 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Core/ns_address_internal.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Core/ns_address_internal.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010-2019, Arm Limited and affiliates. + * Copyright (c) 2008, 2010-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Core/ns_monitor.c b/connectivity/nanostack/sal-stack-nanostack/source/Core/ns_monitor.c index 83c4d3512c..ca20e3f496 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Core/ns_monitor.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Core/ns_monitor.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Core/ns_socket.c b/connectivity/nanostack/sal-stack-nanostack/source/Core/ns_socket.c index 60b5c96b75..77dade5ccf 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Core/ns_socket.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Core/ns_socket.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2015, 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2008-2015, 2017-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Core/sockbuf.c b/connectivity/nanostack/sal-stack-nanostack/source/Core/sockbuf.c index 80e1bdd1da..fa459182ee 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Core/sockbuf.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Core/sockbuf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/DHCPv6_Server/DHCPv6_Server_service.c b/connectivity/nanostack/sal-stack-nanostack/source/DHCPv6_Server/DHCPv6_Server_service.c index 7443f30507..790d7e6064 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/DHCPv6_Server/DHCPv6_Server_service.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/DHCPv6_Server/DHCPv6_Server_service.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -88,36 +88,32 @@ static void DHCP_server_service_timer_stop(void) int DHCPv6_server_respond_client(dhcpv6_gua_server_entry_s *serverBase, dhcpv6_reply_packet_s *replyPacket, dhcp_ia_non_temporal_params_t *dhcp_ia_non_temporal_params, dhcpv6_gua_response_t *response, bool allocateNew) { dhcpv6_allocated_address_t *dhcp_allocated_address = NULL; - dhcpv6_ia_non_temporal_address_s nonTemporalAddress; - bool address_allocated = false; //Validate Client DUID dhcp_link_options_params_t clientDUID; + if (libdhcpv6_get_link_address_from_duid(replyPacket->clientDUID.duid, replyPacket->clientDUID.duid_length, replyPacket->clientDUID.type, &clientDUID) == 0) { dhcp_allocated_address = libdhcpv6_address_allocate(serverBase, clientDUID.link_id, clientDUID.link_type, dhcp_ia_non_temporal_params->iaId, dhcp_ia_non_temporal_params->T0, dhcp_ia_non_temporal_params->T1, allocateNew); } if (dhcp_allocated_address) { - address_allocated = true; - nonTemporalAddress.requestedAddress = dhcp_allocated_address->nonTemporalAddress; - nonTemporalAddress.validLifeTime = dhcp_allocated_address->lifetime; - nonTemporalAddress.preferredLifeTime = dhcp_allocated_address->preferredLifetime; - if (serverBase->addCb) { dhcp_address_cache_update_t update_info; update_info.allocatedAddress = dhcp_allocated_address->nonTemporalAddress; update_info.allocatedNewAddress = allocateNew; - update_info.validLifeTime = nonTemporalAddress.validLifeTime; + update_info.validLifeTime = dhcp_allocated_address->lifetime; if (!serverBase->addCb(serverBase->interfaceId, &update_info, serverBase->guaPrefix)) { - address_allocated = false; libdhcpv6_address_delete(serverBase, dhcp_allocated_address->nonTemporalAddress); + dhcp_allocated_address = NULL; } } } - response->responseLength = libdhcpv6_address_reply_message_len(replyPacket->clientDUID.duid_length, replyPacket->serverDUID.duid_length, 0, replyPacket->rapidCommit, address_allocated); + response->responseLength = libdhcpv6_address_reply_message_len(replyPacket->clientDUID.duid_length, replyPacket->serverDUID.duid_length, 0, replyPacket->rapidCommit, (dhcp_allocated_address != NULL)); //Calculate DNS LIST and Vendor data lengths here - response->responseLength += libdhcpv6_dns_server_message_sizes(serverBase); - response->responseLength += libdhcpv6_vendor_data_message_sizes(serverBase); + if (dhcp_allocated_address) { + response->responseLength += libdhcpv6_dns_server_message_sizes(serverBase); + response->responseLength += libdhcpv6_vendor_data_message_sizes(serverBase); + } response->responsePtr = ns_dyn_mem_temporary_alloc(response->responseLength); if (response->responsePtr) { @@ -126,9 +122,9 @@ int DHCPv6_server_respond_client(dhcpv6_gua_server_entry_s *serverBase, dhcpv6_r ptr = libdhcpv6_header_write(ptr, DHCPV6_REPLY_TYPE, replyPacket->transaction_ID); ptr = libdhcpv6_duid_option_write(ptr, DHCPV6_SERVER_ID_OPTION, &replyPacket->serverDUID); //16 ptr = libdhcpv6_duid_option_write(ptr, DHCPV6_CLIENT_ID_OPTION, &replyPacket->clientDUID); //16 - if (address_allocated) { + if (dhcp_allocated_address) { ptr = libdhcpv6_identity_association_option_write(ptr, replyPacket->iaId, replyPacket->T0, replyPacket->T1, true); - ptr = libdhcpv6_ia_address_option_write(ptr, nonTemporalAddress.requestedAddress, nonTemporalAddress.preferredLifeTime, nonTemporalAddress.validLifeTime); + ptr = libdhcpv6_ia_address_option_write(ptr, dhcp_allocated_address->nonTemporalAddress, dhcp_allocated_address->preferredLifetime, dhcp_allocated_address->lifetime); //Write DNS LIST and Vendor data here ptr = libdhcpv6_dns_server_message_writes(serverBase, ptr); ptr = libdhcpv6_vendor_data_message_writes(serverBase, ptr); @@ -468,7 +464,7 @@ int DHCPv6_server_service_set_dns_server(int8_t interface, uint8_t guaPrefix[sta return 0; } -int DHCPv6_server_service_set_vendor_data(int8_t interface, uint8_t guaPrefix[static 16], uint32_t enterprise_number, uint8_t *dhcp_vendor_data_ptr, uint8_t dhcp_vendor_data_len) +int DHCPv6_server_service_set_vendor_data(int8_t interface, uint8_t guaPrefix[static 16], uint32_t enterprise_number, uint8_t *dhcp_vendor_data_ptr, uint16_t dhcp_vendor_data_len) { dhcpv6_gua_server_entry_s *serverInfo = libdhcpv6_server_data_get_by_prefix_and_interfaceid(interface, guaPrefix); if (!serverInfo) { @@ -500,6 +496,21 @@ int DHCPv6_server_service_set_vendor_data(int8_t interface, uint8_t guaPrefix[st return 0; } +int DHCPv6_server_service_set_vendor_data_callback(int8_t interface, uint8_t guaPrefix[static 16], uint32_t enterprise_number, dhcp_vendor_data_cb *vendor_data_cb) +{ + dhcpv6_gua_server_entry_s *serverInfo = libdhcpv6_server_data_get_by_prefix_and_interfaceid(interface, guaPrefix); + if (!serverInfo) { + return -1; + } + + dhcpv6_vendor_data_t *vendor_data_entry = libdhcpv6_vendor_data_allocate(serverInfo, enterprise_number); + + if (!vendor_data_entry) { + return -1; + } + vendor_data_entry->vendor_data_cb = vendor_data_cb; + return 0; +} #else int DHCPv6_server_service_init(int8_t interface, uint8_t guaPrefix[static 16], uint8_t serverDUID[static 8], uint16_t serverDUIDType) diff --git a/connectivity/nanostack/sal-stack-nanostack/source/DHCPv6_Server/DHCPv6_server_service.h b/connectivity/nanostack/sal-stack-nanostack/source/DHCPv6_Server/DHCPv6_server_service.h index 5a9fb86949..e222807209 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/DHCPv6_Server/DHCPv6_server_service.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/DHCPv6_Server/DHCPv6_server_service.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -98,7 +98,9 @@ int DHCPv6_server_service_set_address_validlifetime(int8_t interface, uint8_t gu int DHCPv6_server_service_set_dns_server(int8_t interface, uint8_t guaPrefix[static 16], uint8_t dns_server_address[static 16], uint8_t *dns_search_list_ptr, uint8_t dns_search_list_len); -int DHCPv6_server_service_set_vendor_data(int8_t interface, uint8_t guaPrefix[static 16], uint32_t enterprise_number, uint8_t *dhcp_vendor_data_ptr, uint8_t dhcp_vendor_data_len); +int DHCPv6_server_service_set_vendor_data(int8_t interface, uint8_t guaPrefix[static 16], uint32_t enterprise_number, uint8_t *dhcp_vendor_data_ptr, uint16_t dhcp_vendor_data_len); + +int DHCPv6_server_service_set_vendor_data_callback(int8_t interface, uint8_t guaPrefix[static 16], uint32_t enterprise_number, dhcp_vendor_data_cb *vendor_data_cb); #else #define DHCPv6_server_service_delete(interface, guaPrefix, delete_gua_addresses) diff --git a/connectivity/nanostack/sal-stack-nanostack/source/DHCPv6_client/dhcpv6_client_api.h b/connectivity/nanostack/sal-stack-nanostack/source/DHCPv6_client/dhcpv6_client_api.h index b7429c6125..26e87d530e 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/DHCPv6_client/dhcpv6_client_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/DHCPv6_client/dhcpv6_client_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -51,8 +51,9 @@ void dhcp_client_configure(int8_t interface, bool renew_uses_solicit, bool one_c * /param timeout SOLICIT timeout initial value. 0 means use defaults * /param max_rt SOLICIT timeout max value. * /param max_rc SOLICIT re-transmission count. 0 means infinite. + * /param max_delay Max delay of first Solicit */ -void dhcp_client_solicit_timeout_set(int8_t interface, uint16_t timeout, uint16_t max_rt, uint8_t max_rc); +void dhcp_client_solicit_timeout_set(int8_t interface, uint16_t timeout, uint16_t max_rt, uint8_t max_rc, uint8_t max_delay); /* Delete dhcp client. * @@ -83,6 +84,7 @@ typedef struct dhcp_server_notify_info { uint16_t duid_type; uint16_t duid_length; uint32_t life_time; + uint32_t rtt; // Round trip time with 100ms tics. uint8_t *duid; } dhcp_server_notify_info_t; diff --git a/connectivity/nanostack/sal-stack-nanostack/source/DHCPv6_client/dhcpv6_client_service.c b/connectivity/nanostack/sal-stack-nanostack/source/DHCPv6_client/dhcpv6_client_service.c index 758ce3977b..15b2dbe4cc 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/DHCPv6_client/dhcpv6_client_service.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/DHCPv6_client/dhcpv6_client_service.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,6 +20,7 @@ #include #include #include "nsdynmemLIB.h" +#include "randLIB.h" #include "ns_list.h" #include "common_functions.h" @@ -36,6 +37,7 @@ typedef struct { dhcp_client_options_notify_cb *option_information_cb; uint16_t service_instance; uint16_t relay_instance; + uint16_t sol_max_delay; uint16_t sol_timeout; uint16_t sol_max_rt; uint8_t sol_max_rc; @@ -104,6 +106,7 @@ void dhcp_client_init(int8_t interface, uint16_t link_type) dhcp_client->sol_timeout = 0; dhcp_client->sol_max_rt = 0; dhcp_client->sol_max_rc = 0; + dhcp_client->sol_max_delay = 0; dhcp_client->renew_uses_solicit = false; dhcp_client->one_instance_interface = false; dhcp_client->no_address_hint = false; @@ -139,13 +142,14 @@ void dhcp_client_configure(int8_t interface, bool renew_uses_solicit, bool one_c dhcp_client->no_address_hint = no_address_hint; } -void dhcp_client_solicit_timeout_set(int8_t interface, uint16_t timeout, uint16_t max_rt, uint8_t max_rc) +void dhcp_client_solicit_timeout_set(int8_t interface, uint16_t timeout, uint16_t max_rt, uint8_t max_rc, uint8_t max_delay) { // Set the default retry values for SOLICIT and RENEW messages. dhcp_client_class_t *dhcp_client = dhcpv6_client_entry_discover(interface); if (!dhcp_client) { return; } + dhcp_client->sol_max_delay = max_delay * 10; //Convert to ticks dhcp_client->sol_timeout = timeout; dhcp_client->sol_max_rt = max_rt; dhcp_client->sol_max_rc = max_rc; @@ -237,7 +241,7 @@ void dhcpv6_client_send_error_cb(dhcpv6_client_server_data_t *srv_data_ptr) } -static void dhcp_vendor_information_notify(uint8_t *ptr, uint16_t data_len, dhcp_client_class_t *dhcp_client, dhcpv6_client_server_data_t *srv_data_ptr) +static void dhcp_vendor_information_notify(uint8_t *ptr, uint16_t data_len, dhcp_client_class_t *dhcp_client, dhcpv6_client_server_data_t *srv_data_ptr, uint32_t message_rtt) { if (!dhcp_client->option_information_cb) { return; @@ -257,6 +261,8 @@ static void dhcp_vendor_information_notify(uint8_t *ptr, uint16_t data_len, dhcp server_info.duid = srv_data_ptr->serverDUID.duid + 2; // Skip the type server_info.duid_type = srv_data_ptr->serverDUID.type; server_info.duid_length = srv_data_ptr->serverDUID.duid_length - 2;// remove the type + server_info.rtt = message_rtt; + while (data_len >= 4) { type = common_read_16_bit(ptr); @@ -305,6 +311,7 @@ int dhcp_solicit_resp_cb(uint16_t instance_id, void *ptr, uint8_t msg_name, uin dhcp_duid_options_params_t clientId; dhcp_duid_options_params_t serverId; dhcpv6_client_server_data_t *srv_data_ptr = NULL; + uint32_t message_rtt; (void)instance_id; //Validate that started TR ID class is still at list @@ -323,6 +330,8 @@ int dhcp_solicit_resp_cb(uint16_t instance_id, void *ptr, uint8_t msg_name, uin } + message_rtt = dhcp_service_rtt_get(srv_data_ptr->transActionId); + //Clear Active Transaction state srv_data_ptr->transActionId = 0; @@ -395,7 +404,7 @@ int dhcp_solicit_resp_cb(uint16_t instance_id, void *ptr, uint8_t msg_name, uin } //Optional Options notify from Reply - dhcp_vendor_information_notify(msg_ptr, msg_len, dhcp_client, srv_data_ptr); + dhcp_vendor_information_notify(msg_ptr, msg_len, dhcp_client, srv_data_ptr, message_rtt); return RET_MSG_ACCEPTED; error_exit: @@ -498,8 +507,12 @@ dhcp_address_get: libdhcpv6_generic_nontemporal_address_message_write(payload_ptr, &solPacket, NULL, NULL); } + uint16_t delay_tx = 0; + if (dhcp_client->sol_max_delay) { + delay_tx = randLIB_get_random_in_range(0, dhcp_client->sol_max_delay); + } // send solicit - srv_data_ptr->transActionId = dhcp_service_send_req(dhcp_client->service_instance, 0, srv_data_ptr, dhcp_addr, payload_ptr, payload_len, dhcp_solicit_resp_cb); + srv_data_ptr->transActionId = dhcp_service_send_req(dhcp_client->service_instance, 0, srv_data_ptr, dhcp_addr, payload_ptr, payload_len, dhcp_solicit_resp_cb, delay_tx); if (srv_data_ptr->transActionId == 0) { ns_dyn_mem_free(payload_ptr); libdhcvp6_nontemporalAddress_server_data_free(srv_data_ptr); @@ -657,7 +670,7 @@ void dhcpv6_renew(protocol_interface_info_entry_t *interface, if_address_entry_t server_address = srv_data_ptr->server_address; } - srv_data_ptr->transActionId = dhcp_service_send_req(dhcp_client->service_instance, 0, srv_data_ptr, server_address, payload_ptr, payload_len, dhcp_solicit_resp_cb); + srv_data_ptr->transActionId = dhcp_service_send_req(dhcp_client->service_instance, 0, srv_data_ptr, server_address, payload_ptr, payload_len, dhcp_solicit_resp_cb, 0); if (srv_data_ptr->transActionId == 0) { ns_dyn_mem_free(payload_ptr); if (addr) { diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_cca_threshold.c b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_cca_threshold.c index ffb40f16bf..1b3a94253b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_cca_threshold.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_cca_threshold.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_cca_threshold.h b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_cca_threshold.h index 6e0da89bd0..ac1bb8b999 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_cca_threshold.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_cca_threshold.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_data_buffer.h b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_data_buffer.h index ec694540da..a76016cb4d 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_data_buffer.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_data_buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -100,6 +100,7 @@ typedef struct mac_pre_build_frame { uint16_t blacklist_period_ms; uint16_t initial_tx_channel; uint32_t tx_time; + uint32_t request_start_time_us; bool upper_layer_request: 1; bool mac_allocated_payload_ptr: 1; bool asynch_request: 1; diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_defines.h b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_defines.h index c13c708e08..c55b5085f4 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_defines.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_defines.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_fhss_callbacks.c b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_fhss_callbacks.c index 8925c5ae4a..3770c3f944 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_fhss_callbacks.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_fhss_callbacks.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_fhss_callbacks.h b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_fhss_callbacks.h index 744e7c2485..b5132a265b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_fhss_callbacks.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_fhss_callbacks.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_filter.c b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_filter.c index a1a3ea9472..6475ddfd66 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_filter.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_filter.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_filter.h b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_filter.h index 2df4e901cd..7224750471 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_filter.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_filter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_header_helper_functions.c b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_header_helper_functions.c index 65f6e05f6b..001b258cf5 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_header_helper_functions.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_header_helper_functions.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_header_helper_functions.h b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_header_helper_functions.h index ce3d10d2a5..fa7bc0550c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_header_helper_functions.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_header_helper_functions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_indirect_data.c b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_indirect_data.c index 51af386bdd..c4d1a6f736 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_indirect_data.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_indirect_data.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_indirect_data.h b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_indirect_data.h index 3f78932a34..d27338f1bc 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_indirect_data.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_indirect_data.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mcps_sap.c b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mcps_sap.c index 9d65c24e6f..6e952174f4 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mcps_sap.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mcps_sap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -56,6 +56,8 @@ // Used to set TX time (us) with FHSS. Must be <= 65ms. #define MAC_TX_PROCESSING_DELAY_INITIAL 2000 +// Give up on data request after given timeout (seconds) +#define DATA_REQUEST_TIMEOUT_NORMAL_PRIORITY_S 10 typedef struct { uint8_t address[8]; @@ -275,7 +277,7 @@ void mcps_sap_data_req_handler_ext(protocol_interface_rf_mac_setup_s *rf_mac_set } break; case MAC_DATA_HIGH_PRIORITY: - buffer->priority = MAC_PD_DATA_HIGH_PRIOTITY; + buffer->priority = MAC_PD_DATA_HIGH_PRIORITY; break; case MAC_DATA_MEDIUM_PRIORITY: buffer->priority = MAC_PD_DATA_MEDIUM_PRIORITY; @@ -383,6 +385,8 @@ void mcps_sap_data_req_handler_ext(protocol_interface_rf_mac_setup_s *rf_mac_set buffer->tx_request_restart_cnt = rf_mac_setup->tx_failure_restart_max; //check that header + payload length is not bigger than MAC MTU + buffer->request_start_time_us = mac_mcps_sap_get_phy_timestamp(rf_mac_setup); + if (data_req->InDirectTx) { mac_indirect_queue_write(rf_mac_setup, buffer); } else { @@ -1100,6 +1104,17 @@ static void mac_mcps_asynch_finish(protocol_interface_rf_mac_setup_s *rf_mac_set } } +static bool mcps_sap_check_buffer_timeout(protocol_interface_rf_mac_setup_s *rf_mac_setup, mac_pre_build_frame_t *buffer) +{ + // Convert from 1us slots to seconds + uint32_t buffer_age_s = (mac_mcps_sap_get_phy_timestamp(rf_mac_setup) - buffer->request_start_time_us) / 1000000; + // Do not timeout broadcast frames. Broadcast interval could be very long. + if (buffer->fcf_dsn.ackRequested && (buffer_age_s > DATA_REQUEST_TIMEOUT_NORMAL_PRIORITY_S)) { + return true; + } + return false; +} + void mac_mcps_trig_buffer_from_queue(protocol_interface_rf_mac_setup_s *rf_mac_setup) { if (!rf_mac_setup) { @@ -1119,22 +1134,31 @@ void mac_mcps_trig_buffer_from_queue(protocol_interface_rf_mac_setup_s *rf_mac_s buffer = mcps_sap_pd_req_queue_read(rf_mac_setup, is_bc_queue, false); if (buffer) { - //Here - if (buffer->ExtendedFrameExchange) { - //Update here state and store peer - memcpy(rf_mac_setup->mac_edfe_info->PeerAddr, buffer->DstAddr, 8); - rf_mac_setup->mac_edfe_info->state = MAC_EDFE_FRAME_CONNECTING; - } - rf_mac_setup->active_pd_data_request = buffer; - if (mcps_pd_data_request(rf_mac_setup, buffer) != 0) { + if (mcps_sap_check_buffer_timeout(rf_mac_setup, buffer)) { + // Buffer is quite old. Return it to adaptation layer with timeout event. + rf_mac_setup->mac_tx_result = MAC_TX_TIMEOUT; if (buffer->ExtendedFrameExchange) { rf_mac_setup->mac_edfe_info->state = MAC_EDFE_FRAME_IDLE; } - rf_mac_setup->active_pd_data_request = NULL; mac_mcps_asynch_finish(rf_mac_setup, buffer); mcps_data_confirm_handle(rf_mac_setup, buffer, NULL); } else { - return; + if (buffer->ExtendedFrameExchange) { + //Update here state and store peer + memcpy(rf_mac_setup->mac_edfe_info->PeerAddr, buffer->DstAddr, 8); + rf_mac_setup->mac_edfe_info->state = MAC_EDFE_FRAME_CONNECTING; + } + rf_mac_setup->active_pd_data_request = buffer; + if (mcps_pd_data_request(rf_mac_setup, buffer) != 0) { + if (buffer->ExtendedFrameExchange) { + rf_mac_setup->mac_edfe_info->state = MAC_EDFE_FRAME_IDLE; + } + rf_mac_setup->active_pd_data_request = NULL; + mac_mcps_asynch_finish(rf_mac_setup, buffer); + mcps_data_confirm_handle(rf_mac_setup, buffer, NULL); + } else { + return; + } } } else { return; @@ -1434,12 +1458,6 @@ static void mac_common_data_confirmation_handle(protocol_interface_rf_mac_setup_ } else if (m_event == MAC_TX_DONE_PENDING) { buf->status = MLME_SUCCESS; } else if (m_event == MAC_TX_TIMEOUT) { - /* Make MAC Soft Reset */; - tr_debug("Driver TO event"); - //Disable allways - mac_mlme_mac_radio_disabled(rf_mac_setup); - //Enable Radio - mac_mlme_mac_radio_enable(rf_mac_setup); buf->status = MLME_TRANSACTION_EXPIRED; } else if (m_event == MAC_UNKNOWN_DESTINATION) { buf->status = MLME_UNAVAILABLE_KEY; @@ -1630,6 +1648,11 @@ static void mcps_data_confirm_handle(protocol_interface_rf_mac_setup_s *rf_ptr, confirm.timestamp = 0; } + if (buffer->fcf_dsn.ackRequested) { + // Update latency for unicast packets. Given as milliseconds. + sw_mac_stats_update(rf_ptr, STAT_MAC_TX_LATENCY, ((mac_mcps_sap_get_phy_timestamp(rf_ptr) - buffer->request_start_time_us) + 500) / 1000); + } + if (buffer->upper_layer_request) { //Check tunnel mcps_sap_prebuild_frame_buffer_free(buffer); @@ -2430,10 +2453,16 @@ static mac_pre_build_frame_t *mcps_sap_pd_req_queue_read(protocol_interface_rf_m mac_pre_build_frame_t *buffer = queue; mac_pre_build_frame_t *prev = NULL; - // With FHSS, check TX conditions + /* With FHSS, read buffer out from queue if: + * - Buffer has timed out, OR + * - Buffer is asynch request, OR + * - Queue is flushed, OR + * - Blacklisting AND FHSS allows buffer to be transmitted + */ if (rf_mac_setup->fhss_api) { while (buffer) { - if (buffer->asynch_request || + if (mcps_sap_check_buffer_timeout(rf_mac_setup, buffer) || + buffer->asynch_request || (flush == true) || ((mcps_check_packet_blacklist(rf_mac_setup, buffer) == false) && (rf_mac_setup->fhss_api->check_tx_conditions(rf_mac_setup->fhss_api, !mac_is_ack_request_set(buffer), diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mcps_sap.h b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mcps_sap.h index d79343546e..94247d58b8 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mcps_sap.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mcps_sap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -48,7 +48,7 @@ typedef enum { #define MAC_PD_DATA_NORMAL_PRIORITY 0 //Normal MCPS DATA REQ #define MAC_PD_DATA_MEDIUM_PRIORITY 1 //Indirect Data which is polled -#define MAC_PD_DATA_HIGH_PRIOTITY 2 //Beacon request Beacon response +#define MAC_PD_DATA_HIGH_PRIORITY 2 //Beacon request Beacon response #define MAC_PD_DATA_EF_PRIORITY 3 //Expedited forwarding #define MAC_PD_DATA_TX_IMMEDIATELY 4 //Only for packets whose transmission was interrupted by wrong channel type. E.g. unicast on broadcast channel. diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mlme.c b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mlme.c index c6c0d01cc4..9d39b35202 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mlme.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mlme.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1837,7 +1837,7 @@ int8_t mac_mlme_beacon_tx(protocol_interface_rf_mac_setup_s *rf_ptr) ptr += BEACON_OPTION_JOIN_PRIORITY_LEN; }*/ } - buf->priority = MAC_PD_DATA_HIGH_PRIOTITY; + buf->priority = MAC_PD_DATA_HIGH_PRIORITY; mcps_sap_pd_req_queue_write(rf_ptr, buf); sw_mac_stats_update(rf_ptr, STAT_MAC_BEA_TX_COUNT, 0); return 0; diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mlme.h b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mlme.h index 2cf6a79a70..f436a5cceb 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mlme.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mlme.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_pd_sap.c b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_pd_sap.c index 2a61f10ee9..da3b6b7a53 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_pd_sap.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_pd_sap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_pd_sap.h b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_pd_sap.h index 396e92bc7f..730c9b0e3e 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_pd_sap.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_pd_sap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_security_mib.c b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_security_mib.c index ed06964ab5..13d2032a99 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_security_mib.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_security_mib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_security_mib.h b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_security_mib.h index 150d8ea64a..84fb3ad131 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_security_mib.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_security_mib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_timer.c b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_timer.c index a14aeaff2f..764cd25a73 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_timer.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_timer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_timer.h b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_timer.h index d4f6958cda..aa0bee3efd 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_timer.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_timer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/sw_mac.c b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/sw_mac.c index 7e287ee514..675eda3b5c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/sw_mac.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/sw_mac.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -765,6 +765,11 @@ void sw_mac_stats_update(protocol_interface_rf_mac_setup_s *setup, mac_stats_typ case STAT_MAC_TX_CCA_FAIL: setup->mac_statistics->mac_failed_cca_count++; break; + case STAT_MAC_TX_LATENCY: + if (update_val > setup->mac_statistics->mac_tx_latency_max) { + setup->mac_statistics->mac_tx_latency_max = update_val; + } + break; } } } diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/sw_mac_internal.h b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/sw_mac_internal.h index b661c9628c..ecac04c7ff 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/sw_mac_internal.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/sw_mac_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -35,6 +35,7 @@ typedef enum { STAT_MAC_TX_RETRY, STAT_MAC_TX_CCA_ATT, STAT_MAC_TX_CCA_FAIL, + STAT_MAC_TX_LATENCY } mac_stats_type_t; typedef enum arm_nwk_timer_id { diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/ethernet/ethernet_mac_api.c b/connectivity/nanostack/sal-stack-nanostack/source/MAC/ethernet/ethernet_mac_api.c index fb4d9d2176..6bf5fdba5b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/ethernet/ethernet_mac_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/ethernet/ethernet_mac_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/rf_driver_storage.c b/connectivity/nanostack/sal-stack-nanostack/source/MAC/rf_driver_storage.c index 6257406c3e..8033dbddc6 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/rf_driver_storage.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/rf_driver_storage.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/rf_driver_storage.h b/connectivity/nanostack/sal-stack-nanostack/source/MAC/rf_driver_storage.h index d9a82d9531..c0c451b8ab 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/rf_driver_storage.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/rf_driver_storage.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/serial/serial_mac_api.c b/connectivity/nanostack/sal-stack-nanostack/source/MAC/serial/serial_mac_api.c index b3ffa24bea..295848de30 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/serial/serial_mac_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/serial/serial_mac_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/virtual_rf/virtual_rf_client.c b/connectivity/nanostack/sal-stack-nanostack/source/MAC/virtual_rf/virtual_rf_client.c index 81395991f3..9afa782b5a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/virtual_rf/virtual_rf_client.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/virtual_rf/virtual_rf_client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/virtual_rf/virtual_rf_defines.h b/connectivity/nanostack/sal-stack-nanostack/source/MAC/virtual_rf/virtual_rf_defines.h index 01919dabcc..dc38ccd15f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/virtual_rf/virtual_rf_defines.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/virtual_rf/virtual_rf_defines.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MAC/virtual_rf/virtual_rf_driver.c b/connectivity/nanostack/sal-stack-nanostack/source/MAC/virtual_rf/virtual_rf_driver.c index 78e8b9ef2c..0f3503fcb9 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MAC/virtual_rf/virtual_rf_driver.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/MAC/virtual_rf/virtual_rf_driver.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MLE/mle.c b/connectivity/nanostack/sal-stack-nanostack/source/MLE/mle.c index 8c24f6b0b1..4e2d0a876d 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MLE/mle.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/MLE/mle.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MLE/mle.h b/connectivity/nanostack/sal-stack-nanostack/source/MLE/mle.h index 7d4389b433..0302886aa1 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MLE/mle.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/MLE/mle.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MLE/mle_tlv.c b/connectivity/nanostack/sal-stack-nanostack/source/MLE/mle_tlv.c index 284fb435ff..d878ca9b80 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MLE/mle_tlv.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/MLE/mle_tlv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MLE/mle_tlv.h b/connectivity/nanostack/sal-stack-nanostack/source/MLE/mle_tlv.h index f7a3829baf..9ccf872138 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MLE/mle_tlv.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/MLE/mle_tlv.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MPL/mpl.c b/connectivity/nanostack/sal-stack-nanostack/source/MPL/mpl.c index 1ab5b21cf1..face25a0f3 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MPL/mpl.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/MPL/mpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/MPL/mpl.h b/connectivity/nanostack/sal-stack-nanostack/source/MPL/mpl.h index d5cd8152e4..557fd48459 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/MPL/mpl.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/MPL/mpl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/Include/protocol.h b/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/Include/protocol.h index 0ca9c30a65..a3a845ffba 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/Include/protocol.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/Include/protocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/Include/protocol_abstract.h b/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/Include/protocol_abstract.h index 78aa552c38..f59ca2bf9e 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/Include/protocol_abstract.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/Include/protocol_abstract.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/Include/protocol_stats.h b/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/Include/protocol_stats.h index 193a9538e9..0bf2e01f59 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/Include/protocol_stats.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/Include/protocol_stats.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -45,7 +45,8 @@ typedef enum { STATS_ETX_1ST_PARENT, STATS_ETX_2ND_PARENT, STATS_AL_TX_QUEUE_SIZE, - STATS_AL_TX_CONGESTION_DROP + STATS_AL_TX_CONGESTION_DROP, + STATS_AL_TX_LATENCY } nwk_stats_type_t; diff --git a/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/Include/protocol_timer.h b/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/Include/protocol_timer.h index 2af1e35591..630770c244 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/Include/protocol_timer.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/Include/protocol_timer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/protocol_core.c b/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/protocol_core.c index 45f0c41384..cab954193b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/protocol_core.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/protocol_core.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/protocol_core_sleep.c b/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/protocol_core_sleep.c index bc11ad738b..a0a1acbfe3 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/protocol_core_sleep.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/protocol_core_sleep.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/protocol_stats.c b/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/protocol_stats.c index 074dc07951..6fecc591f0 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/protocol_stats.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/protocol_stats.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -155,6 +155,11 @@ void protocol_stats_update(nwk_stats_type_t type, uint16_t update_val) case STATS_AL_TX_CONGESTION_DROP: nwk_stats_ptr->adapt_layer_tx_congestion_drop++; break; + case STATS_AL_TX_LATENCY: + if (update_val > nwk_stats_ptr->adapt_layer_tx_latency_max) { + nwk_stats_ptr->adapt_layer_tx_latency_max = update_val; + } + break; } } } diff --git a/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/protocol_timer.c b/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/protocol_timer.c index 6997849ee7..0c518ecf5d 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/protocol_timer.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/NWK_INTERFACE/protocol_timer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_control.c b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_control.c index 522d85107a..282eea4f6e 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_control.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_control.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_control.h b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_control.h index e13f552a09..e5381afefd 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_control.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_control.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_data.c b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_data.c index 099192a107..f94057e5e6 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_data.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_data.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -351,8 +351,9 @@ static buffer_t *rpl_data_exthdr_provider_hbh_2(buffer_t *buf, rpl_instance_t *i // size because of the LL addresses used on the outer header, so // this is an unconditional change. Exception remains for local // DODAGs, where the destination address must be the DODAGID. - if (addr_ipv6_equal(route_info->next_hop_addr, buf->dst_sa.address) || (!rpl_policy_force_tunnel() && - addr_ipv6_equal(buf->dst_sa.address, dodag->id))) { + const uint8_t *ip_dest = buf->route->ip_dest ? buf->route->ip_dest : buf->dst_sa.address; + if (addr_ipv6_equal(route_info->next_hop_addr, ip_dest) || (!rpl_policy_force_tunnel() && + addr_ipv6_equal(ip_dest, dodag->id))) { destination_in_instance = true; if (buf->rpl_option) { @@ -997,7 +998,7 @@ static buffer_t *rpl_data_exthdr_provider_srh(buffer_t *buf, ipv6_exthdr_stage_t * (RFC 6554 4.1). When not tunnelling, we include all hops regardless, * which means the final destination is there as needed. */ - srh_info = rpl_data_sr_compute_header_size(final_rpl_dest, buf->options.tunnelled && buf->options.type == IPV6_NH_IPV6 ? buf->options.hop_limit : 0xFF); + srh_info = rpl_data_sr_compute_header_size(final_rpl_dest, buf->options.tunnelled ? buf->options.hop_limit : 0xFF); if (!srh_info) { /* No source routing header required - this must be because it's one hop. */ /* In this case, we do need to add a HbH option header */ @@ -1033,6 +1034,7 @@ static buffer_t *rpl_data_exthdr_provider_srh(buffer_t *buf, ipv6_exthdr_stage_t if (final_rpl_dest != buf->dst_sa.address) { memcpy(buf->dst_sa.address, final_rpl_dest, 16); } + buf->route->ip_dest = rpl_data_sr_next_hop(); *result = IPV6_EXTHDR_MODIFY_TUNNEL; buf->src_sa.addr_type = ADDR_NONE; // force auto-selection return buf; diff --git a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_data.h b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_data.h index 694106ff4e..4fa5635f27 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_data.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_data.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_downward.c b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_downward.c index 4b7fe15dd2..984c24953e 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_downward.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_downward.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_downward.h b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_downward.h index 73cceeb856..73ec79aa8c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_downward.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_downward.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_mrhof.c b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_mrhof.c index be3fd9a822..248838953f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_mrhof.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_mrhof.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_mrhof.h b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_mrhof.h index e38d7c101a..42ac7d7efb 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_mrhof.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_mrhof.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2015, 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_objective.c b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_objective.c index 5ffa3ab924..4a5948cf54 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_objective.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_objective.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_objective.h b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_objective.h index 7e8293a396..1d3bc66fda 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_objective.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_objective.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2015, 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_of0.c b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_of0.c index bfdee2a496..49df857330 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_of0.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_of0.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_of0.h b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_of0.h index 6e7db0a6f8..0f09658bab 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_of0.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_of0.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2015, 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_policy.c b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_policy.c index 11a6737597..5f669c591c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_policy.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_policy.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_policy.h b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_policy.h index 91e4917587..b80e0e9f2a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_policy.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_policy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, 2019, Arm Limited and affiliates. + * Copyright (c) 2015-2017, 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_protocol.h b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_protocol.h index 27d3b83703..bb6ac92126 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_protocol.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_protocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2015, 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_structures.h b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_structures.h index 837d0fa9ab..0adeaacbf9 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_structures.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_structures.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_upward.c b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_upward.c index 496313a08a..283dff2b9c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_upward.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_upward.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -533,6 +533,9 @@ bool rpl_neighbour_update_dtsn(rpl_neighbour_t *neighbour, uint8_t dtsn) rpl_instance_t *rpl_neighbour_instance(const rpl_neighbour_t *neighbour) { + if (!neighbour || !neighbour->dodag_version || !neighbour->dodag_version->dodag) { + return NULL; + } return neighbour->dodag_version->dodag->instance; } diff --git a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_upward.h b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_upward.h index b3b51b38bc..3a3cb183c2 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_upward.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/RPL/rpl_upward.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/Common/sec_lib.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/Common/sec_lib.h index a1601e7fcc..6091457380 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/Common/sec_lib.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/Common/sec_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/Common/sec_lib_definitions.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/Common/sec_lib_definitions.h index d52883e19c..5eb91a74c1 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/Common/sec_lib_definitions.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/Common/sec_lib_definitions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/Common/security_lib.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/Common/security_lib.c index a48616a086..4d2c58d02b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/Common/security_lib.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/Common/security_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/eap_protocol.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/eap_protocol.c index 8de694d335..33bd7c7229 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/eap_protocol.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/eap_protocol.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/eap_protocol.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/eap_protocol.h index 93e1405161..1faa5e55bc 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/eap_protocol.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/eap_protocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana.c index f09eca992b..c46d14898a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana.h index a8b3f37256..7e463052dc 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_avp.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_avp.c index f9f32dbaa8..16d0b15167 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_avp.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_avp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_avp.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_avp.h index 5ee046c929..0603a95be5 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_avp.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_avp.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_client.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_client.c index d724e28539..8947f0f446 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_client.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_eap_header.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_eap_header.c index 8d9ae32728..9c32471cc9 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_eap_header.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_eap_header.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_eap_header.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_eap_header.h index 2498134433..96113c3d98 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_eap_header.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_eap_header.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_header.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_header.c index fc3135db43..31341301a3 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_header.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_header.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_header.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_header.h index c70c6d4092..bf50b35da5 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_header.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_header.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_internal_api.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_internal_api.h index 927f7ee18a..2ebaed41dd 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_internal_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_internal_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_nvm.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_nvm.h index 325acd6b0e..341114c2c9 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_nvm.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_nvm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2014-2015, 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_relay_table.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_relay_table.c index 355aad1a4c..4dc6f07bdb 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_relay_table.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_relay_table.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_relay_table.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_relay_table.h index 23c9f075ca..6a1356c06f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_relay_table.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_relay_table.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2013-2015, 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_server.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_server.c index 092b4ad59c..354ca5f6b1 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_server.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/PANA/pana_server.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/TLS/tls_ccm_crypt.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/TLS/tls_ccm_crypt.c index 8c98b7bde0..ce0cf3679d 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/TLS/tls_ccm_crypt.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/TLS/tls_ccm_crypt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/TLS/tls_ccm_crypt.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/TLS/tls_ccm_crypt.h index b82de08207..6ef1aff07e 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/TLS/tls_ccm_crypt.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/TLS/tls_ccm_crypt.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/TLS/tls_lib.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/TLS/tls_lib.c index dcd4f8e53f..aa70856c18 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/TLS/tls_lib.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/TLS/tls_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/TLS/tls_lib.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/TLS/tls_lib.h index c369e20635..a26aa4ff2d 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/TLS/tls_lib.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/TLS/tls_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/eapol/eapol_helper.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/eapol/eapol_helper.c index 03d2afcb8a..b2c009fc4a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/eapol/eapol_helper.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/eapol/eapol_helper.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/eapol/eapol_helper.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/eapol/eapol_helper.h index d7fc8d5fe0..0454c122a9 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/eapol/eapol_helper.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/eapol/eapol_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/eapol/kde_helper.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/eapol/kde_helper.c index 13be8926ce..aa27d248e4 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/eapol/kde_helper.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/eapol/kde_helper.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/eapol/kde_helper.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/eapol/kde_helper.h index b735828e61..153e86f365 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/eapol/kde_helper.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/eapol/kde_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_addr.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_addr.c index a09ab4ea74..facc28d1f3 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_addr.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_addr.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_addr.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_addr.h index 43b549a77c..9873b9ede1 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_addr.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_addr.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_api.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_api.c index 296f76362d..d7f114c5fe 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_api.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_api.h index 3c880de292..5a5ae0ee20 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -33,6 +33,7 @@ typedef enum { IEEE_802_1X_MKA = 1, RADIUS_IEEE_802_1X_MKA = 2, + MSG_PROT = 5, IEEE_802_11_4WH = 6, IEEE_802_11_GKH = 7, TLS_PROT = 8, diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_eapol_pdu_if.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_eapol_pdu_if.c index afcae84571..a51bb2e98f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_eapol_pdu_if.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_eapol_pdu_if.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_eapol_pdu_if.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_eapol_pdu_if.h index eaad14b075..294079bb43 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_eapol_pdu_if.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_eapol_pdu_if.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_socket_if.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_socket_if.c index 6197e4304d..f586b90a9d 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_socket_if.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_socket_if.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_socket_if.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_socket_if.h index 20a55c8f45..4d30260b67 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_socket_if.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/kmp/kmp_socket_if.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/auth_eap_tls_sec_prot.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/auth_eap_tls_sec_prot.c index 122cfe4e02..4f1d3a725b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/auth_eap_tls_sec_prot.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/auth_eap_tls_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/auth_eap_tls_sec_prot.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/auth_eap_tls_sec_prot.h index 8c3e1185b9..b3c9c792a9 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/auth_eap_tls_sec_prot.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/auth_eap_tls_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/eap_tls_sec_prot_lib.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/eap_tls_sec_prot_lib.c index 9592059724..34f79d3906 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/eap_tls_sec_prot_lib.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/eap_tls_sec_prot_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/eap_tls_sec_prot_lib.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/eap_tls_sec_prot_lib.h index 6af3687869..a645e21b63 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/eap_tls_sec_prot_lib.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/eap_tls_sec_prot_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/radius_eap_tls_sec_prot.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/radius_eap_tls_sec_prot.c index b37cdf028a..09944249d9 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/radius_eap_tls_sec_prot.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/radius_eap_tls_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/radius_eap_tls_sec_prot.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/radius_eap_tls_sec_prot.h index 03f510985f..5e2b2e19b1 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/radius_eap_tls_sec_prot.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/radius_eap_tls_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.c index 3384716879..aa296c39d1 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.h index 78ececd7bc..30dfcda048 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/fwh_sec_prot/auth_fwh_sec_prot.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/fwh_sec_prot/auth_fwh_sec_prot.c index ec89a9a09e..8138fe8ed4 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/fwh_sec_prot/auth_fwh_sec_prot.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/fwh_sec_prot/auth_fwh_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/fwh_sec_prot/auth_fwh_sec_prot.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/fwh_sec_prot/auth_fwh_sec_prot.h index 67b96a41e0..beda6df752 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/fwh_sec_prot/auth_fwh_sec_prot.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/fwh_sec_prot/auth_fwh_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/fwh_sec_prot/supp_fwh_sec_prot.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/fwh_sec_prot/supp_fwh_sec_prot.c index a1074f7ec2..84e91e61ca 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/fwh_sec_prot/supp_fwh_sec_prot.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/fwh_sec_prot/supp_fwh_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/fwh_sec_prot/supp_fwh_sec_prot.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/fwh_sec_prot/supp_fwh_sec_prot.h index 2cb2284e3c..0335b5713d 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/fwh_sec_prot/supp_fwh_sec_prot.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/fwh_sec_prot/supp_fwh_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/gkh_sec_prot/auth_gkh_sec_prot.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/gkh_sec_prot/auth_gkh_sec_prot.c index 4424b55a2c..b01d60c824 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/gkh_sec_prot/auth_gkh_sec_prot.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/gkh_sec_prot/auth_gkh_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/gkh_sec_prot/auth_gkh_sec_prot.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/gkh_sec_prot/auth_gkh_sec_prot.h index daf09a4c3b..341a2c8be9 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/gkh_sec_prot/auth_gkh_sec_prot.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/gkh_sec_prot/auth_gkh_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/gkh_sec_prot/supp_gkh_sec_prot.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/gkh_sec_prot/supp_gkh_sec_prot.c index 064f2bec76..a836e5870b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/gkh_sec_prot/supp_gkh_sec_prot.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/gkh_sec_prot/supp_gkh_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/gkh_sec_prot/supp_gkh_sec_prot.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/gkh_sec_prot/supp_gkh_sec_prot.h index a8832db62f..d1ba7d378d 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/gkh_sec_prot/supp_gkh_sec_prot.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/gkh_sec_prot/supp_gkh_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/key_sec_prot/key_sec_prot.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/key_sec_prot/key_sec_prot.c index 6467839c46..540ed35c71 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/key_sec_prot/key_sec_prot.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/key_sec_prot/key_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/key_sec_prot/key_sec_prot.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/key_sec_prot/key_sec_prot.h index e059ab7bc0..ed0436d5d2 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/key_sec_prot/key_sec_prot.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/key_sec_prot/key_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/msg_sec_prot/msg_sec_prot.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/msg_sec_prot/msg_sec_prot.c new file mode 100644 index 0000000000..ddaf69a0ce --- /dev/null +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/msg_sec_prot/msg_sec_prot.c @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2021, Pelion and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "nsconfig.h" +#include +#include "ns_types.h" +#include "ns_list.h" +#include "ns_trace.h" +#include "nsdynmemLIB.h" +#include "fhss_config.h" +#include "NWK_INTERFACE/Include/protocol.h" +#include "6LoWPAN/ws/ws_config.h" +#include "Security/protocols/sec_prot_cfg.h" +#include "Security/kmp/kmp_addr.h" +#include "Security/kmp/kmp_api.h" +#include "Security/PANA/pana_eap_header.h" +#include "Security/eapol/eapol_helper.h" +#include "Security/eapol/kde_helper.h" +#include "Security/protocols/sec_prot_certs.h" +#include "Security/protocols/sec_prot_keys.h" +#include "Security/protocols/sec_prot.h" +#include "Security/protocols/sec_prot_lib.h" +#include "Security/protocols/msg_sec_prot/msg_sec_prot.h" + +#ifdef HAVE_WS + +#define TRACE_GROUP "msep" + +typedef enum { + MSG_STATE_INIT = SEC_STATE_INIT, + MSG_STATE_CREATE_REQ = SEC_STATE_CREATE_REQ, + MSG_STATE_FINISH = SEC_STATE_FINISH, + MSG_STATE_FINISHED = SEC_STATE_FINISHED +} msg_sec_prot_state_e; + +typedef struct { + sec_prot_common_t common; /**< Common data */ +} msg_sec_prot_int_t; + +static uint16_t msg_sec_prot_size(void); +static int8_t msg_sec_prot_init(sec_prot_t *prot); +static void msg_sec_prot_delete(sec_prot_t *prot); + +static void msg_sec_prot_create_request(sec_prot_t *prot, sec_prot_keys_t *sec_keys); +static void msg_sec_prot_state_machine(sec_prot_t *prot); +static int8_t msg_sec_prot_auth_rejected_send(sec_prot_t *prot, sec_prot_keys_t *sec_keys); + +#define msg_sec_prot_get(prot) (msg_sec_prot_int_t *) &prot->data + +int8_t msg_sec_prot_register(kmp_service_t *service) +{ + if (!service) { + return -1; + } + + if (kmp_service_sec_protocol_register(service, MSG_PROT, msg_sec_prot_size, msg_sec_prot_init) < 0) { + return -1; + } + + return 0; +} + +static uint16_t msg_sec_prot_size(void) +{ + return sizeof(msg_sec_prot_int_t); +} + +static int8_t msg_sec_prot_init(sec_prot_t *prot) +{ + prot->create_req = msg_sec_prot_create_request; + prot->delete = msg_sec_prot_delete; + prot->state_machine = msg_sec_prot_state_machine; + + msg_sec_prot_int_t *data = msg_sec_prot_get(prot); + sec_prot_init(&data->common); + sec_prot_state_set(prot, &data->common, MSG_STATE_INIT); + + return 0; +} + +static void msg_sec_prot_delete(sec_prot_t *prot) +{ + (void) prot; +} + +static void msg_sec_prot_create_request(sec_prot_t *prot, sec_prot_keys_t *sec_keys) +{ + (void) sec_keys; + + prot->state_machine(prot); +} + +static int8_t msg_sec_prot_auth_rejected_send(sec_prot_t *prot, sec_prot_keys_t *sec_keys) +{ + (void) sec_keys; + + uint8_t *eapol_pdu_frame = ns_dyn_mem_temporary_alloc(prot->header_size); + + // Send zero length message to relay which requests LLC to remove EAPOL temporary entry based on EUI-64 + if (prot->send(prot, eapol_pdu_frame, prot->header_size) < 0) { + return -1; + } + + return 0; +} + +static void msg_sec_prot_state_machine(sec_prot_t *prot) +{ + msg_sec_prot_int_t *data = msg_sec_prot_get(prot); + + switch (sec_prot_state_get(&data->common)) { + case MSG_STATE_INIT: + sec_prot_state_set(prot, &data->common, MSG_STATE_CREATE_REQ); + break; + case MSG_STATE_CREATE_REQ: + // KMP-CREATE.confirm + prot->create_conf(prot, sec_prot_result_get(&data->common)); + // Authentication rejected (will continue only after new EAPOL Initial-Key) + (void) msg_sec_prot_auth_rejected_send(prot, prot->sec_keys); + sec_prot_state_set(prot, &data->common, MSG_STATE_FINISH); + break; + case MSG_STATE_FINISH: + sec_prot_state_set(prot, &data->common, MSG_STATE_FINISHED); + /* fall through */ + case MSG_STATE_FINISHED: + prot->finished(prot); + break; + default: + break; + } +} + +#endif /* HAVE_WS */ + diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/msg_sec_prot/msg_sec_prot.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/msg_sec_prot/msg_sec_prot.h new file mode 100644 index 0000000000..611f30ce98 --- /dev/null +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/msg_sec_prot/msg_sec_prot.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2021, Pelion and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MSG_SEC_PROT_H_ +#define MSG_SEC_PROT_H_ + +/* + * Message security protocol. Protocol can be used for sending messages from + * authenticator EAPOL components to lower layers on authenticator. + * + */ + +/** + * msg_sec_prot_register register message security protocol to KMP service + * + * \param service KMP service + * + * \return < 0 failure + * \return >= 0 success + */ +int8_t msg_sec_prot_register(kmp_service_t *service); + +#endif /* MSG_SEC_PROT_H_ */ diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/radius_sec_prot/avp_helper.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/radius_sec_prot/avp_helper.c index 73cc2d98e5..9d0530495a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/radius_sec_prot/avp_helper.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/radius_sec_prot/avp_helper.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/radius_sec_prot/avp_helper.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/radius_sec_prot/avp_helper.h index 8687a112fa..ecb8f22e9e 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/radius_sec_prot/avp_helper.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/radius_sec_prot/avp_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/radius_sec_prot/radius_client_sec_prot.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/radius_sec_prot/radius_client_sec_prot.c index 882df678fd..21dc0bf7e0 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/radius_sec_prot/radius_client_sec_prot.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/radius_sec_prot/radius_client_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -71,6 +71,7 @@ typedef enum { #define RADIUS_ACCESS_ACCEPT 2 #define RADIUS_ACCESS_REJECT 3 #define RADIUS_ACCESS_CHALLENGE 11 +#define RADIUS_MESSAGE_NONE 0 #define MS_MPPE_RECV_KEY_SALT_LEN 2 #define MS_MPPE_RECV_KEY_BLOCK_LEN 16 @@ -239,7 +240,7 @@ static int8_t radius_client_sec_prot_init(sec_prot_t *prot) data->send_radius_msg = NULL; data->identity_len = 0; data->identity = NULL; - data->radius_code = 0; + data->radius_code = RADIUS_MESSAGE_NONE; data->radius_identifier = 0; memset(data->request_authenticator, 0, 16); data->state_len = 0; @@ -247,6 +248,7 @@ static int8_t radius_client_sec_prot_init(sec_prot_t *prot) memset(data->remote_eui_64_hash, 0, 8); data->remote_eui_64_hash_set = false; data->new_pmk_set = false; + data->radius_id_range_set = false; if (!shared_data) { shared_data = ns_dyn_mem_alloc(sizeof(radius_client_sec_prot_shared_t)); @@ -379,6 +381,10 @@ static int8_t radius_client_sec_prot_receive(sec_prot_t *prot, void *pdu, uint16 uint8_t *radius_msg_ptr = pdu; uint8_t code = *radius_msg_ptr++; + if (code != RADIUS_ACCESS_ACCEPT && code != RADIUS_ACCESS_REJECT && code != RADIUS_ACCESS_CHALLENGE) { + return -1; + } + uint8_t identifier = *radius_msg_ptr++; /* If identifier does not match to sent identifier, silently ignore message, already checked on socket if before routing the request to receive, so @@ -430,6 +436,7 @@ static int8_t radius_client_sec_prot_receive(sec_prot_t *prot, void *pdu, uint16 // Message does not have radius EAP-TLS specific fields data->radius_code = code; prot->state_machine(prot); + data->radius_code = RADIUS_MESSAGE_NONE; return 0; } @@ -519,6 +526,7 @@ static int8_t radius_client_sec_prot_receive(sec_prot_t *prot, void *pdu, uint16 data->radius_code = code; data->recv_eap_msg_len += data->radius_eap_tls_header_size; prot->state_machine(prot); + data->radius_code = RADIUS_MESSAGE_NONE; return 0; } @@ -1127,6 +1135,16 @@ static void radius_client_sec_prot_state_machine(sec_prot_t *prot) return; } + if (data->radius_code != RADIUS_MESSAGE_NONE) { + // Received retry for already handled message from RADIUS server, ignore + if (data->recv_eap_msg) { + ns_dyn_mem_free(data->recv_eap_msg); + } + data->recv_eap_msg = NULL; + data->recv_eap_msg_len = 0; + return; + } + tr_info("Radius: send access request, eui-64: %s", trace_array(sec_prot_remote_eui_64_addr_get(prot), 8)); radius_client_sec_prot_allocate_and_create_radius_message(prot); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/radius_sec_prot/radius_client_sec_prot.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/radius_sec_prot/radius_client_sec_prot.h index 9d3a467284..efedcbd6d1 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/radius_sec_prot/radius_client_sec_prot.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/radius_sec_prot/radius_client_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot.h index ac283a00c1..b32f91777c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_certs.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_certs.c index dc76a22ba9..4c5045fa14 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_certs.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_certs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_certs.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_certs.h index 9a204aaa09..755a9741de 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_certs.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_certs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_cfg.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_cfg.h index 17efc2b589..adc4217281 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_cfg.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,8 +23,9 @@ typedef struct sec_prot_cfg_s { trickle_params_t sec_prot_trickle_params; uint16_t sec_prot_retry_timeout; - uint16_t initial_key_retry_delay; - trickle_params_t initial_key_trickle_params; + uint16_t initial_key_retry_min; + uint16_t initial_key_retry_max; + uint16_t initial_key_retry_max_limit; uint8_t initial_key_retry_cnt; uint8_t max_ongoing_auth_constant; uint16_t max_ongoing_auth_size_scaler; diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_keys.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_keys.c index ff08f74942..02748f08fc 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_keys.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_keys.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_keys.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_keys.h index 0304d9eb44..6215bdc759 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_keys.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_keys.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -114,6 +114,7 @@ typedef struct { typedef struct { frame_counter_t counter[GTK_NUM]; /**< Frame counter for each GTK key */ + int8_t active_gtk_index; /**< Active GTK index */ } frame_counters_t; // Authenticator supplicant security key data diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_lib.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_lib.c index a6ba018ae6..7789020660 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_lib.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -88,6 +88,8 @@ void sec_prot_timer_timeout_handle(sec_prot_t *prot, sec_prot_common_t *data, co void sec_prot_timer_trickle_start(sec_prot_common_t *data, const trickle_params_t *trickle_params) { trickle_start(&data->trickle_timer, trickle_params); + trickle_inconsistent_heard(&data->trickle_timer, trickle_params); + tr_info("Security prot trickle start, I: %i, t: %i", data->trickle_timer.I, data->trickle_timer.t); data->trickle_running = true; } diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_lib.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_lib.h index 4d7fd088ee..83a01879c2 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_lib.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/sec_prot_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/tls_sec_prot/tls_sec_prot.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/tls_sec_prot/tls_sec_prot.c index 472c0411dc..545dbbcb87 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/tls_sec_prot/tls_sec_prot.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/tls_sec_prot/tls_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/tls_sec_prot/tls_sec_prot.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/tls_sec_prot/tls_sec_prot.h index 129648e1cc..23f2a82879 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/tls_sec_prot/tls_sec_prot.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/tls_sec_prot/tls_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/tls_sec_prot/tls_sec_prot_lib.c b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/tls_sec_prot/tls_sec_prot_lib.c index 1ba7f109ab..36f50a8b09 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/tls_sec_prot/tls_sec_prot_lib.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/tls_sec_prot/tls_sec_prot_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/tls_sec_prot/tls_sec_prot_lib.h b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/tls_sec_prot/tls_sec_prot_lib.h index fc4a40b9f0..209064b332 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/tls_sec_prot/tls_sec_prot_lib.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/protocols/tls_sec_prot/tls_sec_prot_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/CCM_lib/ccm_security.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/CCM_lib/ccm_security.c index 14deaa5226..04d1fe55d3 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/CCM_lib/ccm_security.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/CCM_lib/ccm_security.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2015, 2017-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/CCM_lib/mbedOS/aes_mbedtls.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/CCM_lib/mbedOS/aes_mbedtls.c index 36bdd0f590..03594467bb 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/CCM_lib/mbedOS/aes_mbedtls.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/CCM_lib/mbedOS/aes_mbedtls.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, Arm Limited and affiliates. + * Copyright (c) 2006-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/CCM_lib/mbedOS/aes_mbedtls_adapter.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/CCM_lib/mbedOS/aes_mbedtls_adapter.c index afc9132db8..c9aeeedebd 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/CCM_lib/mbedOS/aes_mbedtls_adapter.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/CCM_lib/mbedOS/aes_mbedtls_adapter.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/Neighbor_cache/neighbor_cache.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/Neighbor_cache/neighbor_cache.c index 4f057a5574..c7ffeee88e 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/Neighbor_cache/neighbor_cache.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/Neighbor_cache/neighbor_cache.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/Neighbor_cache/neighbor_table_definition.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/Neighbor_cache/neighbor_table_definition.h index 4141691095..783d7e75b7 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/Neighbor_cache/neighbor_table_definition.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/Neighbor_cache/neighbor_table_definition.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/SHA256_Lib/ns_sha256.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/SHA256_Lib/ns_sha256.c index 10fce9c06a..cdbded6b9b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/SHA256_Lib/ns_sha256.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/SHA256_Lib/ns_sha256.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, Arm Limited and affiliates. + * Copyright (c) 2006-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/SHA256_Lib/shalib.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/SHA256_Lib/shalib.c index 6f1120f45c..bb3a71197b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/SHA256_Lib/shalib.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/SHA256_Lib/shalib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/Trickle/trickle.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/Trickle/trickle.c index 77e58d09ad..2bab1f368a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/Trickle/trickle.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/Trickle/trickle.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/Trickle/trickle.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/Trickle/trickle.h index a6c957826c..e12cfe2f82 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/Trickle/trickle.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/Trickle/trickle.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/blacklist/blacklist.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/blacklist/blacklist.c index f47b2097bf..d195ef93dc 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/blacklist/blacklist.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/blacklist/blacklist.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/blacklist/blacklist.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/blacklist/blacklist.h index 224490194a..d2d1c072fc 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/blacklist/blacklist.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/blacklist/blacklist.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/etx/etx.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/etx/etx.c index 22a86f1cca..73c0d12eca 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/etx/etx.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/etx/etx.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -439,11 +439,6 @@ uint16_t etx_local_etx_read(int8_t interface_id, uint8_t attribute_index) } if (etx_info.cache_sample_requested && entry->etx_samples < etx_info.init_etx_sample_count) { - etx_sample_storage_t *storage = etx_info.etx_cache_storage_list + attribute_index; - if (storage->received_acks == 0 && storage->attempts_count) { - //No ack so return max value - return etx_info.max_etx; - } //Not ready yet return 0xffff; } diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/etx/etx.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/etx/etx.h index 9329d201b2..7b6a68760b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/etx/etx.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/etx/etx.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/channel_functions.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/channel_functions.c index 594686b9bb..27848430a2 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/channel_functions.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/channel_functions.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/channel_functions.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/channel_functions.h index f6ceab73bb..14ed756114 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/channel_functions.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/channel_functions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/channel_list.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/channel_list.c index 0f59f584cf..a25ffe12b4 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/channel_list.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/channel_list.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/channel_list.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/channel_list.h index 7e283b3dbe..d84918c87f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/channel_list.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/channel_list.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss.c index ae960bc8d0..532a57c669 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss.h index 1f09840cbd..77b0aa75f3 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_channel.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_channel.c index 8ad6c3cf52..901a02c945 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_channel.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_channel.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_channel.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_channel.h index af35ba6475..98fe9157e7 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_channel.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_channel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_common.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_common.c index 0d9dc7c505..c968751c85 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_common.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_common.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_common.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_common.h index 71c2d9a4d1..7bc5e88ab7 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_common.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_configuration_interface.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_configuration_interface.c index df247c80b5..6684d265ca 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_configuration_interface.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_configuration_interface.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_statistics.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_statistics.c index b4ee75c48f..c8ee23a973 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_statistics.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_statistics.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_statistics.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_statistics.h index bd2f81eaef..765df79b1f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_statistics.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_statistics.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_test_api.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_test_api.c index 02e63af682..421143e4fe 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_test_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_test_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_ws.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_ws.c index ed174150a5..090520570b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_ws.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_ws.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -130,10 +130,10 @@ fhss_structure_t *fhss_ws_enable(fhss_api_t *fhss_api, const fhss_ws_configurati tr_err("Invalid FHSS enable configuration"); return NULL; } - int channel_count = channel_list_count_channels(fhss_configuration->channel_mask); + int bc_channel_count = channel_list_count_channels(fhss_configuration->channel_mask); int uc_channel_count = channel_list_count_channels(fhss_configuration->unicast_channel_mask); - if (channel_count <= 0) { + if (bc_channel_count <= 0) { // There must be at least one configured channel in channel list return NULL; } @@ -147,7 +147,7 @@ fhss_structure_t *fhss_ws_enable(fhss_api_t *fhss_api, const fhss_ws_configurati return NULL; } memset(fhss_struct->ws, 0, sizeof(fhss_ws_t)); - if (fhss_ws_manage_channel_table_allocation(fhss_struct, channel_count)) { + if (fhss_ws_manage_channel_table_allocation(fhss_struct, uc_channel_count > bc_channel_count ? uc_channel_count : bc_channel_count)) { ns_dyn_mem_free(fhss_struct->ws); fhss_free_instance(fhss_api); tr_error("Failed to allocate channel tables"); @@ -161,10 +161,12 @@ fhss_structure_t *fhss_ws_enable(fhss_api_t *fhss_api, const fhss_ws_configurati for (uint8_t i = 0; i < 8; i++) { fhss_struct->ws->fhss_configuration.unicast_channel_mask[i] = fhss_configuration->channel_mask[i]; } - uc_channel_count = channel_count; + uc_channel_count = bc_channel_count; } - fhss_struct->number_of_channels = channel_count; + + fhss_struct->number_of_channels = fhss_configuration->channel_mask_size; fhss_struct->number_of_uc_channels = uc_channel_count; + fhss_struct->number_of_bc_channels = bc_channel_count; fhss_struct->optimal_packet_length = OPTIMAL_PACKET_LENGTH; fhss_ws_set_hop_count(fhss_struct, 0xff); fhss_struct->rx_channel = fhss_configuration->unicast_fixed_channel; diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_ws.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_ws.h index 6e3b3d5d48..0aa9887289 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_ws.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_ws.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_ws_empty_functions.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_ws_empty_functions.c index 4a68275472..9a43fff87f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_ws_empty_functions.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fhss/fhss_ws_empty_functions.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fnv_hash/fnv_hash.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fnv_hash/fnv_hash.c index fb93f18085..bcc5c12496 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fnv_hash/fnv_hash.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fnv_hash/fnv_hash.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fnv_hash/fnv_hash.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fnv_hash/fnv_hash.h index 5be95a6a70..7ee5f02b9c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fnv_hash/fnv_hash.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/fnv_hash/fnv_hash.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/hmac/hmac_md.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/hmac/hmac_md.c index a3eb539b61..0ef22158e1 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/hmac/hmac_md.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/hmac/hmac_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/hmac/hmac_md.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/hmac/hmac_md.h index 7c55b77a45..fbb57bf18a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/hmac/hmac_md.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/hmac/hmac_md.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/ieee_802_11/ieee_802_11.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/ieee_802_11/ieee_802_11.c index 6200ae0eb9..bfd0724f62 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/ieee_802_11/ieee_802_11.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/ieee_802_11/ieee_802_11.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/ieee_802_11/ieee_802_11.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/ieee_802_11/ieee_802_11.h index 80dc118633..e7737297c2 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/ieee_802_11/ieee_802_11.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/ieee_802_11/ieee_802_11.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/load_balance/load_balance.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/load_balance/load_balance.c index 74d02ae442..7d91760139 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/load_balance/load_balance.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/load_balance/load_balance.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/load_balance/load_balance_api.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/load_balance/load_balance_api.h index 498847da8f..586505f1ff 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/load_balance/load_balance_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/load_balance/load_balance_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mac_neighbor_table/mac_neighbor_table.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mac_neighbor_table/mac_neighbor_table.c index 1969159277..4784d8824c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mac_neighbor_table/mac_neighbor_table.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mac_neighbor_table/mac_neighbor_table.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mac_neighbor_table/mac_neighbor_table.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mac_neighbor_table/mac_neighbor_table.h index 7b2c6d4ef4..37908a0379 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mac_neighbor_table/mac_neighbor_table.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mac_neighbor_table/mac_neighbor_table.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/fnet_config.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/fnet_config.h index 54bb282c4e..85d494dc86 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/fnet_config.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/fnet_config.h @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2017, Arm Limited and affiliates. +* Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2011-2016 by Andrey Butok. FNET Community. * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc. diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/port/compiler/fnet_comp.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/port/compiler/fnet_comp.h index d3109581b5..2fb633df5a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/port/compiler/fnet_comp.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/port/compiler/fnet_comp.h @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2019 Arm Limited and affiliates. +* Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2011-2016 by Andrey Butok. FNET Community. * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc. diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/port/compiler/fnet_comp_config.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/port/compiler/fnet_comp_config.h index ab376cec25..d3fbb98bc6 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/port/compiler/fnet_comp_config.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/port/compiler/fnet_comp_config.h @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2019 Arm Limited and affiliates. +* Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2011-2016 by Andrey Butok. FNET Community. * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc. diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/fnet_services.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/fnet_services.h index 255b8ea950..847dcbade8 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/fnet_services.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/fnet_services.h @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2017, Arm Limited and affiliates. +* Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2011-2016 by Andrey Butok. FNET Community. * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc. diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/fnet_services_config.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/fnet_services_config.h index c93f83a0ca..5300fcfe6d 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/fnet_services_config.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/fnet_services_config.h @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2017, Arm Limited and affiliates. +* Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2011-2016 by Andrey Butok. FNET Community. * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc. diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/mdns/fnet_mdns.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/mdns/fnet_mdns.c index 94561a3a5b..a222aba949 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/mdns/fnet_mdns.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/mdns/fnet_mdns.c @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2017, 2019 Arm Limited and affiliates. +* Copyright (c) 2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2016 by Andrey Butok. FNET Community. * @@ -50,12 +50,12 @@ #define FNET_MDNS_DOMAIN_NAME "local" /* mDNS top level domain (TLD) name: local */ #define FNET_MDNS_PORT FNET_CFG_MDNS_PORT /* mDNS port */ -#define FNET_MDNS_WAIT 250 /* Wait 250ms to check domain name. */ -#define FNET_MDNS_PROBE_WAIT (5*1000) /* Wait 5 seconds before trying again. */ -#define FNET_MDNS_PROBE_DEFER_WAIT (1*1000) /* Defers to the winning host by waiting one second. */ -#define FNET_MDNS_SHARED_RESPONSE_DELAY (200) /* Delay for shared response. Random amount of time selected with uniform random distribution in the range 20-120 ms. */ +#define FNET_MDNS_WAIT 250 /* Wait 250ms to check domain name. */ +#define FNET_MDNS_PROBE_WAIT (5*1000) /* Wait 5 seconds before trying again. */ +#define FNET_MDNS_PROBE_DEFER_WAIT (1*1000) /* Defers to the winning host by waiting one second. */ +#define FNET_MDNS_SHARED_RESPONSE_DELAY (200) /* Delay for shared response. Random amount of time selected with uniform random distribution in the range 20-120 ms. */ -#define FNET_MDNS_ANNOUNCE_COUNT (2) /* The Multicast DNS responder MUST send at least two unsolicited responses. */ +#define FNET_MDNS_ANNOUNCE_COUNT (2) /* The Multicast DNS responder MUST send at least two unsolicited responses. */ #define FNET_MDNS_ANNOUNCE_INTERVAL (1000) /* one second apart. */ #define FNET_MDNS_HEADER_CLASS_IN 0x01 /* Internet */ @@ -141,11 +141,11 @@ typedef struct fnet_mdns_service_if_s { const char *service_type; /* Service Type. Null-terminated string. Example _http._tcp*/ fnet_uint16_t service_port; /* Service Port number (in network byte order). */ - const fnet_uint8_t *(*service_get_txt)(void); /* Call-back function, which returns pointer to the service TXT record (null-terminated). + const fnet_uint8_t *(*service_get_txt)(void); /* Call-back function, which returns pointer to the service TXT record (null-terminated). * If the service does not provide any TXT record, this parameter must be set to NULL. */ fnet_uint16_t offset_service_name; /* Pointer to service name. Offset from the start of the DNS message. Used for Domain Name Compression. */ fnet_uint16_t offset_service_type; /* Pointer to service type. Offset from the start of the DNS message. Used for Domain Name Compression. */ - fnet_mdns_query_type_t response_type; /* Response type used in mDNS response.*/ + fnet_mdns_query_type_t response_type; /* Response type used in mDNS response.*/ } fnet_mdns_service_if_t; /* MDNS interface structure */ @@ -158,9 +158,9 @@ typedef struct fnet_mdns_if fnet_uint32_t rr_ttl_ip; /* Resource record TTL for IP header, hop-count limit for a packet */ fnet_address_family_t addr_family; /* Address family (IPv6 or IPv4 or both) the server will listen and send */ fnet_size_t name_length; /* Length of the service name without index postfix */ - char host_name[FNET_MDNS_HOST_NAME_LEN_MAX+1]; /* Parsed "name" containing only legal symbols, optionally appended with host_name_count */ + char host_name[FNET_MDNS_HOST_NAME_LEN_MAX+1]; /* Parsed "name" containing only legal symbols, optionally appended with host_name_count */ fnet_uint32_t host_name_count; /* Count of try device name */ - char service_name[FNET_MDNS_HOST_NAME_LEN_MAX+1]; /* Service name, optionally appended with host_name_count */ + char service_name[FNET_MDNS_HOST_NAME_LEN_MAX+1]; /* Service name, optionally appended with host_name_count */ fnet_uint32_t probe_count; /* Number of sent probe queries without name conflict.*/ fnet_uint32_t announce_count; /* Count of sent annoncemnts */ fnet_socket_t socket_listen; /* Listening socket.*/ @@ -172,15 +172,15 @@ typedef struct fnet_mdns_if fnet_bool_t is_truncated; /* RFC6762:In query messages, if the TC bit is set, it means that additional Known-Answer records may be following shortly. A responder SHOULD * record this fact, and wait for those additional Known-Answer records, before deciding whether to respond.*/ fnet_bool_t is_legacy_unicast; /* If the source UDP port in a received Multicast DNS query is not port 5353*/ - fnet_bool_t is_shared; /* Response contains only shared records. + fnet_bool_t is_shared; /* Response contains only shared records. * RFC 6762: In any case where there may be multiple responses, such as queries * where the answer is a member of a shared resource record set, each * responder SHOULD delay its response by a random amount of time * selected with uniform random distribution in the range 20-120 ms. */ fnet_uint32_t is_shared_timestamp; /* Timestamp of shared response query.*/ struct sockaddr remote_address; /* Remote address.*/ - fnet_address_family_t response_address_family; /* Address family used in mDNS response.*/ - fnet_mdns_query_type_t response_type; /* Response type used in mDNS response.*/ + fnet_address_family_t response_address_family; /* Address family used in mDNS response.*/ + fnet_mdns_query_type_t response_type; /* Response type used in mDNS response.*/ fnet_mdns_service_if_t service_if_list[FNET_CFG_MDNS_SERVICE_MAX]; /* Service Discovery List */ } fnet_mdns_if_t; @@ -188,7 +188,7 @@ typedef struct fnet_mdns_if FNET_COMP_PACKED_BEGIN typedef struct fnet_mdns_header_s { - fnet_uint16_t ip FNET_COMP_PACKED; + fnet_uint16_t ip FNET_COMP_PACKED; fnet_uint16_t flags FNET_COMP_PACKED; /* flags */ fnet_uint16_t qdcount FNET_COMP_PACKED; /* count of questions */ fnet_uint16_t ancount FNET_COMP_PACKED; /* count of answers */ @@ -462,7 +462,7 @@ fnet_mdns_service_desc_t fnet_mdns_service_register(fnet_mdns_desc_t mdns_desc, for(i = 0; iservice_if_list[i].service_type == NULL) + if(mdns_if->service_if_list[i].service_type == NULL) { mdns_if->service_if_list[i].service_type = service->service_type; mdns_if->service_if_list[i].service_port = service->service_port; @@ -582,7 +582,7 @@ static void fnet_mdns_update_name(fnet_mdns_if_t *mdns_if, const fnet_char_t *na /* Copy name. */ fnet_strcpy(mdns_if->host_name, name); fnet_strcpy(mdns_if->service_name, name); - + /* Allow only legal characters in address record names.*/ for(c = mdns_if->host_name; *c != '\0'; c++) { @@ -607,7 +607,7 @@ static void fnet_mdns_update_name(fnet_mdns_if_t *mdns_if, const fnet_char_t *na FNET_DEBUG_MDNS("MDNS: Host-name set to (%s).", mdns_if->host_name); } /************************************************************************ -* DESCRIPTION: Update counter of host and service name. +* DESCRIPTION: Update counter of host and service name. ************************************************************************/ static void fnet_mdns_update_name_counter(fnet_mdns_if_t *mdns_if) { @@ -780,7 +780,7 @@ static fnet_bool_t fnet_mdns_cmp_rr_name(const char *rr_name, const char *name_1 } /************************************************************************ -* DESCRIPTION: Compare R name with sub-name. +* DESCRIPTION: Compare R name with sub-name. ************************************************************************/ static fnet_bool_t fnet_mdns_cmp_name(const char **rr_name_p, const char *name) { @@ -821,8 +821,8 @@ static fnet_bool_t fnet_mdns_cmp_name(const char **rr_name_p, const char *name) } /************************************************************************ -* DESCRIPTION: Put RR name to rr_name. Retutns pointer to the next pointer; 0 if error. -If rr_name or rr_name_size are 0, just skip name. +* DESCRIPTION: Put RR name to rr_name. Retutns pointer to the next pointer; 0 if error. +If rr_name or rr_name_size are 0, just skip name. ************************************************************************/ static const fnet_uint8_t *fnet_mdns_get_rr_name(char *rr_name, fnet_uint32_t rr_name_size, const fnet_uint8_t *rr, const fnet_uint8_t *packet) { @@ -832,7 +832,7 @@ static const fnet_uint8_t *fnet_mdns_get_rr_name(char *rr_name, fnet_uint32_t rr const fnet_uint8_t *ptr = rr; fnet_uint8_t length = *rr; fnet_uint16_t offset = 0; - const fnet_uint8_t *result = ptr; + const fnet_uint8_t *result = ptr; while(length != 0) { @@ -861,7 +861,7 @@ static const fnet_uint8_t *fnet_mdns_get_rr_name(char *rr_name, fnet_uint32_t rr { goto ERROR; } - + length = *ptr; if( rr_name && rr_name_size ) /* Copy to rr_name buffer.*/ @@ -872,7 +872,7 @@ static const fnet_uint8_t *fnet_mdns_get_rr_name(char *rr_name, fnet_uint32_t rr rr_name += (length+1); rr_name_size -= (length+1); - } + } else { goto ERROR; @@ -917,10 +917,10 @@ static fnet_mdns_query_type_t fnet_mdns_get_query_type(fnet_uint16_t type) break; case FNET_HTONS(FNET_MDNS_RR_ANY): query_rr_type = FNET_MDNS_QUERY_ANY; - break; + break; default: query_rr_type = FNET_MDNS_QUERY_NONE; - break; + break; } return query_rr_type; @@ -937,7 +937,7 @@ static void fnet_mdns_print_qe_name(const fnet_char_t *prefix, const fnet_char_t fnet_uint8_t name_length_index = 0; fnet_index_t i; - fnet_print("%s", prefix); /* Print prefix*/ + fnet_print("%s", prefix); /* Print prefix*/ for(i=0; iresponse_type |= query_type; } - mdns_if->response_address_family |= address_family; + mdns_if->response_address_family |= address_family; } } break; case FNET_MDNS_STATE_PROBING: /* Compare received hostname with my_device.local or my_device._hap._tcp.local*/ - if(fnet_mdns_is_our_host_name(mdns_if, qe_name) - || fnet_mdns_get_service_by_name(mdns_if, qe_name)) + if(fnet_mdns_is_our_host_name(mdns_if, qe_name) + || fnet_mdns_get_service_by_name(mdns_if, qe_name)) { #if FNET_CFG_DEBUG_MDNS && FNET_CFG_DEBUG fnet_mdns_print_qe_name("MDNS: RX Probe for:", qe_name); @@ -1059,19 +1059,19 @@ static const fnet_uint8_t * fnet_mdns_process_query(fnet_mdns_if_t *mdns_if, fne } /************************************************************************ -* DESCRIPTION: Avoid duplicate answer. +* DESCRIPTION: Avoid duplicate answer. ************************************************************************/ static void fnet_mdns_process_duplicate_answer(fnet_mdns_if_t *mdns_if, const fnet_uint8_t *an_ptr, const fnet_uint8_t *packet, fnet_uint32_t packet_size) { FNET_ASSERT(mdns_if != NULL); FNET_ASSERT(an_ptr != NULL); - FNET_ASSERT(packet != NULL); + FNET_ASSERT(packet != NULL); fnet_uint8_t our_rr[FNET_MDNS_RR_PROBE_LEN_MAX]; fnet_mdns_header_t *mdns_header = (fnet_mdns_header_t *)packet; fnet_uint16_t an_count = FNET_HTONS(mdns_header->ancount); const fnet_uint8_t *ptr = an_ptr; - fnet_mdns_rr_header_t *rr_header; + fnet_mdns_rr_header_t *rr_header; fnet_uint32_t i; fnet_mdns_query_type_t rr_type; fnet_bool_t skip; @@ -1090,7 +1090,7 @@ static void fnet_mdns_process_duplicate_answer(fnet_mdns_if_t *mdns_if, const fn } rr_type = fnet_mdns_get_query_type(rr_header->type); - + skip = FNET_FALSE; /* Generate our record.*/ @@ -1156,7 +1156,7 @@ static void fnet_mdns_process_duplicate_answer(fnet_mdns_if_t *mdns_if, const fn skip = FNET_TRUE; break; } - + if(skip == FNET_TRUE) { /* Skip RR record.*/ ptr += sizeof(fnet_mdns_rr_header_t) + FNET_HTONS(rr_header->data_length); @@ -1218,12 +1218,12 @@ static void fnet_mdns_process_simultaneous_probe(fnet_mdns_if_t *mdns_if, const if(fnet_mdns_is_rr_win(our_rr, ns_ptr, ns_count, packet) == FNET_TRUE) { fnet_uint32_t i; - - is_win = FNET_TRUE; - + + is_win = FNET_TRUE; + for(i = 0; iservice_if_list[i].service_type != NULL) + if(mdns_if->service_if_list[i].service_type != NULL) { /* Prepare and Compare Our RR SRV records */ if(fnet_mdns_add_rr_srv(mdns_if, our_rr, sizeof(our_rr), &mdns_if->service_if_list[i], mdns_if->rr_ttl, FNET_FALSE, FNET_FALSE) == NULL) @@ -1237,7 +1237,7 @@ static void fnet_mdns_process_simultaneous_probe(fnet_mdns_if_t *mdns_if, const else { is_win = FNET_FALSE; - break; + break; } } } @@ -1249,7 +1249,7 @@ static void fnet_mdns_process_simultaneous_probe(fnet_mdns_if_t *mdns_if, const /* RFC6762: If the host finds that its own data is lexicographically earlier, then it defers to the winning host by waiting one second, and then begins probing for this record again.*/ - mdns_if->probe_wait_interval = FNET_MDNS_PROBE_DEFER_WAIT; + mdns_if->probe_wait_interval = FNET_MDNS_PROBE_DEFER_WAIT; /* Save conflict timestamp.*/ mdns_if->host_name_conflict_timestamp = fnet_timer_get_ms(); //TBD move to state change. fnet_mdns_change_state(mdns_if, FNET_MDNS_STATE_PROBING_WAIT); /* Reset probing.*/ @@ -1259,7 +1259,7 @@ ERROR: } /************************************************************************ -* DESCRIPTION: Get pointer to Answer Record. +* DESCRIPTION: Get pointer to Answer Record. ************************************************************************/ static const fnet_uint8_t *fnet_mdns_get_an(const fnet_uint8_t *packet, fnet_uint32_t packet_size) { @@ -1267,7 +1267,7 @@ static const fnet_uint8_t *fnet_mdns_get_an(const fnet_uint8_t *packet, fnet_uin fnet_mdns_header_t *mdns_header = (fnet_mdns_header_t *)packet; fnet_uint16_t qd_count; /* Question Count */ - fnet_uint16_t an_count; /* Answer Record Count */ + fnet_uint16_t an_count; /* Answer Record Count */ const fnet_uint8_t *result = NULL; fnet_index_t i; const fnet_uint8_t *ptr; @@ -1276,7 +1276,7 @@ static const fnet_uint8_t *fnet_mdns_get_an(const fnet_uint8_t *packet, fnet_uin { qd_count = FNET_HTONS(mdns_header->qdcount); /* Question Count */ an_count = FNET_HTONS(mdns_header->ancount); /* Answer Record Count */ - + /* Skip mDNS header.*/ ptr = packet + sizeof(fnet_mdns_header_t); @@ -1307,7 +1307,7 @@ ERROR: } /************************************************************************ -* DESCRIPTION: Get pointer to Name Server (Authority Record). +* DESCRIPTION: Get pointer to Name Server (Authority Record). ************************************************************************/ static const fnet_uint8_t *fnet_mdns_get_ns(fnet_uint8_t *packet, fnet_uint32_t packet_size) { @@ -1315,8 +1315,8 @@ static const fnet_uint8_t *fnet_mdns_get_ns(fnet_uint8_t *packet, fnet_uint32_t fnet_mdns_header_t *mdns_header = (fnet_mdns_header_t *)packet; fnet_uint16_t qd_count; /* Question Count */ - fnet_uint16_t an_count; /* Answer Record Count */ - fnet_uint16_t ns_count; /* Authority Record Count */ + fnet_uint16_t an_count; /* Answer Record Count */ + fnet_uint16_t ns_count; /* Authority Record Count */ const fnet_uint8_t *result = NULL; fnet_index_t i; const fnet_uint8_t *ptr; @@ -1326,7 +1326,7 @@ static const fnet_uint8_t *fnet_mdns_get_ns(fnet_uint8_t *packet, fnet_uint32_t qd_count = FNET_HTONS(mdns_header->qdcount); /* Question Count */ an_count = FNET_HTONS(mdns_header->ancount); /* Answer Record Count */ ns_count = FNET_HTONS(mdns_header->nscount); /* Authority Record Count */ - + /* Skip mDNS header.*/ ptr = packet + sizeof(fnet_mdns_header_t); @@ -1363,7 +1363,7 @@ static const fnet_uint8_t *fnet_mdns_get_ns(fnet_uint8_t *packet, fnet_uint32_t { goto ERROR; } - } + } if(ns_count > 0) { @@ -1387,7 +1387,7 @@ static fnet_int32_t fnet_mdns_cmp_rr(fnet_uint8_t *our_rr, const fnet_uint8_t ** fnet_uint16_t rr_type; /* RR type */ fnet_uint16_t rr_class; /* RR class */ const fnet_uint8_t *rr_data; - fnet_uint16_t rr_data_length; + fnet_uint16_t rr_data_length; fnet_mdns_rr_header_t *rr_header; const fnet_uint8_t *ptr = *rr; fnet_char_t rr_name[FNET_MDNS_RR_NAME_LEN_MAX]; @@ -1395,7 +1395,7 @@ static fnet_int32_t fnet_mdns_cmp_rr(fnet_uint8_t *our_rr, const fnet_uint8_t ** fnet_uint16_t our_rr_class; /* RR class */ const fnet_uint8_t *our_rr_data; fnet_uint16_t our_rr_data_length; - fnet_mdns_rr_header_t *our_rr_header; + fnet_mdns_rr_header_t *our_rr_header; fnet_int32_t result; our_rr_header = (fnet_mdns_rr_header_t *)(our_rr + fnet_strlen((char *)our_rr)+1); @@ -1418,17 +1418,17 @@ static fnet_int32_t fnet_mdns_cmp_rr(fnet_uint8_t *our_rr, const fnet_uint8_t ** if(ptr) { rr_header = (fnet_mdns_rr_header_t *)ptr; - ptr += sizeof(fnet_mdns_rr_header_t); + ptr += sizeof(fnet_mdns_rr_header_t); rr_data_length = FNET_HTONS(rr_header->data_length); - + /* Compare RR names.*/ if(fnet_strcmp((char*)our_rr, (char*)rr_name) == 0) { rr_data = ptr; rr_class = FNET_HTONS(rr_header->rr_class) & (~FNET_HTONS(FNET_MDNS_HEADER_CACHE_FLUSH)); rr_type = FNET_HTONS(rr_header->type); - + /* RFC6762: The determination of "lexicographically later" is performed by first comparing the record class (excluding the cache-flush bit described in Section 10.2), then the record type, then raw comparison of the @@ -1447,7 +1447,7 @@ static fnet_int32_t fnet_mdns_cmp_rr(fnet_uint8_t *our_rr, const fnet_uint8_t ** { /* RFC6762: Otherwise, if the record types differ, then the numerically greater type is considered - "lexicographically later".*/ + "lexicographically later".*/ if(rr_type < our_rr_type) { result = 1; /* Win. */ @@ -1457,21 +1457,21 @@ static fnet_int32_t fnet_mdns_cmp_rr(fnet_uint8_t *our_rr, const fnet_uint8_t ** result = -1; /* Loss. */ } /* RFC6762: If the rrtype and rrclass both match, - then the rdata is compared.*/ - else if(rr_data_length) + then the rdata is compared.*/ + else if(rr_data_length) { int cmp_res; fnet_uint16_t cmp_length; - + cmp_length = (rr_data_length > our_rr_data_length)? our_rr_data_length : rr_data_length; /* Get min length value */ - + cmp_res = fnet_memcmp(rr_data, our_rr_data, cmp_length); - + if(cmp_res < 0) { result = 1; /* Win. */ - } - else if (cmp_res > 0) + } + else if (cmp_res > 0) { result = -1; /* Loss. */ } @@ -1498,7 +1498,7 @@ static fnet_int32_t fnet_mdns_cmp_rr(fnet_uint8_t *our_rr, const fnet_uint8_t ** } else { - result = 1; + result = 1; } } } @@ -1559,18 +1559,18 @@ static fnet_bool_t fnet_mdns_is_rr_win(fnet_uint8_t *our_rr, const fnet_uint8_t if(i == ns_count) { - result = FNET_FALSE; + result = FNET_FALSE; } else { - result = FNET_TRUE; + result = FNET_TRUE; } return result; } /************************************************************************ -* DESCRIPTION: Process MDNS response +* DESCRIPTION: Process MDNS response ************************************************************************/ static const fnet_uint8_t *fnet_mdns_process_response(fnet_mdns_if_t *mdns_if, const fnet_uint8_t * ptr, fnet_uint8_t *packet, fnet_uint32_t packet_size) { @@ -1581,7 +1581,7 @@ static const fnet_uint8_t *fnet_mdns_process_response(fnet_mdns_if_t *mdns_if, c fnet_char_t rr_name[FNET_MDNS_RR_NAME_LEN_MAX]; /* Header follows the hostname and the terminating zero */ - fnet_mdns_rr_header_t *rr_header; + fnet_mdns_rr_header_t *rr_header; if( packet_size > (sizeof(fnet_mdns_header_t) + sizeof(fnet_mdns_rr_header_t)) ) /* TND make it universal*/ { @@ -1599,8 +1599,8 @@ static const fnet_uint8_t *fnet_mdns_process_response(fnet_mdns_if_t *mdns_if, c && ( rr_header->rr_class == FNET_HTONS((FNET_MDNS_HEADER_CLASS_IN | FNET_MDNS_HEADER_CACHE_FLUSH)) ) #if 0 /* Cause of Test warnings.*/ && ((rr_header->type == FNET_HTONS(FNET_MDNS_RR_SRV)) || - (rr_header->type == FNET_HTONS(FNET_MDNS_RR_A)) || - (rr_header->type == FNET_HTONS(FNET_MDNS_RR_AAAA))) + (rr_header->type == FNET_HTONS(FNET_MDNS_RR_A)) || + (rr_header->type == FNET_HTONS(FNET_MDNS_RR_AAAA))) #endif ) /* service instance name */ { @@ -1655,7 +1655,7 @@ static void fnet_mdns_recv(fnet_mdns_if_t *mdns_if) const fnet_uint8_t *ptr; fnet_index_t i; fnet_size_t addr_len; - + /* Receive UDP data */ addr_len = sizeof(mdns_if->remote_address); received = fnet_socket_recvfrom( mdns_if->socket_listen, mdns_if->buffer, sizeof(mdns_if->buffer), 0u, &mdns_if->remote_address, &addr_len ); @@ -1670,9 +1670,9 @@ static void fnet_mdns_recv(fnet_mdns_if_t *mdns_if) if((size_t)received > sizeof(fnet_mdns_header_t)) { mdns_header = (fnet_mdns_header_t*)&mdns_if->buffer[0]; - + char *hostname = (char*)&mdns_if->buffer[sizeof(fnet_mdns_header_t)]; - + /* Query */ if( ((mdns_header->flags & FNET_HTONS(FNET_MDNS_HEADER_FLAGS_QR)) == 0) /* Query.*/ && ((mdns_header->flags & FNET_HTONS(FNET_MDNS_HEADER_FLAGS_OPCODE)) == 0) ) /* Standard Query */ @@ -1685,7 +1685,7 @@ static void fnet_mdns_recv(fnet_mdns_if_t *mdns_if) { mdns_if->is_legacy_unicast = FNET_FALSE; } - + if( (mdns_header->flags & FNET_HTONS(FNET_MDNS_HEADER_FLAGS_TC)) == 0) /* Trancation.*/ { mdns_if->is_truncated = FNET_FALSE; @@ -1694,7 +1694,7 @@ static void fnet_mdns_recv(fnet_mdns_if_t *mdns_if) { mdns_if->is_truncated = FNET_TRUE; } - + ptr = (fnet_uint8_t*)hostname; for(i=0; iqdcount); i++) { @@ -1704,14 +1704,14 @@ static void fnet_mdns_recv(fnet_mdns_if_t *mdns_if) return; } } - + /* Duplicate Suppression.*/ if(mdns_if->response_type != FNET_MDNS_QUERY_NONE) { const fnet_uint8_t *an_ptr; - + an_ptr = fnet_mdns_get_an(mdns_if->buffer, received); - + /* Eliminate duplicated answers */ if(an_ptr) { @@ -1728,7 +1728,7 @@ static void fnet_mdns_recv(fnet_mdns_if_t *mdns_if) ) { cnt = FNET_HTONS(mdns_header->nscount) + FNET_HTONS(mdns_header->arcount) + FNET_HTONS(mdns_header->ancount) + FNET_HTONS(mdns_header->qdcount); - + ptr = (fnet_uint8_t*)hostname; for(i=0; (i < cnt) && (ptr < (mdns_if->buffer + received)); i++) { @@ -1747,11 +1747,11 @@ static void fnet_mdns_recv(fnet_mdns_if_t *mdns_if) break; } } - + } /************************************************************************ -* DESCRIPTION: Prepare domain name - replace dots by length of string +* DESCRIPTION: Prepare domain name - replace dots by length of string ************************************************************************/ static fnet_uint8_t *fnet_mdns_add_domain_name(fnet_uint8_t *buf, fnet_uint32_t buf_size, const char * domain_name) { @@ -1760,7 +1760,7 @@ static fnet_uint8_t *fnet_mdns_add_domain_name(fnet_uint8_t *buf, fnet_uint32_t fnet_uint32_t domain_len = fnet_strlen(domain_name) + 1; fnet_uint32_t len = 0; - fnet_index_t i; + fnet_index_t i; fnet_index_t p = 0; fnet_uint8_t *result = NULL; @@ -1898,7 +1898,7 @@ static void fnet_mdns_send_probe(fnet_mdns_if_t *mdns_if) } nscount++; #endif - + /* Prepare RR AAAA record */ ptr = fnet_mdns_add_rr_aaaa(mdns_if, ptr, (buf_end - ptr), mdns_if->rr_ttl_ip, FNET_FALSE, FNET_TRUE); if(ptr == NULL) @@ -2031,7 +2031,7 @@ static void fnet_mdns_send_response(fnet_mdns_if_t *mdns_if, fnet_uint32_t ttl, /* Answer records */ for(i = 0; iservice_if_list[i].service_type) + if(mdns_if->service_if_list[i].service_type) { /* Prepare TXT record */ if(mdns_if->service_if_list[i].response_type & FNET_MDNS_QUERY_TXT) @@ -2076,7 +2076,7 @@ static void fnet_mdns_send_response(fnet_mdns_if_t *mdns_if, fnet_uint32_t ttl, #if FNET_CFG_IP4 // Do not send A record in IPV6 only stack /* Prepare RR A record */ - if(mdns_if->response_type & FNET_MDNS_QUERY_A) + if(mdns_if->response_type & FNET_MDNS_QUERY_A) { ptr = fnet_mdns_add_rr_a(mdns_if, ptr, (buf_end - ptr), ttl, flush, FNET_TRUE); if(ptr == NULL) @@ -2108,7 +2108,7 @@ static void fnet_mdns_send_response(fnet_mdns_if_t *mdns_if, fnet_uint32_t ttl, o All address records (type "A" and "AAAA") named in the SRV rdata.*/ for(i = 0; iservice_if_list[i].service_type) + if(mdns_if->service_if_list[i].service_type) { if(mdns_if->service_if_list[i].response_type & FNET_MDNS_QUERY_PTR) { @@ -2442,7 +2442,7 @@ static fnet_uint8_t * fnet_mdns_add_rr_aaaa(fnet_mdns_if_t *mdns_if, fnet_uint8_ fnet_netif_ip6_addr_info_t addr_info = {.state = FNET_NETIF_IP6_ADDR_STATE_NOT_USED}; fnet_netif_get_ip6_addr (mdns_if->netif, 0u, &addr_info); /* Just get 1st address.*/ - + ptr = fnet_mdns_add_host_name(mdns_if, ptr, (buf+buf_size) - ptr, compression); if(ptr == NULL) { @@ -2522,7 +2522,7 @@ static fnet_uint8_t * fnet_mdns_add_host_name(fnet_mdns_if_t *mdns_if, fnet_uint { FNET_ASSERT(mdns_if != NULL); FNET_ASSERT(buf != NULL); - + fnet_uint8_t *ptr = buf; fnet_uint8_t *result = NULL; @@ -2541,7 +2541,7 @@ static fnet_uint8_t * fnet_mdns_add_host_name(fnet_mdns_if_t *mdns_if, fnet_uint { /* Offset, used by Domain Name Compression.*/ fnet_uint16_t offset = ptr - mdns_if->buffer; - + if(offset <= 0x3FFF) /* Check offset maximum value.*/ { mdns_if->offset_host_name = offset; @@ -2578,7 +2578,7 @@ static fnet_uint8_t * fnet_mdns_add_service_name(fnet_mdns_if_t *mdns_if, fnet_u { FNET_ASSERT(mdns_if != NULL); FNET_ASSERT(buf != NULL); - + fnet_uint16_t offset; fnet_uint8_t *ptr = buf; fnet_uint8_t *result = NULL; @@ -2700,14 +2700,14 @@ ERROR: } /************************************************************************ -* DESCRIPTION: Determines if host_name is our fully qualified domain +* DESCRIPTION: Determines if host_name is our fully qualified domain * name FQDN (hostname.domain). ************************************************************************/ static fnet_bool_t fnet_mdns_is_our_host_name(fnet_mdns_if_t *mdns_if, char *host_name) { FNET_ASSERT(mdns_if != NULL); - return fnet_mdns_cmp_rr_name(host_name, "", mdns_if->host_name); + return fnet_mdns_cmp_rr_name(host_name, "", mdns_if->host_name); } /************************************************************************ @@ -2722,7 +2722,7 @@ static fnet_mdns_service_if_t *fnet_mdns_get_service_by_name(fnet_mdns_if_t *mdn for(i = 0; iservice_if_list[i].service_type != NULL) + if(mdns_if->service_if_list[i].service_type != NULL) { if(fnet_mdns_cmp_rr_name(service_name, mdns_if->service_name, mdns_if->service_if_list[i].service_type) == FNET_TRUE) { @@ -2747,7 +2747,7 @@ static fnet_mdns_service_if_t *fnet_mdns_get_service_by_type(fnet_mdns_if_t *mdn for(i = 0; iservice_if_list[i].service_type != NULL) + if(mdns_if->service_if_list[i].service_type != NULL) { if(fnet_mdns_cmp_rr_name(service_name, "", mdns_if->service_if_list[i].service_type) == FNET_TRUE) { diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/mdns/fnet_mdns.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/mdns/fnet_mdns.h index ff3e2f7119..3c2cd12bf2 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/mdns/fnet_mdns.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/mdns/fnet_mdns.h @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2017, Arm Limited and affiliates. +* Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2016 by Andrey Butok. FNET Community. * @@ -71,7 +71,7 @@ struct fnet_mdns_params }; /**************************************************************************/ /*! - * @brief The mDNS Service structure defining application-specific + * @brief The mDNS Service structure defining application-specific * service, advertised by the mDNS server. * @see fnet_mdns_service_register() ******************************************************************************/ @@ -79,7 +79,7 @@ typedef struct fnet_mdns_service { const char* service_type; /**< @brief Service Type. Null-terminated string. Example "_http._tcp". */ fnet_uint16_t service_port; /**< @brief Service Port number (in network byte order). */ - const fnet_uint8_t* (*service_get_txt)(void); /**< @brief Call-back function, which returns a pointer to the service TXT record (null-terminated). + const fnet_uint8_t* (*service_get_txt)(void); /**< @brief Call-back function, which returns a pointer to the service TXT record (null-terminated). If the service does not provide any TXT record, this parameter must be set to NULL. */ } fnet_mdns_service_t; @@ -173,7 +173,7 @@ fnet_mdns_service_desc_t fnet_mdns_service_register(fnet_mdns_desc_t mdns_desc, ****************************************************************************** * * This function unregisters application service, assigned to the @c service_desc - * descriptor, and stops its advertisement by the mDNS server. + * descriptor, and stops its advertisement by the mDNS server. * ******************************************************************************/ void fnet_mdns_service_unregister(fnet_mdns_service_desc_t service_desc); @@ -189,7 +189,7 @@ void fnet_mdns_service_unregister(fnet_mdns_service_desc_t service_desc); ****************************************************************************** * * This function sends unsolicited mDNS announcement.@n - * Application may call it when any advertised application-specific parameter + * Application may call it when any advertised application-specific parameter * has changed (e.g. network interface IP address or service TXT-record content).@n * RFC 6762: "At any time, if the rdata of any of a host's Multicast DNS records * changes, the host MUST repeat the Announcing step to diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/poll/fnet_poll.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/poll/fnet_poll.c index 8dbd864af9..608d7b5729 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/poll/fnet_poll.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/poll/fnet_poll.c @@ -1,5 +1,5 @@ /************************************************************************** -* Copyright (c) 2017, Arm Limited and affiliates. +* Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2011-2016 by Andrey Butok. FNET Community. * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc. diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/serial/fnet_serial.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/serial/fnet_serial.h index 3bfde79520..f2268124e0 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/serial/fnet_serial.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/serial/fnet_serial.h @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2017, Arm Limited and affiliates. +* Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2011-2016 by Andrey Butok. FNET Community. * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc. diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/stack/fnet_debug.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/stack/fnet_debug.h index b918c9b10b..fa26aa6bd8 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/stack/fnet_debug.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/stack/fnet_debug.h @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2017, Arm Limited and affiliates. +* Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2011-2016 by Andrey Butok. FNET Community. * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc. diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/stack/fnet_stdlib.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/stack/fnet_stdlib.c index 61c2580ce4..0627d706b2 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/stack/fnet_stdlib.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet/fnet_stack/stack/fnet_stdlib.c @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2017, Arm Limited and affiliates. +* Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2011-2016 by Andrey Butok. FNET Community. * Copyright 2008-2010 by Freescale Semiconductor, Inc. diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet_user_config.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet_user_config.h index 3c74283898..d94de3e1a7 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet_user_config.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/fnet_user_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_fnet_events.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_fnet_events.c index 1749e7b258..71e150010d 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_fnet_events.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_fnet_events.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_fnet_events.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_fnet_events.h index 9a3afae865..ded8a0207e 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_fnet_events.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_fnet_events.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_fnet_port.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_fnet_port.c index 456a2f200e..5b7dc1553d 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_fnet_port.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_fnet_port.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_fnet_types.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_fnet_types.h index 6609d381e4..9d8c9ed914 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_fnet_types.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_fnet_types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_mdns_api.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_mdns_api.c index e0c8958146..2afb44fffa 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_mdns_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mdns/ns_mdns_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service.c index 37e53276fe..27ff6fda9a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_api.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_api.h index 76a91950dc..d22f2b5e47 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_buffer.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_buffer.c index 834f96edf0..ec115fde19 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_buffer.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_buffer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_buffer.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_buffer.h index 4f10475920..3c16bd309b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_buffer.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_frame_counter_table.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_frame_counter_table.c index 14af37f30d..161d1388d2 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_frame_counter_table.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_frame_counter_table.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_frame_counter_table.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_frame_counter_table.h index 3505a5f458..4b0fab63fa 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_frame_counter_table.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_frame_counter_table.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_interface.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_interface.c index 63ce08e351..4709e51041 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_interface.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_interface.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_interface.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_interface.h index 32166cf343..b42c175876 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_interface.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_security.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_security.c index 33c11d2e48..bcb8cf2949 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_security.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_security.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_security.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_security.h index 1d3e3f033e..1be73812c6 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_security.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/mle_service/mle_service_security.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/nd_proxy/nd_proxy.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/nd_proxy/nd_proxy.c index d1501b865a..6d75180313 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/nd_proxy/nd_proxy.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/nd_proxy/nd_proxy.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/nd_proxy/nd_proxy.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/nd_proxy/nd_proxy.h index 004d10f325..66ef803308 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/nd_proxy/nd_proxy.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/nd_proxy/nd_proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/nist_aes_kw/nist_aes_kw.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/nist_aes_kw/nist_aes_kw.c index 5345c0deda..98f6a69812 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/nist_aes_kw/nist_aes_kw.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/nist_aes_kw/nist_aes_kw.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/nist_aes_kw/nist_aes_kw.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/nist_aes_kw/nist_aes_kw.h index 9f2eed8aab..216787cacb 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/nist_aes_kw/nist_aes_kw.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/nist_aes_kw/nist_aes_kw.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/pan_blacklist/pan_blacklist.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/pan_blacklist/pan_blacklist.c index 0efcffc970..7fe33be24d 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/pan_blacklist/pan_blacklist.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/pan_blacklist/pan_blacklist.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/pan_blacklist/pan_blacklist_api.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/pan_blacklist/pan_blacklist_api.h index f71cd80014..1c1a007e97 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/pan_blacklist/pan_blacklist_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/pan_blacklist/pan_blacklist_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/random_early_detection/random_early_detection.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/random_early_detection/random_early_detection.c index b1a4b73d74..2dd82535df 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/random_early_detection/random_early_detection.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/random_early_detection/random_early_detection.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/random_early_detection/random_early_detection.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/random_early_detection/random_early_detection.h index 9f81ed660c..fc4ede2e00 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/random_early_detection/random_early_detection.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/random_early_detection/random_early_detection.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/random_early_detection/random_early_detection_api.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/random_early_detection/random_early_detection_api.h index dcefc35ec8..9fe9e595f4 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/random_early_detection/random_early_detection_api.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/random_early_detection/random_early_detection_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/isqrt.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/isqrt.c index 85ca0c07f3..3b087d2b44 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/isqrt.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/isqrt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/isqrt.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/isqrt.h index 373a74244a..7d5f7d495b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/isqrt.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/isqrt.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2015, 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_conf.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_conf.c index affc32cc8b..e6f105c0e3 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_conf.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_conf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_crc.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_crc.c index 40e85f96f2..505f3bee99 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_crc.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_crc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2015, 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_crc.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_crc.h index 92fad32272..4011fb33a4 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_crc.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_crc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_file.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_file.h index 8ba32133a6..0ec436c59d 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_file.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_file.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_file_system.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_file_system.c index a7202ccdd0..729f7eaf4a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_file_system.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_file_system.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_time.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_time.c new file mode 100644 index 0000000000..9e8bf761b3 --- /dev/null +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_time.c @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2021, Pelion and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include "ns_types.h" +#include "ns_time_api.h" //ns_time_api_system_time_callback + +static ns_time_api_system_time_callback *system_time_read_callback = NULL; +static ns_time_api_system_time_write_callback *system_time_write_callback = NULL; + +void ns_time_api_system_time_callback_set(ns_time_api_system_time_callback callback_rd) +{ + system_time_read_callback = callback_rd; +} + +void ns_time_api_system_time_write_callback_set(ns_time_api_system_time_write_callback callback_wr) +{ + system_time_write_callback = callback_wr; +} + +int ns_time_system_time_write(uint64_t time_write) +{ + if (system_time_write_callback) { + system_time_write_callback(time_write); + return 0; + } + + return -1; +} + +int ns_time_system_time_read(uint64_t *time_read) +{ + if (system_time_read_callback && time_read) { + uint64_t new_time = system_time_read_callback(); + *time_read = new_time; + return 0; + } + + return -1; +} diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_time.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_time.h new file mode 100644 index 0000000000..27299ce0bb --- /dev/null +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/utils/ns_time.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2021, Pelion and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _NS_TIME_H_ +#define _NS_TIME_H_ + +/** + * \file ns_time.h + * \brief Nanostack internal time handling API. + */ + +/** + * Write new time as a platform time + * + * Write a new time to platform provided time system. + * Platform time callbacks must be set by using method ns_time_api_system_time_callbacks_set. + * + * \param time_write time to be written as a new system time. + * + * \return 0 in success. + * \return <0 in case of errors. + * + */ +int ns_time_system_time_write(uint64_t time_write); + +/** + * Read platform time from a time callback + * + * Read a new time from time system provided by the platform. + * Platform time callbacks must be set by using the method ns_time_api_system_time_callbacks_set. + * + * \param time_read Address to variable where new time will be written. + * + * \return 0 in success. + * \return <0 in case of errors. + * + */ +int ns_time_system_time_read(uint64_t *time_read); + + + +#endif /* _NS_TIME_H_ */ diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/whiteboard/whiteboard.c b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/whiteboard/whiteboard.c index eb6c205bdb..7f9f723498 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/whiteboard/whiteboard.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/whiteboard/whiteboard.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/whiteboard/whiteboard.h b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/whiteboard/whiteboard.h index e3e22db395..a345ad794b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/whiteboard/whiteboard.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/whiteboard/whiteboard.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_ethernet.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_ethernet.h index 6c1b6c0156..bbede4f134 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_ethernet.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_ethernet.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_local_socket.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_local_socket.h index 4eed70c531..9863bb429c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_local_socket.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_local_socket.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_lowpan_border_router.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_lowpan_border_router.h index 56b598e7f1..a84e36f619 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_lowpan_border_router.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_lowpan_border_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_lowpan_host.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_lowpan_host.h index 11484d1b45..edc1452ca4 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_lowpan_host.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_lowpan_host.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_lowpan_router.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_lowpan_router.h index 6dd4a93471..2da787699c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_lowpan_router.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_lowpan_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_rf_tunnel.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_rf_tunnel.h index 6e6b09acb0..7b149ef345 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_rf_tunnel.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_rf_tunnel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_thread_border_router.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_thread_border_router.h index be579f1e39..94bd589ee7 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_thread_border_router.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_thread_border_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_thread_end_device.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_thread_end_device.h index 4cab9f26a1..4bd01abb70 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_thread_end_device.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_thread_end_device.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_thread_full_end_device.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_thread_full_end_device.h index 7a605f4d1d..94a65ec352 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_thread_full_end_device.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_thread_full_end_device.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_thread_router.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_thread_router.h index a15d0ba5a3..216d897c61 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_thread_router.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_thread_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_ws_border_router.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_ws_border_router.h index d2fec89889..b3df78d00a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_ws_border_router.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_ws_border_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_ws_router.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_ws_router.h index 4822bbc37e..a8a07c5700 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_ws_router.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/base/cfg_ws_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_ethernet_host.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_ethernet_host.h index 7a68772bc1..38ed1114c6 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_ethernet_host.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_ethernet_host.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_generic.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_generic.h index 9ed2d221e5..d17b137850 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_generic.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_generic.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2014, 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_border_router.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_border_router.h index 6ec843c10e..589fa2755a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_border_router.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_border_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2015-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_border_router_rf_tunnel.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_border_router_rf_tunnel.h index bad9374019..e5128b8799 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_border_router_rf_tunnel.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_border_router_rf_tunnel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_border_router_rf_tunnel_ecc.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_border_router_rf_tunnel_ecc.h index 63fd2ca007..195cd83980 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_border_router_rf_tunnel_ecc.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_border_router_rf_tunnel_ecc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2015-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_border_router_rf_tunnel_ecc_release.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_border_router_rf_tunnel_ecc_release.h index 2a7ae8bf99..c0df866a62 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_border_router_rf_tunnel_ecc_release.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_border_router_rf_tunnel_ecc_release.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2015-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_host.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_host.h index 03533192aa..36fd650020 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_host.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_host.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2015-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_router.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_router.h index b119cc3e9d..58449203e7 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_router.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2015-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_router_ecc.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_router_ecc.h index be863e9c5b..37dc24ef6f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_router_ecc.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_router_ecc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_router_ecc_release.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_router_ecc_release.h index f189344917..c1ddcb5315 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_router_ecc_release.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_lowpan_router_ecc_release.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_nanostack_full.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_nanostack_full.h index 9aa6ba0738..0510e0cb3f 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_nanostack_full.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_nanostack_full.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2014-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_nanostack_full_debug.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_nanostack_full_debug.h index 980a0499e4..19658939a6 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_nanostack_full_debug.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_nanostack_full_debug.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2015-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_rf_interface.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_rf_interface.h index e4d1787adf..e046bcf4a7 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_rf_interface.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_rf_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_border_router.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_border_router.h index bf0df9a149..0a992bd360 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_border_router.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_border_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_end_device.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_end_device.h index 1b7d93d89c..b4ae613d6a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_end_device.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_end_device.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_full_end_device.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_full_end_device.h index 92ebdccc05..f14397da44 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_full_end_device.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_full_end_device.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_router.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_router.h index f348ccd5de..850b030bb2 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_router.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2015-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_thci.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_thci.h index ad66413a0a..d2257b0e71 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_thci.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_thread_thci.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_ws_border_router.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_ws_border_router.h index 102890cc60..8927f82837 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_ws_border_router.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_ws_border_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_ws_router.h b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_ws_router.h index b3ce93f785..a4cf952501 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_ws_router.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/configs/cfg_ws_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/ipv6_stack/ipv6_routing_table.c b/connectivity/nanostack/sal-stack-nanostack/source/ipv6_stack/ipv6_routing_table.c index 0cbc0a4065..d036455eca 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/ipv6_stack/ipv6_routing_table.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/ipv6_stack/ipv6_routing_table.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2019, Arm Limited and affiliates. + * Copyright (c) 2012-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/ipv6_stack/ipv6_routing_table.h b/connectivity/nanostack/sal-stack-nanostack/source/ipv6_stack/ipv6_routing_table.h index ce7eb22476..735ab3f56b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/ipv6_stack/ipv6_routing_table.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/ipv6_stack/ipv6_routing_table.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2012, 2014-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/ipv6_stack/protocol_ipv6.c b/connectivity/nanostack/sal-stack-nanostack/source/ipv6_stack/protocol_ipv6.c index b7cd9218fa..6041ac623a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/ipv6_stack/protocol_ipv6.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/ipv6_stack/protocol_ipv6.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2019, Arm Limited and affiliates. + * Copyright (c) 2012-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/ipv6_stack/protocol_ipv6.h b/connectivity/nanostack/sal-stack-nanostack/source/ipv6_stack/protocol_ipv6.h index 51bbc911a7..4370cdbee0 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/ipv6_stack/protocol_ipv6.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/ipv6_stack/protocol_ipv6.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/dhcp_service_api.c b/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/dhcp_service_api.c index 78dddce5ad..db8dd42ba2 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/dhcp_service_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/dhcp_service_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -75,7 +75,9 @@ typedef struct { void *client_obj_ptr; uint32_t msg_tr_id; uint32_t message_tr_id; + uint32_t transmit_time; uint32_t first_transmit_time; + uint16_t delayed_tx; uint16_t timeout; uint16_t timeout_init; uint16_t timeout_max; @@ -768,7 +770,7 @@ int dhcp_service_send_resp(uint32_t msg_tr_id, uint8_t options, uint8_t *msg_ptr dhcp_tr_delete(msg_tr_ptr); return 0; } -uint32_t dhcp_service_send_req(uint16_t instance_id, uint8_t options, void *ptr, const uint8_t addr[static 16], uint8_t *msg_ptr, uint16_t msg_len, dhcp_service_receive_resp_cb *receive_resp_cb) +uint32_t dhcp_service_send_req(uint16_t instance_id, uint8_t options, void *ptr, const uint8_t addr[static 16], uint8_t *msg_ptr, uint16_t msg_len, dhcp_service_receive_resp_cb *receive_resp_cb, uint16_t delay_tx) { tr_debug("Send DHCPv6 request"); msg_tr_t *msg_tr_ptr; @@ -792,7 +794,9 @@ uint32_t dhcp_service_send_req(uint16_t instance_id, uint8_t options, void *ptr, msg_tr_ptr->instance_id = instance_id; msg_tr_ptr->socket = dhcp_service->dhcp_client_socket; msg_tr_ptr->recv_resp_cb = receive_resp_cb; - msg_tr_ptr->first_transmit_time = protocol_core_monotonic_time; + msg_tr_ptr->delayed_tx = delay_tx; + msg_tr_ptr->first_transmit_time = 0; + msg_tr_ptr->transmit_time = 0; dhcp_tr_set_retry_timers(msg_tr_ptr, msg_tr_ptr->msg_ptr[0]); common_write_24_bit(msg_tr_ptr->msg_tr_id, &msg_tr_ptr->msg_ptr[1]); @@ -824,6 +828,16 @@ void dhcp_service_update_server_address(uint32_t msg_tr_id, uint8_t *server_addr } } +uint32_t dhcp_service_rtt_get(uint32_t msg_tr_id) +{ + msg_tr_t *msg_tr_ptr = dhcp_tr_find(msg_tr_id); + + if (msg_tr_ptr && msg_tr_ptr->transmit_time) { + return protocol_core_monotonic_time - msg_tr_ptr->transmit_time; + } + return 0; +} + void dhcp_service_req_remove(uint32_t msg_tr_id) { if (dhcp_service) { @@ -850,8 +864,9 @@ void dhcp_service_send_message(msg_tr_t *msg_tr_ptr) const uint32_t address_pref = SOCKET_IPV6_PREFER_SRC_6LOWPAN_SHORT; dhcp_options_msg_t elapsed_time; - if (libdhcpv6_message_option_discover((msg_tr_ptr->msg_ptr + 4), (msg_tr_ptr->msg_len - 4), DHCPV6_ELAPSED_TIME_OPTION, &elapsed_time) == 0 && + if (msg_tr_ptr->first_transmit_time && libdhcpv6_message_option_discover((msg_tr_ptr->msg_ptr + 4), (msg_tr_ptr->msg_len - 4), DHCPV6_ELAPSED_TIME_OPTION, &elapsed_time) == 0 && elapsed_time.len == 2) { + uint32_t t = protocol_core_monotonic_time - msg_tr_ptr->first_transmit_time; // time in 1/10s ticks uint16_t cs; if (t > 0xffff / 10) { @@ -911,12 +926,25 @@ void dhcp_service_send_message(msg_tr_t *msg_tr_ptr) uint8_t *ptr = msg_tr_ptr->relay_start; *ptr = DHCPV6_RELAY_REPLY; - retval = socket_sendmsg(msg_tr_ptr->socket, &msghdr, NS_MSG_LEGACY0); + if (msg_tr_ptr->delayed_tx) { + retval = 0; + } else { + retval = socket_sendmsg(msg_tr_ptr->socket, &msghdr, NS_MSG_LEGACY0); + } } else { - int16_t tc = 0; - socket_setsockopt(msg_tr_ptr->socket, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_TCLASS, &tc, sizeof(tc)); - retval = socket_sendto(msg_tr_ptr->socket, &msg_tr_ptr->addr, msg_tr_ptr->msg_ptr, msg_tr_ptr->msg_len); + if (msg_tr_ptr->delayed_tx) { + retval = 0; + } else { + int16_t tc = 0; + socket_setsockopt(msg_tr_ptr->socket, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_TCLASS, &tc, sizeof(tc)); + retval = socket_sendto(msg_tr_ptr->socket, &msg_tr_ptr->addr, msg_tr_ptr->msg_ptr, msg_tr_ptr->msg_len); + msg_tr_ptr->transmit_time = protocol_core_monotonic_time ? protocol_core_monotonic_time : 1; + if (msg_tr_ptr->first_transmit_time == 0 && retval == 0) { + //Mark first pushed message timestamp + msg_tr_ptr->first_transmit_time = protocol_core_monotonic_time ? protocol_core_monotonic_time : 1; + } + } } if (retval != 0) { tr_warn("dhcp service socket_sendto fails: %i", retval); @@ -928,6 +956,18 @@ bool dhcp_service_timer_tick(uint16_t ticks) { bool activeTimerNeed = false; ns_list_foreach_safe(msg_tr_t, cur_ptr, &dhcp_service->tr_list) { + + if (cur_ptr->delayed_tx) { + activeTimerNeed = true; + if (cur_ptr->delayed_tx <= ticks) { + cur_ptr->delayed_tx = 0; + dhcp_service_send_message(cur_ptr); + } else { + cur_ptr->delayed_tx -= ticks; + } + continue; + } + if (cur_ptr->timeout == 0) { continue; } @@ -1023,7 +1063,7 @@ int dhcp_service_send_resp(uint32_t msg_tr_id, uint8_t options, uint8_t *msg_ptr return -1; } -uint32_t dhcp_service_send_req(uint16_t instance_id, uint8_t options, void *ptr, const uint8_t addr[static 16], uint8_t *msg_ptr, uint16_t msg_len, dhcp_service_receive_resp_cb *receive_resp_cb) +uint32_t dhcp_service_send_req(uint16_t instance_id, uint8_t options, void *ptr, const uint8_t addr[static 16], uint8_t *msg_ptr, uint16_t msg_len, dhcp_service_receive_resp_cb *receive_resp_cb, uint16_t delay_tx) { (void)instance_id; (void)options; @@ -1032,6 +1072,7 @@ uint32_t dhcp_service_send_req(uint16_t instance_id, uint8_t options, void *ptr, (void)msg_ptr; (void)msg_len; (void)receive_resp_cb; + (void)delay_tx; return 0; } diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6.c b/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6.c index abc29b2272..4c32076c4b 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6.h b/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6.h index 5910bab190..247a251ee5 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2015, 2017-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6_server.c b/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6_server.c index 858d2f0931..87bdfe5a93 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6_server.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6_server.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -461,12 +461,12 @@ dhcpv6_vendor_data_t *libdhcpv6_vendor_data_allocate(dhcpv6_gua_server_entry_s * } ns_list_add_to_end(&serverInfo->vendorDataList, entry); entry->enterprise_number = enterprise_number; + entry->vendor_data_cb = NULL; entry->vendor_data = NULL; entry->vendor_data_length = 0; return entry; } - uint16_t libdhcpv6_dns_server_message_sizes(dhcpv6_gua_server_entry_s *serverInfo) { uint16_t message_size = 0; @@ -482,7 +482,13 @@ uint16_t libdhcpv6_vendor_data_message_sizes(dhcpv6_gua_server_entry_s *serverIn { uint16_t message_size = 0; ns_list_foreach(dhcpv6_vendor_data_t, cur, &serverInfo->vendorDataList) { - message_size += 4 + 4 + cur->vendor_data_length; //Type + Length + enterprise + vendor_data_length + uint16_t size = cur->vendor_data_length; //Type + Length + enterprise + vendor_data_length + if (cur->vendor_data_cb) { + cur->vendor_data_cb(serverInfo->interfaceId, NULL, &size); + } + if (size != 0) { + message_size += 2 + 2 + 4 + size; + } } return message_size; } @@ -510,7 +516,17 @@ uint8_t *libdhcpv6_vendor_data_message_writes(dhcpv6_gua_server_entry_s *serverI { ns_list_foreach(dhcpv6_vendor_data_t, cur, &serverInfo->vendorDataList) { - uint16_t length = cur->vendor_data_length + 4; + uint16_t length = cur->vendor_data_length; + + if (cur->vendor_data_cb) { + cur->vendor_data_cb(serverInfo->interfaceId, NULL, &length); + } + if (length == 0) { + // No vendor data + continue; + } + length += 4; + ptr = common_write_16_bit(DHCPV6_OPTION_VENDOR_SPECIFIC_INFO, ptr); ptr = common_write_16_bit(length, ptr); //Length ptr = common_write_32_bit(cur->enterprise_number, ptr); @@ -518,6 +534,9 @@ uint8_t *libdhcpv6_vendor_data_message_writes(dhcpv6_gua_server_entry_s *serverI memcpy(ptr, cur->vendor_data, cur->vendor_data_length); ptr += cur->vendor_data_length; } + if (cur->vendor_data_cb) { + ptr = cur->vendor_data_cb(serverInfo->interfaceId, ptr, NULL); + } } return ptr; } diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6_server.h b/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6_server.h index 4dab618b92..f7615ba7da 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6_server.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6_server.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2015, 2017-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -32,6 +32,8 @@ #define DHCP_ADDRESS_ID_START 2 typedef void (dhcp_address_prefer_remove_cb)(int8_t interfaceId, uint8_t *targetAddress, void *prefix_info); +typedef uint8_t *(dhcp_vendor_data_cb)(int8_t interfaceId, uint8_t *ptr, uint16_t *dhcp_vendor_data_len); + typedef struct dhcpv6_allocated_address_entry_s { uint8_t linkId[8]; /*!< Services UL64 */ @@ -54,8 +56,9 @@ typedef struct dhcpv6_dns_server_data_s { typedef struct dhcpv6_vendor_data_s { uint32_t enterprise_number; + dhcp_vendor_data_cb *vendor_data_cb; // Additional vendor data that can be set for individual reply uint8_t *vendor_data; - uint8_t vendor_data_length; + uint16_t vendor_data_length; ns_list_link_t link; /*!< List link entry */ } dhcpv6_vendor_data_t; diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6_vendordata.c b/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6_vendordata.c index 2854517d5e..fb6b909c7c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6_vendordata.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6_vendordata.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -98,3 +98,61 @@ uint16_t net_dns_option_vendor_option_data_dns_query_read(uint8_t *ptr, uint16_t } return option_len; } + +uint16_t net_vendor_option_current_time_length(void) +{ + return 4 + 3 * sizeof(uint32_t); +} + +uint8_t *net_vendor_option_current_time_write(uint8_t *ptr, int32_t era, uint32_t offset, uint32_t fraction) +{ + /* + * Time value written using NTP time format + * Following rfc5905 + */ + + ptr = common_write_16_bit(ARM_DHCP_VENDOR_DATA_NETWORK_TIME, ptr); + ptr = common_write_16_bit(3 * sizeof(uint32_t), ptr); + ptr = common_write_32_bit((uint32_t)era, ptr); + ptr = common_write_32_bit(offset, ptr); + ptr = common_write_32_bit(fraction, ptr); + return ptr; +} + +uint8_t *net_vendor_option_current_time_read(uint8_t *ptr, uint16_t length, int32_t *era, uint32_t *offset, uint32_t *fraction) +{ + /* + * Time value written using NTP time format + * Following rfc5905 + */ + uint16_t option_len; + + if (length < net_vendor_option_current_time_length()) { + // Corrupted as there is no room for all fields + return 0; + } + + if (common_read_16_bit(ptr) != ARM_DHCP_VENDOR_DATA_NETWORK_TIME) { + return 0; + } + + option_len = common_read_16_bit(ptr + 2); + ptr += 4; + + if (option_len < 3 * sizeof(uint32_t)) { + // Corrupted as not enough room for fields + return 0; + } + + if (era) { + *era = (int32_t)common_read_32_bit(ptr); + } + if (offset) { + *offset = common_read_32_bit(ptr + sizeof(uint32_t)); + } + if (fraction) { + *fraction = common_read_32_bit(ptr + 2 * sizeof(uint32_t)); + } + + return ptr; +} diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6_vendordata.h b/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6_vendordata.h index 1a1ef44f7f..a9974e8862 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6_vendordata.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/libDHCPv6/libDHCPv6_vendordata.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -32,6 +32,40 @@ * */ #define ARM_DHCP_VENDOR_DATA_DNS_QUERY_RESULT 297 +/* ARM Defined vendor data option to distribute network time through DHCP server + * Format. This can be used to syncronice the times of Wi-SUN devices to match the + * time of border router. + * + * Following rfc5905 date format. + * +-------------+------------+-----+---------------+------------------+ + * | Date | MJD | NTP | NTP Timestamp | Epoch | + * | | | Era | Era Offset | | + * +-------------+------------+-----+---------------+------------------+ + * | 1 Jan -4712 | -2,400,001 | -49 | 1,795,583,104 | 1st day Julian | + * | 1 Jan -1 | -679,306 | -14 | 139,775,744 | 2 BCE | + * | 1 Jan 0 | -678,491 | -14 | 171,311,744 | 1 BCE | + * | 1 Jan 1 | -678,575 | -14 | 202,939,144 | 1 CE | + * | 4 Oct 1582 | -100,851 | -3 | 2,873,647,488 | Last day Julian | + * | 15 Oct 1582 | -100,840 | -3 | 2,874,597,888 | First day | + * | | | | | Gregorian | + * | 31 Dec 1899 | 15019 | -1 | 4,294,880,896 | Last day NTP Era | + * | | | | | -1 | + * | 1 Jan 1900 | 15020 | 0 | 0 | First day NTP | + * | | | | | Era 0 | + * | 1 Jan 1970 | 40,587 | 0 | 2,208,988,800 | First day UNIX | + * | 1 Jan 1972 | 41,317 | 0 | 2,272,060,800 | First day UTC | + * | 31 Dec 1999 | 51,543 | 0 | 3,155,587,200 | Last day 20th | + * | | | | | Century | + * | 8 Feb 2036 | 64,731 | 1 | 63,104 | First day NTP | + * | | | | | Era 1 | + * +-------------+------------+-----+---------------+------------------+ + * int32_t Era + * uint32_t offset + * uint32_t fraction + * + * */ +#define ARM_DHCP_VENDOR_DATA_NETWORK_TIME 298 + /* DHCPv6 vendor options to distribute ARM vendor data*/ uint16_t net_dns_option_vendor_option_data_dns_query_length(char *domain); @@ -40,5 +74,9 @@ uint8_t *net_dns_option_vendor_option_data_dns_query_write(uint8_t *ptr, uint8_t uint16_t net_dns_option_vendor_option_data_get_next(uint8_t *ptr, uint16_t length, uint16_t *type); uint16_t net_dns_option_vendor_option_data_dns_query_read(uint8_t *ptr, uint16_t length, uint8_t **address, char **domain); +uint16_t net_vendor_option_current_time_length(void); +uint8_t *net_vendor_option_current_time_write(uint8_t *ptr, int32_t era, uint32_t offset, uint32_t fraction); +uint8_t *net_vendor_option_current_time_read(uint8_t *ptr, uint16_t length, int32_t *era, uint32_t *offset, uint32_t *fraction); + #endif /* LIBDHCPV6_VENDOR_DATA_H_ */ diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/multicast_api.c b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/multicast_api.c index 2f654dacb5..dfc64cf97c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/multicast_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/multicast_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_6lowpan_parameter_api.c b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_6lowpan_parameter_api.c index cd1649df3c..776c09f069 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_6lowpan_parameter_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_6lowpan_parameter_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_dns.c b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_dns.c index 7975ba89b6..7e4dc8d78c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_dns.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_dns.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_dns_internal.h b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_dns_internal.h index bd58dbb51b..7f2d15ef31 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_dns_internal.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_dns_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_ipv6.c b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_ipv6.c index f990c1b2b3..b9387b2d4c 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_ipv6.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_ipv6.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_load_balance.c b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_load_balance.c index a643d90fde..7dbbe1ae29 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_load_balance.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_load_balance.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_load_balance_internal.h b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_load_balance_internal.h index 7c073eb4fe..2b3dd926ee 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_load_balance_internal.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_load_balance_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_mle.c b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_mle.c index 39be3ee252..58c4776c49 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_mle.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_mle.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, 2019, Arm Limited and affiliates. + * Copyright (c) 2016-2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_rpl.c b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_rpl.c index 70e26a5c29..e15dcdc7ac 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_rpl.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_rpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_short_address_extension.c b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_short_address_extension.c index 3af8a11a6e..32e64edb5a 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_short_address_extension.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_short_address_extension.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_test.c b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_test.c index 89cb141eaf..ad1c9b236d 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_test.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/net_test.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/ns_net.c b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/ns_net.c index 09c3fc1b7b..dd3883c6ef 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/ns_net.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/ns_net.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/socket_api.c b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/socket_api.c index d02df10121..2de5d0d298 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/socket_api.c +++ b/connectivity/nanostack/sal-stack-nanostack/source/libNET/src/socket_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/source/nsconfig.h b/connectivity/nanostack/sal-stack-nanostack/source/nsconfig.h index dfb182a5af..0f55f1fdcf 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/nsconfig.h +++ b/connectivity/nanostack/sal-stack-nanostack/source/nsconfig.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/connectivity/nanostack/sal-stack-nanostack/sources.mk b/connectivity/nanostack/sal-stack-nanostack/sources.mk index ef0ec51253..7c5af85feb 100644 --- a/connectivity/nanostack/sal-stack-nanostack/sources.mk +++ b/connectivity/nanostack/sal-stack-nanostack/sources.mk @@ -123,6 +123,7 @@ SRCS += \ source/Security/protocols/gkh_sec_prot/supp_gkh_sec_prot.c \ source/Security/protocols/radius_sec_prot/radius_client_sec_prot.c \ source/Security/protocols/radius_sec_prot/avp_helper.c \ + source/Security/protocols/msg_sec_prot/msg_sec_prot.c \ source/Security/protocols/tls_sec_prot/tls_sec_prot.c \ source/Security/protocols/tls_sec_prot/tls_sec_prot_lib.c \ source/Security/PANA/eap_protocol.c \ @@ -211,6 +212,7 @@ SRCS += \ source/Service_Libs/utils/ns_crc.c \ source/Service_Libs/utils/isqrt.c \ source/Service_Libs/utils/ns_file_system.c \ + source/Service_Libs/utils/ns_time.c \ source/Service_Libs/utils/ns_conf.c \ source/Service_Libs/mdns/ns_mdns_api.c \ source/Service_Libs/mdns/ns_fnet_port.c \ From b3cced7d7fd82be06cf599aeadc8f4ec7742ff40 Mon Sep 17 00:00:00 2001 From: Arto Kinnunen Date: Wed, 23 Jun 2021 13:06:05 +0300 Subject: [PATCH 17/18] Update sal-stack-nanostack CMakeLists Add new files to CMakeLists.txt --- .../sal-stack-nanostack/source/Security/CMakeLists.txt | 2 ++ .../sal-stack-nanostack/source/Service_Libs/CMakeLists.txt | 1 + 2 files changed, 3 insertions(+) diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/CMakeLists.txt b/connectivity/nanostack/sal-stack-nanostack/source/Security/CMakeLists.txt index 38e3553a15..e43b5c0aae 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/CMakeLists.txt +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/CMakeLists.txt @@ -58,6 +58,8 @@ target_sources(mbed-nanostack-sal_stack protocols/gkh_sec_prot/supp_gkh_sec_prot.c protocols/key_sec_prot/key_sec_prot.c + + msg_sec_prot/msg_sec_prot.c protocols/radius_sec_prot/avp_helper.c protocols/radius_sec_prot/radius_client_sec_prot.c diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/CMakeLists.txt b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/CMakeLists.txt index fbaac0925c..b77b3bc784 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/CMakeLists.txt +++ b/connectivity/nanostack/sal-stack-nanostack/source/Service_Libs/CMakeLists.txt @@ -101,6 +101,7 @@ target_sources(mbed-nanostack-sal_stack utils/ns_conf.c utils/ns_crc.c utils/ns_file_system.c + utils/ns_time.c whiteboard/whiteboard.c ) From 9913b59901f0d99eb00ef73c6bc8acf797b938ce Mon Sep 17 00:00:00 2001 From: Arto Kinnunen Date: Tue, 29 Jun 2021 17:50:02 +0300 Subject: [PATCH 18/18] Update file path in CMakeLists.txt Folder 'protocols' was missing from the file path. --- .../sal-stack-nanostack/source/Security/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connectivity/nanostack/sal-stack-nanostack/source/Security/CMakeLists.txt b/connectivity/nanostack/sal-stack-nanostack/source/Security/CMakeLists.txt index e43b5c0aae..b945694ffa 100644 --- a/connectivity/nanostack/sal-stack-nanostack/source/Security/CMakeLists.txt +++ b/connectivity/nanostack/sal-stack-nanostack/source/Security/CMakeLists.txt @@ -59,7 +59,7 @@ target_sources(mbed-nanostack-sal_stack protocols/key_sec_prot/key_sec_prot.c - msg_sec_prot/msg_sec_prot.c + protocols/msg_sec_prot/msg_sec_prot.c protocols/radius_sec_prot/avp_helper.c protocols/radius_sec_prot/radius_client_sec_prot.c