From b8cd50fea2799c6f7b21fdd5b86d0800f4ba78fa Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:31:13 -0400 Subject: [PATCH 01/13] Migrate Zigbee firmware to SDK 2024.6.0 --- .gitignore | 3 +- src/ncp-uart-hw/.cproject | 226 ++++++++++++++++-- src/ncp-uart-hw/app.c | 2 +- .../config/btl_interface_cfg_s2c1.h | 90 +++---- .../config/emlib_core_debug_config.h | 2 +- src/ncp-uart-hw/config/sl_core_config.h | 44 ++++ .../config/sl_device_init_lfxo_config.h | 22 -- ...fig.h => sl_interrupt_manager_s2_config.h} | 32 +-- .../config/sl_memory_manager_config.h | 49 ++++ .../config/sl_memory_manager_region_config.h | 49 ++++ .../config/sl_power_manager_config.h | 14 ++ .../config/sl_zigbee_green_power_config.h | 28 +-- .../config/sl_zigbee_light_link_config.h | 12 +- .../config/sl_zigbee_pro_stack_config.h | 71 +++--- .../sl_zigbee_security_link_keys_config.h | 8 +- .../config/sl_zigbee_source_route_config.h | 8 +- .../zigbee_watchdog_periodic_refresh_config.h | 34 --- src/ncp-uart-hw/main.c | 2 +- src/ncp-uart-hw/ncp-uart-hw.slcp | 15 +- src/ncp-uart-hw/ncp-uart-hw.slps | 3 +- .../sl_zigbee_watchdog_periodic_refresh.c | 59 ----- 21 files changed, 508 insertions(+), 265 deletions(-) create mode 100644 src/ncp-uart-hw/config/sl_core_config.h rename src/ncp-uart-hw/config/{sl_device_init_emu_config.h => sl_interrupt_manager_s2_config.h} (59%) create mode 100644 src/ncp-uart-hw/config/sl_memory_manager_config.h create mode 100644 src/ncp-uart-hw/config/sl_memory_manager_region_config.h delete mode 100644 src/ncp-uart-hw/config/zigbee_watchdog_periodic_refresh_config.h delete mode 100644 src/ncp-uart-hw/sl_zigbee_watchdog_periodic_refresh.c diff --git a/.gitignore b/.gitignore index 7a24addf..6033bcbd 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ artifact/ artifacts/ trashed_modified_files/ src/**/*.bak -misc/**/*.bak \ No newline at end of file +misc/**/*.bak +src/**/*.bak0 \ No newline at end of file diff --git a/src/ncp-uart-hw/.cproject b/src/ncp-uart-hw/.cproject index 6f295900..5e772f01 100644 --- a/src/ncp-uart-hw/.cproject +++ b/src/ncp-uart-hw/.cproject @@ -4,7 +4,7 @@ - + @@ -23,7 +23,7 @@ - + @@ -38,7 +38,7 @@ - @@ -175,7 +196,7 @@ - + + + @@ -324,8 +497,8 @@ - + @@ -340,6 +513,7 @@ - + + + + + + - - \ No newline at end of file diff --git a/src/ncp-uart-hw/app.c b/src/ncp-uart-hw/app.c index 9e7f24f5..454b3f45 100644 --- a/src/ncp-uart-hw/app.c +++ b/src/ncp-uart-hw/app.c @@ -16,7 +16,7 @@ ******************************************************************************/ #include PLATFORM_HEADER -#include "ember.h" +#include "sl_zigbee.h" //---------------------- // Implemented Callbacks diff --git a/src/ncp-uart-hw/config/btl_interface_cfg_s2c1.h b/src/ncp-uart-hw/config/btl_interface_cfg_s2c1.h index 7f703143..35e65f10 100644 --- a/src/ncp-uart-hw/config/btl_interface_cfg_s2c1.h +++ b/src/ncp-uart-hw/config/btl_interface_cfg_s2c1.h @@ -231,51 +231,51 @@ // <<< end of configuration section >>> #if BOOTLOADER_MANUAL_OVERRIDE_SECURITY_STATE == 1 -#define BOOTLOADER_PPUSATD0_MASK ((BOOTLOADER_PPUSATD0_EMU << _SMU_PPUSATD0_EMU_SHIFT) \ - | (BOOTLOADER_PPUSATD0_CMU << _SMU_PPUSATD0_CMU_SHIFT) \ - | (BOOTLOADER_PPUSATD0_HFXO0 << _SMU_PPUSATD0_HFXO0_SHIFT) \ - | (BOOTLOADER_PPUSATD0_HFRCO0 << _SMU_PPUSATD0_HFRCO0_SHIFT) \ - | (BOOTLOADER_PPUSATD0_FSRCO << _SMU_PPUSATD0_FSRCO_SHIFT) \ - | (BOOTLOADER_PPUSATD0_DPLL0 << _SMU_PPUSATD0_DPLL0_SHIFT) \ - | (BOOTLOADER_PPUSATD0_LFXO << _SMU_PPUSATD0_LFXO_SHIFT) \ - | (BOOTLOADER_PPUSATD0_LFRCO << _SMU_PPUSATD0_LFRCO_SHIFT) \ - | (BOOTLOADER_PPUSATD0_ULFRCO << _SMU_PPUSATD0_ULFRCO_SHIFT) \ - | (BOOTLOADER_PPUSATD0_MSC << _SMU_PPUSATD0_MSC_SHIFT) \ - | (BOOTLOADER_PPUSATD0_ICACHE0 << _SMU_PPUSATD0_ICACHE0_SHIFT) \ - | (BOOTLOADER_PPUSATD0_PRS << _SMU_PPUSATD0_PRS_SHIFT) \ - | (BOOTLOADER_PPUSATD0_GPIO << _SMU_PPUSATD0_GPIO_SHIFT) \ - | (BOOTLOADER_PPUSATD0_LDMA << _SMU_PPUSATD0_LDMA_SHIFT) \ - | (BOOTLOADER_PPUSATD0_LDMAXBAR << _SMU_PPUSATD0_LDMAXBAR_SHIFT) \ - | (BOOTLOADER_PPUSATD0_TIMER0 << _SMU_PPUSATD0_TIMER0_SHIFT) \ - | (BOOTLOADER_PPUSATD0_TIMER1 << _SMU_PPUSATD0_TIMER1_SHIFT) \ - | (BOOTLOADER_PPUSATD0_TIMER2 << _SMU_PPUSATD0_TIMER2_SHIFT) \ - | (BOOTLOADER_PPUSATD0_TIMER3 << _SMU_PPUSATD0_TIMER3_SHIFT) \ - | (BOOTLOADER_PPUSATD0_USART0 << _SMU_PPUSATD0_USART0_SHIFT) \ - | (BOOTLOADER_PPUSATD0_USART1 << _SMU_PPUSATD0_USART1_SHIFT) \ - | (BOOTLOADER_PPUSATD0_USART2 << _SMU_PPUSATD0_USART2_SHIFT) \ - | (BOOTLOADER_PPUSATD0_BURTC << _SMU_PPUSATD0_BURTC_SHIFT) \ - | (BOOTLOADER_PPUSATD0_I2C1 << _SMU_PPUSATD0_I2C1_SHIFT) \ - | (BOOTLOADER_PPUSATD0_CHIPTESTCTRL << _SMU_PPUSATD0_CHIPTESTCTRL_SHIFT) \ - | (BOOTLOADER_PPUSATD0_LVGD << _SMU_PPUSATD0_LVGD_SHIFT) \ - | (BOOTLOADER_PPUSATD0_SYSCFG << _SMU_PPUSATD0_SYSCFG_SHIFT) \ - | (BOOTLOADER_PPUSATD0_BURAM << _SMU_PPUSATD0_BURAM_SHIFT) \ - | (BOOTLOADER_PPUSATD0_IFADCDEBUG << _SMU_PPUSATD0_IFADCDEBUG_SHIFT) \ - | (BOOTLOADER_PPUSATD0_GPCRC << _SMU_PPUSATD0_GPCRC_SHIFT) \ - | (BOOTLOADER_PPUSATD0_RTCC << _SMU_PPUSATD0_RTCC_SHIFT)) -#define BOOTLOADER_PPUSATD1_MASK ((BOOTLOADER_PPUSATD1_LETIMER0 << _SMU_PPUSATD1_LETIMER0_SHIFT) \ - | (BOOTLOADER_PPUSATD1_IADC0 << _SMU_PPUSATD1_IADC0_SHIFT) \ - | (BOOTLOADER_PPUSATD1_ACMP0 << _SMU_PPUSATD1_ACMP0_SHIFT) \ - | (BOOTLOADER_PPUSATD1_ACMP1 << _SMU_PPUSATD1_ACMP1_SHIFT) \ - | (BOOTLOADER_PPUSATD1_I2C0 << _SMU_PPUSATD1_I2C0_SHIFT) \ - | (BOOTLOADER_PPUSATD1_HFRCOEM23 << _SMU_PPUSATD1_HFRCOEM23_SHIFT) \ - | (BOOTLOADER_PPUSATD1_WDOG0 << _SMU_PPUSATD1_WDOG0_SHIFT) \ - | (BOOTLOADER_PPUSATD1_WDOG1 << _SMU_PPUSATD1_WDOG1_SHIFT) \ - | (BOOTLOADER_PPUSATD1_AMUXCP0 << _SMU_PPUSATD1_AMUXCP0_SHIFT) \ - | (BOOTLOADER_PPUSATD1_RADIOAES << _SMU_PPUSATD1_RADIOAES_SHIFT) \ - | (BOOTLOADER_PPUSATD1_BUFC << _SMU_PPUSATD1_BUFC_SHIFT) \ - | (BOOTLOADER_PPUSATD1_SMU << _SMU_PPUSATD1_SMU_SHIFT) \ - | (BOOTLOADER_PPUSATD1_AHBRADIO << _SMU_PPUSATD1_AHBRADIO_SHIFT) \ - | (BOOTLOADER_PPUSATD1_SEMAILBOX << _SMU_PPUSATD1_SEMAILBOX_SHIFT)) +#define BOOTLOADER_PPUSATD0_MASK ((BOOTLOADER_PPUSATD0_EMU << _SMU_PPUSATD0_EMU_SHIFT) \ + | (BOOTLOADER_PPUSATD0_CMU << _SMU_PPUSATD0_CMU_SHIFT) \ + | (BOOTLOADER_PPUSATD0_HFXO0 << _SMU_PPUSATD0_HFXO0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_HFRCO0 << _SMU_PPUSATD0_HFRCO0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_FSRCO << _SMU_PPUSATD0_FSRCO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_DPLL0 << _SMU_PPUSATD0_DPLL0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_LFXO << _SMU_PPUSATD0_LFXO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_LFRCO << _SMU_PPUSATD0_LFRCO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_ULFRCO << _SMU_PPUSATD0_ULFRCO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_MSC << _SMU_PPUSATD0_MSC_SHIFT) \ + | (BOOTLOADER_PPUSATD0_ICACHE0 << _SMU_PPUSATD0_ICACHE0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_PRS << _SMU_PPUSATD0_PRS_SHIFT) \ + | (BOOTLOADER_PPUSATD0_GPIO << _SMU_PPUSATD0_GPIO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_LDMA << _SMU_PPUSATD0_LDMA_SHIFT) \ + | (BOOTLOADER_PPUSATD0_LDMAXBAR << _SMU_PPUSATD0_LDMAXBAR_SHIFT) \ + | (BOOTLOADER_PPUSATD0_TIMER0 << _SMU_PPUSATD0_TIMER0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_TIMER1 << _SMU_PPUSATD0_TIMER1_SHIFT) \ + | (BOOTLOADER_PPUSATD0_TIMER2 << _SMU_PPUSATD0_TIMER2_SHIFT) \ + | (BOOTLOADER_PPUSATD0_TIMER3 << _SMU_PPUSATD0_TIMER3_SHIFT) \ + | (BOOTLOADER_PPUSATD0_USART0 << _SMU_PPUSATD0_USART0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_USART1 << _SMU_PPUSATD0_USART1_SHIFT) \ + | (BOOTLOADER_PPUSATD0_USART2 << _SMU_PPUSATD0_USART2_SHIFT) \ + | (BOOTLOADER_PPUSATD0_BURTC << _SMU_PPUSATD0_BURTC_SHIFT) \ + | (BOOTLOADER_PPUSATD0_I2C1 << _SMU_PPUSATD0_I2C1_SHIFT) \ + | (BOOTLOADER_PPUSATD0_CHIPTESTCTRL << _SMU_PPUSATD0_CHIPTESTCTRL_SHIFT) \ + | (BOOTLOADER_PPUSATD0_LVGD << _SMU_PPUSATD0_LVGD_SHIFT) \ + | (BOOTLOADER_PPUSATD0_SYSCFG << _SMU_PPUSATD0_SYSCFG_SHIFT) \ + | (BOOTLOADER_PPUSATD0_BURAM << _SMU_PPUSATD0_BURAM_SHIFT) \ + | (BOOTLOADER_PPUSATD0_IFADCDEBUG << _SMU_PPUSATD0_IFADCDEBUG_SHIFT) \ + | (BOOTLOADER_PPUSATD0_GPCRC << _SMU_PPUSATD0_GPCRC_SHIFT) \ + | (BOOTLOADER_PPUSATD0_RTCC << _SMU_PPUSATD0_RTCC_SHIFT)) +#define BOOTLOADER_PPUSATD1_MASK ((BOOTLOADER_PPUSATD1_LETIMER0 << _SMU_PPUSATD1_LETIMER0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_IADC0 << _SMU_PPUSATD1_IADC0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_ACMP0 << _SMU_PPUSATD1_ACMP0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_ACMP1 << _SMU_PPUSATD1_ACMP1_SHIFT) \ + | (BOOTLOADER_PPUSATD1_I2C0 << _SMU_PPUSATD1_I2C0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_HFRCOEM23 << _SMU_PPUSATD1_HFRCOEM23_SHIFT) \ + | (BOOTLOADER_PPUSATD1_WDOG0 << _SMU_PPUSATD1_WDOG0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_WDOG1 << _SMU_PPUSATD1_WDOG1_SHIFT) \ + | (BOOTLOADER_PPUSATD1_AMUXCP0 << _SMU_PPUSATD1_AMUXCP0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_RADIOAES << _SMU_PPUSATD1_RADIOAES_SHIFT) \ + | (BOOTLOADER_PPUSATD1_BUFC << _SMU_PPUSATD1_BUFC_SHIFT) \ + | (BOOTLOADER_PPUSATD1_SMU << _SMU_PPUSATD1_SMU_SHIFT) \ + | (BOOTLOADER_PPUSATD1_AHBRADIO << _SMU_PPUSATD1_AHBRADIO_SHIFT) \ + | (BOOTLOADER_PPUSATD1_SEMAILBOX << _SMU_PPUSATD1_SEMAILBOX_SHIFT)) #endif // BOOTLOADER_MANUAL_OVERRIDE_SECURITY_STATE #endif // BTL_INTERFACE_CFG_S2C1_H \ No newline at end of file diff --git a/src/ncp-uart-hw/config/emlib_core_debug_config.h b/src/ncp-uart-hw/config/emlib_core_debug_config.h index e4a01682..82bba0b2 100644 --- a/src/ncp-uart-hw/config/emlib_core_debug_config.h +++ b/src/ncp-uart-hw/config/emlib_core_debug_config.h @@ -37,7 +37,7 @@ // Enables measuring of interrupt disable time for debugging purposes. // Default: 0 -#define SL_EMLIB_CORE_ENABLE_INTERRUPT_DISABLED_TIMING 0 +#define SL_CORE_DEBUG_INTERRUPTS_MASKED_TIMING 0 // diff --git a/src/ncp-uart-hw/config/sl_core_config.h b/src/ncp-uart-hw/config/sl_core_config.h new file mode 100644 index 00000000..27b173d2 --- /dev/null +++ b/src/ncp-uart-hw/config/sl_core_config.h @@ -0,0 +1,44 @@ +/***************************************************************************//** + * @file + * @brief sl_core Configuration + ******************************************************************************* + * # License + * Copyright 2023 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +#ifndef SL_CORE_CONFIG_H +#define SL_CORE_CONFIG_H + +// <<< Use Configuration Wizard in Context Menu >>> + +// Core Abstraction Configuration + +// Enables measurement of interrupt masking time for debugging purposes. +// Default: 0 +#define SL_CORE_DEBUG_INTERRUPTS_MASKED_TIMING 0 +// + +// <<< end of configuration section >>> +#endif // SL_CORE_CONFIG_H diff --git a/src/ncp-uart-hw/config/sl_device_init_lfxo_config.h b/src/ncp-uart-hw/config/sl_device_init_lfxo_config.h index 29371b6c..7976b065 100644 --- a/src/ncp-uart-hw/config/sl_device_init_lfxo_config.h +++ b/src/ncp-uart-hw/config/sl_device_init_lfxo_config.h @@ -63,26 +63,4 @@ #define SL_DEVICE_INIT_LFXO_TIMEOUT cmuLfxoStartupDelay_4KCycles // <<< end of configuration section >>> -// <<< sl:start pin_tool >>> -// SL_DEVICE_INIT_LFXO -// $[LFXO_SL_DEVICE_INIT_LFXO] -#define SL_DEVICE_INIT_LFXO_PERIPHERAL LFXO - -// LFXO LFXTAL_O on PD00 -#define SL_DEVICE_INIT_LFXO_LFXTAL_O_PORT gpioPortD -#define SL_DEVICE_INIT_LFXO_LFXTAL_O_PIN 0 - -// LFXO LFXTAL_I on PD01 -#define SL_DEVICE_INIT_LFXO_LFXTAL_I_PORT gpioPortD -#define SL_DEVICE_INIT_LFXO_LFXTAL_I_PIN 1 - - -// [LFXO_SL_DEVICE_INIT_LFXO]$ - -// $[LFXO_EXTERNAL_DIGITAL_CLOCK] -#define SL_DEVICE_INIT_LFXO_LF_EXTCLK_PORT gpioPortD -#define SL_DEVICE_INIT_LFXO_LF_EXTCLK_PIN 1 -// [LFXO_EXTERNAL_DIGITAL_CLOCK]$ -// <<< sl:end pin_tool >>> - #endif // SL_DEVICE_INIT_LFXO_CONFIG_H \ No newline at end of file diff --git a/src/ncp-uart-hw/config/sl_device_init_emu_config.h b/src/ncp-uart-hw/config/sl_interrupt_manager_s2_config.h similarity index 59% rename from src/ncp-uart-hw/config/sl_device_init_emu_config.h rename to src/ncp-uart-hw/config/sl_interrupt_manager_s2_config.h index f23d055b..714893aa 100644 --- a/src/ncp-uart-hw/config/sl_device_init_emu_config.h +++ b/src/ncp-uart-hw/config/sl_interrupt_manager_s2_config.h @@ -1,9 +1,9 @@ /***************************************************************************//** * @file - * @brief DEVICE_INIT_EMU Config + * @brief Interrupt Manager configuration file for series 2 devices. ******************************************************************************* * # License - * Copyright 2019 Silicon Laboratories Inc. www.silabs.com + * Copyright 2023 Silicon Laboratories Inc. www.silabs.com ******************************************************************************* * * SPDX-License-Identifier: Zlib @@ -28,26 +28,20 @@ * ******************************************************************************/ -#ifndef SL_DEVICE_INIT_EMU_CONFIG_H -#define SL_DEVICE_INIT_EMU_CONFIG_H +// <<< Use Configuration Wizard in Context Menu >>> -#include "em_emu.h" +#ifndef SL_INTERRUPT_MANAGER_S2_CONFIG_H +#define SL_INTERRUPT_MANAGER_S2_CONFIG_H -// <<< Use Configuration Wizard in Context Menu >>> +// Interrupt Manager Configuration -// Allow debugger to remain connected in EM2 -// Force PD0B to stay on on EM2 entry. This allows the debugger to remain connected in EM2 and EM3. -// Enabling debug connectivity results in an increased power consumption in EM2/EM3. -// Default: 1 -#define SL_DEVICE_INIT_EMU_EM2_DEBUG_ENABLE 1 +// Put the interrupt vector table in RAM. +// Set to 1 to put the vector table in RAM. +// Default: 0 +#define SL_INTERRUPT_MANAGER_S2_INTERRUPTS_IN_RAM 0 -// EM4 pin retention mode -// No Retention: Pads enter reset state when entering EM4. -// Retention through EM4: Pads enter reset state when exiting EM4. -// Retention through EM4 and wakeup. -// Default: emuPinRetentionDisable -#define SL_DEVICE_INIT_EMU_EM4_PIN_RETENTION_MODE emuPinRetentionDisable +// -// <<< end of configuration section >>> +#endif /* SSL_INTERRUPT_MANAGER_S2_CONFIG_H */ -#endif // SL_DEVICE_INIT_EMU_CONFIG_H \ No newline at end of file +// <<< end of configuration section >>> diff --git a/src/ncp-uart-hw/config/sl_memory_manager_config.h b/src/ncp-uart-hw/config/sl_memory_manager_config.h new file mode 100644 index 00000000..7e4b0567 --- /dev/null +++ b/src/ncp-uart-hw/config/sl_memory_manager_config.h @@ -0,0 +1,49 @@ +/***************************************************************************//** + * @file + * @brief Memory Heap Allocator configuration file. + ******************************************************************************* + * # License + * Copyright 2024 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +// <<< Use Configuration Wizard in Context Menu >>> + +#ifndef SL_MEMORY_MANAGER_CONFIG_H +#define SL_MEMORY_MANAGER_CONFIG_H + +// Memory Manager Configuration + +// Minimum block allocation size +// <32-128:8> +// Minimum block allocation size to avoid creating a block too small while splitting up an allocated block. +// Size expressed in bytes and can only be a multiple of 8 bytes for the proper data alignment management done by the dynamic allocator malloc() function. +// Default: 32 +#define SL_MEMORY_MANAGER_BLOCK_ALLOCATION_MIN_SIZE (32) + +// + +// <<< end of configuration section >>> + +#endif /* SL_MEMORY_MANAGER_CONFIG_H */ diff --git a/src/ncp-uart-hw/config/sl_memory_manager_region_config.h b/src/ncp-uart-hw/config/sl_memory_manager_region_config.h new file mode 100644 index 00000000..ba02fdd8 --- /dev/null +++ b/src/ncp-uart-hw/config/sl_memory_manager_region_config.h @@ -0,0 +1,49 @@ +/***************************************************************************//** + * @file + * @brief Memory Heap and stack size configuration file. + ******************************************************************************* + * # License + * Copyright 2024 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +// <<< Use Configuration Wizard in Context Menu >>> + +#ifndef SL_MEMORY_MANAGER_REGION_CONFIG_H +#define SL_MEMORY_MANAGER_REGION_CONFIG_H + +// Memory configuration + +// Stack size for the application. +// Default: 4096 +// The stack size configured here will be used by the stack that the +// application uses when coming out of a reset. +#ifndef SL_STACK_SIZE +#define SL_STACK_SIZE 4096 +#endif +// + +// <<< end of configuration section >>> + +#endif /* SL_MEMORY_MANAGER_REGION_CONFIG_H */ diff --git a/src/ncp-uart-hw/config/sl_power_manager_config.h b/src/ncp-uart-hw/config/sl_power_manager_config.h index e4b1da09..d90c0b55 100644 --- a/src/ncp-uart-hw/config/sl_power_manager_config.h +++ b/src/ncp-uart-hw/config/sl_power_manager_config.h @@ -57,6 +57,20 @@ #define SL_POWER_MANAGER_DEBUG_POOL_SIZE 10 // +// Pin retention mode +// +// No retention +// Retention through EM4 +// Retention through EM4 and wakeup +// power_manager_pin_retention_disable +#define SL_POWER_MANAGER_INIT_EMU_EM4_PIN_RETENTION_MODE EMU_EM4CTRL_EM4IORETMODE_DISABLE + +// Enable EM2 debugging feature +// Enable or disable debugging features. +// Default: 1 +#define SL_POWER_MANAGER_INIT_EMU_EM2_DEBUG_ENABLE 1 +// + // #endif /* SL_POWER_MANAGER_CONFIG_H */ diff --git a/src/ncp-uart-hw/config/sl_zigbee_green_power_config.h b/src/ncp-uart-hw/config/sl_zigbee_green_power_config.h index e0310d3a..25c1d001 100644 --- a/src/ncp-uart-hw/config/sl_zigbee_green_power_config.h +++ b/src/ncp-uart-hw/config/sl_zigbee_green_power_config.h @@ -18,35 +18,35 @@ // Zigbee Green Power Library configuration -// Green Power Proxy Table Size <1-126> +// Green Power Proxy Table Size <1-126> // Default: 5 // The maximum number of Green Power proxy table entries supported by the stack. -#define EMBER_GP_PROXY_TABLE_SIZE 5 +#define SL_ZIGBEE_GP_PROXY_TABLE_SIZE 5 -// Green Power Sink Table Size <0-126> +// Green Power Sink Table Size <0-126> // Default: 0 // The maximum number of Green Power sink table entries supported by the stack. -#define EMBER_GP_SINK_TABLE_SIZE 0 +#define SL_ZIGBEE_GP_SINK_TABLE_SIZE 0 -// Green Power incoming FC (as part of proxy table) Token timeout <0-60> +// Green Power incoming FC (as part of proxy table) Token timeout <0-60> // Default: 0 // The timeout (seconds) to restore the GPD incoming security frame counter in the Flash (0 being never). -#define EMBER_GP_INCOMING_FC_TOKEN_TIMEOUT 7 +#define SL_ZIGBEE_GP_INCOMING_FC_TOKEN_TIMEOUT 7 -// Green Power incoming FC (as part of proxy table) table token table size <0-126> +// Green Power incoming FC (as part of proxy table) table token table size <0-126> // Default: 0 -// The maximum table size to restore the GPD incoming security frame counter in the Flash (being either 0 or EMBER_GP_PROXY_TABLE_SIZE). -#define EMBER_GP_INCOMING_FC_TOKEN_TABLE_SIZE 0 +// The maximum table size to restore the GPD incoming security frame counter in the Flash (being either 0 or SL_ZIGBEE_GP_PROXY_TABLE_SIZE). +#define SL_ZIGBEE_GP_INCOMING_FC_TOKEN_TABLE_SIZE 0 -// Green Power incoming FC (as part of sink table) token table token timeout <0-60> +// Green Power incoming FC (as part of sink table) token table token timeout <0-60> // Default: 0 // The timeout (seconds) to restore the GPD incoming security frame counter in the Flash (0 being never). -#define EMBER_GP_INCOMING_FC_IN_SINK_TOKEN_TIMEOUT 7 +#define SL_ZIGBEE_GP_INCOMING_FC_IN_SINK_TOKEN_TIMEOUT 7 -// Green Power incoming FC (as part of sink table)Token table size <0-126> +// Green Power incoming FC (as part of sink table)Token table size <0-126> // Default: 0 -// The maximum table size to restore the GPD incoming security frame counter in the Flash (being either 0 or EMBER_GP_SINK_TABLE_SIZE). -#define EMBER_GP_INCOMING_FC_IN_SINK_TOKEN_TABLE_SIZE 0 +// The maximum table size to restore the GPD incoming security frame counter in the Flash (being either 0 or SL_ZIGBEE_GP_SINK_TABLE_SIZE). +#define SL_ZIGBEE_GP_INCOMING_FC_IN_SINK_TOKEN_TABLE_SIZE 0 // diff --git a/src/ncp-uart-hw/config/sl_zigbee_light_link_config.h b/src/ncp-uart-hw/config/sl_zigbee_light_link_config.h index edaded9a..f38262b5 100644 --- a/src/ncp-uart-hw/config/sl_zigbee_light_link_config.h +++ b/src/ncp-uart-hw/config/sl_zigbee_light_link_config.h @@ -18,20 +18,20 @@ // Zigbee ZigBee Light Link Library configuration -// Group addresses <0-255> +// Group addresses <0-255> // Default: 0 // The number of unique group identifiers that this device requires. -#define EMBER_ZLL_GROUP_ADDRESSES 0 +#define SL_ZIGBEE_ZLL_GROUP_ADDRESSES 0 -// RSSI threshold <-128..127:1> +// RSSI threshold <-128..127:1> // Default: -40 // The RSSI threshold applied to incoming scan requests. The stack will ignore scan requests with corrected RSSI values less than this threshold. -#define EMBER_ZLL_RSSI_THRESHOLD -40 +#define SL_ZIGBEE_ZLL_RSSI_THRESHOLD -40 -// Apply RSSI threshold to all interpan messages +// Apply RSSI threshold to all interpan messages // Default: FALSE // True if the RSSI threshold is to be applied to all incoming touchlink interpan messages. This is not required by the Zigbee 3.0 specifications, but may be useful for testing in a busy environment. -#define EMBER_ZLL_APPLY_THRESHOLD_TO_ALL_INTERPANS 0 +#define SL_ZIGBEE_ZLL_APPLY_THRESHOLD_TO_ALL_INTERPANS 0 // diff --git a/src/ncp-uart-hw/config/sl_zigbee_pro_stack_config.h b/src/ncp-uart-hw/config/sl_zigbee_pro_stack_config.h index b050b467..2d840e57 100644 --- a/src/ncp-uart-hw/config/sl_zigbee_pro_stack_config.h +++ b/src/ncp-uart-hw/config/sl_zigbee_pro_stack_config.h @@ -17,26 +17,43 @@ // Zigbee PRO Stack Library configuration -// Child Table Size <0-64> +// Child Table Size <0-64> // Default: 6 // The maximum number of ZigBee PRO End Devices that can be supported by a single device. -#define EMBER_MAX_END_DEVICE_CHILDREN 32 +#define SL_ZIGBEE_MAX_END_DEVICE_CHILDREN 6 -// Packet Buffer Count <20-255> -// Default: 75 -// The maximum number of packet buffers supported by the system. This is limited by the amount of available RAM. -#define EMBER_PACKET_BUFFER_COUNT 255 +// Packet Buffer Heap Allocation +// Packet Buffer Heap Size <512-16384> +// Default: SL_ZIGBEE_MEDIUM_PACKET_BUFFER_HEAP +// The amount of heap space that is allocated for packet buffers (in bytes). Each packet buffer has an overhead of `4 * sizeof(uint16_t)` bytes. +// Tiny (1024) +// Small (2048) +// Medium (4096) +// Large (8192) +// Huge (16384) +// Custom +// SL_ZIGBEE_LARGE_PACKET_BUFFER_HEAP +// Custom Heap Size <1024-16384> +// Specify the exact number of bytes to use (aligned on 4-byte boundaries) +#define SL_ZIGBEE_TINY_PACKET_BUFFER_HEAP 1024 +#define SL_ZIGBEE_SMALL_PACKET_BUFFER_HEAP 2048 +#define SL_ZIGBEE_MEDIUM_PACKET_BUFFER_HEAP 4096 +#define SL_ZIGBEE_LARGE_PACKET_BUFFER_HEAP 8192 +#define SL_ZIGBEE_HUGE_PACKET_BUFFER_HEAP 16384 +#define SL_ZIGBEE_CUSTOM_PACKET_BUFFER_HEAP 0 +#define SL_ZIGBEE_PACKET_BUFFER_HEAP_SIZE SL_ZIGBEE_LARGE_PACKET_BUFFER_HEAP +// -// End Device keep alive support mode +// End Device keep alive support mode // End Device keep alive support mode -// MAC Data Poll Keep Alive -// End Device Timeout Keep Alive -// Keep Alive Support All -// Default: EMBER_KEEP_ALIVE_SUPPORT_ALL +// MAC Data Poll Keep Alive +// End Device Timeout Keep Alive +// Keep Alive Support All +// Default: SL_ZIGBEE_KEEP_ALIVE_SUPPORT_ALL // End Device keep alive support mode on the coordinator/router could be set here. -#define EMBER_END_DEVICE_KEEP_ALIVE_SUPPORT_MODE EMBER_KEEP_ALIVE_SUPPORT_ALL +#define SL_ZIGBEE_END_DEVICE_KEEP_ALIVE_SUPPORT_MODE SL_ZIGBEE_KEEP_ALIVE_SUPPORT_ALL -// End Device Poll Timeout Value +// End Device Poll Timeout Value // End Device Poll Timeout Value // Seconds-10 // Minutes-2 @@ -55,17 +72,17 @@ // Minutes-16384 // Default: MINUTES_256 // The amount of time that must pass without hearing a MAC data poll from the device before the end device is removed from the child table. For a router device this applies to its children. For an end device, this is the amount of time before it automatically times itself out. -#define EMBER_END_DEVICE_POLL_TIMEOUT MINUTES_256 +#define SL_ZIGBEE_END_DEVICE_POLL_TIMEOUT MINUTES_256 -// Link Power Delta Request Interval <1-65535> +// Link Power Delta Request Interval <1-65535> // Default: 300 // The amount of time in seconds that pass between link power delta requests. -#define EMBER_LINK_POWER_DELTA_INTERVAL 300 +#define SL_ZIGBEE_LINK_POWER_DELTA_INTERVAL 300 -// APS Unicast Message Queue Size <1-255> +// APS Unicast Message Queue Size <1-255> // Default: 10 -// The maximum number of APS unicast messages that can be queued up by the stack. A message is considered queued when emberSendUnicast() is called and is de-queued when the emberMessageSentHandler() is called. -#define EMBER_APS_UNICAST_MESSAGE_COUNT 10 +// The maximum number of APS unicast messages that can be queued up by the stack. A message is considered queued when sli_zigbee_stack_send_unicast() is called and is de-queued when the sli_zigbee_stack_message_sent_handler() is called. +#define SL_ZIGBEE_APS_UNICAST_MESSAGE_COUNT 10 // APS unicast Message Duplicate Rejection table Size <1-255> // Default: 5 @@ -73,28 +90,28 @@ // Size of 1 is basically the same thing as no duplicate rejection #define SL_ZIGBEE_APS_DUPLICATE_REJECTION_MAX_ENTRIES 5 -// Broadcast Table Size <15-254> +// Broadcast Table Size <15-254> // Default: 15 // The size of the broadcast table. -#define EMBER_BROADCAST_TABLE_SIZE 15 +#define SL_ZIGBEE_BROADCAST_TABLE_SIZE 15 -// Neighbor Table Size +// Neighbor Table Size // Neighbor Table Size // <16=> 16 // <26=> 26 // Default: 16 // The size of the neighbor table. -#define EMBER_NEIGHBOR_TABLE_SIZE 16 +#define SL_ZIGBEE_NEIGHBOR_TABLE_SIZE 16 -// Transient key timeout (in seconds) <0-65535> +// Transient key timeout (in seconds) <0-65535> // Default: 300 // The amount of time a device will store a transient link key that can be used to join a network. -#define EMBER_TRANSIENT_KEY_TIMEOUT_S 300 +#define SL_ZIGBEE_TRANSIENT_KEY_TIMEOUT_S 300 -// Binding Table Size <1-127> +// Binding Table Size <1-127> // Default: 3 // The number of entries that the binding table can hold. -#define EMBER_BINDING_TABLE_SIZE 32 +#define SL_ZIGBEE_BINDING_TABLE_SIZE 3 // diff --git a/src/ncp-uart-hw/config/sl_zigbee_security_link_keys_config.h b/src/ncp-uart-hw/config/sl_zigbee_security_link_keys_config.h index 1bd373cc..3ff1862d 100644 --- a/src/ncp-uart-hw/config/sl_zigbee_security_link_keys_config.h +++ b/src/ncp-uart-hw/config/sl_zigbee_security_link_keys_config.h @@ -18,15 +18,15 @@ // Zigbee Security Link Keys Library configuration -// Link Key Table Size <1-127> +// Link Key Table Size <1-127> // Default: 6 // The maximum number of link key table entries supported by the stack. -#define EMBER_KEY_TABLE_SIZE 12 +#define SL_ZIGBEE_KEY_TABLE_SIZE 6 -// Request Key Timeout <0-10> +// Request Key Timeout <0-10> // Default: 0 // The length of time that a node will wait for a trust center to answer its Application Link Key request. -#define EMBER_REQUEST_KEY_TIMEOUT 0 +#define SL_ZIGBEE_REQUEST_KEY_TIMEOUT 0 // diff --git a/src/ncp-uart-hw/config/sl_zigbee_source_route_config.h b/src/ncp-uart-hw/config/sl_zigbee_source_route_config.h index af3d1adf..65ce1f99 100644 --- a/src/ncp-uart-hw/config/sl_zigbee_source_route_config.h +++ b/src/ncp-uart-hw/config/sl_zigbee_source_route_config.h @@ -18,15 +18,15 @@ // Zigbee Source Route Library configuration -// Source route table Size (SoC or NCP) <2-255> +// Source route table Size (SoC or NCP) <2-255> // Default: 7 // The size of the source route table for storing source routes on the SOC or NCP. -#define EMBER_SOURCE_ROUTE_TABLE_SIZE 200 +#define SL_ZIGBEE_SOURCE_ROUTE_TABLE_SIZE 7 -// Max source route relay counts <11-40> +// Max source route relay counts <11-40> // Default: 11 // Max source route hops accepted or/and inserted in the source route table/header. -#define EMBER_MAX_SOURCE_ROUTE_RELAY_COUNT 11 +#define SL_ZIGBEE_MAX_SOURCE_ROUTE_RELAY_COUNT 11 // diff --git a/src/ncp-uart-hw/config/zigbee_watchdog_periodic_refresh_config.h b/src/ncp-uart-hw/config/zigbee_watchdog_periodic_refresh_config.h deleted file mode 100644 index 35f204e7..00000000 --- a/src/ncp-uart-hw/config/zigbee_watchdog_periodic_refresh_config.h +++ /dev/null @@ -1,34 +0,0 @@ -/***************************************************************************//** - * @brief Sample watchdog refresh event component configuration header. - ******************************************************************************** - * # License - * Copyright 2022 Silicon Laboratories Inc. www.silabs.com - ******************************************************************************* - * - * The licensor of this software is Silicon Laboratories Inc. Your use of this - * software is governed by the terms of Silicon Labs Master Software License - * Agreement (MSLA) available at - * www.silabs.com/about-us/legal/master-software-license-agreement. This - * software is distributed to you in Source Code format and is governed by the - * sections of the MSLA applicable to Source Code. - * - ******************************************************************************/ - -// <<< Use Configuration Wizard in Context Menu >>> - -// Zigbee Watchdog reset component configuration - -// Enable periodic watchdog refresh -// Default: TRUE -// This allows for enabling or disabling periodic watchdog refresh -#define SL_ZIGBEE_WATCHDOG_PERIODIC_REFRESH_ENABLE 1 - -// Watchdog refresh duration <50-5000> -// Default: 1000 -// Defines the periodic interval at which the watchdog timer is reset in the application -#define SL_ZIGBEE_WATCHDOG_REFRESH_DURATION_MS 1000 - -// -// - -// <<< end of configuration section >>> \ No newline at end of file diff --git a/src/ncp-uart-hw/main.c b/src/ncp-uart-hw/main.c index 996b1e0b..f07f4b28 100644 --- a/src/ncp-uart-hw/main.c +++ b/src/ncp-uart-hw/main.c @@ -28,7 +28,7 @@ #include "sl_system_process_action.h" #endif // SL_CATALOG_KERNEL_PRESENT -#ifdef EMBER_TEST +#ifdef SL_ZIGBEE_TEST #define main nodeMain #endif diff --git a/src/ncp-uart-hw/ncp-uart-hw.slcp b/src/ncp-uart-hw/ncp-uart-hw.slcp index 72d95dac..679763f5 100644 --- a/src/ncp-uart-hw/ncp-uart-hw.slcp +++ b/src/ncp-uart-hw/ncp-uart-hw.slcp @@ -26,7 +26,7 @@ source: - {path: main.c} - {path: app.c} tag: [prebuilt_demo] -sdk: {id: gecko_sdk, version: 4.4.2} +sdk: {id: simplicity_sdk, version: 2024.6.0} toolchain_settings: [] component: - {id: EFR32MG21A010F1024IM32} @@ -35,6 +35,7 @@ component: - instance: [vcom] id: iostream_usart - {id: iostream_vuart} +- {id: memory_manager} - {id: token_manager} - {id: zigbee_app_framework_common} - {id: zigbee_debug_basic} @@ -50,16 +51,16 @@ component: - {id: zigbee_token_interface} - {id: zigbee_zll} define: -- {name: EMBER_CUSTOM_MAC_FILTER_TABLE_SIZE, value: '15'} +- {name: SL_ZIGBEE_CUSTOM_MAC_FILTER_TABLE_SIZE, value: '15'} configuration: - {name: SL_BOARD_ENABLE_VCOM, value: '1'} - {name: SL_IOSTREAM_USART_VCOM_FLOW_CONTROL_TYPE, value: usartHwFlowControlCtsAndRts} - {name: SL_CLI_MAX_INPUT_ARGUMENTS, value: '16'} -- {name: EMBER_BINDING_TABLE_SIZE, value: '32'} -- {name: EMBER_MAX_END_DEVICE_CHILDREN, value: '32'} -- {name: EMBER_PACKET_BUFFER_COUNT, value: '255'} -- {name: EMBER_AF_PLUGIN_ZIGBEE_PRO_STACK_CHILD_TABLE_SIZE, value: '32'} -- {name: EMBER_KEY_TABLE_SIZE, value: '12'} +- {name: SL_ZIGBEE_BINDING_TABLE_SIZE, value: '32'} +- {name: SL_ZIGBEE_MAX_END_DEVICE_CHILDREN, value: '32'} +- {name: SL_ZIGBEE_PACKET_BUFFER_COUNT, value: '255'} +- {name: SL_ZIGBEE_AF_PLUGIN_ZIGBEE_PRO_STACK_CHILD_TABLE_SIZE, value: '32'} +- {name: SL_ZIGBEE_KEY_TABLE_SIZE, value: '12'} - {name: SL_CLI_EXAMPLE_IOSTREAM_HANDLE, value: sl_iostream_vuart_handle} - condition: [device_series_1] name: NVM3_DEFAULT_NVM_SIZE diff --git a/src/ncp-uart-hw/ncp-uart-hw.slps b/src/ncp-uart-hw/ncp-uart-hw.slps index 113b53a9..281b1192 100644 --- a/src/ncp-uart-hw/ncp-uart-hw.slps +++ b/src/ncp-uart-hw/ncp-uart-hw.slps @@ -1,7 +1,7 @@ - + @@ -12,5 +12,6 @@ + \ No newline at end of file diff --git a/src/ncp-uart-hw/sl_zigbee_watchdog_periodic_refresh.c b/src/ncp-uart-hw/sl_zigbee_watchdog_periodic_refresh.c deleted file mode 100644 index e3251c3c..00000000 --- a/src/ncp-uart-hw/sl_zigbee_watchdog_periodic_refresh.c +++ /dev/null @@ -1,59 +0,0 @@ -/***************************************************************************//** - * @file - * @brief Sample watchdog refresh event implementation and related configuration - ******************************************************************************* - * # License - * Copyright 2022 Silicon Laboratories Inc. www.silabs.com - ******************************************************************************* - * - * The licensor of this software is Silicon Laboratories Inc. Your use of this - * software is governed by the terms of Silicon Labs Master Software License - * Agreement (MSLA) available at - * www.silabs.com/about-us/legal/master-software-license-agreement. This - * software is distributed to you in Source Code format and is governed by the - * sections of the MSLA applicable to Source Code. - * - ******************************************************************************/ -#include PLATFORM_HEADER -#include "hal.h" -#include "ember.h" -#include "zigbee_app_framework_event.h" -#include "zigbee_app_framework_common.h" -#include "zigbee_watchdog_periodic_refresh_config.h" - -#if (SL_ZIGBEE_WATCHDOG_PERIODIC_REFRESH_ENABLE == 1) - -static sl_zigbee_event_t watchdog_refresh_event; -static void watchdog_refresh_event_handler(sl_zigbee_event_t *event); - -// Initialization of watchdog refresh event -void sli_zigbee_watchdog_refresh_handler_init(uint8_t init_level) -{ - switch (init_level) { - case SL_ZIGBEE_INIT_LEVEL_EVENT: - { - sl_zigbee_event_init(&watchdog_refresh_event, watchdog_refresh_event_handler); - sl_zigbee_event_set_active(&watchdog_refresh_event); - break; - } - default: - break; - } -} - -// In RTOS-based applications, the Zigbee task refreshes the watchdog. -// However, when the node is not on a network the Zigbee task does not run. -// Therefore, there needs to be a way to ensure that the watchdog does not fire -// and reset the node unnecessarily. Below we provide an example of an application -// event that periodically resets the watchdog. -// Note, such a periodic event gets the node out of EM1/EM2 low power modes, -// which may result in unnecessary energy consumption. -// The application should ultimately own the refreshing of the watchdog and tailor -// it based on the specific use case. -// In the bare-metal case, this is done in the zigbee stack and app framework ticks -static void watchdog_refresh_event_handler(sl_zigbee_event_t *event) -{ - halResetWatchdog(); - sl_zigbee_event_set_delay_ms(&watchdog_refresh_event, SL_ZIGBEE_WATCHDOG_REFRESH_DURATION_MS); -} -#endif //(SL_ZIGBEE_WATCHDOG_PERIODIC_REFRESH_ENABLE == 1) From f78696393dbc5e1e277df438a20f782b4c282945 Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:36:06 -0400 Subject: [PATCH 02/13] Do not hardcode `gecko_sdk` --- tools/build_project.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tools/build_project.py b/tools/build_project.py index 5e72582d..be4c325b 100755 --- a/tools/build_project.py +++ b/tools/build_project.py @@ -76,9 +76,7 @@ def get_toolchain_default_paths() -> list[pathlib.Path]: def get_sdk_default_paths() -> list[pathlib.Path]: """Return the path to the SDK.""" if sys.platform == "darwin": - return list( - pathlib.Path("~/SimplicityStudio/SDKs").expanduser().glob("gecko_sdk*") - ) + return list(pathlib.Path("~/SimplicityStudio/SDKs").expanduser().glob("*_sdk*")) return [] @@ -386,18 +384,23 @@ def main(): cmake_build_root = args.build_dir / f"{base_project_name}_cmake" shutil.rmtree(cmake_build_root, ignore_errors=True) + sdk_name: str + # Find the SDK version required by the project for sdk in args.sdks: + sdk_name = "gecko_sdk" if "gecko_sdk" in sdk.name else "simplicity_sdk" + try: - sdk_meta = yaml.load((sdk / "gecko_sdk.slcs").read_text()) + sdk_meta = yaml.load((sdk / f"{sdk_name}.slcs").read_text()) except FileNotFoundError: LOGGER.warning("SDK %s is not valid, skipping", sdk) continue - assert base_project["sdk"]["id"] == "gecko_sdk" - LOGGER.info("SDK %s has version %s", sdk, sdk_meta["sdk_version"]) + if base_project["sdk"]["id"] != sdk_name: + continue + if base_project["sdk"]["version"] == sdk_meta["sdk_version"]: LOGGER.info("Version is correct, picking %s", sdk) break @@ -546,7 +549,7 @@ def main(): extra_compiler_flags = [ f"-ffile-prefix-map={str(src.absolute())}={dst}" for src, dst in { - sdk: "/gecko_sdk", + sdk: f"/{sdk_name}", args.build_dir: "/src", toolchain: "/toolchain", }.items() From 8208e03907545047095560f8133ad294b957fcb8 Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:44:28 -0400 Subject: [PATCH 03/13] Rename `zigbee_app_framework_common` to `zigbee_system_common` --- src/ncp-uart-hw/ncp-uart-hw.slcp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ncp-uart-hw/ncp-uart-hw.slcp b/src/ncp-uart-hw/ncp-uart-hw.slcp index 679763f5..c1c5b9d7 100644 --- a/src/ncp-uart-hw/ncp-uart-hw.slcp +++ b/src/ncp-uart-hw/ncp-uart-hw.slcp @@ -37,7 +37,7 @@ component: - {id: iostream_vuart} - {id: memory_manager} - {id: token_manager} -- {id: zigbee_app_framework_common} +- {id: zigbee_system_common} - {id: zigbee_debug_basic} - {id: zigbee_debug_extended} - {id: zigbee_debug_print} From f71dcb6a5fc2da00f1bf9eecf5b3ca82667821d4 Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:57:10 -0400 Subject: [PATCH 04/13] Replace latest Gecko SDK with Simplicity SDK in Dockerfile --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9ac41213..466c0c17 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,11 +51,11 @@ RUN \ && tar -C /opt -xf gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 \ && rm gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 -# Gecko SDK 4.4.2 +# Simplicity SDK 2024.6.0 RUN \ - curl -o gecko_sdk_4.4.2.zip -L https://github.com/SiliconLabs/gecko_sdk/releases/download/v4.4.2/gecko-sdk.zip \ - && unzip -q -d gecko_sdk_4.4.2 gecko_sdk_4.4.2.zip \ - && rm gecko_sdk_4.4.2.zip + curl -o simplicity_sdk_2024.6.0.zip -L https://github.com/SiliconLabs/simplicity_sdk/releases/download/v2024.6.0/sisdk-sdk.zip \ + && unzip -q -d simplicity_sdk_2024.6.0 simplicity_sdk_2024.6.0.zip \ + && rm simplicity_sdk_2024.6.0.zip # Gecko SDK 4.3.1 RUN \ From dc8d95ffcdc06bdc910ed281738bf8d1989d618a Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:59:15 -0400 Subject: [PATCH 05/13] Glob the SDK name instead of hardcoding `gecko` --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9938b54a..edfcfd74 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -130,7 +130,7 @@ jobs: - name: Install SDK extensions run: | # XXX: slc-cli does not actually work when the extensions aren't in the SDK! - for sdk in /gecko_sdk_*; do + for sdk in /*_sdk_*; do slc signature trust --sdk "$sdk" ln -s $PWD/gecko_sdk_extensions "$sdk"/extension @@ -148,7 +148,7 @@ jobs: # Pass all SDKs as consecutive `--sdk ...` arguments sdk_args="" - for sdk_dir in /gecko_sdk*; do + for sdk_dir in /*_sdk*; do sdk_args="$sdk_args --sdk $sdk_dir" done From edb8fac34972f48b5cf3510c846aa3aa60dd9e7a Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:30:35 -0400 Subject: [PATCH 06/13] Upgrade firmware eraser --- .gitignore | 4 +- misc/firmware-eraser/.cproject | 51 ++++++++--- .../config/btl_interface_cfg_s2c1.h | 90 +++++++++---------- .../config/emlib_core_debug_config.h | 2 +- misc/firmware-eraser/config/sl_core_config.h | 44 +++++++++ .../config/sl_device_init_lfxo_config.h | 22 ----- .../config/sl_interrupt_manager_s2_config.h | 47 ++++++++++ .../config/sl_memory_manager_region_config.h | 49 ++++++++++ misc/firmware-eraser/firmware-eraser.slcp | 4 +- misc/firmware-eraser/firmware-eraser.slps | 3 +- 10 files changed, 232 insertions(+), 84 deletions(-) create mode 100644 misc/firmware-eraser/config/sl_core_config.h create mode 100644 misc/firmware-eraser/config/sl_interrupt_manager_s2_config.h create mode 100644 misc/firmware-eraser/config/sl_memory_manager_region_config.h diff --git a/.gitignore b/.gitignore index 6033bcbd..3ecce8f6 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,8 @@ build/ artifact/ artifacts/ trashed_modified_files/ + src/**/*.bak +src/**/*.bak0 misc/**/*.bak -src/**/*.bak0 \ No newline at end of file +misc/**/*.bak0 \ No newline at end of file diff --git a/misc/firmware-eraser/.cproject b/misc/firmware-eraser/.cproject index e43de06c..cfb1122a 100644 --- a/misc/firmware-eraser/.cproject +++ b/misc/firmware-eraser/.cproject @@ -4,7 +4,7 @@ - + @@ -23,9 +23,9 @@ - + - + - @@ -97,7 +106,7 @@ - @@ -142,6 +157,9 @@ + + + @@ -159,12 +177,18 @@ + + + + - + + + @@ -179,6 +203,9 @@ + + + @@ -245,7 +272,7 @@ - + @@ -264,7 +291,7 @@ - + @@ -323,14 +350,14 @@ - + - + diff --git a/misc/firmware-eraser/config/btl_interface_cfg_s2c1.h b/misc/firmware-eraser/config/btl_interface_cfg_s2c1.h index 7f703143..35e65f10 100644 --- a/misc/firmware-eraser/config/btl_interface_cfg_s2c1.h +++ b/misc/firmware-eraser/config/btl_interface_cfg_s2c1.h @@ -231,51 +231,51 @@ // <<< end of configuration section >>> #if BOOTLOADER_MANUAL_OVERRIDE_SECURITY_STATE == 1 -#define BOOTLOADER_PPUSATD0_MASK ((BOOTLOADER_PPUSATD0_EMU << _SMU_PPUSATD0_EMU_SHIFT) \ - | (BOOTLOADER_PPUSATD0_CMU << _SMU_PPUSATD0_CMU_SHIFT) \ - | (BOOTLOADER_PPUSATD0_HFXO0 << _SMU_PPUSATD0_HFXO0_SHIFT) \ - | (BOOTLOADER_PPUSATD0_HFRCO0 << _SMU_PPUSATD0_HFRCO0_SHIFT) \ - | (BOOTLOADER_PPUSATD0_FSRCO << _SMU_PPUSATD0_FSRCO_SHIFT) \ - | (BOOTLOADER_PPUSATD0_DPLL0 << _SMU_PPUSATD0_DPLL0_SHIFT) \ - | (BOOTLOADER_PPUSATD0_LFXO << _SMU_PPUSATD0_LFXO_SHIFT) \ - | (BOOTLOADER_PPUSATD0_LFRCO << _SMU_PPUSATD0_LFRCO_SHIFT) \ - | (BOOTLOADER_PPUSATD0_ULFRCO << _SMU_PPUSATD0_ULFRCO_SHIFT) \ - | (BOOTLOADER_PPUSATD0_MSC << _SMU_PPUSATD0_MSC_SHIFT) \ - | (BOOTLOADER_PPUSATD0_ICACHE0 << _SMU_PPUSATD0_ICACHE0_SHIFT) \ - | (BOOTLOADER_PPUSATD0_PRS << _SMU_PPUSATD0_PRS_SHIFT) \ - | (BOOTLOADER_PPUSATD0_GPIO << _SMU_PPUSATD0_GPIO_SHIFT) \ - | (BOOTLOADER_PPUSATD0_LDMA << _SMU_PPUSATD0_LDMA_SHIFT) \ - | (BOOTLOADER_PPUSATD0_LDMAXBAR << _SMU_PPUSATD0_LDMAXBAR_SHIFT) \ - | (BOOTLOADER_PPUSATD0_TIMER0 << _SMU_PPUSATD0_TIMER0_SHIFT) \ - | (BOOTLOADER_PPUSATD0_TIMER1 << _SMU_PPUSATD0_TIMER1_SHIFT) \ - | (BOOTLOADER_PPUSATD0_TIMER2 << _SMU_PPUSATD0_TIMER2_SHIFT) \ - | (BOOTLOADER_PPUSATD0_TIMER3 << _SMU_PPUSATD0_TIMER3_SHIFT) \ - | (BOOTLOADER_PPUSATD0_USART0 << _SMU_PPUSATD0_USART0_SHIFT) \ - | (BOOTLOADER_PPUSATD0_USART1 << _SMU_PPUSATD0_USART1_SHIFT) \ - | (BOOTLOADER_PPUSATD0_USART2 << _SMU_PPUSATD0_USART2_SHIFT) \ - | (BOOTLOADER_PPUSATD0_BURTC << _SMU_PPUSATD0_BURTC_SHIFT) \ - | (BOOTLOADER_PPUSATD0_I2C1 << _SMU_PPUSATD0_I2C1_SHIFT) \ - | (BOOTLOADER_PPUSATD0_CHIPTESTCTRL << _SMU_PPUSATD0_CHIPTESTCTRL_SHIFT) \ - | (BOOTLOADER_PPUSATD0_LVGD << _SMU_PPUSATD0_LVGD_SHIFT) \ - | (BOOTLOADER_PPUSATD0_SYSCFG << _SMU_PPUSATD0_SYSCFG_SHIFT) \ - | (BOOTLOADER_PPUSATD0_BURAM << _SMU_PPUSATD0_BURAM_SHIFT) \ - | (BOOTLOADER_PPUSATD0_IFADCDEBUG << _SMU_PPUSATD0_IFADCDEBUG_SHIFT) \ - | (BOOTLOADER_PPUSATD0_GPCRC << _SMU_PPUSATD0_GPCRC_SHIFT) \ - | (BOOTLOADER_PPUSATD0_RTCC << _SMU_PPUSATD0_RTCC_SHIFT)) -#define BOOTLOADER_PPUSATD1_MASK ((BOOTLOADER_PPUSATD1_LETIMER0 << _SMU_PPUSATD1_LETIMER0_SHIFT) \ - | (BOOTLOADER_PPUSATD1_IADC0 << _SMU_PPUSATD1_IADC0_SHIFT) \ - | (BOOTLOADER_PPUSATD1_ACMP0 << _SMU_PPUSATD1_ACMP0_SHIFT) \ - | (BOOTLOADER_PPUSATD1_ACMP1 << _SMU_PPUSATD1_ACMP1_SHIFT) \ - | (BOOTLOADER_PPUSATD1_I2C0 << _SMU_PPUSATD1_I2C0_SHIFT) \ - | (BOOTLOADER_PPUSATD1_HFRCOEM23 << _SMU_PPUSATD1_HFRCOEM23_SHIFT) \ - | (BOOTLOADER_PPUSATD1_WDOG0 << _SMU_PPUSATD1_WDOG0_SHIFT) \ - | (BOOTLOADER_PPUSATD1_WDOG1 << _SMU_PPUSATD1_WDOG1_SHIFT) \ - | (BOOTLOADER_PPUSATD1_AMUXCP0 << _SMU_PPUSATD1_AMUXCP0_SHIFT) \ - | (BOOTLOADER_PPUSATD1_RADIOAES << _SMU_PPUSATD1_RADIOAES_SHIFT) \ - | (BOOTLOADER_PPUSATD1_BUFC << _SMU_PPUSATD1_BUFC_SHIFT) \ - | (BOOTLOADER_PPUSATD1_SMU << _SMU_PPUSATD1_SMU_SHIFT) \ - | (BOOTLOADER_PPUSATD1_AHBRADIO << _SMU_PPUSATD1_AHBRADIO_SHIFT) \ - | (BOOTLOADER_PPUSATD1_SEMAILBOX << _SMU_PPUSATD1_SEMAILBOX_SHIFT)) +#define BOOTLOADER_PPUSATD0_MASK ((BOOTLOADER_PPUSATD0_EMU << _SMU_PPUSATD0_EMU_SHIFT) \ + | (BOOTLOADER_PPUSATD0_CMU << _SMU_PPUSATD0_CMU_SHIFT) \ + | (BOOTLOADER_PPUSATD0_HFXO0 << _SMU_PPUSATD0_HFXO0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_HFRCO0 << _SMU_PPUSATD0_HFRCO0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_FSRCO << _SMU_PPUSATD0_FSRCO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_DPLL0 << _SMU_PPUSATD0_DPLL0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_LFXO << _SMU_PPUSATD0_LFXO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_LFRCO << _SMU_PPUSATD0_LFRCO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_ULFRCO << _SMU_PPUSATD0_ULFRCO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_MSC << _SMU_PPUSATD0_MSC_SHIFT) \ + | (BOOTLOADER_PPUSATD0_ICACHE0 << _SMU_PPUSATD0_ICACHE0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_PRS << _SMU_PPUSATD0_PRS_SHIFT) \ + | (BOOTLOADER_PPUSATD0_GPIO << _SMU_PPUSATD0_GPIO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_LDMA << _SMU_PPUSATD0_LDMA_SHIFT) \ + | (BOOTLOADER_PPUSATD0_LDMAXBAR << _SMU_PPUSATD0_LDMAXBAR_SHIFT) \ + | (BOOTLOADER_PPUSATD0_TIMER0 << _SMU_PPUSATD0_TIMER0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_TIMER1 << _SMU_PPUSATD0_TIMER1_SHIFT) \ + | (BOOTLOADER_PPUSATD0_TIMER2 << _SMU_PPUSATD0_TIMER2_SHIFT) \ + | (BOOTLOADER_PPUSATD0_TIMER3 << _SMU_PPUSATD0_TIMER3_SHIFT) \ + | (BOOTLOADER_PPUSATD0_USART0 << _SMU_PPUSATD0_USART0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_USART1 << _SMU_PPUSATD0_USART1_SHIFT) \ + | (BOOTLOADER_PPUSATD0_USART2 << _SMU_PPUSATD0_USART2_SHIFT) \ + | (BOOTLOADER_PPUSATD0_BURTC << _SMU_PPUSATD0_BURTC_SHIFT) \ + | (BOOTLOADER_PPUSATD0_I2C1 << _SMU_PPUSATD0_I2C1_SHIFT) \ + | (BOOTLOADER_PPUSATD0_CHIPTESTCTRL << _SMU_PPUSATD0_CHIPTESTCTRL_SHIFT) \ + | (BOOTLOADER_PPUSATD0_LVGD << _SMU_PPUSATD0_LVGD_SHIFT) \ + | (BOOTLOADER_PPUSATD0_SYSCFG << _SMU_PPUSATD0_SYSCFG_SHIFT) \ + | (BOOTLOADER_PPUSATD0_BURAM << _SMU_PPUSATD0_BURAM_SHIFT) \ + | (BOOTLOADER_PPUSATD0_IFADCDEBUG << _SMU_PPUSATD0_IFADCDEBUG_SHIFT) \ + | (BOOTLOADER_PPUSATD0_GPCRC << _SMU_PPUSATD0_GPCRC_SHIFT) \ + | (BOOTLOADER_PPUSATD0_RTCC << _SMU_PPUSATD0_RTCC_SHIFT)) +#define BOOTLOADER_PPUSATD1_MASK ((BOOTLOADER_PPUSATD1_LETIMER0 << _SMU_PPUSATD1_LETIMER0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_IADC0 << _SMU_PPUSATD1_IADC0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_ACMP0 << _SMU_PPUSATD1_ACMP0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_ACMP1 << _SMU_PPUSATD1_ACMP1_SHIFT) \ + | (BOOTLOADER_PPUSATD1_I2C0 << _SMU_PPUSATD1_I2C0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_HFRCOEM23 << _SMU_PPUSATD1_HFRCOEM23_SHIFT) \ + | (BOOTLOADER_PPUSATD1_WDOG0 << _SMU_PPUSATD1_WDOG0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_WDOG1 << _SMU_PPUSATD1_WDOG1_SHIFT) \ + | (BOOTLOADER_PPUSATD1_AMUXCP0 << _SMU_PPUSATD1_AMUXCP0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_RADIOAES << _SMU_PPUSATD1_RADIOAES_SHIFT) \ + | (BOOTLOADER_PPUSATD1_BUFC << _SMU_PPUSATD1_BUFC_SHIFT) \ + | (BOOTLOADER_PPUSATD1_SMU << _SMU_PPUSATD1_SMU_SHIFT) \ + | (BOOTLOADER_PPUSATD1_AHBRADIO << _SMU_PPUSATD1_AHBRADIO_SHIFT) \ + | (BOOTLOADER_PPUSATD1_SEMAILBOX << _SMU_PPUSATD1_SEMAILBOX_SHIFT)) #endif // BOOTLOADER_MANUAL_OVERRIDE_SECURITY_STATE #endif // BTL_INTERFACE_CFG_S2C1_H \ No newline at end of file diff --git a/misc/firmware-eraser/config/emlib_core_debug_config.h b/misc/firmware-eraser/config/emlib_core_debug_config.h index e4a01682..82bba0b2 100644 --- a/misc/firmware-eraser/config/emlib_core_debug_config.h +++ b/misc/firmware-eraser/config/emlib_core_debug_config.h @@ -37,7 +37,7 @@ // Enables measuring of interrupt disable time for debugging purposes. // Default: 0 -#define SL_EMLIB_CORE_ENABLE_INTERRUPT_DISABLED_TIMING 0 +#define SL_CORE_DEBUG_INTERRUPTS_MASKED_TIMING 0 // diff --git a/misc/firmware-eraser/config/sl_core_config.h b/misc/firmware-eraser/config/sl_core_config.h new file mode 100644 index 00000000..27b173d2 --- /dev/null +++ b/misc/firmware-eraser/config/sl_core_config.h @@ -0,0 +1,44 @@ +/***************************************************************************//** + * @file + * @brief sl_core Configuration + ******************************************************************************* + * # License + * Copyright 2023 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +#ifndef SL_CORE_CONFIG_H +#define SL_CORE_CONFIG_H + +// <<< Use Configuration Wizard in Context Menu >>> + +// Core Abstraction Configuration + +// Enables measurement of interrupt masking time for debugging purposes. +// Default: 0 +#define SL_CORE_DEBUG_INTERRUPTS_MASKED_TIMING 0 +// + +// <<< end of configuration section >>> +#endif // SL_CORE_CONFIG_H diff --git a/misc/firmware-eraser/config/sl_device_init_lfxo_config.h b/misc/firmware-eraser/config/sl_device_init_lfxo_config.h index 29371b6c..7976b065 100644 --- a/misc/firmware-eraser/config/sl_device_init_lfxo_config.h +++ b/misc/firmware-eraser/config/sl_device_init_lfxo_config.h @@ -63,26 +63,4 @@ #define SL_DEVICE_INIT_LFXO_TIMEOUT cmuLfxoStartupDelay_4KCycles // <<< end of configuration section >>> -// <<< sl:start pin_tool >>> -// SL_DEVICE_INIT_LFXO -// $[LFXO_SL_DEVICE_INIT_LFXO] -#define SL_DEVICE_INIT_LFXO_PERIPHERAL LFXO - -// LFXO LFXTAL_O on PD00 -#define SL_DEVICE_INIT_LFXO_LFXTAL_O_PORT gpioPortD -#define SL_DEVICE_INIT_LFXO_LFXTAL_O_PIN 0 - -// LFXO LFXTAL_I on PD01 -#define SL_DEVICE_INIT_LFXO_LFXTAL_I_PORT gpioPortD -#define SL_DEVICE_INIT_LFXO_LFXTAL_I_PIN 1 - - -// [LFXO_SL_DEVICE_INIT_LFXO]$ - -// $[LFXO_EXTERNAL_DIGITAL_CLOCK] -#define SL_DEVICE_INIT_LFXO_LF_EXTCLK_PORT gpioPortD -#define SL_DEVICE_INIT_LFXO_LF_EXTCLK_PIN 1 -// [LFXO_EXTERNAL_DIGITAL_CLOCK]$ -// <<< sl:end pin_tool >>> - #endif // SL_DEVICE_INIT_LFXO_CONFIG_H \ No newline at end of file diff --git a/misc/firmware-eraser/config/sl_interrupt_manager_s2_config.h b/misc/firmware-eraser/config/sl_interrupt_manager_s2_config.h new file mode 100644 index 00000000..714893aa --- /dev/null +++ b/misc/firmware-eraser/config/sl_interrupt_manager_s2_config.h @@ -0,0 +1,47 @@ +/***************************************************************************//** + * @file + * @brief Interrupt Manager configuration file for series 2 devices. + ******************************************************************************* + * # License + * Copyright 2023 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +// <<< Use Configuration Wizard in Context Menu >>> + +#ifndef SL_INTERRUPT_MANAGER_S2_CONFIG_H +#define SL_INTERRUPT_MANAGER_S2_CONFIG_H + +// Interrupt Manager Configuration + +// Put the interrupt vector table in RAM. +// Set to 1 to put the vector table in RAM. +// Default: 0 +#define SL_INTERRUPT_MANAGER_S2_INTERRUPTS_IN_RAM 0 + +// + +#endif /* SSL_INTERRUPT_MANAGER_S2_CONFIG_H */ + +// <<< end of configuration section >>> diff --git a/misc/firmware-eraser/config/sl_memory_manager_region_config.h b/misc/firmware-eraser/config/sl_memory_manager_region_config.h new file mode 100644 index 00000000..ba02fdd8 --- /dev/null +++ b/misc/firmware-eraser/config/sl_memory_manager_region_config.h @@ -0,0 +1,49 @@ +/***************************************************************************//** + * @file + * @brief Memory Heap and stack size configuration file. + ******************************************************************************* + * # License + * Copyright 2024 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +// <<< Use Configuration Wizard in Context Menu >>> + +#ifndef SL_MEMORY_MANAGER_REGION_CONFIG_H +#define SL_MEMORY_MANAGER_REGION_CONFIG_H + +// Memory configuration + +// Stack size for the application. +// Default: 4096 +// The stack size configured here will be used by the stack that the +// application uses when coming out of a reset. +#ifndef SL_STACK_SIZE +#define SL_STACK_SIZE 4096 +#endif +// + +// <<< end of configuration section >>> + +#endif /* SL_MEMORY_MANAGER_REGION_CONFIG_H */ diff --git a/misc/firmware-eraser/firmware-eraser.slcp b/misc/firmware-eraser/firmware-eraser.slcp index 58036c1b..db017b90 100644 --- a/misc/firmware-eraser/firmware-eraser.slcp +++ b/misc/firmware-eraser/firmware-eraser.slcp @@ -19,10 +19,10 @@ source: - {path: app.cpp} - {path: main.cpp} include: -- path: '' +- path: . file_list: - {path: app.h} -sdk: {id: gecko_sdk, version: 4.4.2} +sdk: {id: simplicity_sdk, version: 2024.6.0} toolchain_settings: [] component: - {id: EFR32MG21A010F1024IM32} diff --git a/misc/firmware-eraser/firmware-eraser.slps b/misc/firmware-eraser/firmware-eraser.slps index b0409ce9..ad839ec8 100644 --- a/misc/firmware-eraser/firmware-eraser.slps +++ b/misc/firmware-eraser/firmware-eraser.slps @@ -1,7 +1,7 @@ - + @@ -12,5 +12,6 @@ + \ No newline at end of file From ff49d553e196c941c515fe38a1120e5879df0fd6 Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:32:47 -0400 Subject: [PATCH 07/13] Upgrade bootloader --- src/bootloader-uart-xmodem/.cproject | 26 ++++++---- .../bootloader-uart-xmodem.slcp | 3 +- .../bootloader-uart-xmodem.slps | 3 +- .../config/emlib_core_debug_config.h | 2 +- .../config/sl_core_config.h | 44 +++++++++++++++++ .../config/sl_memory_manager_config.h | 49 +++++++++++++++++++ .../config/sl_memory_manager_region_config.h | 49 +++++++++++++++++++ 7 files changed, 164 insertions(+), 12 deletions(-) create mode 100644 src/bootloader-uart-xmodem/config/sl_core_config.h create mode 100644 src/bootloader-uart-xmodem/config/sl_memory_manager_config.h create mode 100644 src/bootloader-uart-xmodem/config/sl_memory_manager_region_config.h diff --git a/src/bootloader-uart-xmodem/.cproject b/src/bootloader-uart-xmodem/.cproject index bdab046b..93b79a48 100644 --- a/src/bootloader-uart-xmodem/.cproject +++ b/src/bootloader-uart-xmodem/.cproject @@ -4,7 +4,7 @@ - + @@ -23,7 +23,7 @@ - + @@ -38,7 +38,7 @@ - @@ -116,7 +119,7 @@ - @@ -207,6 +213,7 @@ @@ -245,7 +253,7 @@ - + diff --git a/src/bootloader-uart-xmodem/bootloader-uart-xmodem.slcp b/src/bootloader-uart-xmodem/bootloader-uart-xmodem.slcp index 5c191301..7c13abca 100644 --- a/src/bootloader-uart-xmodem/bootloader-uart-xmodem.slcp +++ b/src/bootloader-uart-xmodem/bootloader-uart-xmodem.slcp @@ -15,7 +15,7 @@ package: bootloader quality: production readme: - {path: readme.md} -sdk: {id: gecko_sdk, version: 4.4.2} +sdk: {id: simplicity_sdk, version: 2024.6.0} toolchain_settings: [] component: - {id: EFR32MG21A010F1024IM32} @@ -32,6 +32,7 @@ component: - {id: bootloader_xmodem_parser} - {id: brd4001a} - {id: brd4179b} +- {id: memory_manager} configuration: - {name: SL_VCOM_ENABLE, value: '1'} ui_hints: diff --git a/src/bootloader-uart-xmodem/bootloader-uart-xmodem.slps b/src/bootloader-uart-xmodem/bootloader-uart-xmodem.slps index 2cbc35df..85fdb414 100644 --- a/src/bootloader-uart-xmodem/bootloader-uart-xmodem.slps +++ b/src/bootloader-uart-xmodem/bootloader-uart-xmodem.slps @@ -1,7 +1,7 @@ - + @@ -12,5 +12,6 @@ + \ No newline at end of file diff --git a/src/bootloader-uart-xmodem/config/emlib_core_debug_config.h b/src/bootloader-uart-xmodem/config/emlib_core_debug_config.h index e4a01682..82bba0b2 100644 --- a/src/bootloader-uart-xmodem/config/emlib_core_debug_config.h +++ b/src/bootloader-uart-xmodem/config/emlib_core_debug_config.h @@ -37,7 +37,7 @@ // Enables measuring of interrupt disable time for debugging purposes. // Default: 0 -#define SL_EMLIB_CORE_ENABLE_INTERRUPT_DISABLED_TIMING 0 +#define SL_CORE_DEBUG_INTERRUPTS_MASKED_TIMING 0 // diff --git a/src/bootloader-uart-xmodem/config/sl_core_config.h b/src/bootloader-uart-xmodem/config/sl_core_config.h new file mode 100644 index 00000000..27b173d2 --- /dev/null +++ b/src/bootloader-uart-xmodem/config/sl_core_config.h @@ -0,0 +1,44 @@ +/***************************************************************************//** + * @file + * @brief sl_core Configuration + ******************************************************************************* + * # License + * Copyright 2023 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +#ifndef SL_CORE_CONFIG_H +#define SL_CORE_CONFIG_H + +// <<< Use Configuration Wizard in Context Menu >>> + +// Core Abstraction Configuration + +// Enables measurement of interrupt masking time for debugging purposes. +// Default: 0 +#define SL_CORE_DEBUG_INTERRUPTS_MASKED_TIMING 0 +// + +// <<< end of configuration section >>> +#endif // SL_CORE_CONFIG_H diff --git a/src/bootloader-uart-xmodem/config/sl_memory_manager_config.h b/src/bootloader-uart-xmodem/config/sl_memory_manager_config.h new file mode 100644 index 00000000..7e4b0567 --- /dev/null +++ b/src/bootloader-uart-xmodem/config/sl_memory_manager_config.h @@ -0,0 +1,49 @@ +/***************************************************************************//** + * @file + * @brief Memory Heap Allocator configuration file. + ******************************************************************************* + * # License + * Copyright 2024 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +// <<< Use Configuration Wizard in Context Menu >>> + +#ifndef SL_MEMORY_MANAGER_CONFIG_H +#define SL_MEMORY_MANAGER_CONFIG_H + +// Memory Manager Configuration + +// Minimum block allocation size +// <32-128:8> +// Minimum block allocation size to avoid creating a block too small while splitting up an allocated block. +// Size expressed in bytes and can only be a multiple of 8 bytes for the proper data alignment management done by the dynamic allocator malloc() function. +// Default: 32 +#define SL_MEMORY_MANAGER_BLOCK_ALLOCATION_MIN_SIZE (32) + +// + +// <<< end of configuration section >>> + +#endif /* SL_MEMORY_MANAGER_CONFIG_H */ diff --git a/src/bootloader-uart-xmodem/config/sl_memory_manager_region_config.h b/src/bootloader-uart-xmodem/config/sl_memory_manager_region_config.h new file mode 100644 index 00000000..ba02fdd8 --- /dev/null +++ b/src/bootloader-uart-xmodem/config/sl_memory_manager_region_config.h @@ -0,0 +1,49 @@ +/***************************************************************************//** + * @file + * @brief Memory Heap and stack size configuration file. + ******************************************************************************* + * # License + * Copyright 2024 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +// <<< Use Configuration Wizard in Context Menu >>> + +#ifndef SL_MEMORY_MANAGER_REGION_CONFIG_H +#define SL_MEMORY_MANAGER_REGION_CONFIG_H + +// Memory configuration + +// Stack size for the application. +// Default: 4096 +// The stack size configured here will be used by the stack that the +// application uses when coming out of a reset. +#ifndef SL_STACK_SIZE +#define SL_STACK_SIZE 4096 +#endif +// + +// <<< end of configuration section >>> + +#endif /* SL_MEMORY_MANAGER_REGION_CONFIG_H */ From 007b474ae81a33ad8289a7081b40a717871bc8dd Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:40:46 -0400 Subject: [PATCH 08/13] Upgrade OpenThread --- src/ot-rcp/.cproject | 92 ++++++++++++----- src/ot-rcp/config/btl_interface_cfg_s2c1.h | 90 ++++++++--------- src/ot-rcp/config/circular_queue_config.h | 23 +++++ src/ot-rcp/config/emlib_core_debug_config.h | 2 +- src/ot-rcp/config/sl_core_config.h | 44 +++++++++ .../config/sl_device_init_lfxo_config.h | 22 ----- src/ot-rcp/config/sl_gp_interface_config.h | 44 +++++++++ .../config/sl_interrupt_manager_s2_config.h | 47 +++++++++ src/ot-rcp/config/sl_memory_config.h | 25 +---- src/ot-rcp/config/sl_memory_manager_config.h | 49 +++++++++ .../config/sl_memory_manager_region_config.h | 49 +++++++++ .../config/sl_openthread_features_config.h | 99 +++++++++++++++++-- src/ot-rcp/ot-rcp.slcp | 9 +- src/ot-rcp/ot-rcp.slps | 3 +- 14 files changed, 473 insertions(+), 125 deletions(-) create mode 100644 src/ot-rcp/config/circular_queue_config.h create mode 100644 src/ot-rcp/config/sl_core_config.h create mode 100644 src/ot-rcp/config/sl_gp_interface_config.h create mode 100644 src/ot-rcp/config/sl_interrupt_manager_s2_config.h create mode 100644 src/ot-rcp/config/sl_memory_manager_config.h create mode 100644 src/ot-rcp/config/sl_memory_manager_region_config.h diff --git a/src/ot-rcp/.cproject b/src/ot-rcp/.cproject index ddf40559..99861877 100644 --- a/src/ot-rcp/.cproject +++ b/src/ot-rcp/.cproject @@ -4,7 +4,7 @@ - + @@ -23,7 +23,7 @@ - + @@ -38,7 +38,7 @@ - @@ -158,7 +174,7 @@ - @@ -289,35 +321,42 @@ + + + + + + + + + + - - - @@ -335,7 +374,7 @@ - + @@ -353,11 +392,14 @@ + + - + + @@ -365,6 +407,7 @@ + @@ -373,6 +416,9 @@ + + + @@ -391,6 +437,7 @@ - + diff --git a/src/ot-rcp/config/btl_interface_cfg_s2c1.h b/src/ot-rcp/config/btl_interface_cfg_s2c1.h index 7f703143..35e65f10 100644 --- a/src/ot-rcp/config/btl_interface_cfg_s2c1.h +++ b/src/ot-rcp/config/btl_interface_cfg_s2c1.h @@ -231,51 +231,51 @@ // <<< end of configuration section >>> #if BOOTLOADER_MANUAL_OVERRIDE_SECURITY_STATE == 1 -#define BOOTLOADER_PPUSATD0_MASK ((BOOTLOADER_PPUSATD0_EMU << _SMU_PPUSATD0_EMU_SHIFT) \ - | (BOOTLOADER_PPUSATD0_CMU << _SMU_PPUSATD0_CMU_SHIFT) \ - | (BOOTLOADER_PPUSATD0_HFXO0 << _SMU_PPUSATD0_HFXO0_SHIFT) \ - | (BOOTLOADER_PPUSATD0_HFRCO0 << _SMU_PPUSATD0_HFRCO0_SHIFT) \ - | (BOOTLOADER_PPUSATD0_FSRCO << _SMU_PPUSATD0_FSRCO_SHIFT) \ - | (BOOTLOADER_PPUSATD0_DPLL0 << _SMU_PPUSATD0_DPLL0_SHIFT) \ - | (BOOTLOADER_PPUSATD0_LFXO << _SMU_PPUSATD0_LFXO_SHIFT) \ - | (BOOTLOADER_PPUSATD0_LFRCO << _SMU_PPUSATD0_LFRCO_SHIFT) \ - | (BOOTLOADER_PPUSATD0_ULFRCO << _SMU_PPUSATD0_ULFRCO_SHIFT) \ - | (BOOTLOADER_PPUSATD0_MSC << _SMU_PPUSATD0_MSC_SHIFT) \ - | (BOOTLOADER_PPUSATD0_ICACHE0 << _SMU_PPUSATD0_ICACHE0_SHIFT) \ - | (BOOTLOADER_PPUSATD0_PRS << _SMU_PPUSATD0_PRS_SHIFT) \ - | (BOOTLOADER_PPUSATD0_GPIO << _SMU_PPUSATD0_GPIO_SHIFT) \ - | (BOOTLOADER_PPUSATD0_LDMA << _SMU_PPUSATD0_LDMA_SHIFT) \ - | (BOOTLOADER_PPUSATD0_LDMAXBAR << _SMU_PPUSATD0_LDMAXBAR_SHIFT) \ - | (BOOTLOADER_PPUSATD0_TIMER0 << _SMU_PPUSATD0_TIMER0_SHIFT) \ - | (BOOTLOADER_PPUSATD0_TIMER1 << _SMU_PPUSATD0_TIMER1_SHIFT) \ - | (BOOTLOADER_PPUSATD0_TIMER2 << _SMU_PPUSATD0_TIMER2_SHIFT) \ - | (BOOTLOADER_PPUSATD0_TIMER3 << _SMU_PPUSATD0_TIMER3_SHIFT) \ - | (BOOTLOADER_PPUSATD0_USART0 << _SMU_PPUSATD0_USART0_SHIFT) \ - | (BOOTLOADER_PPUSATD0_USART1 << _SMU_PPUSATD0_USART1_SHIFT) \ - | (BOOTLOADER_PPUSATD0_USART2 << _SMU_PPUSATD0_USART2_SHIFT) \ - | (BOOTLOADER_PPUSATD0_BURTC << _SMU_PPUSATD0_BURTC_SHIFT) \ - | (BOOTLOADER_PPUSATD0_I2C1 << _SMU_PPUSATD0_I2C1_SHIFT) \ - | (BOOTLOADER_PPUSATD0_CHIPTESTCTRL << _SMU_PPUSATD0_CHIPTESTCTRL_SHIFT) \ - | (BOOTLOADER_PPUSATD0_LVGD << _SMU_PPUSATD0_LVGD_SHIFT) \ - | (BOOTLOADER_PPUSATD0_SYSCFG << _SMU_PPUSATD0_SYSCFG_SHIFT) \ - | (BOOTLOADER_PPUSATD0_BURAM << _SMU_PPUSATD0_BURAM_SHIFT) \ - | (BOOTLOADER_PPUSATD0_IFADCDEBUG << _SMU_PPUSATD0_IFADCDEBUG_SHIFT) \ - | (BOOTLOADER_PPUSATD0_GPCRC << _SMU_PPUSATD0_GPCRC_SHIFT) \ - | (BOOTLOADER_PPUSATD0_RTCC << _SMU_PPUSATD0_RTCC_SHIFT)) -#define BOOTLOADER_PPUSATD1_MASK ((BOOTLOADER_PPUSATD1_LETIMER0 << _SMU_PPUSATD1_LETIMER0_SHIFT) \ - | (BOOTLOADER_PPUSATD1_IADC0 << _SMU_PPUSATD1_IADC0_SHIFT) \ - | (BOOTLOADER_PPUSATD1_ACMP0 << _SMU_PPUSATD1_ACMP0_SHIFT) \ - | (BOOTLOADER_PPUSATD1_ACMP1 << _SMU_PPUSATD1_ACMP1_SHIFT) \ - | (BOOTLOADER_PPUSATD1_I2C0 << _SMU_PPUSATD1_I2C0_SHIFT) \ - | (BOOTLOADER_PPUSATD1_HFRCOEM23 << _SMU_PPUSATD1_HFRCOEM23_SHIFT) \ - | (BOOTLOADER_PPUSATD1_WDOG0 << _SMU_PPUSATD1_WDOG0_SHIFT) \ - | (BOOTLOADER_PPUSATD1_WDOG1 << _SMU_PPUSATD1_WDOG1_SHIFT) \ - | (BOOTLOADER_PPUSATD1_AMUXCP0 << _SMU_PPUSATD1_AMUXCP0_SHIFT) \ - | (BOOTLOADER_PPUSATD1_RADIOAES << _SMU_PPUSATD1_RADIOAES_SHIFT) \ - | (BOOTLOADER_PPUSATD1_BUFC << _SMU_PPUSATD1_BUFC_SHIFT) \ - | (BOOTLOADER_PPUSATD1_SMU << _SMU_PPUSATD1_SMU_SHIFT) \ - | (BOOTLOADER_PPUSATD1_AHBRADIO << _SMU_PPUSATD1_AHBRADIO_SHIFT) \ - | (BOOTLOADER_PPUSATD1_SEMAILBOX << _SMU_PPUSATD1_SEMAILBOX_SHIFT)) +#define BOOTLOADER_PPUSATD0_MASK ((BOOTLOADER_PPUSATD0_EMU << _SMU_PPUSATD0_EMU_SHIFT) \ + | (BOOTLOADER_PPUSATD0_CMU << _SMU_PPUSATD0_CMU_SHIFT) \ + | (BOOTLOADER_PPUSATD0_HFXO0 << _SMU_PPUSATD0_HFXO0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_HFRCO0 << _SMU_PPUSATD0_HFRCO0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_FSRCO << _SMU_PPUSATD0_FSRCO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_DPLL0 << _SMU_PPUSATD0_DPLL0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_LFXO << _SMU_PPUSATD0_LFXO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_LFRCO << _SMU_PPUSATD0_LFRCO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_ULFRCO << _SMU_PPUSATD0_ULFRCO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_MSC << _SMU_PPUSATD0_MSC_SHIFT) \ + | (BOOTLOADER_PPUSATD0_ICACHE0 << _SMU_PPUSATD0_ICACHE0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_PRS << _SMU_PPUSATD0_PRS_SHIFT) \ + | (BOOTLOADER_PPUSATD0_GPIO << _SMU_PPUSATD0_GPIO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_LDMA << _SMU_PPUSATD0_LDMA_SHIFT) \ + | (BOOTLOADER_PPUSATD0_LDMAXBAR << _SMU_PPUSATD0_LDMAXBAR_SHIFT) \ + | (BOOTLOADER_PPUSATD0_TIMER0 << _SMU_PPUSATD0_TIMER0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_TIMER1 << _SMU_PPUSATD0_TIMER1_SHIFT) \ + | (BOOTLOADER_PPUSATD0_TIMER2 << _SMU_PPUSATD0_TIMER2_SHIFT) \ + | (BOOTLOADER_PPUSATD0_TIMER3 << _SMU_PPUSATD0_TIMER3_SHIFT) \ + | (BOOTLOADER_PPUSATD0_USART0 << _SMU_PPUSATD0_USART0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_USART1 << _SMU_PPUSATD0_USART1_SHIFT) \ + | (BOOTLOADER_PPUSATD0_USART2 << _SMU_PPUSATD0_USART2_SHIFT) \ + | (BOOTLOADER_PPUSATD0_BURTC << _SMU_PPUSATD0_BURTC_SHIFT) \ + | (BOOTLOADER_PPUSATD0_I2C1 << _SMU_PPUSATD0_I2C1_SHIFT) \ + | (BOOTLOADER_PPUSATD0_CHIPTESTCTRL << _SMU_PPUSATD0_CHIPTESTCTRL_SHIFT) \ + | (BOOTLOADER_PPUSATD0_LVGD << _SMU_PPUSATD0_LVGD_SHIFT) \ + | (BOOTLOADER_PPUSATD0_SYSCFG << _SMU_PPUSATD0_SYSCFG_SHIFT) \ + | (BOOTLOADER_PPUSATD0_BURAM << _SMU_PPUSATD0_BURAM_SHIFT) \ + | (BOOTLOADER_PPUSATD0_IFADCDEBUG << _SMU_PPUSATD0_IFADCDEBUG_SHIFT) \ + | (BOOTLOADER_PPUSATD0_GPCRC << _SMU_PPUSATD0_GPCRC_SHIFT) \ + | (BOOTLOADER_PPUSATD0_RTCC << _SMU_PPUSATD0_RTCC_SHIFT)) +#define BOOTLOADER_PPUSATD1_MASK ((BOOTLOADER_PPUSATD1_LETIMER0 << _SMU_PPUSATD1_LETIMER0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_IADC0 << _SMU_PPUSATD1_IADC0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_ACMP0 << _SMU_PPUSATD1_ACMP0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_ACMP1 << _SMU_PPUSATD1_ACMP1_SHIFT) \ + | (BOOTLOADER_PPUSATD1_I2C0 << _SMU_PPUSATD1_I2C0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_HFRCOEM23 << _SMU_PPUSATD1_HFRCOEM23_SHIFT) \ + | (BOOTLOADER_PPUSATD1_WDOG0 << _SMU_PPUSATD1_WDOG0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_WDOG1 << _SMU_PPUSATD1_WDOG1_SHIFT) \ + | (BOOTLOADER_PPUSATD1_AMUXCP0 << _SMU_PPUSATD1_AMUXCP0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_RADIOAES << _SMU_PPUSATD1_RADIOAES_SHIFT) \ + | (BOOTLOADER_PPUSATD1_BUFC << _SMU_PPUSATD1_BUFC_SHIFT) \ + | (BOOTLOADER_PPUSATD1_SMU << _SMU_PPUSATD1_SMU_SHIFT) \ + | (BOOTLOADER_PPUSATD1_AHBRADIO << _SMU_PPUSATD1_AHBRADIO_SHIFT) \ + | (BOOTLOADER_PPUSATD1_SEMAILBOX << _SMU_PPUSATD1_SEMAILBOX_SHIFT)) #endif // BOOTLOADER_MANUAL_OVERRIDE_SECURITY_STATE #endif // BTL_INTERFACE_CFG_S2C1_H \ No newline at end of file diff --git a/src/ot-rcp/config/circular_queue_config.h b/src/ot-rcp/config/circular_queue_config.h new file mode 100644 index 00000000..81a7173d --- /dev/null +++ b/src/ot-rcp/config/circular_queue_config.h @@ -0,0 +1,23 @@ +/***************************************************************************//** + * @file circular_queue_config.h + * @brief Configuration file for circular queue. + * @copyright Copyright 2015 Silicon Laboratories, Inc. www.silabs.com + ******************************************************************************/ + +#ifndef __CIRCULAR_QUEUE_CONFIG_H__ +#define __CIRCULAR_QUEUE_CONFIG_H__ + +// <<< Use Configuration Wizard in Context Menu >>> +// Circular Queue Configuration + +// Max Queue Length +// <0-256:1> +// Default: 5 +#ifndef CIRCULAR_QUEUE_LEN_MAX +#define CIRCULAR_QUEUE_LEN_MAX 16 +#endif + +// +// <<< end of configuration section >>> + +#endif // __CIRCULAR_QUEUE_CONFIG_H__ diff --git a/src/ot-rcp/config/emlib_core_debug_config.h b/src/ot-rcp/config/emlib_core_debug_config.h index e4a01682..82bba0b2 100644 --- a/src/ot-rcp/config/emlib_core_debug_config.h +++ b/src/ot-rcp/config/emlib_core_debug_config.h @@ -37,7 +37,7 @@ // Enables measuring of interrupt disable time for debugging purposes. // Default: 0 -#define SL_EMLIB_CORE_ENABLE_INTERRUPT_DISABLED_TIMING 0 +#define SL_CORE_DEBUG_INTERRUPTS_MASKED_TIMING 0 // diff --git a/src/ot-rcp/config/sl_core_config.h b/src/ot-rcp/config/sl_core_config.h new file mode 100644 index 00000000..27b173d2 --- /dev/null +++ b/src/ot-rcp/config/sl_core_config.h @@ -0,0 +1,44 @@ +/***************************************************************************//** + * @file + * @brief sl_core Configuration + ******************************************************************************* + * # License + * Copyright 2023 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +#ifndef SL_CORE_CONFIG_H +#define SL_CORE_CONFIG_H + +// <<< Use Configuration Wizard in Context Menu >>> + +// Core Abstraction Configuration + +// Enables measurement of interrupt masking time for debugging purposes. +// Default: 0 +#define SL_CORE_DEBUG_INTERRUPTS_MASKED_TIMING 0 +// + +// <<< end of configuration section >>> +#endif // SL_CORE_CONFIG_H diff --git a/src/ot-rcp/config/sl_device_init_lfxo_config.h b/src/ot-rcp/config/sl_device_init_lfxo_config.h index 29371b6c..7976b065 100644 --- a/src/ot-rcp/config/sl_device_init_lfxo_config.h +++ b/src/ot-rcp/config/sl_device_init_lfxo_config.h @@ -63,26 +63,4 @@ #define SL_DEVICE_INIT_LFXO_TIMEOUT cmuLfxoStartupDelay_4KCycles // <<< end of configuration section >>> -// <<< sl:start pin_tool >>> -// SL_DEVICE_INIT_LFXO -// $[LFXO_SL_DEVICE_INIT_LFXO] -#define SL_DEVICE_INIT_LFXO_PERIPHERAL LFXO - -// LFXO LFXTAL_O on PD00 -#define SL_DEVICE_INIT_LFXO_LFXTAL_O_PORT gpioPortD -#define SL_DEVICE_INIT_LFXO_LFXTAL_O_PIN 0 - -// LFXO LFXTAL_I on PD01 -#define SL_DEVICE_INIT_LFXO_LFXTAL_I_PORT gpioPortD -#define SL_DEVICE_INIT_LFXO_LFXTAL_I_PIN 1 - - -// [LFXO_SL_DEVICE_INIT_LFXO]$ - -// $[LFXO_EXTERNAL_DIGITAL_CLOCK] -#define SL_DEVICE_INIT_LFXO_LF_EXTCLK_PORT gpioPortD -#define SL_DEVICE_INIT_LFXO_LF_EXTCLK_PIN 1 -// [LFXO_EXTERNAL_DIGITAL_CLOCK]$ -// <<< sl:end pin_tool >>> - #endif // SL_DEVICE_INIT_LFXO_CONFIG_H \ No newline at end of file diff --git a/src/ot-rcp/config/sl_gp_interface_config.h b/src/ot-rcp/config/sl_gp_interface_config.h new file mode 100644 index 00000000..a937b58b --- /dev/null +++ b/src/ot-rcp/config/sl_gp_interface_config.h @@ -0,0 +1,44 @@ +/***************************************************************************//** + * @file + * @brief OpenThread Green Power configuration file. + ******************************************************************************* + * # License + * Copyright 2024 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +//-------- <<< Use Configuration Wizard in Context Menu >>> ----------------- + +// Rx Offset time +// The rx offset time for the bidirectional message. +// +#define GP_RX_OFFSET_IN_MICRO_SECONDS 21000 +// + +// TX Timeout +// Tx timeout after which the gp outgoing packet is invalid. +// +#define GP_TX_MAX_TIMEOUT_IN_MICRO_SECONDS 5000000 +// +// <<< end of configuration section >>> diff --git a/src/ot-rcp/config/sl_interrupt_manager_s2_config.h b/src/ot-rcp/config/sl_interrupt_manager_s2_config.h new file mode 100644 index 00000000..714893aa --- /dev/null +++ b/src/ot-rcp/config/sl_interrupt_manager_s2_config.h @@ -0,0 +1,47 @@ +/***************************************************************************//** + * @file + * @brief Interrupt Manager configuration file for series 2 devices. + ******************************************************************************* + * # License + * Copyright 2023 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +// <<< Use Configuration Wizard in Context Menu >>> + +#ifndef SL_INTERRUPT_MANAGER_S2_CONFIG_H +#define SL_INTERRUPT_MANAGER_S2_CONFIG_H + +// Interrupt Manager Configuration + +// Put the interrupt vector table in RAM. +// Set to 1 to put the vector table in RAM. +// Default: 0 +#define SL_INTERRUPT_MANAGER_S2_INTERRUPTS_IN_RAM 0 + +// + +#endif /* SSL_INTERRUPT_MANAGER_S2_CONFIG_H */ + +// <<< end of configuration section >>> diff --git a/src/ot-rcp/config/sl_memory_config.h b/src/ot-rcp/config/sl_memory_config.h index 9acd1505..f1fd3df8 100644 --- a/src/ot-rcp/config/sl_memory_config.h +++ b/src/ot-rcp/config/sl_memory_config.h @@ -1,28 +1,11 @@ #ifndef SL_MEMORY_CONFIG_H #define SL_MEMORY_CONFIG_H -// <<< Use Configuration Wizard in Context Menu >>> -// Memory configuration +#include "sl_memory_manager_region_config.h" +#include "sl_common.h" -// Stack size for the application. -// Default: 4096 -// The stack size configured here will be used by the stack that the -// application uses when coming out of a reset. -#ifndef SL_STACK_SIZE - #define SL_STACK_SIZE 4096 +#ifndef SL_SUPPRESS_DEPRECATION_WARNINGS_SDK_2024_6 +#warning "This file is deprecated as of Simplicity SDK 2024.6. Content was moved to sl_memory_manager_region_config.h." #endif -// Minimum heap size for the application. -// Default: 2048 -// Note that this value will configure the c heap which is normally used by -// malloc() and free() from the c library. The value defines a minimum heap -// size that is guaranteed to be available. The available heap may be larger -// to make use of any memory that would otherwise remain unused. -#ifndef SL_HEAP_SIZE - #define SL_HEAP_SIZE 2048 -#endif - -// -// <<< end of configuration section >>> - #endif \ No newline at end of file diff --git a/src/ot-rcp/config/sl_memory_manager_config.h b/src/ot-rcp/config/sl_memory_manager_config.h new file mode 100644 index 00000000..7e4b0567 --- /dev/null +++ b/src/ot-rcp/config/sl_memory_manager_config.h @@ -0,0 +1,49 @@ +/***************************************************************************//** + * @file + * @brief Memory Heap Allocator configuration file. + ******************************************************************************* + * # License + * Copyright 2024 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +// <<< Use Configuration Wizard in Context Menu >>> + +#ifndef SL_MEMORY_MANAGER_CONFIG_H +#define SL_MEMORY_MANAGER_CONFIG_H + +// Memory Manager Configuration + +// Minimum block allocation size +// <32-128:8> +// Minimum block allocation size to avoid creating a block too small while splitting up an allocated block. +// Size expressed in bytes and can only be a multiple of 8 bytes for the proper data alignment management done by the dynamic allocator malloc() function. +// Default: 32 +#define SL_MEMORY_MANAGER_BLOCK_ALLOCATION_MIN_SIZE (32) + +// + +// <<< end of configuration section >>> + +#endif /* SL_MEMORY_MANAGER_CONFIG_H */ diff --git a/src/ot-rcp/config/sl_memory_manager_region_config.h b/src/ot-rcp/config/sl_memory_manager_region_config.h new file mode 100644 index 00000000..ba02fdd8 --- /dev/null +++ b/src/ot-rcp/config/sl_memory_manager_region_config.h @@ -0,0 +1,49 @@ +/***************************************************************************//** + * @file + * @brief Memory Heap and stack size configuration file. + ******************************************************************************* + * # License + * Copyright 2024 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +// <<< Use Configuration Wizard in Context Menu >>> + +#ifndef SL_MEMORY_MANAGER_REGION_CONFIG_H +#define SL_MEMORY_MANAGER_REGION_CONFIG_H + +// Memory configuration + +// Stack size for the application. +// Default: 4096 +// The stack size configured here will be used by the stack that the +// application uses when coming out of a reset. +#ifndef SL_STACK_SIZE +#define SL_STACK_SIZE 4096 +#endif +// + +// <<< end of configuration section >>> + +#endif /* SL_MEMORY_MANAGER_REGION_CONFIG_H */ diff --git a/src/ot-rcp/config/sl_openthread_features_config.h b/src/ot-rcp/config/sl_openthread_features_config.h index 0bb69678..319bb6a8 100644 --- a/src/ot-rcp/config/sl_openthread_features_config.h +++ b/src/ot-rcp/config/sl_openthread_features_config.h @@ -1,3 +1,33 @@ +/***************************************************************************//** + * @file + * @brief OpenThread stack configuration file. + ******************************************************************************* + * # License + * Copyright 2024 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + #ifndef _SL_OPENTHREAD_FEATURES_CONFIG_H #define _SL_OPENTHREAD_FEATURES_CONFIG_H //-------- <<< Use Configuration Wizard in Context Menu >>> ----------------- @@ -9,7 +39,7 @@ // Thread 1.1 // Thread 1.2 // Thread 1.3 -// Thread 1.2 and Thread 1.3 are compatible with Thread 1.1. +// Thread 1.4 // Current Default: OT_THREAD_VERSION_1_3 #ifndef OPENTHREAD_CONFIG_THREAD_VERSION #define OPENTHREAD_CONFIG_THREAD_VERSION OT_THREAD_VERSION_1_3 @@ -60,32 +90,41 @@ #ifndef OPENTHREAD_CONFIG_MLR_ENABLE #define OPENTHREAD_CONFIG_MLR_ENABLE 1 #endif -// DNS Client (Thread 1.3) +// +#endif // OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2 + +#if (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_3) +// The following features require at least Thread Stack Protocol Version 1.3 +// DNS Client #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE #define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1 #endif -// DNS-SD Server (Thread 1.3) +// DNS-SD Server #ifndef OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE #define OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE 0 #endif -// Service Registration Protocol (SRP) Client (Thread 1.3) +// Service Registration Protocol (SRP) Client #ifndef OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE #define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1 #endif -// Service Registration Protocol (SRP) Server (Thread 1.3) +// Service Registration Protocol (SRP) Server #ifndef OPENTHREAD_CONFIG_SRP_SERVER_ENABLE #define OPENTHREAD_CONFIG_SRP_SERVER_ENABLE 0 #endif -// TCPlp (Low power TCP over OpenThread) (Thread 1.3) +// TCPlp (Low power TCP over OpenThread) #ifndef OPENTHREAD_CONFIG_TCP_ENABLE #define OPENTHREAD_CONFIG_TCP_ENABLE 0 #endif -// Thread over Infrastructure (Thread 1.3: NCP only) +// DNS Client over TCP +#ifndef OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_ENABLE +#define OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_ENABLE 0 +#endif +// Thread over Infrastructure (NCP only) #ifndef OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE #define OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE 0 #endif // -#endif // OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2 +#endif // OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_3 // Border Agent #ifndef OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE @@ -211,6 +250,21 @@ #define OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE 0 #endif // +// Multiple Static Instance Support +#ifndef OPENTHREAD_CONFIG_MULTIPLE_STATIC_INSTANCE_ENABLE +#define OPENTHREAD_CONFIG_MULTIPLE_STATIC_INSTANCE_ENABLE 0 +#endif +// +// Number of OpenThread Instances For Static Buffer Allocation +#ifndef OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_NUM +#define OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_NUM 2 +#endif +// +// Define broadcast IID for spinel frames dedicated to all hosts in multipan configuration +#ifndef OPENTHREAD_SPINEL_CONFIG_BROADCAST_IID +#define OPENTHREAD_SPINEL_CONFIG_BROADCAST_IID 0 +#endif +// // OTNS (OpenThread Network Simulator) #ifndef OPENTHREAD_CONFIG_OTNS_ENABLE #define OPENTHREAD_CONFIG_OTNS_ENABLE 0 @@ -220,6 +274,13 @@ #ifndef OPENTHREAD_CONFIG_PING_SENDER_ENABLE #define OPENTHREAD_CONFIG_PING_SENDER_ENABLE 1 #endif + +// +// Power Calibration Module (RCP only configuration) +#ifndef OPENTHREAD_CONFIG_POWER_CALIBRATION_ENABLE +#define OPENTHREAD_CONFIG_POWER_CALIBRATION_ENABLE 0 +#endif + // // Platform UDP #ifndef OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE @@ -269,6 +330,21 @@ #define OPENTHREAD_CONFIG_MAC_BEACON_PAYLOAD_PARSING_ENABLE 1 #endif // +// Max raw power calibration length. +#ifndef SL_OPENTHREAD_RAW_POWER_CALIBRATION_LENGTH +#define SL_OPENTHREAD_RAW_POWER_CALIBRATION_LENGTH 4 +#endif +// +// Max FEM config setting length. +#ifndef SL_OPENTHREAD_FEM_SETTING_LENGTH +#define SL_OPENTHREAD_FEM_SETTING_LENGTH 4 +#endif +// +// The maximum number of RX buffers to use in the radio driver. +// 16 +#ifndef SL_OPENTHREAD_RADIO_RX_BUFFER_COUNT +#define SL_OPENTHREAD_RADIO_RX_BUFFER_COUNT 16 +#endif // // Logging // LOG_OUTPUT @@ -318,7 +394,14 @@ #define OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL 1 #endif +#endif // OPENTHREAD_FULL_LOGS_ENABLE + +// Log crash dump after initialization +#ifndef OPENTHREAD_CONFIG_PLATFORM_LOG_CRASH_DUMP_ENABLE +#define OPENTHREAD_CONFIG_PLATFORM_LOG_CRASH_DUMP_ENABLE 0 #endif +// + // // // diff --git a/src/ot-rcp/ot-rcp.slcp b/src/ot-rcp/ot-rcp.slcp index 47207f7d..2db87e4e 100644 --- a/src/ot-rcp/ot-rcp.slcp +++ b/src/ot-rcp/ot-rcp.slcp @@ -20,17 +20,18 @@ source: - {path: app.c} tag: [prebuilt_demo] include: -- path: '' +- path: . file_list: - {path: app.h} - {path: reset_util.h} -sdk: {id: gecko_sdk, version: 4.4.2} +sdk: {id: simplicity_sdk, version: 2024.6.0} toolchain_settings: [] component: - {id: EFR32MG21A010F1024IM32} - {id: bootloader_interface} - {id: brd4001a} - {id: brd4179b} +- {id: memory_manager} - {id: ot_crash_handler} - {id: ot_stack_rcp} - {id: rail_util_pti} @@ -47,12 +48,10 @@ configuration: - condition: [ot_rtt_log] name: BUFFER_SIZE_UP value: '768' -- condition: [ot_rtt_log, device_family_efr32mg1] - name: BUFFER_SIZE_UP - value: '128' - condition: [ot_rtt_log] name: BUFFER_SIZE_DOWN value: '0' +- {name: CIRCULAR_QUEUE_LEN_MAX, value: '16'} ui_hints: highlight: - {path: ./README-OT-RCP.md, focus: true} diff --git a/src/ot-rcp/ot-rcp.slps b/src/ot-rcp/ot-rcp.slps index c081112c..34cb9628 100644 --- a/src/ot-rcp/ot-rcp.slps +++ b/src/ot-rcp/ot-rcp.slps @@ -1,7 +1,7 @@ - + @@ -12,5 +12,6 @@ + \ No newline at end of file From 5f4dd69b8439186832dcd6d537e72c33052ac2a7 Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Wed, 19 Jun 2024 11:39:16 -0400 Subject: [PATCH 09/13] Keep around Gecko SDK 4.4.2 for Z-Wave --- Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Dockerfile b/Dockerfile index 466c0c17..244d8cbf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -63,6 +63,12 @@ RUN \ && unzip -q -d gecko_sdk_4.3.1 gecko_sdk_4.3.1.zip \ && rm gecko_sdk_4.3.1.zip +# Gecko SDK 4.4.2 +RUN \ + curl -o gecko_sdk_4.4.2.zip -L https://github.com/SiliconLabs/gecko_sdk/releases/download/v4.4.2/gecko-sdk.zip \ + && unzip -q -d gecko_sdk_4.4.2 gecko_sdk_4.4.2.zip \ + && rm gecko_sdk_4.4.2.zip + ARG USERNAME=builder ARG USER_UID=1000 ARG USER_GID=$USER_UID From 257d847b4af912c6faea7c31f3ff00ce09cc09a4 Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Thu, 20 Jun 2024 14:17:57 -0400 Subject: [PATCH 10/13] Regenerate Z-Wave firmware project for new dev board --- src/zwave_ncp_serial_api_controller/.cproject | 316 ++++---- .../SerialAPI.h | 387 ++++++++++ src/zwave_ncp_serial_api_controller/app.c | 184 +---- src/zwave_ncp_serial_api_controller/app.h | 378 +--------- .../cmd_get_capabilities.c | 16 + .../cmd_handlers.c | 701 ++++-------------- .../cmd_handlers.h | 2 +- .../cmd_handlers_invoker.c | 12 +- .../cmds_dcdc.c | 2 +- .../cmds_management.c | 35 +- .../cmds_power_management.c | 2 +- .../comm_interface.c | 26 +- .../common_supported_func.h | 69 ++ .../config/FreeRTOSConfig.h | 26 +- .../config/app_properties_config.h | 2 +- .../config/btl_interface_cfg.h | 6 +- .../config/btl_interface_cfg_s2c3.h | 338 +++++++++ .../config/emlib_core_debug_config.h | 2 +- .../config/extension_board_8029a_efr32xg13.h | 48 -- .../extension_board_8029a_efr32xg13_button.h | 138 ---- .../extension_board_8029a_efr32xg13_led.h | 110 --- .../extension_board_8029a_efr32xg13_slider.h | 52 -- .../config/nvm3_default_config.h | 6 +- .../config/pin_config.h | 190 +++-- .../config/psa_crypto_config.h | 170 +++++ .../config/radio_board_brd2603a.h | 30 + .../config/radio_board_brd2603a_button.h | 76 ++ .../config/radio_board_brd2603a_led.h | 58 ++ .../config/serial_api_config.h | 16 +- .../config/sl_board_control_config.h | 88 ++- ...il_sequencer_config.h => sl_core_config.h} | 26 +- .../config/sl_debug_swo_config.h | 109 --- .../config/sl_device_init_dcdc_config.h | 8 +- .../config/sl_device_init_emu_config.h | 68 -- .../config/sl_device_init_hfxo_config.h | 31 +- .../config/sl_device_init_lfxo_config.h | 66 ++ .../config/sl_fem_util_config.h | 2 +- .../config/sl_hfxo_manager_config.h | 56 ++ .../config/sl_interrupt_manager_s2_config.h | 47 ++ .../config/sl_mbedtls_config.h | 118 +++ .../config/sl_mbedtls_device_config.h | 72 ++ .../config/sl_memory_config.h | 25 +- .../config/sl_memory_manager_config.h | 49 ++ .../config/sl_memory_manager_region_config.h | 49 ++ .../sl_mx25_flash_shutdown_usart_config.h | 67 ++ .../config/sl_power_manager_config.h | 16 +- .../config/sl_rail_util_pa_config.h | 14 +- .../sl_rail_util_power_manager_init_config.h | 2 +- .../config/sl_sleeptimer_config.h | 4 +- .../config/zaf_appname_config.h | 4 +- .../config/zaf_config.h | 16 +- .../zaf_event_distributor_core_config.h | 4 +- .../config/zpal_zwave_nvm_instance_config.h | 58 -- .../config/zw_build_no.h | 17 - .../config/zw_config_rf.h | 6 +- .../config/zw_region_config.h | 5 +- .../config/zw_version_config.h | 4 +- .../controller_supported_func.h | 136 +--- .../gbl_metadata.yaml | 6 - src/zwave_ncp_serial_api_controller/main.c | 1 - .../nvm_backup_restore.c | 207 ++++-- .../nvm_backup_restore.h | 12 +- .../serialapi_file.c | 71 +- .../slave_supported_func.h | 133 +--- src/zwave_ncp_serial_api_controller/utils.c | 81 +- .../zwave_ncp_serial_api_controller.pintool | 31 +- .../zwave_ncp_serial_api_controller.slcp | 45 +- .../zwave_ncp_serial_api_controller.slpb | 14 + .../zwave_ncp_serial_api_controller.slps | 7 +- 69 files changed, 2589 insertions(+), 2584 deletions(-) create mode 100644 src/zwave_ncp_serial_api_controller/SerialAPI.h create mode 100644 src/zwave_ncp_serial_api_controller/common_supported_func.h create mode 100644 src/zwave_ncp_serial_api_controller/config/btl_interface_cfg_s2c3.h delete mode 100644 src/zwave_ncp_serial_api_controller/config/extension_board_8029a_efr32xg13.h delete mode 100644 src/zwave_ncp_serial_api_controller/config/extension_board_8029a_efr32xg13_button.h delete mode 100644 src/zwave_ncp_serial_api_controller/config/extension_board_8029a_efr32xg13_led.h delete mode 100644 src/zwave_ncp_serial_api_controller/config/extension_board_8029a_efr32xg13_slider.h create mode 100644 src/zwave_ncp_serial_api_controller/config/psa_crypto_config.h create mode 100644 src/zwave_ncp_serial_api_controller/config/radio_board_brd2603a.h create mode 100644 src/zwave_ncp_serial_api_controller/config/radio_board_brd2603a_button.h create mode 100644 src/zwave_ncp_serial_api_controller/config/radio_board_brd2603a_led.h rename src/zwave_ncp_serial_api_controller/config/{sl_rail_util_sequencer_config.h => sl_core_config.h} (76%) delete mode 100644 src/zwave_ncp_serial_api_controller/config/sl_debug_swo_config.h delete mode 100644 src/zwave_ncp_serial_api_controller/config/sl_device_init_emu_config.h create mode 100644 src/zwave_ncp_serial_api_controller/config/sl_device_init_lfxo_config.h create mode 100644 src/zwave_ncp_serial_api_controller/config/sl_hfxo_manager_config.h create mode 100644 src/zwave_ncp_serial_api_controller/config/sl_interrupt_manager_s2_config.h create mode 100644 src/zwave_ncp_serial_api_controller/config/sl_mbedtls_config.h create mode 100644 src/zwave_ncp_serial_api_controller/config/sl_mbedtls_device_config.h create mode 100644 src/zwave_ncp_serial_api_controller/config/sl_memory_manager_config.h create mode 100644 src/zwave_ncp_serial_api_controller/config/sl_memory_manager_region_config.h create mode 100644 src/zwave_ncp_serial_api_controller/config/sl_mx25_flash_shutdown_usart_config.h delete mode 100644 src/zwave_ncp_serial_api_controller/config/zpal_zwave_nvm_instance_config.h delete mode 100644 src/zwave_ncp_serial_api_controller/config/zw_build_no.h delete mode 100644 src/zwave_ncp_serial_api_controller/gbl_metadata.yaml create mode 100644 src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slpb diff --git a/src/zwave_ncp_serial_api_controller/.cproject b/src/zwave_ncp_serial_api_controller/.cproject index b62976c8..d7401951 100644 --- a/src/zwave_ncp_serial_api_controller/.cproject +++ b/src/zwave_ncp_serial_api_controller/.cproject @@ -4,7 +4,7 @@ - + @@ -23,31 +23,32 @@ - + - + - - @@ -367,17 +405,15 @@ - + - + - + - - \ No newline at end of file diff --git a/src/zwave_ncp_serial_api_controller/SerialAPI.h b/src/zwave_ncp_serial_api_controller/SerialAPI.h new file mode 100644 index 00000000..be9476a6 --- /dev/null +++ b/src/zwave_ncp_serial_api_controller/SerialAPI.h @@ -0,0 +1,387 @@ +/** + * @file + * @copyright 2019 Silicon Laboratories Inc. + */ +#ifndef _ZW_SERIALAPI_H_ +#define _ZW_SERIALAPI_H_ + + +/** + * @addtogroup ZWaveAPI + * @{ + * @addtogroup ZWSerialAPI Z-Wave Serial API + * @{ + */ + +#define SOF 0x01 ///< Start Of Frame +#define ACK 0x06 ///< Acknowledge successful frame reception +#define NAK 0x15 ///< Not Acknowledge successful frame reception - please retransmit... +#define CAN 0x18 ///< Frame received (from host) was dropped - waiting for ACK + +///@addtogroup FT Frame Types +/// @{ +#define REQUEST 0x00 +#define RESPONSE 0x01 +///@} + +///@addtogroup GET_INIT_DATA_FLAG +/// Flags used in FUNC_ID_SERIAL_API_GET_INIT_DATA functionality +/// @{ +#define GET_INIT_DATA_FLAG_SLAVE_API 0x01 +#define GET_INIT_DATA_FLAG_TIMER_SUPPORT 0x02 +#define GET_INIT_DATA_FLAG_CONTROLLER_STATUS 0x04 /* Obsolete. USE next */ +#define GET_INIT_DATA_FLAG_SECONDARY_CTRL 0x04 +#define GET_INIT_DATA_FLAG_IS_SUC 0x08 +///@} + +/** + * Firmware update functionality specifics + * Enum definitions for Firmware Update functionality selector; firmwareUpdateFunction + */ +typedef enum +{ + FIRMWARE_UPDATE_NVM_INIT = 0, + FIRMWARE_UPDATE_NVM_SET_NEW_IMAGE = 1, + FIRMWARE_UPDATE_NVM_GET_NEW_IMAGE = 2, + FIRMWARE_UPDATE_NVM_UPDATE_CRC16 = 3, + FIRMWARE_UPDATE_NVM_IS_VALID_CRC16 = 4, + FIRMWARE_UPDATE_NVM_WRITE = 5, + FIRMWARE_UPDATE_NVM_UNKNOWN = 0xFF +} FIRMWARE_UPDATE_NVM_T; + +/** + * @addtogroup FUNC_ID + * Function IDs + * @{ + */ +#define FUNC_ID_SERIAL_API_GET_INIT_DATA 0x02 +#define FUNC_ID_SERIAL_API_APPL_NODE_INFORMATION 0x03 +#define FUNC_ID_APPLICATION_COMMAND_HANDLER 0x04 +#define FUNC_ID_ZW_GET_CONTROLLER_CAPABILITIES 0x05 + +/* SERIAL API ver 4 added - START */ +#define FUNC_ID_SERIAL_API_SET_TIMEOUTS 0x06 +#define FUNC_ID_SERIAL_API_GET_CAPABILITIES 0x07 +#define FUNC_ID_SERIAL_API_SOFT_RESET 0x08 +/* SERIAL API ver 4 added - END */ + +#define FUNC_ID_ZW_GET_PROTOCOL_VERSION 0x09 + +/* Function ID for startup message */ +#define FUNC_ID_SERIAL_API_STARTED 0x0A +#define FUNC_ID_SERIAL_API_SETUP 0x0B + +#define FUNC_ID_SERIAL_API_APPL_NODE_INFORMATION_CMD_CLASSES 0x0C + +#define FUNC_ID_ZW_SEND_DATA_EX 0x0E +#define FUNC_ID_ZW_SEND_DATA_MULTI_EX 0x0F + +#define FUNC_ID_ZW_SET_RF_RECEIVE_MODE 0x10 +#define FUNC_ID_ZW_SET_SLEEP_MODE 0x11 +#define FUNC_ID_ZW_SEND_NODE_INFORMATION 0x12 +#define FUNC_ID_ZW_SEND_DATA 0x13 +#define FUNC_ID_ZW_SEND_DATA_MULTI 0x14 +#define FUNC_ID_ZW_GET_VERSION 0x15 + +/* SERIAL API ver 4 added - START */ +#define FUNC_ID_ZW_SEND_DATA_ABORT 0x16 +// FUNC_ID_ZW_RF_POWER_LEVEL_SET is no longer supported +#define FUNC_ID_ZW_RF_POWER_LEVEL_SET 0x17 +#define FUNC_ID_ZW_SEND_DATA_META 0x18 +/* SERIAL API ver 4 added - END */ + +#define FUNC_ID_ZW_RESERVED_SD 0x19 +#define FUNC_ID_ZW_RESERVED_SDM 0x1A +#define FUNC_ID_ZW_RESERVED_SRI 0x1B + +#define FUNC_ID_ZW_SET_ROUTING_INFO 0x1B + +#define FUNC_ID_ZW_GET_RANDOM 0x1C +#define FUNC_ID_ZW_RANDOM 0x1D +#define FUNC_ID_ZW_RF_POWER_LEVEL_REDISCOVERY_SET 0x1E + +#define FUNC_ID_MEMORY_GET_ID 0x20 +#define FUNC_ID_MEMORY_GET_BYTE 0x21 +#define FUNC_ID_MEMORY_PUT_BYTE 0x22 +#define FUNC_ID_MEMORY_GET_BUFFER 0x23 +#define FUNC_ID_MEMORY_PUT_BUFFER 0x24 +/* Unimplemented - START */ +#define FUNC_ID_SERIAL_API_GET_APPL_HOST_MEMORY_OFFSET 0x25 +#define FUNC_ID_DEBUG_OUTPUT 0x26 +/* Unimplemented - END */ + +#define FUNC_ID_AUTO_PROGRAMMING 0x27 + +#define FUNC_ID_NVR_GET_VALUE 0x28 + +#define FUNC_ID_NVM_GET_ID 0x29 +#define FUNC_ID_NVM_EXT_READ_LONG_BUFFER 0x2A +#define FUNC_ID_NVM_EXT_WRITE_LONG_BUFFER 0x2B +#define FUNC_ID_NVM_EXT_READ_LONG_BYTE 0x2C +#define FUNC_ID_NVM_EXT_WRITE_LONG_BYTE 0x2D +#define FUNC_ID_NVM_BACKUP_RESTORE 0x2E + +#define FUNC_ID_ZW_NVR_GET_APP_VALUE 0x2F + +#define FUNC_ID_CLOCK_SET 0x30 +#define FUNC_ID_CLOCK_GET 0x31 +#define FUNC_ID_CLOCK_CMP 0x32 +#define FUNC_ID_RTC_TIMER_CREATE 0x33 +#define FUNC_ID_RTC_TIMER_READ 0x34 +#define FUNC_ID_RTC_TIMER_DELETE 0x35 +#define FUNC_ID_RTC_TIMER_CALL 0x36 + +#define FUNC_ID_CLEAR_TX_TIMERS 0x37 +#define FUNC_ID_GET_TX_TIMERS 0x38 + +#define FUNC_ID_ZW_CLEAR_NETWORK_STATS 0x39 +#define FUNC_ID_ZW_GET_NETWORK_STATS 0x3A +#define FUNC_ID_ZW_GET_BACKGROUND_RSSI 0x3B +#define FUNC_ID_ZW_SET_LISTEN_BEFORE_TALK_THRESHOLD 0x3C +#define FUNC_ID_NVM_EXT_BACKUP_RESTORE 0x3D +#define FUNC_ID_ZW_REMOVE_NODE_ID_FROM_NETWORK 0x3F + +#define FUNC_ID_ZW_SET_LEARN_NODE_STATE 0x40 +#define FUNC_ID_ZW_GET_NODE_PROTOCOL_INFO 0x41 +#define FUNC_ID_ZW_SET_DEFAULT 0x42 +#define FUNC_ID_ZW_NEW_CONTROLLER 0x43 +// +#define FUNC_ID_ZW_REPLICATION_COMMAND_COMPLETE 0x44 +#define FUNC_ID_ZW_REPLICATION_SEND_DATA 0x45 +// +#define FUNC_ID_ZW_ASSIGN_RETURN_ROUTE 0x46 +#define FUNC_ID_ZW_DELETE_RETURN_ROUTE 0x47 +#define FUNC_ID_ZW_REQUEST_NODE_NEIGHBOR_UPDATE 0x48 +#define FUNC_ID_ZW_REQUEST_NODETYPE_NEIGHBOR_UPDATE 0x68 +#define FUNC_ID_ZW_APPLICATION_UPDATE 0x49 + +/** @deprecated Use ZW_APPLICATION_UPDATE */ +#define FUNC_ID_ZW_APPLICATION_CONTROLLER_UPDATE 0x49 + +#define FUNC_ID_ZW_ADD_NODE_TO_NETWORK 0x4A +#define FUNC_ID_ZW_REMOVE_NODE_FROM_NETWORK 0x4B +#define FUNC_ID_ZW_CREATE_NEW_PRIMARY 0x4C +#define FUNC_ID_ZW_CONTROLLER_CHANGE 0x4D + +#define FUNC_ID_ZW_RESERVED_FN 0x4E + +/* Devkit 6.6x */ +#define FUNC_ID_ZW_ASSIGN_PRIORITY_RETURN_ROUTE 0x4F + +/* Slave only */ +#define FUNC_ID_ZW_SET_LEARN_MODE 0x50 +/* Slave only end */ + +#define FUNC_ID_ZW_ASSIGN_SUC_RETURN_ROUTE 0x51 +#define FUNC_ID_ZW_ENABLE_SUC 0x52 +#define FUNC_ID_ZW_REQUEST_NETWORK_UPDATE 0x53 +#define FUNC_ID_ZW_SET_SUC_NODE_ID 0x54 +#define FUNC_ID_ZW_DELETE_SUC_RETURN_ROUTE 0x55 +#define FUNC_ID_ZW_GET_SUC_NODE_ID 0x56 +#define FUNC_ID_ZW_SEND_SUC_ID 0x57 + +/* Devkit 6.6x */ +#define FUNC_ID_ZW_ASSIGN_PRIORITY_SUC_RETURN_ROUTE 0x58 + +/* Obsolete - Not available in devkit 6.6x+ */ +#define FUNC_ID_ZW_REDISCOVERY_NEEDED 0x59 + +#define FUNC_ID_ZW_REQUEST_NODE_NEIGHBOR_UPDATE_OPTION 0x5A + +/* Slave only */ +#define FUNC_ID_ZW_SUPPORT9600_ONLY 0x5B +/* Slave only end */ + +/* Enhanced/Routing Slave only */ +#define FUNC_ID_ZW_REQUEST_NEW_ROUTE_DESTINATIONS 0x5C +#define FUNC_ID_ZW_IS_NODE_WITHIN_DIRECT_RANGE 0x5D +/* Enhanced/Routing Slave only end */ + +#define FUNC_ID_ZW_EXPLORE_REQUEST_INCLUSION 0x5E +#define FUNC_ID_ZW_EXPLORE_REQUEST_EXCLUSION 0x5F + +#define FUNC_ID_ZW_REQUEST_NODE_INFO 0x60 +#define FUNC_ID_ZW_REMOVE_FAILED_NODE_ID 0x61 +#define FUNC_ID_ZW_IS_FAILED_NODE_ID 0x62 +#define FUNC_ID_ZW_REPLACE_FAILED_NODE 0x63 + +/* In 6.0x the function id was wrong so we need to support this wrong function id as well in the future */ +#define FUNC_ID_ZW_SET_ROUTING_MAX_6_00 0x65 +/* */ + +#define FUNC_ID_ZW_IS_PRIMARY_CTRL 0x66 + +#define FUNC_ID_ZW_AES_ECB 0x67 + +#define FUNC_ID_TIMER_START 0x70 +#define FUNC_ID_TIMER_RESTART 0x71 +#define FUNC_ID_TIMER_CANCEL 0x72 +#define FUNC_ID_TIMER_CALL 0x73 + +/* Firmware Update API */ +#define FUNC_ID_ZW_FIRMWARE_UPDATE_NVM 0x78 + +/* Installer API */ +#define FUNC_ID_GET_ROUTING_TABLE_LINE 0x80 +#define FUNC_ID_GET_TX_COUNTER 0x81 +#define FUNC_ID_RESET_TX_COUNTER 0x82 +#define FUNC_ID_STORE_NODEINFO 0x83 +#define FUNC_ID_STORE_HOMEID 0x84 +/* Installer API only end */ + +#define FUNC_ID_LOCK_ROUTE_RESPONSE 0x90 +#ifdef ZW_ROUTING_DEMO +/* Max hops in route */ +#define TRANSMIT_ROUTED_ATTEMPT 0x08 +#define FUNC_ID_ZW_SEND_DATA_ROUTE_DEMO 0x91 +#endif + +/* ZW_SetPriorityRoute/ZW_GetPriorityRoute replaces ZW_SetLastWorkingRoute/ZW_GetLastWorkingRoute */ +#define FUNC_ID_ZW_GET_PRIORITY_ROUTE 0x92 +#define FUNC_ID_ZW_SET_PRIORITY_ROUTE 0x93 +/* NOTE: Obsoleted - BEGIN */ +#define FUNC_ID_ZW_GET_LAST_WORKING_ROUTE 0x92 +#define FUNC_ID_ZW_SET_LAST_WORKING_ROUTE 0x93 +/* NOTE: Obsoleted - END */ + +#define FUNC_ID_SERIAL_API_TEST 0x95 + +#define FUNC_ID_SERIAL_API_EXT 0x98 + +/* DevKit 6.7x introduced - slave_enhanced_232 and slave_routing only */ +#define FUNC_ID_ZW_SECURITY_SETUP 0x9C +#define FUNC_ID_APPLICATION_SECURITY_EVENT 0x9D + +/* ZW_CONTROLLER_BRIDGE only START */ +#define FUNC_ID_SERIAL_API_APPL_SLAVE_NODE_INFORMATION 0xA0 + +/** @deprecated OBSOLETE: In DevKit 4.5x/6.0x Controller Bridge applications, this is obsoleted + * by the FUNC_ID_APPLICATION_COMMAND_HANDLER_BRIDGE + */ +#define FUNC_ID_APPLICATION_SLAVE_COMMAND_HANDLER 0xA1 +#define FUNC_ID_ZW_SEND_SLAVE_NODE_INFORMATION 0xA2 +#define FUNC_ID_ZW_SEND_SLAVE_DATA 0xA3 +#define FUNC_ID_ZW_SET_SLAVE_LEARN_MODE 0xA4 +#define FUNC_ID_ZW_GET_VIRTUAL_NODES 0xA5 +#define FUNC_ID_ZW_IS_VIRTUAL_NODE 0xA6 +#define FUNC_ID_ZW_RESERVED_SSD 0xA7 +/* DevKit 4.5x/6.0x added - obsoletes FUNC_ID_APPLICATION_SLAVE_COMMAND_HANDLER and */ +/* FUNC_ID_APPLICATION_COMMAND_HANDLER for the Controller Bridge applications as */ +/* this handles both cases - only for 4.5x/6.0x based Controller Bridge applications */ +#define FUNC_ID_APPLICATION_COMMAND_HANDLER_BRIDGE 0xA8 +/* DevKit 4.5x/6.0x added - Adds sourceNodeID to the parameter list */ +#define FUNC_ID_ZW_SEND_DATA_BRIDGE 0xA9 +/* Obsolete */ +#define FUNC_ID_ZW_SEND_DATA_META_BRIDGE 0xAA +#define FUNC_ID_ZW_SEND_DATA_MULTI_BRIDGE 0xAB +/* ZW_CONTROLLER_BRIDGE only END */ + +#define FUNC_ID_PWR_SETSTOPMODE 0xB0 // ZW102 only +#define FUNC_ID_PWR_CLK_PD 0xB1 // ZW102 only +#define FUNC_ID_PWR_CLK_PUP 0xB2 // ZW102 only +#define FUNC_ID_PWR_SELECT_CLK 0xB3 // ZW102 only +#define FUNC_ID_ZW_SET_WUT_TIMEOUT 0xB4 +#define FUNC_ID_ZW_IS_WUT_KICKED 0xB5 // ZW201 only + +#define FUNC_ID_ZW_WATCHDOG_ENABLE 0xB6 +#define FUNC_ID_ZW_WATCHDOG_DISABLE 0xB7 +#define FUNC_ID_ZW_WATCHDOG_KICK 0xB8 +/** @deprecated Use FUNC_ID_ZW_INT_EXT_LEVEL_SET */ +#define FUNC_ID_ZW_SET_EXT_INT_LEVEL 0xB9 // ZW201 only +#define FUNC_ID_ZW_INT_EXT_LEVEL_SET 0xB9 + +// FUNC_ID_ZW_RF_POWER_LEVEL_GET is no longer supported +#define FUNC_ID_ZW_RF_POWER_LEVEL_GET 0xBA +#define FUNC_ID_ZW_GET_NEIGHBOR_COUNT 0xBB +#define FUNC_ID_ZW_ARE_NODES_NEIGHBOURS 0xBC + +#define FUNC_ID_ZW_TYPE_LIBRARY 0xBD +#define FUNC_ID_ZW_SEND_TEST_FRAME 0xBE +#define FUNC_ID_ZW_GET_PROTOCOL_STATUS 0xBF + +#define FUNC_ID_ZW_SET_PROMISCUOUS_MODE 0xD0 +/* SERIAL API ver 5 added - START */ +#define FUNC_ID_PROMISCUOUS_APPLICATION_COMMAND_HANDLER 0xD1 +/* SERIAL API ver 5 added - END */ + +#define FUNC_ID_ZW_WATCHDOG_START 0xD2 +#define FUNC_ID_ZW_WATCHDOG_STOP 0xD3 + +#define FUNC_ID_ZW_SET_ROUTING_MAX 0xD4 +/* Unimplemented - START */ +/* Obsoleted */ +#define FUNC_ID_ZW_GET_ROUTING_MAX 0xD5 + +#define FUNC_ID_PM_STAY_AWAKE 0xD7 +#define FUNC_ID_PM_CANCEL 0xD8 +/* Unimplemented - END */ + +/* Allocated for setting the maximum number of 128sec ticks inbetween SmartStart inclusion requests. */ +#define FUNC_ID_ZW_NETWORK_MANAGEMENT_SET_MAX_INCLUSION_REQUEST_INTERVALS 0xD6 + +#define FUNC_ID_ZW_INITIATE_SHUTDOWN 0xD9 + +#define FUNC_ID_SERIAL_API_GET_LR_NODES 0xDA + +#define FUNC_ID_GET_LR_CHANNEL 0xDB +#define FUNC_ID_SET_LR_CHANNEL 0xDC + +#define FUNC_ID_ZW_SET_LR_VIRTUAL_IDS 0xDD + +#define FUNC_ID_GET_DCDC_CONFIG 0xDE +#define FUNC_ID_SET_DCDC_CONFIG 0xDF + +/* Allocated for NUNIT test */ +#define FUNC_ID_ZW_NUNIT_CMD 0xE0 // DEPRECATED +#define FUNC_ID_ZW_NUNIT_INIT 0xE1 // DEPRECATED +#define FUNC_ID_ZW_NUNIT_LIST 0xE2 // DEPRECATED +#define FUNC_ID_ZW_NUNIT_RUN 0xE3 // DEPRECATED +#define FUNC_ID_ZW_NUNIT_END 0xE4 // DEPRECATED + +#define FUNC_ID_ENABLE_RADIO_PTI 0xE7 +#define FUNC_ID_GET_RADIO_PTI 0xE8 + +#define FUNC_ID_SEND_NOP 0xE9 //Reserved. Command to be implemented in future. + +/* Allocated for Power Management */ +#define FUNC_ID_SERIAL_API_POWER_MANAGEMENT 0xEE +#define FUNC_ID_SERIAL_API_READY 0xEF + +/* Allocated for proprietary serial API commands */ +#define FUNC_ID_PROPRIETARY_0 0xF0 +#define FUNC_ID_PROPRIETARY_1 0xF1 +#define FUNC_ID_PROPRIETARY_2 0xF2 +#define FUNC_ID_PROPRIETARY_3 0xF3 +#define FUNC_ID_PROPRIETARY_4 0xF4 +#define FUNC_ID_PROPRIETARY_5 0xF5 +#define FUNC_ID_PROPRIETARY_6 0xF6 +#define FUNC_ID_PROPRIETARY_7 0xF7 +#define FUNC_ID_PROPRIETARY_8 0xF8 +#define FUNC_ID_PROPRIETARY_9 0xF9 +#define FUNC_ID_PROPRIETARY_A 0xFA +#define FUNC_ID_PROPRIETARY_B 0xFB +#define FUNC_ID_PROPRIETARY_C 0xFC +#define FUNC_ID_PROPRIETARY_D 0xFD +#define FUNC_ID_PROPRIETARY_E 0xFE + + +/* Illegal function ID */ +#define FUNC_ID_UNKNOWN 0xFF +///@} + +/**size of the address field of NVM_BACKUP_RESTORE or NVM_EXT_BACKUP_RESTORE frames. +Item value is the size in byte of the address field. +*/ +typedef enum +{ + NVM_BACKUP_RESTORE_ADDR_SIZE = 2, ///< 2 bytes for the legacy NVM backup & restore command + NVM_EXT_BACKUP_RESTORE_ADDR_SIZE = 4, ///< 4 bytes for the extended NVM backup & restore command +} nvm_backup_restore_addr_size_t; + + +///@} +///@} + + + +#endif /*_ZW_SERIALAPI_H_*/ diff --git a/src/zwave_ncp_serial_api_controller/app.c b/src/zwave_ncp_serial_api_controller/app.c index a39f90c2..0afc0ddd 100644 --- a/src/zwave_ncp_serial_api_controller/app.c +++ b/src/zwave_ncp_serial_api_controller/app.c @@ -7,7 +7,7 @@ #include #include -#include "Assert.h" +#include #include "SyncEvent.h" #ifdef ZW_CONTROLLER #include "ZW_controller_api.h" @@ -16,29 +16,21 @@ #include "ZW_system_startup_api.h" /* Include app header file - containing version and */ /* SerialAPI functionality support definitions */ -#ifdef ZW_SECURITY_PROTOCOL -#include "ZW_security_api.h" -#include "ZW_TransportSecProtocol.h" -#endif #include "DebugPrintConfig.h" // SerialAPI uses SWO for debug output. // For example SWO Terminal in Studio commander can be used to get the output. //#define DEBUGPRINT #include "DebugPrint.h" #include "app_node_info.h" -#include "virtual_slave_node_info.h" #include "serialapi_file.h" #include "cmd_handlers.h" #include "cmds_management.h" #include "ZAF_Common_interface.h" #include "utils.h" -#include "zpal_watchdog.h" #include "app_hw.h" #include "SerialAPI_hw.h" -#include "board_indicator.h" #include "zaf_event_distributor_ncp.h" #include "zpal_misc.h" -#include "zw_build_no.h" #include "zaf_protocol_config.h" #ifdef DEBUGPRINT #include "ZAF_PrintAppInfo.h" @@ -54,16 +46,7 @@ #define TX_POWER_LR_20_DBM 200 #define TX_POWER_LR_14_DBM 140 -#ifdef JP_DK -/* Define RSSI threshold so JP can be tested in DK */ -#define JP_DK_RSSI_THRESHOLD 52 -#endif - -#ifdef ZW_SECURITY_PROTOCOL -#define REQUESTED_SECURITY_KEYS ( SECURITY_KEY_S0_BIT | SECURITY_KEY_S2_UNAUTHENTICATED_BIT | SECURITY_KEY_S2_AUTHENTICATED_BIT | SECURITY_KEY_S2_ACCESS_BIT) -#else #define REQUESTED_SECURITY_KEYS 0 -#endif /* ZW_SECURITY_PROTOCOL */ /* Accept all incoming command classes, regardless of NIF contents. */ #define ACCEPT_ALL_CMD_CLASSES @@ -131,24 +114,7 @@ extern uint8_t bWatchdogStarted; #endif /* Last system wakeup reason - is set in ApplicationInit */ -EResetReason_t g_eApplResetReason; - -#ifdef APPL_PROD_TEST -#define PRODTEST_NR_1 1 -#define PRODTEST_NR_2 2 -#define PRODTEST_NR_3 3 -#define PRODTEST_NR_4 4 -#define PRODTEST_NR_5 5 -#define PRODTEST_NR_6 6 -#define PRODTEST_NR_7 7 - -#define POWERON_MAGIC_VALUE 0x4242 -extern uint8_t bProdtestState; -/* Production test pin definition */ -static uint8_t testRun; -#define SET_PRODUCTIONTEST_PIN PIN_IN(P21, 1) -#define IN_PRODUCTIONTEST (!PIN_GET(P21)) -#endif /* APPL_PROD_TEST */ +zpal_reset_reason_t g_eApplResetReason; zpal_pm_handle_t radio_power_lock; zpal_pm_handle_t io_power_lock; @@ -166,10 +132,6 @@ void ApplicationCommandHandler(void *pSubscriberContext, SZwaveReceivePackage* p void ApplicationNodeUpdate(uint8_t bStatus, uint16_t nodeID, uint8_t *pCmd, uint8_t bLen); -#if SUPPORT_ZW_SET_PROMISCUOUS_MODE -static void SetPromiscuousMode(uint8_t mode); -#endif - #if SUPPORT_ZW_REMOVE_FAILED_NODE_ID extern void ZCB_ComplHandler_ZW_RemoveFailedNodeID(uint8_t bStatus); #endif @@ -186,47 +148,6 @@ extern void ZCB_ComplHandler_ZW_SetSlaveLearnMode(uint8_t bStatus, uint8_t orgID extern uint8_t SetRFReceiveMode(uint8_t mode); #endif -#ifdef UZB - -#if 1 // 0 - test UZB on ZDP03A, 1 - normal mode (UZB on UZB :) -#define LEDxPort P0 -#define LEDxSHADOW P0Shadow -#define LEDxSHADOWDIR P0ShadowDIR -#define LEDxDIR P0DIR -#define LEDxDIR_PAGE P0DIR_PAGE -#define LEDx 4 -#else // 0 - test UZB on ZDP03A, 1 - normal mode (UZB on UZB :) -#define LEDxPort P0 -#define LEDxSHADOW P0Shadow -#define LEDxSHADOWDIR P0ShadowDIR -#define LEDxDIR P0DIR -#define LEDxDIR_PAGE P0DIR_PAGE -#define LEDx 7 -#endif // 0 - test UZB on ZDP03A, 1 - normal mode (UZB on UZB :) - -void /*RET Nothing */ -set_state_and_notify(uint8_t st) -{ - - if (state != st) - { - xTaskNotify(g_AppTaskHandle, - 1< (uint8_t)BUF_SIZE_TX) { - ASSERT((uint8_t)BUF_SIZE_TX >= len); + assert((uint8_t)BUF_SIZE_TX >= len); len = (uint8_t)BUF_SIZE_TX; } callbackQueue.requestQueue[callbackQueue.requestIn].wLen = len; @@ -309,7 +227,7 @@ RequestUnsolicited( commandQueue.requestQueue[commandQueue.requestIn].wCmd = cmd; if (len > (uint8_t)BUF_SIZE_TX) { - ASSERT((uint8_t)BUF_SIZE_TX >= len); + assert((uint8_t)BUF_SIZE_TX >= len); len = (uint8_t)BUF_SIZE_TX; } commandQueue.requestQueue[commandQueue.requestIn].wLen = len; @@ -498,12 +416,11 @@ appFileSystemInit(void) * We end up here on the first boot after initializing the flash file system */ - zpal_radio_region_t mfgRegionConfig; - // Check for a valid RF Region value in the manufacturing user data configuration + zpal_radio_region_t mfgRegionConfig = REGION_UNDEFINED; + // In case of valid MfgToken, override the app default settings. ZW_GetMfgTokenDataCountryFreq(&mfgRegionConfig); - if ( (mfgRegionConfig <= REGION_US_LR) || (mfgRegionConfig == REGION_JP) || (mfgRegionConfig == REGION_KR) ) + if (true == isRfRegionValid(mfgRegionConfig)) { - // Valid RF Region configuration found. Use instead of the app default setting RadioConfig->eRegion = mfgRegionConfig; } @@ -921,7 +838,7 @@ void UsbSuspendCallback(void) **--------------------------------------------------------------------------*/ ZW_APPLICATION_STATUS ApplicationInit( - EResetReason_t eResetReason) + zpal_reset_reason_t eResetReason) { // Serial API can control hardware with information // set in the file system therefore it should be the first @@ -935,14 +852,14 @@ ApplicationInit( #endif #if SUPPORT_SERIAL_API_READY - if (ERESETREASON_SLEEP == eResetReason) + if (ZPAL_RESET_REASON_SLEEP == eResetReason) { /* We have been waken from sleep by timer or external pin event - we must assume we are connected. */ serialLinkState = SERIAL_LINK_CONNECTED; } else { - /* We have been waken either by ERESETREASON_POWER_ON or ERESETREASON_PIN or similar. Initially we are DETACHED */ + /* We have been waken either by ZPAL_RESET_REASON_POWER_ON or ZPAL_RESET_REASON_PIN or similar. Initially we are DETACHED */ serialLinkState = SERIAL_LINK_CONNECTED; } #endif @@ -951,7 +868,6 @@ ApplicationInit( #ifdef DEBUGPRINT static uint8_t m_aDebugPrintBuffer[96]; - zpal_debug_init(); DebugPrintConfig(m_aDebugPrintBuffer, sizeof(m_aDebugPrintBuffer), zpal_debug_output); DebugPrintf("ApplicationInit eResetReason = %d\n", eResetReason); ZAF_PrintAppInfo(); @@ -971,13 +887,13 @@ ApplicationInit( * ZW_UserTask_CreateTask() can be used to create additional tasks. * @see zwave_soc_sensor_pir example for more info. *************************************************************************************/ - bool bWasTaskCreated = ZW_ApplicationRegisterTask( + __attribute__((unused)) bool bWasTaskCreated = ZW_ApplicationRegisterTask( ApplicationTask, EAPPLICATIONEVENT_ZWRX, EAPPLICATIONEVENT_ZWCOMMANDSTATUS, zaf_get_protocol_config() ); - ASSERT(bWasTaskCreated); + assert(bWasTaskCreated); return (APPLICATION_RUNNING); /*Return false to enter production test mode*/ } @@ -1068,7 +984,6 @@ typedef struct SMultiCastNodeMaskHeaderSerial static void /*RET Nothing */ ApplicationCommandHandler_Bridge(SReceiveMulti* pReceiveMulti) { -#if SUPPORT_APPLICATION_COMMAND_HANDLER_BRIDGE /* ZW->HOST: REQ | 0xA8 | rxStatus | destNode | sourceNode | cmdLength * | pCmd[] | multiDestsOffset_NodeMaskLen | multiDestsNodeMask[] | rssiVal * | securityKey | bSourceTxPower | bSourceNoiseFloor */ @@ -1150,67 +1065,6 @@ ApplicationCommandHandler_Bridge(SReceiveMulti* pReceiveMulti) } /* Unified Application Command Handler for Bridge and Virtual nodes */ RequestUnsolicited(FUNC_ID_APPLICATION_COMMAND_HANDLER_BRIDGE, compl_workbuf, (uint8_t)(offset + 1 + i)); -#else - /* Simulate old split Application Command Handlers */ - uint8_t offset = 0; - if (!IsNodeVirtual(destNode)) - { - /* ZW->PC: REQ | 0x04 | rxStatus | sourceNode | cmdLength | Payload */ - BYTE_IN_AR(compl_workbuf, 0) = pReceiveMulti->RxOptions.rxStatus; - if (SERIAL_API_SETUP_NODEID_BASE_TYPE_16_BIT == nodeIdBaseType) - { - BYTE_IN_AR(compl_workbuf, offset + 1) = (uint8_t)(pReceiveMulti->RxOptions.sourceNode >> 8); // MSB - BYTE_IN_AR(compl_workbuf, offset + 2) = (uint8_t)(pReceiveMulti->RxOptions.sourceNode & 0xFF); // LSB - offset = 4; // 16 bit nodeID means the command fields that follow are offset by one byte - } - else - { - BYTE_IN_AR(compl_workbuf, 1) = (uint8_t)pReceiveMulti->RxOptions.sourceNode; // Legacy 8 bit - offset = 3; - } - if (cmdLength > (uint8_t)(BUF_SIZE_TX - offset) ) - { - cmdLength = (uint8_t)(BUF_SIZE_TX - offset) ; - } - BYTE_IN_AR(compl_workbuf, offset - 1 ) = (uint8_t)cmdLength; - for (i = 0; i < cmdLength; i++) - { - BYTE_IN_AR(compl_workbuf, offset + i) = *((uint8_t*)&pReceiveMulti->Payload + i); - } - RequestUnsolicited(FUNC_ID_APPLICATION_COMMAND_HANDLER, compl_workbuf, offset + cmdLength); - } - else - { - /* ZW->PC: REQ | 0xA1 | rxStatus | destNode | sourceNode | cmdLength | Payload */ - BYTE_IN_AR(compl_workbuf, 0) = pReceiveMulti->RxOptions.rxStatus; - if (SERIAL_API_SETUP_NODEID_BASE_TYPE_16_BIT == nodeIdBaseType) - { - BYTE_IN_AR(compl_workbuf, 1) = (uint8_t)(pReceiveMulti->RxOptions.destNode >> 8); // MSB - BYTE_IN_AR(compl_workbuf, 2) = (uint8_t)(pReceiveMulti->RxOptions.destNode & 0xFF); // LSB - BYTE_IN_AR(compl_workbuf, 3) = (uint8_t)(pReceiveMulti->RxOptions.sourceNode >> 8); // MSB - BYTE_IN_AR(compl_workbuf, 4) = (uint8_t)(pReceiveMulti->RxOptions.sourceNode & 0xFF); // LSB - offset = 6; // 16 bit nodeIDs means the command fields that follow are offset by two bytes - } - else - { - // Legacy 8 bit nodeIDs - BYTE_IN_AR(compl_workbuf, 1) = (uint8_t)pReceiveMulti->RxOptions.destNode; - BYTE_IN_AR(compl_workbuf, 2) = (uint8_t)pReceiveMulti->RxOptions.sourceNode; - offset = 4; - } - if (cmdLength > (uint8_t)(BUF_SIZE_TX - offset)) - { - cmdLength = (uint8_t)(BUF_SIZE_TX - offset) ; - } - BYTE_IN_AR(compl_workbuf, offset - 1) = cmdLength; - for (i = 0; i < cmdLength; i++) - { - BYTE_IN_AR(compl_workbuf, offset + i) = *((uint8_t*)&pReceiveMulti->Payload + i); - } - - RequestUnsolicited(FUNC_ID_APPLICATION_SLAVE_COMMAND_HANDLER, compl_workbuf, offset + cmdLength); - } -#endif } #endif @@ -1241,14 +1095,16 @@ ApplicationNodeUpdate( } /* - Buffer boundary check */ - if (bLen > (uint8_t)(BUF_SIZE_TX - (offset + 3))) - { - bLen = (uint8_t)(BUF_SIZE_TX - (offset + 3)); - } + bLen = (bLen > MAX_NODE_INFO_LENGTH) ? MAX_NODE_INFO_LENGTH : bLen; + bLen = (bLen > (uint8_t)(BUF_SIZE_TX - (offset + 3))) ? (uint8_t)(BUF_SIZE_TX - (offset + 3)) : bLen; + BYTE_IN_AR(compl_workbuf, offset + 2) = bLen; - for (uint8_t i = 0; i < bLen; i++) + if(bLen > 0 && pCmd) { - BYTE_IN_AR(compl_workbuf, offset + 3 + i) = *(pCmd + i); + for (uint8_t i = 0; i < bLen; i++) + { + BYTE_IN_AR(compl_workbuf, offset + 3 + i) = *(pCmd + i); + } } RequestUnsolicited(FUNC_ID_ZW_APPLICATION_UPDATE, compl_workbuf, (uint8_t)(offset + bLen + 3)); } diff --git a/src/zwave_ncp_serial_api_controller/app.h b/src/zwave_ncp_serial_api_controller/app.h index 4ab412ef..4ba575aa 100644 --- a/src/zwave_ncp_serial_api_controller/app.h +++ b/src/zwave_ncp_serial_api_controller/app.h @@ -20,16 +20,13 @@ #endif #endif /*#ifndef UNIT_TEST*/ -#include +#include #include #ifdef ZW_SLAVE #include #endif -#ifdef ZW_SECURITY_PROTOCOL -#include -#endif #ifdef ZW_CONTROLLER #include @@ -81,6 +78,7 @@ typedef enum NVMBackupRestoreOperationClose } eNVMBackupRestoreOperation; + /* Return values for FUNC_ID_NVM_BACKUP_RESTORE operation */ typedef enum { @@ -91,10 +89,8 @@ typedef enum NVMBackupRestoreReturnValueEOF = EOF /* Not really an error. Just an indication of EndOfFile */ } eNVMBackupRestoreReturnValue; -#ifndef ZW_SECURITY_PROTOCOL /* params used by ApplicationNodeInformation */ #define APPL_NODEPARM_MAX 35 -#endif #define APPL_SLAVENODEPARM_MAX APPL_NODEPARM_MAX @@ -126,38 +122,14 @@ typedef enum SERIALAPI_CONFIG_UNDEFINED = 0xFE } SERIALAPI_CONFIG_T; -#if defined(NUNIT_TEST) && !defined(ZW_CONTROLLER_BRIDGE) -#define SUPPORT_ZW_NUNIT 1 -#else -#define SUPPORT_ZW_NUNIT 0 -#endif - -#ifdef PORT_STATUS -#define SUPPORT_ZW_PORT_STATUS 1 -#else -#define SUPPORT_ZW_PORT_STATUS 0 -#endif #define SUPPORT_ZW_SET_SECURITY_S0_NETWORK_KEY 0 /*deprecated*/ /* Enable support for SerialAPI Startup Notification */ #define SUPPORT_SERIAL_API_STARTUP_NOTIFICATION 1 /* Security in Protocol SerialAPI functionality support definitions */ -#ifdef ZW_SECURITY_PROTOCOL -#define SUPPORT_APPLICATION_SECURITY_EVENT 0 -#define SUPPORT_SERIAL_API_APPL_NODE_INFORMATION_CMD_CLASSES 1 -#if (SUPPORT_ZW_GET_SECURITY_KEYS | \ - SUPPORT_ZW_SET_SECURITY_S0_NETWORK_KEY | \ - SUPPORT_ZW_GET_SECURITY_S2_PUBLIC_DSK | \ - SUPPORT_ZW_SET_SECURITY_S2_CRITICAL_NODE_ID) -#define SUPPORT_ZW_SECURITY_SETUP 1 -#else -#define SUPPORT_ZW_SECURITY_SETUP 0 -#endif -#else /*#ifdef ZW_SECURITY_PROTOCOL*/ #define SUPPORT_SERIAL_API_APPL_NODE_INFORMATION_CMD_CLASSES 0 #define SUPPORT_ZW_SECURITY_SETUP 0 #define SUPPORT_APPLICATION_SECURITY_EVENT 0 -#endif /* Common SerialAPI functionality support definitions */ #define SUPPORT_SERIAL_API_APPL_NODE_INFORMATION 1 @@ -169,12 +141,7 @@ typedef enum #define SUPPORT_SERIAL_API_READY 0 #define SUPPORT_SERIAL_API_EXT 1 -#ifdef ZW_SECURITY_PROTOCOL -/* Only libraries with SECURITY buildin should supports this (slave_enhanced_232) */ -#define SUPPORT_SERIAL_API_APPL_NODE_INFORMATION_CMD_CLASSES 1 -#else #define SUPPORT_SERIAL_API_APPL_NODE_INFORMATION_CMD_CLASSES 0 -#endif #ifdef ZW_ENABLE_RTC #define SUPPORT_CLOCK_SET 1 @@ -208,318 +175,11 @@ typedef enum #define SUPPORT_TIMER_CALL 0 #endif -#if defined(NUNIT_TEST) && !defined(ZW_CONTROLLER_BRIDGE) -#define SUPPORT_ZW_NUNIT 1 -#else -#define SUPPORT_ZW_NUNIT 0 -#endif - -#ifdef PORT_STATUS -#define SUPPORT_ZW_PORT_STATUS 1 -#else -#define SUPPORT_ZW_PORT_STATUS 0 -#endif /* ZW_EnableSUC() no longer exists in the library */ /* */ #define SUPPORT_SERIAL_API_GET_APPL_HOST_MEMORY_OFFSET 0 - -#define FID_BM_OFFS(FUNCID) ((FUNCID - 1) / 8) -#define FID_BM(FUNCID) (1 << ((FUNCID - 1) & 0x07)) -#define CAP_FID(OFFSET, FUNCID) (((FUNCID != 0) && (FID_BM_OFFS(FUNCID) == OFFSET)) ? FID_BM(FUNCID) : 0) -#ifdef ZW_CONTROLLER_SINGLE -#define CAP_BM(OFFSET) (CAP_FID(OFFSET, (SUPPORT_SERIAL_API_POWER_MANAGEMENT == 0) ? 0 : FUNC_ID_SERIAL_API_POWER_MANAGEMENT) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_READY == 0) ? 0 : FUNC_ID_SERIAL_API_READY) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_GET_INIT_DATA == 0) ? 0 : FUNC_ID_SERIAL_API_GET_INIT_DATA) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_APPL_NODE_INFORMATION == 0) ? 0 : FUNC_ID_SERIAL_API_APPL_NODE_INFORMATION) | \ - CAP_FID(OFFSET, (SUPPORT_APPLICATION_COMMAND_HANDLER_BRIDGE == 0) ? 0 : FUNC_ID_APPLICATION_COMMAND_HANDLER_BRIDGE) | \ - CAP_FID(OFFSET, (SUPPORT_APPLICATION_COMMAND_HANDLER == 0) ? 0 : FUNC_ID_APPLICATION_COMMAND_HANDLER) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_CONTROLLER_CAPABILITIES == 0) ? 0 : FUNC_ID_ZW_GET_CONTROLLER_CAPABILITIES) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_SET_TIMEOUTS == 0) ? 0 : FUNC_ID_SERIAL_API_SET_TIMEOUTS) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_GET_CAPABILITIES == 0) ? 0 : FUNC_ID_SERIAL_API_GET_CAPABILITIES) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_SOFT_RESET == 0) ? 0 : FUNC_ID_SERIAL_API_SOFT_RESET) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_STARTUP_NOTIFICATION == 0) ? 0 : FUNC_ID_SERIAL_API_STARTED) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_SETUP == 0) ? 0 : FUNC_ID_SERIAL_API_SETUP) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_APPL_NODE_INFORMATION_CMD_CLASSES == 0) ? 0 : FUNC_ID_SERIAL_API_APPL_NODE_INFORMATION_CMD_CLASSES) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_PROTOCOL_VERSION == 0) ? 0 : FUNC_ID_ZW_GET_PROTOCOL_VERSION) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_RF_RECEIVE_MODE == 0) ? 0 : FUNC_ID_ZW_SET_RF_RECEIVE_MODE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_SLEEP_MODE == 0) ? 0 : FUNC_ID_ZW_SET_SLEEP_MODE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_NODE_INFORMATION == 0) ? 0 : FUNC_ID_ZW_SEND_NODE_INFORMATION) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_DATA == 0) ? 0 : FUNC_ID_ZW_SEND_DATA) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_DATA_BRIDGE == 0) ? 0 : FUNC_ID_ZW_SEND_DATA_BRIDGE)|\ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_DATA_EX == 0) ? 0 : FUNC_ID_ZW_SEND_DATA_EX) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_DATA_META_BRIDGE == 0) ? 0 : FUNC_ID_ZW_SEND_DATA_META_BRIDGE)|\ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_DATA_MULTI == 0) ? 0 : FUNC_ID_ZW_SEND_DATA_MULTI) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_DATA_MULTI_BRIDGE == 0) ? 0 : FUNC_ID_ZW_SEND_DATA_MULTI_BRIDGE)|\ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_DATA_MULTI_EX == 0) ? 0 : FUNC_ID_ZW_SEND_DATA_MULTI_EX) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SECURITY_SETUP == 0) ? 0 : FUNC_ID_ZW_SECURITY_SETUP) | \ - CAP_FID(OFFSET, (SUPPORT_APPLICATION_SECURITY_EVENT == 0) ? 0 : FUNC_ID_APPLICATION_SECURITY_EVENT) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_VERSION == 0) ? 0 : FUNC_ID_ZW_GET_VERSION) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_DATA_ABORT == 0) ? 0 : FUNC_ID_ZW_SEND_DATA_ABORT) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_RF_POWER_LEVEL_SET == 0) ? 0 : FUNC_ID_ZW_RF_POWER_LEVEL_SET) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_RF_POWER_LEVEL_GET == 0) ? 0 : FUNC_ID_ZW_RF_POWER_LEVEL_GET) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_TYPE_LIBRARY == 0) ? 0 : FUNC_ID_ZW_TYPE_LIBRARY) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_PROTOCOL_STATUS == 0) ? 0 : FUNC_ID_ZW_GET_PROTOCOL_STATUS) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_WATCHDOG_ENABLE == 0) ? 0 : FUNC_ID_ZW_WATCHDOG_ENABLE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_WATCHDOG_DISABLE == 0) ? 0 : FUNC_ID_ZW_WATCHDOG_DISABLE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_WATCHDOG_KICK == 0) ? 0 : FUNC_ID_ZW_WATCHDOG_KICK) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_WATCHDOG_START == 0) ? 0 : FUNC_ID_ZW_WATCHDOG_START)|\ - CAP_FID(OFFSET, (SUPPORT_ZW_WATCHDOG_STOP == 0) ? 0 : FUNC_ID_ZW_WATCHDOG_STOP)|\ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_WUT_TIMEOUT == 0) ? 0 : FUNC_ID_ZW_SET_WUT_TIMEOUT) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_IS_WUT_KICKED == 0) ? 0 : FUNC_ID_ZW_IS_WUT_KICKED) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_EXT_INT_LEVEL == 0) ? 0 : FUNC_ID_ZW_SET_EXT_INT_LEVEL) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_DATA_META == 0) ? 0 : FUNC_ID_ZW_SEND_DATA_META) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_TEST_FRAME == 0) ? 0 : FUNC_ID_ZW_SEND_TEST_FRAME) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_RANDOM == 0) ? 0 : FUNC_ID_ZW_GET_RANDOM) | \ - CAP_FID(OFFSET, (SUPPORT_MEMORY_GET_ID == 0) ? 0 : FUNC_ID_MEMORY_GET_ID) | \ - CAP_FID(OFFSET, (SUPPORT_MEMORY_GET_BYTE == 0) ? 0 : FUNC_ID_MEMORY_GET_BYTE) | \ - CAP_FID(OFFSET, (SUPPORT_MEMORY_PUT_BYTE == 0) ? 0 : FUNC_ID_MEMORY_PUT_BYTE) | \ - CAP_FID(OFFSET, (SUPPORT_MEMORY_GET_BUFFER == 0) ? 0 : FUNC_ID_MEMORY_GET_BUFFER) | \ - CAP_FID(OFFSET, (SUPPORT_MEMORY_PUT_BUFFER == 0) ? 0 : FUNC_ID_MEMORY_PUT_BUFFER) | \ - CAP_FID(OFFSET, (SUPPORT_NVM_BACKUP_RESTORE == 0) ? 0 : FUNC_ID_NVM_BACKUP_RESTORE) | \ - CAP_FID(OFFSET, (SUPPORT_NVM_GET_ID == 0) ? 0 : FUNC_ID_NVM_GET_ID) | \ - CAP_FID(OFFSET, (SUPPORT_NVM_EXT_READ_LONG_BYTE == 0) ? 0 : FUNC_ID_NVM_EXT_READ_LONG_BYTE) | \ - CAP_FID(OFFSET, (SUPPORT_NVM_EXT_WRITE_LONG_BYTE == 0) ? 0 : FUNC_ID_NVM_EXT_WRITE_LONG_BYTE) | \ - CAP_FID(OFFSET, (SUPPORT_NVM_EXT_READ_LONG_BUFFER == 0) ? 0 : FUNC_ID_NVM_EXT_READ_LONG_BUFFER) | \ - CAP_FID(OFFSET, (SUPPORT_NVM_EXT_WRITE_LONG_BUFFER == 0) ? 0 : FUNC_ID_NVM_EXT_WRITE_LONG_BUFFER) | \ - CAP_FID(OFFSET, (SUPPORT_CLOCK_SET == 0) ? 0 : FUNC_ID_CLOCK_SET) | \ - CAP_FID(OFFSET, (SUPPORT_CLOCK_GET == 0) ? 0 : FUNC_ID_CLOCK_GET) | \ - CAP_FID(OFFSET, (SUPPORT_CLOCK_CMP == 0) ? 0 : FUNC_ID_CLOCK_CMP) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_NVR_GET_VALUE == 0) ? 0 : FUNC_ID_NVR_GET_VALUE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_AUTO_PROGRAMMING == 0) ? 0 : FUNC_ID_AUTO_PROGRAMMING) | \ - CAP_FID(OFFSET, (SUPPORT_PWR_SETSTOPMODE == 0) ? 0 : FUNC_ID_PWR_SETSTOPMODE) | \ - CAP_FID(OFFSET, (SUPPORT_PWR_CLK_PD == 0) ? 0 : FUNC_ID_PWR_CLK_PD) | \ - CAP_FID(OFFSET, (SUPPORT_PWR_CLK_PUP == 0) ? 0 : FUNC_ID_PWR_CLK_PUP) | \ - CAP_FID(OFFSET, (SUPPORT_PWR_SELECT_CLK == 0) ? 0 : FUNC_ID_PWR_SELECT_CLK) | \ - CAP_FID(OFFSET, (SUPPORT_RTC_TIMER_CREATE == 0) ? 0 : FUNC_ID_RTC_TIMER_CREATE) | \ - CAP_FID(OFFSET, (SUPPORT_RTC_TIMER_READ == 0) ? 0 : FUNC_ID_RTC_TIMER_READ) | \ - CAP_FID(OFFSET, (SUPPORT_RTC_TIMER_DELETE == 0) ? 0 : FUNC_ID_RTC_TIMER_DELETE) | \ - CAP_FID(OFFSET, (SUPPORT_RTC_TIMER_CALL == 0) ? 0 : FUNC_ID_RTC_TIMER_CALL) | \ - CAP_FID(OFFSET, (SUPPORT_FUNC_ID_CLEAR_TX_TIMERS == 0) ? 0 : FUNC_ID_CLEAR_TX_TIMERS) | \ - CAP_FID(OFFSET, (SUPPORT_FUNC_ID_GET_TX_TIMERS == 0) ? 0 : FUNC_ID_GET_TX_TIMERS) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_CLEAR_NETWORK_STATS == 0) ? 0 : FUNC_ID_ZW_CLEAR_NETWORK_STATS) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_NETWORK_STATS == 0) ? 0 : FUNC_ID_ZW_GET_NETWORK_STATS) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_BACKGROUND_RSSI == 0) ? 0 : FUNC_ID_ZW_GET_BACKGROUND_RSSI) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_REMOVE_NODE_ID_FROM_NETWORK == 0) ? 0 : FUNC_ID_ZW_REMOVE_NODE_ID_FROM_NETWORK) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_LEARN_NODE_STATE == 0) ? 0 : FUNC_ID_ZW_SET_LEARN_NODE_STATE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_NODE_PROTOCOL_INFO == 0) ? 0 : FUNC_ID_ZW_GET_NODE_PROTOCOL_INFO) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_DEFAULT == 0) ? 0 : FUNC_ID_ZW_SET_DEFAULT) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_NEW_CONTROLLER == 0) ? 0 : FUNC_ID_ZW_NEW_CONTROLLER) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_REPLICATION_COMMAND_COMPLETE == 0) ? 0 : FUNC_ID_ZW_REPLICATION_COMMAND_COMPLETE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_REPLICATION_SEND_DATA == 0) ? 0 : FUNC_ID_ZW_REPLICATION_SEND_DATA) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_ASSIGN_RETURN_ROUTE == 0) ? 0 : FUNC_ID_ZW_ASSIGN_RETURN_ROUTE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_DELETE_RETURN_ROUTE == 0) ? 0 : FUNC_ID_ZW_DELETE_RETURN_ROUTE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_REQUEST_NODE_NEIGHBOR_UPDATE == 0) ? 0 : FUNC_ID_ZW_REQUEST_NODE_NEIGHBOR_UPDATE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_NEIGHBOR_COUNT == 0) ? 0 : FUNC_ID_ZW_GET_NEIGHBOR_COUNT) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_ARE_NODES_NEIGHBOURS == 0) ? 0 : FUNC_ID_ZW_ARE_NODES_NEIGHBOURS) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_APPLICATION_CONTROLLER_UPDATE == 0) ? 0 : FUNC_ID_ZW_APPLICATION_UPDATE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_ADD_NODE_TO_NETWORK == 0) ? 0 : FUNC_ID_ZW_ADD_NODE_TO_NETWORK) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_REMOVE_NODE_FROM_NETWORK == 0) ? 0 : FUNC_ID_ZW_REMOVE_NODE_FROM_NETWORK) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_CREATE_NEW_PRIMARY == 0) ? 0 : FUNC_ID_ZW_CREATE_NEW_PRIMARY) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_CONTROLLER_CHANGE == 0) ? 0 : FUNC_ID_ZW_CONTROLLER_CHANGE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_REQUEST_NODE_INFO == 0) ? 0 : FUNC_ID_ZW_REQUEST_NODE_INFO) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_REMOVE_FAILED_NODE_ID == 0) ? 0 : FUNC_ID_ZW_REMOVE_FAILED_NODE_ID) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_IS_FAILED_NODE_ID == 0) ? 0 : FUNC_ID_ZW_IS_FAILED_NODE_ID) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_REPLACE_FAILED_NODE == 0) ? 0 : FUNC_ID_ZW_REPLACE_FAILED_NODE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_ROUTING_MAX == 0) ? 0 : FUNC_ID_ZW_GET_ROUTING_MAX) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_ROUTING_MAX == 0) ? 0 : FUNC_ID_ZW_SET_ROUTING_MAX) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_IS_PRIMARY_CTRL == 0) ? 0 : FUNC_ID_ZW_IS_PRIMARY_CTRL) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_AES_ECB == 0) ? 0 : FUNC_ID_ZW_AES_ECB) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_APPLICATION_UPDATE == 0) ? 0 : FUNC_ID_ZW_APPLICATION_UPDATE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_LEARN_MODE == 0) ? 0 : FUNC_ID_ZW_SET_LEARN_MODE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_EXPLORE_REQUEST_INCLUSION == 0) ? 0 : FUNC_ID_ZW_EXPLORE_REQUEST_INCLUSION) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_EXPLORE_REQUEST_EXCLUSION == 0) ? 0 : FUNC_ID_ZW_EXPLORE_REQUEST_EXCLUSION) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_ASSIGN_SUC_RETURN_ROUTE == 0) ? 0 : FUNC_ID_ZW_ASSIGN_SUC_RETURN_ROUTE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_ENABLE_SUC == 0) ? 0 : FUNC_ID_ZW_ENABLE_SUC) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_REQUEST_NETWORK_UPDATE == 0) ? 0 : FUNC_ID_ZW_REQUEST_NETWORK_UPDATE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_SUC_NODE_ID == 0) ? 0 : FUNC_ID_ZW_SET_SUC_NODE_ID) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_DELETE_SUC_RETURN_ROUTE == 0) ? 0 : FUNC_ID_ZW_DELETE_SUC_RETURN_ROUTE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_SUC_NODE_ID == 0) ? 0 : FUNC_ID_ZW_GET_SUC_NODE_ID) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_SUC_ID == 0) ? 0 : FUNC_ID_ZW_SEND_SUC_ID) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_ASSIGN_PRIORITY_SUC_RETURN_ROUTE == 0) ? 0 : FUNC_ID_ZW_ASSIGN_PRIORITY_SUC_RETURN_ROUTE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_ASSIGN_PRIORITY_RETURN_ROUTE == 0) ? 0 : FUNC_ID_ZW_ASSIGN_PRIORITY_RETURN_ROUTE) | \ - CAP_FID(OFFSET, (SUPPORT_TIMER_START == 0) ? 0 : FUNC_ID_TIMER_START) | \ - CAP_FID(OFFSET, (SUPPORT_TIMER_RESTART == 0) ? 0 : FUNC_ID_TIMER_RESTART) | \ - CAP_FID(OFFSET, (SUPPORT_TIMER_CANCEL == 0) ? 0 : FUNC_ID_TIMER_CANCEL) | \ - CAP_FID(OFFSET, (SUPPORT_TIMER_CALL == 0) ? 0 : FUNC_ID_TIMER_CALL) | \ - CAP_FID(OFFSET, (SUPPORT_GET_ROUTING_TABLE_LINE == 0) ? 0 : FUNC_ID_GET_ROUTING_TABLE_LINE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_ROUTING_INFO == 0) ? 0 : FUNC_ID_ZW_SET_ROUTING_INFO) | \ - CAP_FID(OFFSET, (SUPPORT_GET_TX_COUNTER == 0) ? 0 : FUNC_ID_GET_TX_COUNTER) | \ - CAP_FID(OFFSET, (SUPPORT_RESET_TX_COUNTER == 0) ? 0 : FUNC_ID_RESET_TX_COUNTER) | \ - CAP_FID(OFFSET, (SUPPORT_STORE_NODEINFO == 0) ? 0 : FUNC_ID_STORE_NODEINFO) | \ - CAP_FID(OFFSET, (SUPPORT_STORE_HOMEID == 0) ? 0 : FUNC_ID_STORE_HOMEID) | \ - CAP_FID(OFFSET, (SUPPORT_LOCK_ROUTE_RESPONSE == 0) ? 0 : FUNC_ID_LOCK_ROUTE_RESPONSE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_PRIORITY_ROUTE == 0) ? 0 : FUNC_ID_ZW_GET_PRIORITY_ROUTE)|\ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_PRIORITY_ROUTE == 0) ? 0 : FUNC_ID_ZW_SET_PRIORITY_ROUTE)|\ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_APPL_SLAVE_NODE_INFORMATION == 0) ? 0 : FUNC_ID_SERIAL_API_APPL_SLAVE_NODE_INFORMATION) | \ - CAP_FID(OFFSET, (SUPPORT_APPLICATION_SLAVE_COMMAND_HANDLER == 0) ? 0 : FUNC_ID_APPLICATION_SLAVE_COMMAND_HANDLER) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_SLAVE_NODE_INFORMATION == 0) ? 0 : FUNC_ID_ZW_SEND_SLAVE_NODE_INFORMATION) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_SLAVE_DATA == 0) ? 0 : FUNC_ID_ZW_SEND_SLAVE_DATA) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_SLAVE_LEARN_MODE == 0) ? 0 : FUNC_ID_ZW_SET_SLAVE_LEARN_MODE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_VIRTUAL_NODES == 0) ? 0 : FUNC_ID_ZW_GET_VIRTUAL_NODES) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_IS_VIRTUAL_NODE == 0) ? 0 : FUNC_ID_ZW_IS_VIRTUAL_NODE) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_TEST == 0) ? 0 : FUNC_ID_SERIAL_API_TEST) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_EXT == 0) ? 0 : FUNC_ID_SERIAL_API_EXT) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_GET_APPL_HOST_MEMORY_OFFSET == 0) ? 0 : FUNC_ID_SERIAL_API_GET_APPL_HOST_MEMORY_OFFSET) |\ - CAP_FID(OFFSET, (SUPPORT_ZW_NUNIT == 0) ? 0 : FUNC_ID_ZW_NUNIT_CMD) |\ - CAP_FID(OFFSET, (SUPPORT_ZW_NUNIT == 0) ? 0 : FUNC_ID_ZW_NUNIT_INIT) |\ - CAP_FID(OFFSET, (SUPPORT_ZW_NUNIT == 0) ? 0 : FUNC_ID_ZW_NUNIT_LIST) |\ - CAP_FID(OFFSET, (SUPPORT_ZW_NUNIT == 0) ? 0 : FUNC_ID_ZW_NUNIT_RUN) |\ - CAP_FID(OFFSET, (SUPPORT_ZW_NUNIT == 0) ? 0 : FUNC_ID_ZW_NUNIT_END) |\ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_LISTEN_BEFORE_TALK_THRESHOLD == 0) ? 0 : FUNC_ID_ZW_SET_LISTEN_BEFORE_TALK_THRESHOLD)| \ - CAP_FID(OFFSET, (SUPPORT_ZW_NETWORK_MANAGEMENT_SET_MAX_INCLUSION_REQUEST_INTERVALS == 0) ? 0 : FUNC_ID_ZW_NETWORK_MANAGEMENT_SET_MAX_INCLUSION_REQUEST_INTERVALS) \ - ) -#else -#define CAP_BM(OFFSET) (CAP_FID(OFFSET, (SUPPORT_SERIAL_API_POWER_MANAGEMENT == 0) ? 0 : FUNC_ID_SERIAL_API_POWER_MANAGEMENT) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_READY == 0) ? 0 : FUNC_ID_SERIAL_API_READY) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_GET_INIT_DATA == 0) ? 0 : FUNC_ID_SERIAL_API_GET_INIT_DATA) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_APPL_NODE_INFORMATION == 0) ? 0 : FUNC_ID_SERIAL_API_APPL_NODE_INFORMATION) | \ - CAP_FID(OFFSET, (SUPPORT_APPLICATION_COMMAND_HANDLER_BRIDGE == 0) ? 0 : FUNC_ID_APPLICATION_COMMAND_HANDLER_BRIDGE) | \ - CAP_FID(OFFSET, (SUPPORT_APPLICATION_COMMAND_HANDLER == 0) ? 0 : FUNC_ID_APPLICATION_COMMAND_HANDLER) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_CONTROLLER_CAPABILITIES == 0) ? 0 : FUNC_ID_ZW_GET_CONTROLLER_CAPABILITIES) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_SET_TIMEOUTS == 0) ? 0 : FUNC_ID_SERIAL_API_SET_TIMEOUTS) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_GET_CAPABILITIES == 0) ? 0 : FUNC_ID_SERIAL_API_GET_CAPABILITIES) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_SOFT_RESET == 0) ? 0 : FUNC_ID_SERIAL_API_SOFT_RESET) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_STARTUP_NOTIFICATION == 0) ? 0 : FUNC_ID_SERIAL_API_STARTED) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_SETUP == 0) ? 0 : FUNC_ID_SERIAL_API_SETUP) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_APPL_NODE_INFORMATION_CMD_CLASSES == 0) ? 0 : FUNC_ID_SERIAL_API_APPL_NODE_INFORMATION_CMD_CLASSES) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_PROTOCOL_VERSION == 0) ? 0 : FUNC_ID_ZW_GET_PROTOCOL_VERSION) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_RF_RECEIVE_MODE == 0) ? 0 : FUNC_ID_ZW_SET_RF_RECEIVE_MODE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_SLEEP_MODE == 0) ? 0 : FUNC_ID_ZW_SET_SLEEP_MODE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_NODE_INFORMATION == 0) ? 0 : FUNC_ID_ZW_SEND_NODE_INFORMATION) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_DATA == 0) ? 0 : FUNC_ID_ZW_SEND_DATA) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_DATA_BRIDGE == 0) ? 0 : FUNC_ID_ZW_SEND_DATA_BRIDGE)|\ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_DATA_EX == 0) ? 0 : FUNC_ID_ZW_SEND_DATA_EX) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_DATA_META_BRIDGE == 0) ? 0 : FUNC_ID_ZW_SEND_DATA_META_BRIDGE)|\ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_DATA_MULTI == 0) ? 0 : FUNC_ID_ZW_SEND_DATA_MULTI) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_DATA_MULTI_BRIDGE == 0) ? 0 : FUNC_ID_ZW_SEND_DATA_MULTI_BRIDGE)|\ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_DATA_MULTI_EX == 0) ? 0 : FUNC_ID_ZW_SEND_DATA_MULTI_EX) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SECURITY_SETUP == 0) ? 0 : FUNC_ID_ZW_SECURITY_SETUP) | \ - CAP_FID(OFFSET, (SUPPORT_APPLICATION_SECURITY_EVENT == 0) ? 0 : FUNC_ID_APPLICATION_SECURITY_EVENT) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_VERSION == 0) ? 0 : FUNC_ID_ZW_GET_VERSION) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_DATA_ABORT == 0) ? 0 : FUNC_ID_ZW_SEND_DATA_ABORT) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_RF_POWER_LEVEL_SET == 0) ? 0 : FUNC_ID_ZW_RF_POWER_LEVEL_SET) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_RF_POWER_LEVEL_GET == 0) ? 0 : FUNC_ID_ZW_RF_POWER_LEVEL_GET) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_TYPE_LIBRARY == 0) ? 0 : FUNC_ID_ZW_TYPE_LIBRARY) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_PROTOCOL_STATUS == 0) ? 0 : FUNC_ID_ZW_GET_PROTOCOL_STATUS) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_WATCHDOG_ENABLE == 0) ? 0 : FUNC_ID_ZW_WATCHDOG_ENABLE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_WATCHDOG_DISABLE == 0) ? 0 : FUNC_ID_ZW_WATCHDOG_DISABLE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_WATCHDOG_KICK == 0) ? 0 : FUNC_ID_ZW_WATCHDOG_KICK) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_WATCHDOG_START == 0) ? 0 : FUNC_ID_ZW_WATCHDOG_START)|\ - CAP_FID(OFFSET, (SUPPORT_ZW_WATCHDOG_STOP == 0) ? 0 : FUNC_ID_ZW_WATCHDOG_STOP)|\ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_WUT_TIMEOUT == 0) ? 0 : FUNC_ID_ZW_SET_WUT_TIMEOUT) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_IS_WUT_KICKED == 0) ? 0 : FUNC_ID_ZW_IS_WUT_KICKED) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_EXT_INT_LEVEL == 0) ? 0 : FUNC_ID_ZW_SET_EXT_INT_LEVEL) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_DATA_META == 0) ? 0 : FUNC_ID_ZW_SEND_DATA_META) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_TEST_FRAME == 0) ? 0 : FUNC_ID_ZW_SEND_TEST_FRAME) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_RANDOM == 0) ? 0 : FUNC_ID_ZW_GET_RANDOM) | \ - CAP_FID(OFFSET, (SUPPORT_MEMORY_GET_ID == 0) ? 0 : FUNC_ID_MEMORY_GET_ID) | \ - CAP_FID(OFFSET, (SUPPORT_MEMORY_GET_BYTE == 0) ? 0 : FUNC_ID_MEMORY_GET_BYTE) | \ - CAP_FID(OFFSET, (SUPPORT_MEMORY_PUT_BYTE == 0) ? 0 : FUNC_ID_MEMORY_PUT_BYTE) | \ - CAP_FID(OFFSET, (SUPPORT_MEMORY_GET_BUFFER == 0) ? 0 : FUNC_ID_MEMORY_GET_BUFFER) | \ - CAP_FID(OFFSET, (SUPPORT_MEMORY_PUT_BUFFER == 0) ? 0 : FUNC_ID_MEMORY_PUT_BUFFER) | \ - CAP_FID(OFFSET, (SUPPORT_NVM_BACKUP_RESTORE == 0) ? 0 : FUNC_ID_NVM_BACKUP_RESTORE) | \ - CAP_FID(OFFSET, (SUPPORT_NVM_GET_ID == 0) ? 0 : FUNC_ID_NVM_GET_ID) | \ - CAP_FID(OFFSET, (SUPPORT_NVM_EXT_READ_LONG_BYTE == 0) ? 0 : FUNC_ID_NVM_EXT_READ_LONG_BYTE) | \ - CAP_FID(OFFSET, (SUPPORT_NVM_EXT_WRITE_LONG_BYTE == 0) ? 0 : FUNC_ID_NVM_EXT_WRITE_LONG_BYTE) | \ - CAP_FID(OFFSET, (SUPPORT_NVM_EXT_READ_LONG_BUFFER == 0) ? 0 : FUNC_ID_NVM_EXT_READ_LONG_BUFFER) | \ - CAP_FID(OFFSET, (SUPPORT_NVM_EXT_WRITE_LONG_BUFFER == 0) ? 0 : FUNC_ID_NVM_EXT_WRITE_LONG_BUFFER) | \ - CAP_FID(OFFSET, (SUPPORT_CLOCK_SET == 0) ? 0 : FUNC_ID_CLOCK_SET) | \ - CAP_FID(OFFSET, (SUPPORT_CLOCK_GET == 0) ? 0 : FUNC_ID_CLOCK_GET) | \ - CAP_FID(OFFSET, (SUPPORT_CLOCK_CMP == 0) ? 0 : FUNC_ID_CLOCK_CMP) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_NVR_GET_VALUE == 0) ? 0 : FUNC_ID_NVR_GET_VALUE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_AUTO_PROGRAMMING == 0) ? 0 : FUNC_ID_AUTO_PROGRAMMING) | \ - CAP_FID(OFFSET, (SUPPORT_PWR_SETSTOPMODE == 0) ? 0 : FUNC_ID_PWR_SETSTOPMODE) | \ - CAP_FID(OFFSET, (SUPPORT_PWR_CLK_PD == 0) ? 0 : FUNC_ID_PWR_CLK_PD) | \ - CAP_FID(OFFSET, (SUPPORT_PWR_CLK_PUP == 0) ? 0 : FUNC_ID_PWR_CLK_PUP) | \ - CAP_FID(OFFSET, (SUPPORT_PWR_SELECT_CLK == 0) ? 0 : FUNC_ID_PWR_SELECT_CLK) | \ - CAP_FID(OFFSET, (SUPPORT_RTC_TIMER_CREATE == 0) ? 0 : FUNC_ID_RTC_TIMER_CREATE) | \ - CAP_FID(OFFSET, (SUPPORT_RTC_TIMER_READ == 0) ? 0 : FUNC_ID_RTC_TIMER_READ) | \ - CAP_FID(OFFSET, (SUPPORT_RTC_TIMER_DELETE == 0) ? 0 : FUNC_ID_RTC_TIMER_DELETE) | \ - CAP_FID(OFFSET, (SUPPORT_RTC_TIMER_CALL == 0) ? 0 : FUNC_ID_RTC_TIMER_CALL) | \ - CAP_FID(OFFSET, (SUPPORT_FUNC_ID_CLEAR_TX_TIMERS == 0) ? 0 : FUNC_ID_CLEAR_TX_TIMERS) | \ - CAP_FID(OFFSET, (SUPPORT_FUNC_ID_GET_TX_TIMERS == 0) ? 0 : FUNC_ID_GET_TX_TIMERS) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_CLEAR_NETWORK_STATS == 0) ? 0 : FUNC_ID_ZW_CLEAR_NETWORK_STATS) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_NETWORK_STATS == 0) ? 0 : FUNC_ID_ZW_GET_NETWORK_STATS) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_BACKGROUND_RSSI == 0) ? 0 : FUNC_ID_ZW_GET_BACKGROUND_RSSI) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_REMOVE_NODE_ID_FROM_NETWORK == 0) ? 0 : FUNC_ID_ZW_REMOVE_NODE_ID_FROM_NETWORK) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_LEARN_NODE_STATE == 0) ? 0 : FUNC_ID_ZW_SET_LEARN_NODE_STATE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_NODE_PROTOCOL_INFO == 0) ? 0 : FUNC_ID_ZW_GET_NODE_PROTOCOL_INFO) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_DEFAULT == 0) ? 0 : FUNC_ID_ZW_SET_DEFAULT) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_NEW_CONTROLLER == 0) ? 0 : FUNC_ID_ZW_NEW_CONTROLLER) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_REPLICATION_COMMAND_COMPLETE == 0) ? 0 : FUNC_ID_ZW_REPLICATION_COMMAND_COMPLETE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_REPLICATION_SEND_DATA == 0) ? 0 : FUNC_ID_ZW_REPLICATION_SEND_DATA) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_ASSIGN_RETURN_ROUTE == 0) ? 0 : FUNC_ID_ZW_ASSIGN_RETURN_ROUTE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_DELETE_RETURN_ROUTE == 0) ? 0 : FUNC_ID_ZW_DELETE_RETURN_ROUTE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_REQUEST_NODE_NEIGHBOR_UPDATE == 0) ? 0 : FUNC_ID_ZW_REQUEST_NODE_NEIGHBOR_UPDATE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_APPLICATION_CONTROLLER_UPDATE == 0) ? 0 : FUNC_ID_ZW_APPLICATION_UPDATE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_ADD_NODE_TO_NETWORK == 0) ? 0 : FUNC_ID_ZW_ADD_NODE_TO_NETWORK) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_REMOVE_NODE_FROM_NETWORK == 0) ? 0 : FUNC_ID_ZW_REMOVE_NODE_FROM_NETWORK) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_CREATE_NEW_PRIMARY == 0) ? 0 : FUNC_ID_ZW_CREATE_NEW_PRIMARY) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_CONTROLLER_CHANGE == 0) ? 0 : FUNC_ID_ZW_CONTROLLER_CHANGE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_REQUEST_NODE_INFO == 0) ? 0 : FUNC_ID_ZW_REQUEST_NODE_INFO) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_REMOVE_FAILED_NODE_ID == 0) ? 0 : FUNC_ID_ZW_REMOVE_FAILED_NODE_ID) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_IS_FAILED_NODE_ID == 0) ? 0 : FUNC_ID_ZW_IS_FAILED_NODE_ID) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_REPLACE_FAILED_NODE == 0) ? 0 : FUNC_ID_ZW_REPLACE_FAILED_NODE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_ROUTING_MAX == 0) ? 0 : FUNC_ID_ZW_GET_ROUTING_MAX) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_ROUTING_MAX == 0) ? 0 : FUNC_ID_ZW_SET_ROUTING_MAX) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_IS_PRIMARY_CTRL == 0) ? 0 : FUNC_ID_ZW_IS_PRIMARY_CTRL) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_AES_ECB == 0) ? 0 : FUNC_ID_ZW_AES_ECB) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_APPLICATION_UPDATE == 0) ? 0 : FUNC_ID_ZW_APPLICATION_UPDATE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_LEARN_MODE == 0) ? 0 : FUNC_ID_ZW_SET_LEARN_MODE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_EXPLORE_REQUEST_INCLUSION == 0) ? 0 : FUNC_ID_ZW_EXPLORE_REQUEST_INCLUSION) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_EXPLORE_REQUEST_EXCLUSION == 0) ? 0 : FUNC_ID_ZW_EXPLORE_REQUEST_EXCLUSION) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_ASSIGN_SUC_RETURN_ROUTE == 0) ? 0 : FUNC_ID_ZW_ASSIGN_SUC_RETURN_ROUTE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_ENABLE_SUC == 0) ? 0 : FUNC_ID_ZW_ENABLE_SUC) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_REQUEST_NETWORK_UPDATE == 0) ? 0 : FUNC_ID_ZW_REQUEST_NETWORK_UPDATE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_SUC_NODE_ID == 0) ? 0 : FUNC_ID_ZW_SET_SUC_NODE_ID) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_DELETE_SUC_RETURN_ROUTE == 0) ? 0 : FUNC_ID_ZW_DELETE_SUC_RETURN_ROUTE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_SUC_NODE_ID == 0) ? 0 : FUNC_ID_ZW_GET_SUC_NODE_ID) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_SUC_ID == 0) ? 0 : FUNC_ID_ZW_SEND_SUC_ID) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_ASSIGN_PRIORITY_SUC_RETURN_ROUTE == 0) ? 0 : FUNC_ID_ZW_ASSIGN_PRIORITY_SUC_RETURN_ROUTE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_ASSIGN_PRIORITY_RETURN_ROUTE == 0) ? 0 : FUNC_ID_ZW_ASSIGN_PRIORITY_RETURN_ROUTE) | \ - CAP_FID(OFFSET, (SUPPORT_TIMER_START == 0) ? 0 : FUNC_ID_TIMER_START) | \ - CAP_FID(OFFSET, (SUPPORT_TIMER_RESTART == 0) ? 0 : FUNC_ID_TIMER_RESTART) | \ - CAP_FID(OFFSET, (SUPPORT_TIMER_CANCEL == 0) ? 0 : FUNC_ID_TIMER_CANCEL) | \ - CAP_FID(OFFSET, (SUPPORT_TIMER_CALL == 0) ? 0 : FUNC_ID_TIMER_CALL) | \ - CAP_FID(OFFSET, (SUPPORT_GET_ROUTING_TABLE_LINE == 0) ? 0 : FUNC_ID_GET_ROUTING_TABLE_LINE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_ROUTING_INFO == 0) ? 0 : FUNC_ID_ZW_SET_ROUTING_INFO) | \ - CAP_FID(OFFSET, (SUPPORT_GET_TX_COUNTER == 0) ? 0 : FUNC_ID_GET_TX_COUNTER) | \ - CAP_FID(OFFSET, (SUPPORT_RESET_TX_COUNTER == 0) ? 0 : FUNC_ID_RESET_TX_COUNTER) | \ - CAP_FID(OFFSET, (SUPPORT_STORE_NODEINFO == 0) ? 0 : FUNC_ID_STORE_NODEINFO) | \ - CAP_FID(OFFSET, (SUPPORT_STORE_HOMEID == 0) ? 0 : FUNC_ID_STORE_HOMEID) | \ - CAP_FID(OFFSET, (SUPPORT_LOCK_ROUTE_RESPONSE == 0) ? 0 : FUNC_ID_LOCK_ROUTE_RESPONSE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_PRIORITY_ROUTE == 0) ? 0 : FUNC_ID_ZW_GET_PRIORITY_ROUTE)|\ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_PRIORITY_ROUTE == 0) ? 0 : FUNC_ID_ZW_SET_PRIORITY_ROUTE)|\ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_APPL_SLAVE_NODE_INFORMATION == 0) ? 0 : FUNC_ID_SERIAL_API_APPL_SLAVE_NODE_INFORMATION) | \ - CAP_FID(OFFSET, (SUPPORT_APPLICATION_SLAVE_COMMAND_HANDLER == 0) ? 0 : FUNC_ID_APPLICATION_SLAVE_COMMAND_HANDLER) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_SLAVE_NODE_INFORMATION == 0) ? 0 : FUNC_ID_ZW_SEND_SLAVE_NODE_INFORMATION) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SEND_SLAVE_DATA == 0) ? 0 : FUNC_ID_ZW_SEND_SLAVE_DATA) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_SLAVE_LEARN_MODE == 0) ? 0 : FUNC_ID_ZW_SET_SLAVE_LEARN_MODE) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_GET_VIRTUAL_NODES == 0) ? 0 : FUNC_ID_ZW_GET_VIRTUAL_NODES) | \ - CAP_FID(OFFSET, (SUPPORT_ZW_IS_VIRTUAL_NODE == 0) ? 0 : FUNC_ID_ZW_IS_VIRTUAL_NODE) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_EXT == 0) ? 0 : FUNC_ID_SERIAL_API_EXT) | \ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_GET_APPL_HOST_MEMORY_OFFSET == 0) ? 0 : FUNC_ID_SERIAL_API_GET_APPL_HOST_MEMORY_OFFSET) |\ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_PROMISCUOUS_MODE == 0) ? 0 : FUNC_ID_ZW_SET_PROMISCUOUS_MODE) |\ - CAP_FID(OFFSET, (SUPPORT_ZW_NUNIT == 0) ? 0 : FUNC_ID_ZW_NUNIT_CMD) |\ - CAP_FID(OFFSET, (SUPPORT_ZW_NUNIT == 0) ? 0 : FUNC_ID_ZW_NUNIT_INIT) |\ - CAP_FID(OFFSET, (SUPPORT_ZW_NUNIT == 0) ? 0 : FUNC_ID_ZW_NUNIT_LIST) |\ - CAP_FID(OFFSET, (SUPPORT_ZW_NUNIT == 0) ? 0 : FUNC_ID_ZW_NUNIT_RUN) |\ - CAP_FID(OFFSET, (SUPPORT_ZW_NUNIT == 0) ? 0 : FUNC_ID_ZW_NUNIT_END) |\ - CAP_FID(OFFSET, (SUPPORT_ZW_SET_LISTEN_BEFORE_TALK_THRESHOLD == 0) ? 0 : FUNC_ID_ZW_SET_LISTEN_BEFORE_TALK_THRESHOLD)| \ - CAP_FID(OFFSET, (SUPPORT_ZW_NETWORK_MANAGEMENT_SET_MAX_INCLUSION_REQUEST_INTERVALS == 0) ? 0 : FUNC_ID_ZW_NETWORK_MANAGEMENT_SET_MAX_INCLUSION_REQUEST_INTERVALS)| \ - CAP_FID(OFFSET, (SUPPORT_ZW_INITIATE_SHUTDOWN == 0) ? 0 : FUNC_ID_ZW_INITIATE_SHUTDOWN) |\ - CAP_FID(OFFSET, (SUPPORT_SERIAL_API_GET_LR_NODES == 0) ? 0 : FUNC_ID_SERIAL_API_GET_LR_NODES) |\ - CAP_FID(OFFSET, (SUPPORT_SERIAL_GET_LR_CHANNEL == 0) ? 0 : FUNC_ID_GET_LR_CHANNEL) |\ - CAP_FID(OFFSET, (SUPPORT_SERIAL_SET_LR_CHANNEL == 0) ? 0 : FUNC_ID_SET_LR_CHANNEL) |\ - CAP_FID(OFFSET, (SUPPORT_SERIAL_SET_LR_VIRTUAL_IDS == 0) ? 0 : FUNC_ID_ZW_SET_LR_VIRTUAL_IDS) |\ - CAP_FID(OFFSET, (SUPPORT_SERIAL_ENABLE_RADIO_PTI == 0) ? 0 : FUNC_ID_ENABLE_RADIO_PTI) |\ - CAP_FID(OFFSET, (SUPPORT_SERIAL_ENABLE_RADIO_PTI == 0) ? 0 : FUNC_ID_GET_RADIO_PTI) \ - ) -#endif /* ZW_CONTROLLER_SINGLE */ - - #if SUPPORT_SERIAL_API_READY enum { @@ -574,40 +234,6 @@ extern uint8_t GetCallbackCnt(void); extern void ZW_GetMfgTokenDataCountryFreq(void *data); -#ifdef ZW_CONTROLLER_SINGLE -#if SUPPORT_SERIAL_API_TEST - -extern void -SendTestReport( - uint8_t txStatus); - -extern void -TestStartRound(void); - -extern void -SendTestRoundReport( - uint8_t txStatus); - -extern void -ZCB_TestDelayNextSendTimeout(void); - -extern void -ZCB_TestDelayTimeout(void); - -extern bool -TestFindNextNode(void); - -extern void -ZCB_TestSendComplete( - uint8_t bStatus, - TX_STATUS_TYPE *txStatusReport); - -extern void -TestSend(void); - -#endif /* SUPPORT_SERIAL_API_TEST */ -#endif /* ZW_CONTROLLER_SINGLE */ - #if SUPPORT_SERIAL_API_POWER_MANAGEMENT extern void ZCB_PowerManagementWakeUpOnExternalActive(void); diff --git a/src/zwave_ncp_serial_api_controller/cmd_get_capabilities.c b/src/zwave_ncp_serial_api_controller/cmd_get_capabilities.c index 4ce912c9..8dceb3e6 100644 --- a/src/zwave_ncp_serial_api_controller/cmd_get_capabilities.c +++ b/src/zwave_ncp_serial_api_controller/cmd_get_capabilities.c @@ -3,10 +3,14 @@ * @copyright 2022 Silicon Laboratories Inc. */ #include + +#include + #include "cmd_handlers.h" #include "app.h" #include "zaf_config.h" #include "zw_version_config.h" +#include "nvm_backup_restore.h" #define CAPABILITIES_SIZE (8 + 32) // Info + supported commands @@ -40,6 +44,18 @@ static bool add_cmd_to_capabilities(cmd_handler_map_t const * const p_cmd_entry, ZW_ADD_CMD(FUNC_ID_SERIAL_API_GET_CAPABILITIES) { cmd_foreach(add_cmd_to_capabilities, &SERIALAPI_CAPABILITIES[8]); + +#if SUPPORT_NVM_BACKUP_RESTORE + //If the legacy NVM backup & restore command cannot be used, it must be removed from available command. + if (false == NvmBackupLegacyCmdAvailable()) + { + /*SUPPORT_NVM_BACKUP_RESTORE cannot be set depending on the NVM size, because it is define in + the application. However the NVM_SIZE is defined inside the ZPAL. It is available to the + application only through the function zpal_nvm_backup_get_size(). + So this configuration must be done dynamically. */ + ZW_NodeMaskClearBit(&SERIALAPI_CAPABILITIES[8], FUNC_ID_NVM_BACKUP_RESTORE); + } +#endif /* HOST->ZW: no params defined */ /* ZW->HOST: RES | 0x07 | */ /* SERIAL_APPL_VERSION | SERIAL_APPL_REVISION | SERIALAPI_MANUFACTURER_ID1 | SERIALAPI_MANUFACTURER_ID2 | */ diff --git a/src/zwave_ncp_serial_api_controller/cmd_handlers.c b/src/zwave_ncp_serial_api_controller/cmd_handlers.c index 496eee8a..17b0b99b 100644 --- a/src/zwave_ncp_serial_api_controller/cmd_handlers.c +++ b/src/zwave_ncp_serial_api_controller/cmd_handlers.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -22,7 +23,7 @@ #include "cmds_management.h" #include "cmds_security.h" #include "cmds_rf.h" -#include "ZW_SerialAPI.h" +#include "SerialAPI.h" #include "app.h" #include "serialapi_file.h" #include "utils.h" @@ -33,6 +34,10 @@ #include #endif +#ifndef MIN +#define MIN(a,b) (((a)<(b))?(a):(b)) +#endif + extern bool bTxStatusReportEnabled; SSyncEventArg1 LearnModeStatusCb = {.uFunctor.pFunction = 0}; // Ensure function pointer is initialized @@ -128,26 +133,26 @@ ZW_ADD_CMD(FUNC_ID_GET_TX_TIMERS) uint8_t i = 0; // Copy with endian swap - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_0 >> 24) & 0xff); - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_0 >> 16) & 0xff); - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_0 >> 8) & 0xff); - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_0 >> 0) & 0xff); - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_1 >> 24) & 0xff); - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_1 >> 16) & 0xff); - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_1 >> 8) & 0xff); - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_1 >> 0) & 0xff); - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_2 >> 24) & 0xff); - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_2 >> 16) & 0xff); - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_2 >> 8) & 0xff); - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_2 >> 0) & 0xff); - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_3 >> 24) & 0xff); - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_3 >> 16) & 0xff); - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_3 >> 8) & 0xff); - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_3 >> 0) & 0xff); - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_4 >> 24) & 0xff); - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_4 >> 16) & 0xff); - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_4 >> 8) & 0xff); - compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel_4 >> 0) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[0] >> 24) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[0] >> 16) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[0] >> 8) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[0] >> 0) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[1] >> 24) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[1] >> 16) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[1] >> 8) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[1] >> 0) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[2] >> 24) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[2] >> 16) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[2] >> 8) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[2] >> 0) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[3] >> 24) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[3] >> 16) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[3] >> 8) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[3] >> 0) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[4] >> 24) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[4] >> 16) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[4] >> 8) & 0xff); + compl_workbuf[i++] = (uint8_t)((sRFStats->tx_time_channel[4] >> 0) & 0xff); DoRespond_workbuf(i); } @@ -158,15 +163,15 @@ ZW_ADD_CMD(FUNC_ID_GET_TX_TIMERS) static void GetBackgroundRSSI(RSSI_LEVELS *noise_levels) { SZwaveCommandPackage cmdPackage = {.eCommandType = EZWAVECOMMANDTYPE_GET_BACKGROUND_RSSI}; - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 0); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 0); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); SZwaveCommandStatusPackage cmdStatus = { 0 }; if (GetCommandResponse(&cmdStatus, EZWAVECOMMANDSTATUS_GET_BACKGROUND_RSSI)) { memcpy((uint8_t *)noise_levels, cmdStatus.Content.GetBackgroundRssiStatus.rssi, sizeof(RSSI_LEVELS)); return; } - ASSERT(false); // FIXME We should have more intelligent error handling, we shouldnt assert here. + assert(false); // FIXME We should have more intelligent error handling, we shouldnt assert here. } ZW_ADD_CMD(FUNC_ID_ZW_GET_BACKGROUND_RSSI) @@ -184,8 +189,8 @@ static void ClearNetworkStats(void) { SZwaveCommandPackage CommandPackage = {.eCommandType = EZWAVECOMMANDTYPE_CLEAR_NETWORK_STATISTICS}; // Put the package on queue (and dont wait for it) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&CommandPackage, 0); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&CommandPackage, 0); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); } ZW_ADD_CMD(FUNC_ID_ZW_CLEAR_NETWORK_STATS) @@ -240,14 +245,14 @@ uint8_t SetRFReceiveMode(uint8_t mode) .uCommandParams.SetRfReceiveMode.mode = mode}; // Put the Command on queue (and dont wait for it, queue must be empty) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&pCmdPackage, 0); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&pCmdPackage, 0); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); SZwaveCommandStatusPackage cmdStatus = { 0 }; if (GetCommandResponse(&cmdStatus, EZWAVECOMMANDSTATUS_SET_RF_RECEIVE_MODE)) { return cmdStatus.Content.SetRFReceiveModeStatus.result; } - ASSERT(0); + assert(0); return 0; } @@ -377,33 +382,16 @@ ZCB_ComplHandler_ZW_SendData( static uint8_t SendData(uint16_t nodeID, const uint8_t *pData, uint8_t dataLength, uint8_t txOptions, ZW_TX_Callback_t pCallBack) { - SZwaveTransmitPackage FramePackage = { 0 }; - -#ifndef ZW_SECURITY_PROTOCOL - SSendData *pSendData = &FramePackage.uTransmitParams.SendData; - memset(&pSendData->FrameConfig.aFrame, 0, sizeof(pSendData->FrameConfig.aFrame)); - pSendData->DestNodeId = nodeID; - pSendData->FrameConfig.TransmitOptions = txOptions; - memcpy(&pSendData->FrameConfig.aFrame, pData, dataLength); - pSendData->FrameConfig.Handle = pCallBack; - FramePackage.eTransmitType = EZWAVETRANSMITTYPE_STD; - pSendData->FrameConfig.iFrameLength = dataLength; - -#else - { - SSendDataEx *pSendDataEx = &FramePackage.uTransmitParams.SendDataEx; - pSendDataEx->DestNodeId = nodeID; - pSendDataEx->FrameConfig.TransmitOptions = txOptions; - memcpy(&pSendDataEx->FrameConfig.aFrame, pData, dataLength); - pSendDataEx->FrameConfig.Handle = pCallBack; - FramePackage.eTransmitType = EZWAVETRANSMITTYPE_EX; - FramePackage.uTransmitParams.SendDataEx.FrameConfig.iFrameLength = dataLength; - } -#endif /* !ZW_SLAVE_ENHANCED_232 */ + SZwaveTransmitPackage FramePackage = { + .uTransmitParams.SendData.DestNodeId = nodeID, + .uTransmitParams.SendData.FrameConfig.TransmitOptions = txOptions, + .uTransmitParams.SendData.FrameConfig.Handle = pCallBack, + .eTransmitType = EZWAVETRANSMITTYPE_STD, + .uTransmitParams.SendData.FrameConfig.iFrameLength = dataLength, + }; - // Put the package on queue (and dont wait for it) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwTxQueue(), (uint8_t *)&FramePackage, 0); - return (EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus) ? true : false; + memcpy(FramePackage.uTransmitParams.SendData.FrameConfig.aFrame, pData, dataLength); + return (EQUEUENOTIFYING_STATUS_SUCCESS == QueueNotifyingSendToBack(ZAF_getZwTxQueue(), (uint8_t *)&FramePackage, 0)); } ZW_ADD_CMD(FUNC_ID_ZW_SEND_DATA) @@ -421,12 +409,9 @@ ZW_ADD_CMD(FUNC_ID_ZW_SEND_DATA) uint8_t offset = 0; node_id_t nodeId = (node_id_t)GET_NODEID(&frame->payload[0], offset); uint8_t dataLength = frame->payload[offset + 1]; - ASSERT(dataLength <= BUF_SIZE_RX); - if (dataLength > BUF_SIZE_RX) - { - dataLength = BUF_SIZE_RX; - } + assert(dataLength <= BUF_SIZE_RX); + dataLength = MIN(dataLength, BUF_SIZE_RX); const uint8_t * const pSerInData = frame->payload + offset + 2; funcID_ComplHandler_ZW_SendData = frame->payload[offset + 3 + dataLength]; @@ -489,11 +474,8 @@ ZW_ADD_CMD(FUNC_ID_ZW_SEND_DATA_EX) uint8_t dataLength; dataLength = frame->payload[offset + 1]; - ASSERT(dataLength <= BUF_SIZE_RX); - if (dataLength > BUF_SIZE_RX) - { - dataLength = BUF_SIZE_RX; - } + assert(dataLength <= BUF_SIZE_RX); + dataLength = MIN(dataLength, BUF_SIZE_RX); funcID_ComplHandler_ZW_SendDataEx = frame->payload[offset + 6 + dataLength]; const uint8_t retVal = SendDataEx(nodeId, &frame->payload[offset + 2], dataLength, frame->payload[offset + 2 + dataLength], @@ -537,12 +519,9 @@ static uint8_t SendDataMulti(uint8_t numberOfNodes, const uint8_t *pNodeList, co { ZW_NodeMaskSetBit(pSendDataMulti->NodeMask, pNodeList[i]); } + assert(dataLength <= BUF_SIZE_RX); + dataLength = MIN(dataLength, BUF_SIZE_RX); pSendDataMulti->FrameConfig.TransmitOptions = txOptions; - ASSERT(dataLength <= BUF_SIZE_RX); - if (dataLength > BUF_SIZE_RX) - { - dataLength = BUF_SIZE_RX; - } memcpy(&pSendDataMulti->FrameConfig.aFrame, pData, dataLength); pSendDataMulti->FrameConfig.Handle = pCallBack; FramePackage.eTransmitType = EZWAVETRANSMITTYPE_MULTI; @@ -589,11 +568,8 @@ ZCB_ComplHandler_ZW_SendDataMultiEx( static uint8_t SendDataMultiEx(uint8_t dataLength, uint8_t *pData, uint8_t txOptions, uint8_t secKeyType, uint8_t groupID, ZW_TX_Callback_t pCallBack) { - ASSERT(dataLength <= BUF_SIZE_RX); - if (dataLength > BUF_SIZE_RX) - { - dataLength = BUF_SIZE_RX; - } + assert(dataLength <= BUF_SIZE_RX); + dataLength = MIN(dataLength, BUF_SIZE_RX); // Create transmit frame package SZwaveTransmitPackage FramePackage = { .uTransmitParams.SendDataMultiEx.FrameConfig.Handle = pCallBack, @@ -666,11 +642,8 @@ ZCB_ComplHandler_ZW_SendData_Bridge( static uint8_t SendDataBridge(uint16_t srcNode, uint16_t destNode, uint8_t dataLength, const uint8_t *pData, uint8_t txOptions, ZW_TX_Callback_t pCallBack) { - ASSERT(dataLength <= BUF_SIZE_RX); - if (dataLength > BUF_SIZE_RX) - { - dataLength = BUF_SIZE_RX; - } + assert(dataLength <= BUF_SIZE_RX); + dataLength = MIN(dataLength, BUF_SIZE_RX); // Create transmit frame package SZwaveTransmitPackage FramePackage = { .uTransmitParams.SendDataBridge.FrameConfig.Handle = pCallBack, @@ -727,7 +700,8 @@ static uint8_t SendDataMultiBridge(node_id_t srcNode, uint8_t numOfNodes, uint8_ // when nodeIdBaseType is 2 then we handle the FramePackage.uTransmitParams.SendDataMultiBridge.NodeMask as node list // when nodeIdBaseType is 1 then we handle the FramePackage.uTransmitParams.SendDataMultiBridge.NodeMask as node mask // Create transmit frame package - ASSERT(dataLength <= BUF_SIZE_RX); + assert(dataLength <= BUF_SIZE_RX); + dataLength = MIN(dataLength, BUF_SIZE_RX); SZwaveTransmitPackage FramePackage = { .uTransmitParams.SendDataMultiBridge.FrameConfig.Handle = pCallBack, @@ -961,9 +935,26 @@ ZW_ADD_CMD(FUNC_ID_MEMORY_PUT_BUFFER) #if SUPPORT_NVM_BACKUP_RESTORE ZW_ADD_CMD(FUNC_ID_NVM_BACKUP_RESTORE) +{ + if (true == NvmBackupLegacyCmdAvailable()) + { + uint8_t length = 0; + func_id_serial_api_nvm_backup_restore(frame_payload_len(frame), frame->payload, compl_workbuf, &length, false); + DoRespond_workbuf(length); + } + else + { + //if legacy command is not allowed, drop it + set_state_and_notify(stateIdle); + } +} +#endif + +#if SUPPORT_NVM_EXT_BACKUP_RESTORE +ZW_ADD_CMD(FUNC_ID_NVM_EXT_BACKUP_RESTORE) { uint8_t length = 0; - func_id_serial_api_nvm_backup_restore(frame_payload_len(frame), frame->payload, compl_workbuf, &length); + func_id_serial_api_nvm_backup_restore(frame_payload_len(frame), frame->payload, compl_workbuf, &length, true); DoRespond_workbuf(length); } #endif @@ -1004,7 +995,7 @@ ZW_ADD_CMD(FUNC_ID_NVM_EXT_WRITE_LONG_BYTE) if ((FRAME_LENGTH_MIN + 3) < frame->len) { uint32_t offset = (((uint32_t)frame->payload[0] << 16) + ((uint32_t)((uint16_t)frame->payload[1] << 8)) + frame->payload[2]); - const uint8_t retVal = SerialApiNvmWriteAppData(offset, &frame->payload[3], 1); + retVal = SerialApiNvmWriteAppData(offset, &frame->payload[3], 1); } DoRespond(retVal); } @@ -1042,11 +1033,11 @@ ZW_ADD_CMD(FUNC_ID_NVM_EXT_WRITE_LONG_BUFFER) { /* HOST->ZW: offset3byte(MSB) | offset3byte | offset2byte(LSB) | length2byte(MSB) | length2byte(LSB) | buffer[] */ /* ZW->HOST: retVal */ - uint16_t length; uint8_t retVal = 0; ///* Ignore if frame has no data to write */ if ((FRAME_LENGTH_MIN + 5) < frame->len) { + uint16_t length; length = ((uint16_t)(frame->payload[3] << 8)) + frame->payload[4]; /* Ignore write if length exceeds specified data-array */ if (length <= frame->len - FRAME_LENGTH_MIN) @@ -1056,7 +1047,7 @@ ZW_ADD_CMD(FUNC_ID_NVM_EXT_WRITE_LONG_BUFFER) { const uint8_t * const pSerInData = frame->payload + 5; uint32_t offset = (((uint32_t)frame->payload[0] << 16) + ((uint32_t)((uint16_t)frame->payload[1] << 8)) + frame->payload[2]); - const uint8_t retVal = SerialApiNvmWriteAppData(offset, pSerInData, length); + retVal = SerialApiNvmWriteAppData(offset, pSerInData, length); } } } @@ -1169,8 +1160,8 @@ static uint8_t RequestNodeNeighborUpdate(uint16_t nodeID, ZW_TX_Callback_t pCall if (EQUEUENOTIFYING_STATUS_SUCCESS == QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&Request, 0)) { // Wait for protocol to handle command - SZwaveCommandStatusPackage status = { 0 }; - if (GetCommandResponse(&status, EZWAVECOMMANDSTATUS_ZW_REQUESTNODENEIGHBORUPDATE)) + SZwaveCommandStatusPackage status = { .eStatusType = EZWAVECOMMANDSTATUS_ZW_REQUESTNODENEIGHBORUPDATE}; + if (GetCommandResponse(&status, status.eStatusType)) { return status.Content.RequestNodeNeigborUpdateStatus.result; } @@ -1260,7 +1251,7 @@ ZW_ADD_CMD(FUNC_ID_ZW_GET_NODE_PROTOCOL_INFO) volatile uint8_t offset = 0; node_id_t nodeId = (node_id_t)GET_NODEID(&frame->payload[0], offset); GetNodeInfo(nodeId, (t_ExtNodeInfo *)compl_workbuf); - STATIC_ASSERT(sizeof(t_ExtNodeInfo) == 7, STATIC_ASSERT_FAILED_size_mismatch); + _Static_assert(sizeof(t_ExtNodeInfo) == 7, "STATIC_ASSERT_FAILED_size_mismatch"); DoRespond_workbuf(7); } #endif @@ -1323,30 +1314,33 @@ ZCB_ComplHandler_ZW_NodeManagement( } uint8_t offset = 0; - addState = (*statusInfo).bStatus; + addState = statusInfo->bStatus; BYTE_IN_AR(compl_workbuf, 0) = funcID_ComplHandler_ZW_NodeManagement; BYTE_IN_AR(compl_workbuf, 1) = (*statusInfo).bStatus; if (SERIAL_API_SETUP_NODEID_BASE_TYPE_16_BIT == nodeIdBaseType) { - BYTE_IN_AR(compl_workbuf, 2) = (uint8_t)((*statusInfo).bSource >> 8); // MSB - BYTE_IN_AR(compl_workbuf, 3) = (uint8_t)((*statusInfo).bSource & 0xFF); // LSB + BYTE_IN_AR(compl_workbuf, 2) = (uint8_t)(statusInfo->bSource >> 8); // MSB + BYTE_IN_AR(compl_workbuf, 3) = (uint8_t)(statusInfo->bSource & 0xFF); // LSB offset++; // 16 bit nodeID means the command fields that follow are offset by one byte } else { - BYTE_IN_AR(compl_workbuf, 2) = (uint8_t)((*statusInfo).bSource & 0xFF); // Legacy 8 bit nodeID + BYTE_IN_AR(compl_workbuf, 2) = (uint8_t)(statusInfo->bSource & 0xFF); // Legacy 8 bit nodeID } /* - Buffer boundary check */ - if ((*statusInfo).bLen > (uint8_t)(BUF_SIZE_TX - (offset + 4))) + if (statusInfo->bLen > (uint8_t)(BUF_SIZE_TX - (offset + 4))) { - (*statusInfo).bLen = (uint8_t)(BUF_SIZE_TX - (offset + 4)); + statusInfo->bLen = (uint8_t)(BUF_SIZE_TX - (offset + 4)); } - BYTE_IN_AR(compl_workbuf, offset + 3) = (*statusInfo).bLen; - for (uint8_t i = 0; i < (*statusInfo).bLen; i++) + BYTE_IN_AR(compl_workbuf, offset + 3) = statusInfo->bLen; + if(statusInfo->pCmd != NULL) { - BYTE_IN_AR(compl_workbuf, offset + 4 + i) = (*statusInfo).pCmd[i]; + for (uint8_t i = 0; i < statusInfo->bLen; i++) + { + BYTE_IN_AR(compl_workbuf, offset + 4 + i) = statusInfo->pCmd[i]; + } } - Request(nodeManagement_Func_ID, compl_workbuf, (uint8_t)(offset + (*statusInfo).bLen + 4)); + Request(nodeManagement_Func_ID, compl_workbuf, (uint8_t)(offset + statusInfo->bLen + 4)); } bool ZW_NodeManagementRunning(void) @@ -1367,8 +1361,8 @@ static void AddNodeToNetwork(uint8_t mode, void (*pCallBack)(LEARN_INFO_T *statu .uCommandParams.NetworkManagement.pHandle = (ZW_Void_Callback_t)pCallBack }; // Put the package on queue (and dont wait for it) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&pCmdPackage, 0); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&pCmdPackage, 0); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); } static void AddNodeDskToNetwork(uint8_t mode, const uint8_t* pDsk, void (*pCallBack)(LEARN_INFO_T *statusInfo)) @@ -1380,8 +1374,8 @@ static void AddNodeDskToNetwork(uint8_t mode, const uint8_t* pDsk, void (*pCallB }; memcpy(&pCmdPackage.uCommandParams.NetworkManagementDSK.dsk[0], pDsk, 8); // Put the package on queue (and dont wait for it) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&pCmdPackage, 0); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&pCmdPackage, 0); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); } ZW_ADD_CMD(FUNC_ID_ZW_ADD_NODE_TO_NETWORK) @@ -1423,8 +1417,8 @@ static void RemoveNodeFromNetwork(uint8_t mode, node_id_t node_id, void (*pCallB pCmdPackage.uCommandParams.NetworkManagement.nodeID = node_id; } // Put the package on queue (and dont wait for it) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&pCmdPackage, 0); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&pCmdPackage, 0); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); } #endif @@ -1475,8 +1469,8 @@ static void ControllerChange(uint8_t mode, void (*pCallBack)(LEARN_INFO_T *statu .uCommandParams.NetworkManagement.pHandle = (ZW_Void_Callback_t)pCallBack}; // Put the package on queue (and dont wait for it) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&pCmdPackage, 0); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&pCmdPackage, 0); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); } ZW_ADD_CMD(FUNC_ID_ZW_CONTROLLER_CHANGE) @@ -1534,7 +1528,9 @@ static void ZCB_ZW_NodeManagementLearnStatusRelay(uint32_t Status) LEARN_INFO_T Info = { .bStatus = (uint8_t)Status, .bSource = node_id, - 0}; + .pCmd = NULL, + .bLen = 0 + }; ZCB_ComplHandler_ZW_NodeManagement(&Info); } @@ -1569,20 +1565,6 @@ ZW_ADD_CMD(FUNC_ID_ZW_SET_LEARN_MODE) #ifdef ZW_SLAVE funcID_ComplHandler_ZW_SetLearnMode = frame->payload[1]; #endif -#ifdef ZW_CONTROLLER_SINGLE - SyncEventArg1Unbind(&LearnModeStatusCb); - if (frame->payload[1] != 0) - { - SyncEventArg1bind(&LearnModeStatusCb, ZCB_ZW_NodeManagementLearnStatusRelay); - } - SZwaveCommandPackage Command = { - .eCommandType = EZWAVECOMMANDTYPE_SET_LEARN_MODE, - .uCommandParams.SetLearnMode.eLearnMode = frame->payload[0], - .uCommandParams.SetLearnMode.useCB = frame->payload[1] != 0 - }; - QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&Command, 0); - -#else SyncEventArg1Unbind(&LearnModeStatusCb); if (frame->payload[1] != 0) { @@ -1619,7 +1601,6 @@ ZW_ADD_CMD(FUNC_ID_ZW_SET_LEARN_MODE) /* E_NETWORK_LEARN_MODE_INCLUSION_SMARTSTART = 4 Enable the learn process to initiate SMARTSTART inclusion */ retVal = NetworkLearnModeStart(frame->payload[0] - SERIALPI_SET_LEARN_MODE_LEARN_PLUS_OFFSET); } -#endif /* ZW_CONTROLLER_SINGLE */ DoRespond(retVal); } #endif /* SUPPORT_ZW_SET_LEARN_MODE */ @@ -1705,7 +1686,8 @@ ZCB_ComplHandler_ZW_ReplicationSendData( static uint8_t ReplicationSendData(uint16_t nodeID, uint8_t dataLength, const uint8_t* pData, uint8_t txOptions, ZW_TX_Callback_t pCallBack) { - ASSERT(dataLength <= BUF_SIZE_RX); + assert(dataLength <= BUF_SIZE_RX); + dataLength = MIN(dataLength, BUF_SIZE_RX); SZwaveTransmitPackage FramePackage = { .uTransmitParams.SendReplication.DestNodeId = nodeID, .uTransmitParams.SendReplication.FrameConfig.TransmitOptions = txOptions, @@ -2149,14 +2131,14 @@ static uint8_t RemoveFailedNode(uint16_t nodeID) .uCommandParams.FailedNodeIDCmd.nodeID = nodeID }; // Put the package on queue (and dont wait for it) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 0); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 0); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); SZwaveCommandStatusPackage cmdStatus = { 0 }; if (GetCommandResponse(&cmdStatus, EZWAVECOMMANDSTATUS_REMOVE_FAILED_NODE_ID)) { return cmdStatus.Content.FailedNodeIDStatus.result; } - ASSERT(0); + assert(0); return 0; } @@ -2180,8 +2162,8 @@ static uint8_t IsNodeIDFailed(uint16_t nodeID) .uCommandParams.IsFailedNodeID.nodeID = nodeID}; // Put the Command on queue (and dont wait for it, queue must be empty) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 0); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 0); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); // Wait for protocol to handle command (it shouldnt take long) SZwaveCommandStatusPackage cmdStatus = { 0 }; @@ -2189,7 +2171,7 @@ static uint8_t IsNodeIDFailed(uint16_t nodeID) { return cmdStatus.Content.IsFailedNodeIDStatus.result; } - ASSERT(false); // FIXME We should have more intelligent error handling, we shouldnt assert here. + assert(false); // FIXME We should have more intelligent error handling, we shouldnt assert here. return 0; } @@ -2233,14 +2215,14 @@ static uint8_t ReplaceFailedNode(uint16_t nodeID, uint8_t normalPower) .uCommandParams.FailedNodeIDCmd.normalPower = normalPower }; // Put the package on queue (and dont wait for it) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 0); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 0); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); SZwaveCommandStatusPackage cmdStatus = { 0 }; if (GetCommandResponse(&cmdStatus, EZWAVECOMMANDSTATUS_REPLACE_FAILED_NODE_ID)) { return cmdStatus.Content.FailedNodeIDStatus.result; } - ASSERT(0); + assert(0); return 0; } @@ -2265,8 +2247,8 @@ static void GetRoutingInfo(uint16_t nodeID, uint8_t options, uint8_t *pRoutingIn .uCommandParams.GetRoutingInfo.nodeID = nodeID, .uCommandParams.GetRoutingInfo.options = options}; // Put the Command on queue (and dont wait for it, queue must be empty) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 0); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 0); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); // Wait for protocol to handle command (it shouldnt take long) SZwaveCommandStatusPackage cmdStatus = { 0 }; @@ -2275,7 +2257,7 @@ static void GetRoutingInfo(uint16_t nodeID, uint8_t options, uint8_t *pRoutingIn memcpy(pRoutingInfo, cmdStatus.Content.GetRoutingInfoStatus.RoutingInfo, MAX_NODEMASK_LENGTH); return; } - ASSERT(false); // FIXME We should have more intelligent error handling, we shouldnt assert here. + assert(false); // FIXME We should have more intelligent error handling, we shouldnt assert here. } ZW_ADD_CMD(FUNC_ID_GET_ROUTING_TABLE_LINE) @@ -2323,8 +2305,8 @@ static void StoreHomeID(uin8_t *pHomeID, uint16_t nodeID) }; memcpy(cmdPackage.uCommandParams.StoreHomeID.homeID, pHomeID, sizeof(cmdPackage.uCommandParams.StoreHomeID.homeID)); // Put the Command on queue (and dont wait for it, queue must be empty) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 0); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 0); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); } ZW_ADD_CMD(FUNC_ID_STORE_HOMEID) @@ -2346,8 +2328,8 @@ static void LockResponseRoute(uint8_t lockID) .uCommandParams.LockRouteResponse.value = lockID, }; // Put the Command on queue (and dont wait for it, queue must be empty) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 0); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 0); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); } ZW_ADD_CMD(FUNC_ID_LOCK_ROUTE_RESPONSE) @@ -2369,8 +2351,8 @@ static uint8_t GetPriorityRoute(uint16_t nodeID, uint8_t *priRoute) .uCommandParams.GetPriorityRoute.pPriRouteBuffer = priRoute, }; // Put the Command on queue (and dont wait for it, queue must be empty) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 0); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 0); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); // Wait for protocol to handle command (it shouldnt take long) SZwaveCommandStatusPackage cmdStatus = { 0 }; @@ -2380,7 +2362,7 @@ static uint8_t GetPriorityRoute(uint16_t nodeID, uint8_t *priRoute) priRoute[4] = cmdStatus.Content.GetPriorityRouteStatus.routeSpeed; return cmdStatus.Content.GetPriorityRouteStatus.bAnyRouteFound; } - ASSERT(false); // FIXME We should have more intelligent error handling, we shouldnt assert here. + assert(false); // FIXME We should have more intelligent error handling, we shouldnt assert here. return 0; } @@ -2422,8 +2404,8 @@ static uint8_t SetPriorityRoute(uint16_t nodeID, const uint8_t *routeInfo) cmdPackage.uCommandParams.SetPriorityRoute.clearGolden = true; } // Put the Command on queue (and dont wait for it, queue must be empty) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 0); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 0); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); // Wait for protocol to handle command (it shouldnt take long) SZwaveCommandStatusPackage cmdStatus = { 0 }; @@ -2431,7 +2413,7 @@ static uint8_t SetPriorityRoute(uint16_t nodeID, const uint8_t *routeInfo) { return cmdStatus.Content.SetPriorityRouteStatus.bRouteUpdated; } - ASSERT(false); // FIXME We should have more intelligent error handling, we shouldnt assert here. + assert(false); // FIXME We should have more intelligent error handling, we shouldnt assert here. return 0; } @@ -2477,10 +2459,10 @@ ZW_ADD_CMD(FUNC_ID_ZW_GET_VERSION) // Make ZW_GET_VERSION return a unique version string "Z-Wave 7.99" so that test tools can distinguish it from the normal builds. versionMinor = 99; } - volatile int32_t iCharacters = snprintf((char *)(&compl_workbuf[0]), 12, "Z-Wave %1d.%02d", protocol_info->ProtocolVersion.Major, versionMinor); - ASSERT(iCharacters == 11); // Serial API must deliver 13 bytes reply. 11 byte string (no zero termination) followed by zero and 1 byte lib type + __attribute__((unused)) volatile int32_t iCharacters = snprintf((char *)(&compl_workbuf[0]), 12, "Z-Wave %1d.%02d", protocol_info->ProtocolVersion.Major, versionMinor); + assert(iCharacters == 11); // Serial API must deliver 13 bytes reply. 11 byte string (no zero termination) followed by zero and 1 byte lib type // We use SNPRINTF zero termination to produce the zero. - STATIC_ASSERT(sizeof(compl_workbuf) >= 13, STATIC_ASSERT_compl_workbuf_to_small); + _Static_assert(sizeof(compl_workbuf) >= 13, "STATIC_ASSERT_compl_workbuf_to_small"); compl_workbuf[12] = protocol_info->eLibraryType; DoRespond_workbuf(13); } @@ -2707,8 +2689,8 @@ static uint8_t SetSlaveLearnMode(uint16_t nodeID, uint8_t mode) .uCommandParams.SetSlaveLearnMode.nodeID = nodeID, .uCommandParams.SetSlaveLearnMode.mode = mode, }; - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 500); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 500); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); SZwaveCommandStatusPackage cmdStatus = { 0 }; if (GetCommandResponse(&cmdStatus, EZWAVECOMMANDSTATUS_SET_SLAVE_LEARN_MODE_RESULT)) { @@ -2786,15 +2768,15 @@ static uint8_t IsNodeVirtual(uint16_t nodeID) .eCommandType = EZWAVECOMMANDTYPE_IS_VIRTUAL_NODE, .uCommandParams.IsVirtualNode.value = nodeID, }; - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 500); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); - SZwaveCommandStatusPackage cmdStatus = { 0 }; - if (GetCommandResponse(&cmdStatus, EZWAVECOMMANDSTATUS_IS_VIRTUAL_NODE)) + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 500); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + SZwaveCommandStatusPackage cmdStatus = { .eStatusType = EZWAVECOMMANDSTATUS_IS_VIRTUAL_NODE }; + if (GetCommandResponse(&cmdStatus, cmdStatus.eStatusType)) { return cmdStatus.Content.IsVirtualNodeStatus.result; } - ASSERT(false); // FIXME We should have more intelligent error handling, we shouldnt assert here. + assert(false); // FIXME We should have more intelligent error handling, we shouldnt assert here. return 0; } @@ -2813,8 +2795,8 @@ static void GetVirtualNodes(uint8_t *vNodesMask) { SZwaveCommandPackage cmdPackage = { .eCommandType = EZWAVECOMMANDTYPE_GET_VIRTUAL_NODES}; - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 500); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 500); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); SZwaveCommandStatusPackage cmdStatus = { 0 }; if (GetCommandResponse(&cmdStatus, EZWAVECOMMANDSTATUS_GET_VIRTUAL_NODES)) { @@ -2822,7 +2804,7 @@ static void GetVirtualNodes(uint8_t *vNodesMask) return; } - ASSERT(false); // FIXME We should have more intelligent error handling, we shouldnt assert here. + assert(false); // FIXME We should have more intelligent error handling, we shouldnt assert here. } ZW_ADD_CMD(FUNC_ID_ZW_GET_VIRTUAL_NODES) @@ -3064,389 +3046,6 @@ ZW_ADD_CMD(FUNC_ID_ZW_SET_ROUTING_MAX_6_00) } #endif - -#if SUPPORT_ZW_SET_PROMISCUOUS_MODE -static void SetPromiscuousMode(uint8_t mode) -{ - SZwaveCommandPackage PromiscuousMode = { - .eCommandType = EZWAVECOMMANDTYPE_SET_PROMISCUOUS_MODE, - .uCommandParams.SetPromiscuousMode.Enable = mode; - }; - - // Put the Command on queue (and dont wait for it, queue must be empty) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t*)&PromiscuousMode, 0); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); -} - -ZW_ADD_CMD(FUNC_ID_ZW_SET_PROMISCUOUS_MODE) -{ - /* HOST->ZW: promiscuousMode */ - SetPromiscuousMode(frame->payload[0]); - set_state_and_notify(stateIdle); -} -#endif - - -#if SUPPORT_SERIAL_API_TEST -ZW_APPLICATION_META_TX_BUFFER txBuffer; - -uint8_t funcID_ComplHandler_Serial_API_Test; -uint8_t testnodemask[ZW_MAX_NODES / 8]; -uint8_t testresultnodemask[ZW_MAX_NODES / 8]; - -uint8_t testnodemasklen = 0; -uint8_t timerTestHandle = 0xff; -uint8_t testCmd; -bool setON = true; -uint8_t testNodeID = 0; -uint16_t testDelay; -uint16_t testCurrentDelay; -uint8_t testPayloadLen; -uint16_t testCount; -uint16_t testSuccessCount; -uint16_t testFailedCount; -uint8_t testState = 0; -uint8_t testTxOptions; - -void -SendTestReport( - uint8_t txStatus) -{ - if (funcID_ComplHandler_Serial_API_Test != 0) - { - BYTE_IN_AR(compl_workbuf, 0) = funcID_ComplHandler_Serial_API_Test; - BYTE_IN_AR(compl_workbuf, 1) = testCmd; - BYTE_IN_AR(compl_workbuf, 2) = testState; - BYTE_IN_AR(compl_workbuf, 3) = testNodeID; - BYTE_IN_AR(compl_workbuf, 4) = txStatus; - BYTE_IN_AR(compl_workbuf, 5) = BYTE_GET_LOW_BYTE_IN_WORD(testCount); - Request(FUNC_ID_SERIAL_API_TEST, compl_workbuf, 6); - } -} - - -void -SendTestRoundReport( - __attribute__((unused)) uint8_t txStatus) -{ - if (funcID_ComplHandler_Serial_API_Test != 0) - { - BYTE_IN_AR(compl_workbuf, 0) = funcID_ComplHandler_Serial_API_Test; - BYTE_IN_AR(compl_workbuf, 1) = testCmd; - BYTE_IN_AR(compl_workbuf, 2) = testState; - BYTE_IN_AR(compl_workbuf, 3) = BYTE_GET_HIGH_BYTE_IN_WORD(testCount); - BYTE_IN_AR(compl_workbuf, 4) = BYTE_GET_LOW_BYTE_IN_WORD(testCount); - /* Initialy we assume every node acked, so we assume no nodemask is to be send */ - uint8_t i = 0; - if (ZW_NODE_MASK_BITS_IN(testresultnodemask, testnodemasklen)) - { - for (; i < testnodemasklen; i++) - { - BYTE_IN_AR(compl_workbuf, 6 + i) = testresultnodemask[i]; - } - BYTE_IN_AR(compl_workbuf, 5) = testnodemasklen; - i++; - } - Request(FUNC_ID_SERIAL_API_TEST, compl_workbuf, 5 + i); - } -} - - -void -ZCB_TestDelayNextSendTimeout(void) -{ - if (--testCurrentDelay == 0) - { - if (timerTestHandle != 0xff) - { - TimerCancel(timerTestHandle); - } - timerTestHandle = 0xff; - TestSend(); - } -} - - -void -ZCB_TestDelayTimeout(void) -{ - if (--testCurrentDelay == 0) - { - if (timerTestHandle != 0xff) - { - TimerCancel(timerTestHandle); - } - timerTestHandle = 0xff; - setON = !setON; - TestStartRound(); - } -} - - -bool -TestFindNextNode(void) -{ - do - { - if (ZW_NodeMaskNodeIn(testnodemask, ++testNodeID)) - { - return true; - } - } while (testNodeID < ZW_MAX_NODES); - return false; -} - - -/*=========================== MetaDataSendComplete ========================= -** Function description -** -** -** -** Side effects: -** -**--------------------------------------------------------------------------*/ -void -ZCB_TestSendComplete( - uint8_t bStatus, - __attribute__((unused)) TX_STATUS_TYPE *txStatusReport -) -{ - DPRINT("C"); - DPRINTF("%u", bStatus); - - if (bStatus == TRANSMIT_COMPLETE_OK) - { - testSuccessCount++; - } - else - { - /* Set bit indicating that node failed to acknowledge */ - ZW_NODE_MASK_SET_BIT(testresultnodemask, testNodeID); - testFailedCount++; - } - /* Should we transmit result (to host) after every transmit or do we send one frame after every round? */ - if (testCmd < 0x05) - { - /* One result frame after every transmit */ - SendTestReport(bStatus); - } - if (testState == POWERLEVEL_TEST_NODE_REPORT_ZW_TEST_INPROGRESS) - { - if (TestFindNextNode()) - { - { - testCurrentDelay = testDelay; - if (timerTestHandle != 0xff) - { - TimerCancel(timerTestHandle); - } - timerTestHandle = 0xff; - if (!testCurrentDelay) - { - testCurrentDelay++; - ZCB_TestDelayNextSendTimeout(); - } - else - { - timerTestHandle = TimerStart(ZCB_TestDelayNextSendTimeout, 1, TIMER_FOREVER); - } - } - } - else - { - if (testCmd >= 0x05) - { - /* One result frame after every round */ - SendTestRoundReport(0); - } - /* No more nodes in this round - delay (if any delay to be done) before starting next round */ - if (testCount && (--testCount != 0)) - { - testCurrentDelay = testDelay; - if (timerTestHandle != 0xff) - { - TimerCancel(timerTestHandle); - } - timerTestHandle = 0xff; - if (!testCurrentDelay) - { - testCurrentDelay++; - ZCB_TestDelayTimeout(); - } - else - { - timerTestHandle = TimerStart(ZCB_TestDelayTimeout, 1, TIMER_FOREVER); - } - } - else - { - testState = POWERLEVEL_TEST_NODE_REPORT_ZW_TEST_SUCCES; - SendTestReport(0); - } - } - } - else - { - if (timerTestHandle != 0xff) - { - TimerCancel(timerTestHandle); - } - timerTestHandle = 0xff; - SendTestReport(0); - } -} - - -/*================================= TestSend =============================== -** Function description -** Send the next data frame -** -** -** Side effects: -** -**--------------------------------------------------------------------------*/ -void -TestSend(void) -{ - uint8_t payLoadLen; - - DPRINT("N"); - - if ((testCmd == 0x03) || (testCmd == 0x04) || (testCmd == 0x07) || (testCmd == 0x08)) - { - txBuffer.ZW_BasicSetFrame.cmdClass = COMMAND_CLASS_BASIC; - txBuffer.ZW_BasicSetFrame.cmd = BASIC_SET; - txBuffer.ZW_BasicSetFrame.value = setON ? BASIC_ON : BASIC_OFF; - payLoadLen = sizeof(txBuffer.ZW_BasicSetFrame); - } - else - { - txBuffer.ZW_ManufacturerSpecificReportFrame.cmdClass = COMMAND_CLASS_MANUFACTURER_PROPRIETARY; - txBuffer.ZW_ManufacturerSpecificReportFrame.manufacturerId1 = 0x00; - txBuffer.ZW_ManufacturerSpecificReportFrame.manufacturerId2 = 0x00; - txBuffer.ZW_ManufacturerSpecificReportFrame.productId1 = 0x04; - txBuffer.ZW_ManufacturerSpecificReportFrame.productId2 = 0x81; - *(&(txBuffer.ZW_ManufacturerSpecificReportFrame.productId2) + 1) = 0x00; - *(&(txBuffer.ZW_ManufacturerSpecificReportFrame.productId2) + 2) = BYTE_GET_HIGH_BYTE_IN_WORD(testCount); //data1 - *(&(txBuffer.ZW_ManufacturerSpecificReportFrame.productId2) + 3) = BYTE_GET_LOW_BYTE_IN_WORD(testCount); //data1+1 - payLoadLen = sizeof(txBuffer.ZW_ManufacturerSpecificReportFrame); - } - /* Send meta data frame */ - // Create transmit frame package - uint8_t iFrameLength = (testPayloadLen > payLoadLen) ? testPayloadLen : payLoadLen; - SZwaveTransmitPackage FramePackage = { - .uTransmitParams.SendData.DestNodeId = testNodeID, - .uTransmitParams.SendData.FrameConfig.TransmitOptions = testTxOptions, - .uTransmitParams.SendData.FrameConfig.Handle = &ZCB_TestSendComplete, - .eTransmitType = EZWAVETRANSMITTYPE_STD, - .uTransmitParams.SendData.FrameConfig.iFrameLength = iFrameLength - }; - memcpy(&FramePackage.uTransmitParams.SendData.FrameConfig.aFrame, &txBuffer, iFrameLength); - // Put the package on queue (and dont wait for it) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwTxQueue(), (uint8_t *)&FramePackage, 0); - - if (EQUEUENOTIFYING_STATUS_SUCCESS != QueueStatus) - { - ZCB_TestSendComplete(TRANSMIT_COMPLETE_NO_ACK, NULL); - } -} - - -/*============================ TestStartRound ============================ -** Start a Test round -** -** This is an application function example -** -**--------------------------------------------------------------------------*/ -void -TestStartRound(void) -{ - uint8_t bTemp; - - ZW_NODE_MASK_CLEAR(testresultnodemask, ZW_MAX_NODES / 8); - /* Fill the meta data frame with data */ - for (bTemp = 0; bTemp < (META_DATA_MAX_DATA_SIZE - sizeof(ZW_MANUFACTURER_SPECIFIC_REPORT_FRAME)); bTemp++) - { - *(&(txBuffer.ZW_ManufacturerSpecificReportFrame.productId2) + 1 + bTemp) = bTemp + 1; - } - testNodeID = 0; - /* Find first node to transmit to */ - if ((testState == POWERLEVEL_TEST_NODE_REPORT_ZW_TEST_INPROGRESS) && TestFindNextNode()) - { - /* Found a node */ - TestSend(); - } - else - { - testState = POWERLEVEL_TEST_NODE_REPORT_ZW_TEST_FAILED; - SendTestReport(0); - } -} - -ZW_ADD_CMD(FUNC_ID_SERIAL_API_TEST) -{ - /* HOST->ZW: testCmd | testDelay(MSB) | testDelay(LSB) | testPayloadLen | */ - /* testCount(MSB) | testCount(LSB) | testTxOptions | nodemasklen | testnodemask[] | funcID */ - /* testCmd = 0x01 - use sendData */ - /* testCmd = 0x02 - use sendDataMeta */ - /* testCmd = 0x03 - use sendData with Basic Set toggle ON/OFF between rounds */ - /* testCmd = 0x04 - use sendDataMeta with Basic Set toggle ON/OFF between rounds */ - /* testCmd = 0x05 - use sendData with one group result frame (serial) at every round end */ - /* testCmd = 0x06 - use sendDataMeta with one group result frame (serial) at every round end */ - /* testCmd = 0x07 - use sendData with Basic Set toggle ON/OFF and one group result frame (serial) between rounds */ - /* testCmd = 0x08 - use sendDataMeta with Basic Set toggle ON/OFF and one group result frame (serial) between rounds */ - /* ZW->HOST: RES | testStarted */ - uint8_t retVal = 0; - testCmd = frame->payload[0]; - if (testCmd && (testState != POWERLEVEL_TEST_NODE_REPORT_ZW_TEST_INPROGRESS)) - { - WORD_SET_HIGH_LOW_BYTES(testDelay, frame->payload[1], frame->payload[2]); - - testPayloadLen = frame->payload[3]; - WORD_SET_HIGH_LOW_BYTES(testCount, frame->payload[4], frame->payload[5]); - testTxOptions = frame->payload[6]; - testnodemasklen = frame->payload[7]; - /* - Boundary Check */ - if (testnodemasklen > MAX_NODEMASK_LENGTH) - { - testnodemasklen = MAX_NODEMASK_LENGTH; - } - ZW_NODE_MASK_CLEAR(testnodemask, MAX_NODEMASK_LENGTH); - for (uint8_t i = 0; i < testnodemasklen; i++) - { - BYTE_IN_AR(testnodemask, i) = frame->payload[i + 8]; - } - funcID_ComplHandler_Serial_API_Test = frame->payload[frame->payload[7] + 8]; - if (testCount != 0) - { - testFailedCount = 0; - testSuccessCount = 0; - testState = POWERLEVEL_TEST_NODE_REPORT_ZW_TEST_INPROGRESS; - TestStartRound(); - retVal = 1; - } - else - { - testState = POWERLEVEL_TEST_NODE_REPORT_ZW_TEST_FAILED; - SendTestReport(0); - return; - } - } - else - { - /* STOP test ??? */ - if (!testCmd) - { - testState = POWERLEVEL_TEST_NODE_REPORT_ZW_TEST_FAILED; - SendTestReport(0); - retVal = 1; - } - } - DoRespond(retVal); -} -#endif - - #if SUPPORT_SERIAL_API_EXT ZW_ADD_CMD(FUNC_ID_SERIAL_API_EXT) { @@ -3487,8 +3086,8 @@ static uint8_t GetRandom(uint8_t noOfRndBytes, uint8_t* rndBytes) if (EQUEUENOTIFYING_STATUS_SUCCESS == QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&GetRandom, 0)) { // Wait for protocol to handle command - SZwaveCommandStatusPackage Random = { 0 }; - if (GetCommandResponse(&Random, EZWAVECOMMANDSTATUS_GENERATE_RANDOM)) + SZwaveCommandStatusPackage Random = { .eStatusType = EZWAVECOMMANDSTATUS_GENERATE_RANDOM }; + if (GetCommandResponse(&Random, Random.eStatusType)) { memcpy(rndBytes, Random.Content.GenerateRandomStatus.aRandomNumber, Random.Content.GenerateRandomStatus.iLength); return Random.Content.GenerateRandomStatus.iLength; @@ -3536,8 +3135,8 @@ static void AesEcb(uint8_t *key, uint8_t *InputData, uint8_t *outData) SZwaveCommandPackage cmdPackage = {.eCommandType = EZWAVECOMMANDTYPE_AES_ECB}; memcpy(cmdPackage.uCommandParams.AesEcb.key, key, sizeof(cmdPackage.uCommandParams.AesEcb.key)); memcpy(cmdPackage.uCommandParams.AesEcb.inputData, InputData, sizeof(cmdPackage.uCommandParams.AesEcb.inputData)); - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 500); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&cmdPackage, 500); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); SZwaveCommandStatusPackage cmdStatus = { 0 }; if (GetCommandResponse(&cmdStatus, EZWAVECOMMANDSTATUS_AES_ECB)) { @@ -3545,7 +3144,7 @@ static void AesEcb(uint8_t *key, uint8_t *InputData, uint8_t *outData) return; } - ASSERT(false); // FIXME We should have more intelligent error handling, we shouldnt assert here. + assert(false); // FIXME We should have more intelligent error handling, we shouldnt assert here. } ZW_ADD_CMD(FUNC_ID_ZW_AES_ECB) @@ -3593,13 +3192,11 @@ static bool SetMaxInclReqIntervals( uint32_t maxInclReqIntervals) if (EQUEUENOTIFYING_STATUS_SUCCESS == QueueNotifyingSendToBack(ZAF_getZwCommandQueue(), (uint8_t *)&setMaxInclusionRequestIntervals, 0)) { // Wait for protocol to handle command - SZwaveCommandStatusPackage result = { 0 }; - if (GetCommandResponse(&result, EZWAVECOMMANDSTATUS_ZW_SET_MAX_INCL_REQ_INTERVALS)) + SZwaveCommandStatusPackage result = { .eStatusType = EZWAVECOMMANDSTATUS_ZW_SET_MAX_INCL_REQ_INTERVALS}; + if ((GetCommandResponse(&result, result.eStatusType)) + && (result.Content.NetworkManagementStatus.statusInfo[0])) { - if(result.Content.NetworkManagementStatus.statusInfo[0]) - { - return true; - } + return true; } } return false; diff --git a/src/zwave_ncp_serial_api_controller/cmd_handlers.h b/src/zwave_ncp_serial_api_controller/cmd_handlers.h index a76f2717..59f1cbc4 100644 --- a/src/zwave_ncp_serial_api_controller/cmd_handlers.h +++ b/src/zwave_ncp_serial_api_controller/cmd_handlers.h @@ -29,7 +29,7 @@ typedef struct } cmd_handler_map_t; -#define CMD_HANDLER_SECTION "_cmd_handlers" +#define CMD_HANDLER_SECTION "zw_cmd_handlers" #define ZW_ADD_CMD(cmd) \ static void cmd_handler_fcn_##cmd(__attribute__((unused)) const comm_interface_frame_ptr frame); /* Prototype */ \ diff --git a/src/zwave_ncp_serial_api_controller/cmd_handlers_invoker.c b/src/zwave_ncp_serial_api_controller/cmd_handlers_invoker.c index 2fdc8244..d250882d 100644 --- a/src/zwave_ncp_serial_api_controller/cmd_handlers_invoker.c +++ b/src/zwave_ncp_serial_api_controller/cmd_handlers_invoker.c @@ -4,20 +4,20 @@ */ #include "cmd_handlers.h" -#include "Assert.h" +#include /** * This is the first of the registered handlers */ -extern const cmd_handler_map_t __start__cmd_handlers; -#define cmd_handlers_start __start__cmd_handlers +extern const cmd_handler_map_t __start_zw_cmd_handlers; +#define cmd_handlers_start __start_zw_cmd_handlers /** * This marks the end of the handlers. The element * after the last element. This means that this element * is not valid. */ -extern const cmd_handler_map_t __stop__cmd_handlers; -#define cmd_handlers_stop __stop__cmd_handlers +extern const cmd_handler_map_t __stop_zw_cmd_handlers; +#define cmd_handlers_stop __stop_zw_cmd_handlers bool invoke_cmd_handler(const comm_interface_frame_ptr frame) @@ -36,7 +36,7 @@ bool invoke_cmd_handler(const comm_interface_frame_ptr frame) void cmd_foreach(cmd_foreach_callback_t callback, cmd_context_t context) { - ASSERT(callback != NULL); + assert(callback != NULL); cmd_handler_map_t const * iter = &cmd_handlers_start; for ( ; iter < &cmd_handlers_stop; ++iter) { diff --git a/src/zwave_ncp_serial_api_controller/cmds_dcdc.c b/src/zwave_ncp_serial_api_controller/cmds_dcdc.c index bc9c76af..22e9eb40 100644 --- a/src/zwave_ncp_serial_api_controller/cmds_dcdc.c +++ b/src/zwave_ncp_serial_api_controller/cmds_dcdc.c @@ -9,7 +9,7 @@ #include "app.h" #include "sl_dcdc.h" #include "ZW_typedefs.h" -#include "ZW_SerialAPI.h" +#include "SerialAPI.h" #include "zpal_nvm.h" #include "serialapi_file.h" #include "ZAF_nvm_app.h" diff --git a/src/zwave_ncp_serial_api_controller/cmds_management.c b/src/zwave_ncp_serial_api_controller/cmds_management.c index 86527977..8877f569 100644 --- a/src/zwave_ncp_serial_api_controller/cmds_management.c +++ b/src/zwave_ncp_serial_api_controller/cmds_management.c @@ -2,7 +2,7 @@ * @file cmds_management.c * @copyright 2022 Silicon Laboratories Inc. */ - +#include #include #include #include @@ -11,12 +11,12 @@ #include #include #include +#include #include #include //#define DEBUGPRINT #include -#include "zw_build_no.h" #ifdef ZW_CONTROLLER #include @@ -76,7 +76,7 @@ void func_id_serial_api_get_init_data(__attribute__((unused)) uint8_t inputLengt BYTE_IN_AR(pOutputBuffer, 3 + (ZW_MAX_NODES / 8)) = zpal_get_chip_type(); BYTE_IN_AR(pOutputBuffer, 4 + (ZW_MAX_NODES / 8)) = zpal_get_chip_revision(); *pOutputLength += (ZW_MAX_NODES / 8); - ASSERT(*pOutputLength <= 34); // Elsewhere, like in zwapi_init.c, the pOutputBuffer is hardcoded to 34 bytes in lenght. + assert(*pOutputLength <= 34); // Elsewhere, like in zwapi_init.c, the pOutputBuffer is hardcoded to 34 bytes in lenght. #else BYTE_IN_AR(pOutputBuffer, 1) |= GET_INIT_DATA_FLAG_SLAVE_API; /* Flag byte */ BYTE_IN_AR(pOutputBuffer, 2) = 0; /* node bitmask length */ @@ -99,7 +99,7 @@ void func_id_serial_api_get_LR_nodes(__attribute__((unused)) uint8_t inputLength * This Assert is here to remind us to update this function, if in the future the number of supported nodes increases. * In which case the MAX_LR_NODEMASK_LENGTH define will become greater than 128 */ - STATIC_ASSERT(MAX_LR_NODEMASK_LENGTH <= 128, STATIC_ASSERT_MAX_LR_NODEMASK_LENGTH_to_big); + _Static_assert(MAX_LR_NODEMASK_LENGTH <= 128, "STATIC_ASSERT_MAX_LR_NODEMASK_LENGTH_to_big"); uint8_t bitmaskOffset = pInputBuffer[0]; *pOutputLength = 3 + MAX_LR_NODEMASK_LENGTH; @@ -152,7 +152,8 @@ void func_id_serial_api_setup(uint8_t inputLength, uint8_t i=0; uint8_t cmdRes; zpal_radio_region_t rfRegion; - zpal_tx_power_t iPowerLevel, iPower0dbmMeasured; + zpal_tx_power_t iPowerLevel = 0; + zpal_tx_power_t iPower0dbmMeasured = 0; /* We assume operation is nonesuccessful */ cmdRes = false; @@ -244,7 +245,7 @@ void func_id_serial_api_setup(uint8_t inputLength, { rfRegion = pInputBuffer[1]; /* Check if the RF Region value is valid, and then store it in flash */ - if ((rfRegion <= REGION_US_LR) || (rfRegion == REGION_JP) || (rfRegion == REGION_KR)) + if (true == isRfRegionValid(rfRegion)) { /* Save into nvm */ cmdRes = SaveApplicationRfRegion(rfRegion); @@ -255,7 +256,8 @@ void func_id_serial_api_setup(uint8_t inputLength, case SERIAL_API_SETUP_CMD_TX_POWERLEVEL_SET: { - zpal_tx_power_t iTxPower, iAdjust; + zpal_tx_power_t iTxPower; + zpal_tx_power_t iAdjust; /** * HOST->ZW: SERIAL_API_SETUP_CMD_TX_POWER_SET | NormalTxPowerLevel | Measured0dBmPower * ZW->HOST: SERIAL_API_SETUP_CMD_TX_POWER_SET | cmdRes @@ -308,7 +310,8 @@ void func_id_serial_api_setup(uint8_t inputLength, case SERIAL_API_SETUP_CMD_TX_POWERLEVEL_SET_16_BIT: { - zpal_tx_power_t iTxPower, iAdjust; + zpal_tx_power_t iTxPower; + zpal_tx_power_t iAdjust; zpal_tx_power_t iTxPowerMaxSupported; /** * HOST->ZW: SERIAL_API_SETUP_CMD_TX_POWER_SET | NormalTxPowerLevel (MSB) |NormalTxPowerLevel (LSB) | Measured0dBmPower (MSB)| Measured0dBmPower (LSB) @@ -407,7 +410,7 @@ void func_id_serial_api_setup(uint8_t inputLength, * ZW->HOST: SERIAL_API_SETUP_CMD_MAX_LR_TX_PWR_GET | maxtxpower (16-bit) */ { - int16_t readout; + int16_t readout = 0; ReadApplicationMaxLRTxPwr(&readout); BYTE_IN_AR(pOutputBuffer, i++) = (uint8_t)((readout >> 8) & 0xFF); BYTE_IN_AR(pOutputBuffer, i++) = (uint8_t)(readout & 0xFF); @@ -474,19 +477,15 @@ void func_id_zw_get_protocol_version(uint8_t inputLength, // Defined in the specs to be the max size of the git hash const uint8_t git_hash_max_size = 16; uint8_t len = 0; -#if defined(GIT_HASH_ID) - uint8_t git_hash_id[40] = GIT_HASH_ID; -#else /* defined(GIT_HASH_ID) */ - uint8_t *git_hash_id = ZW_GetProtocolGitHash(); -#endif /* defined(GIT_HASH_ID) */ + const uint8_t *git_hash_id = ZW_GetProtocolGitHash(); const SApplicationHandles *pAppHandles = ZAF_getAppHandle(); pOutputBuffer[len++] = pAppHandles->pProtocolInfo->eProtocolType; pOutputBuffer[len++] = pAppHandles->pProtocolInfo->ProtocolVersion.Major; pOutputBuffer[len++] = pAppHandles->pProtocolInfo->ProtocolVersion.Minor; pOutputBuffer[len++] = pAppHandles->pProtocolInfo->ProtocolVersion.Revision; - pOutputBuffer[len++] = (uint8_t)(ZAF_BUILD_NO >> 8); - pOutputBuffer[len++] = (uint8_t)(ZAF_BUILD_NO ); + pOutputBuffer[len++] = (uint8_t)(ZAF_GetBuildNumber() >> 8); + pOutputBuffer[len++] = (uint8_t)(ZAF_GetBuildNumber() ); for (uint32_t i = 0 ; i < git_hash_max_size; i++,len++) { pOutputBuffer[len] = git_hash_id[i]; @@ -505,8 +504,8 @@ bool InitiateShutdown( ZW_Void_Callback_t pCallback) if (EQUEUENOTIFYING_STATUS_SUCCESS == QueueNotifyingSendToBack(pAppHandles->pZwCommandQueue, (uint8_t *)&shutdown, 0)) { // Wait for protocol to handle command - SZwaveCommandStatusPackage result = { 0 }; - if (GetCommandResponse(&result, EZWAVECOMMANDSTATUS_ZW_INITIATE_SHUTDOWN)) + SZwaveCommandStatusPackage result = { .eStatusType = EZWAVECOMMANDSTATUS_ZW_INITIATE_SHUTDOWN }; + if (GetCommandResponse(&result, result.eStatusType)) { return result.Content.InitiateShutdownStatus.result; } diff --git a/src/zwave_ncp_serial_api_controller/cmds_power_management.c b/src/zwave_ncp_serial_api_controller/cmds_power_management.c index 0502891e..601bfbc4 100644 --- a/src/zwave_ncp_serial_api_controller/cmds_power_management.c +++ b/src/zwave_ncp_serial_api_controller/cmds_power_management.c @@ -6,7 +6,7 @@ */ #include #include "cmd_handlers.h" -#include "ZW_SerialAPI.h" +#include "SerialAPI.h" #include "app.h" #include "zpal_power_manager.h" #include "SwTimer.h" diff --git a/src/zwave_ncp_serial_api_controller/comm_interface.c b/src/zwave_ncp_serial_api_controller/comm_interface.c index 880d3e29..74052542 100644 --- a/src/zwave_ncp_serial_api_controller/comm_interface.c +++ b/src/zwave_ncp_serial_api_controller/comm_interface.c @@ -5,12 +5,12 @@ #include "comm_interface.h" #include "zpal_uart.h" -#include "ZW_SerialAPI.h" +#include "SerialAPI.h" #include "SwTimer.h" #include "utils.h" #include #include "AppTimer.h" -#include "Assert.h" +#include #include "SerialAPI_hw.h" #define BUFFER_CHECK_TIME_MS 250 @@ -20,8 +20,8 @@ #define ACK_LEN 1 #define CRC_LEN 1 -#define COMM_INT_TX_BUFFER_SIZE 200 -#define COMM_INT_RX_BUFFER_SIZE 200 +#define COMM_INT_TX_BUFFER_SIZE RECEIVE_BUFFER_SIZE +#define COMM_INT_RX_BUFFER_SIZE RECEIVE_BUFFER_SIZE #define TRANSMIT_BUFFER_SIZE COMM_INT_TX_BUFFER_SIZE @@ -64,7 +64,12 @@ typedef struct } tx_frame_t; -static comm_interface_t comm_interface = { 0 }; +static comm_interface_t comm_interface = { + .transport.type = TRANSPORT_TYPE_UART, + .state = COMM_INTERFACE_STATE_SOF, + .buffer_len = 0, +}; + comm_interface_frame_ptr const serial_frame = (comm_interface_frame_ptr)comm_interface.buffer; static uint8_t tx_data[COMM_INT_TX_BUFFER_SIZE]; @@ -219,11 +224,10 @@ void comm_interface_init(void) comm_interface_set_ack_timeout_ms(DEFAULT_ACK_TIMEOUT_MS); comm_interface_set_byte_timeout_ms(DEFAULT_BYTE_TIMEOUT_MS); - zpal_status_t status = zpal_uart_init(&uart_config, &comm_interface.transport.handle); - ASSERT(status == ZPAL_STATUS_OK); + __attribute__((unused)) zpal_status_t status = zpal_uart_init(&uart_config, &comm_interface.transport.handle); + assert(status == ZPAL_STATUS_OK); status = zpal_uart_enable(comm_interface.transport.handle); - ASSERT(status == ZPAL_STATUS_OK); - comm_interface.transport.type = TRANSPORT_TYPE_UART; + assert(status == ZPAL_STATUS_OK); AppTimerRegister(&comm_interface.ack_timer, false, ack_timer_cb); TimerStop(&comm_interface.ack_timer); @@ -234,8 +238,6 @@ void comm_interface_init(void) AppTimerRegister(&comm_interface.buffer_check_timer, true, buffer_check_timer_cb); TimerStop(&comm_interface.buffer_check_timer); - comm_interface.state = COMM_INTERFACE_STATE_SOF; - comm_interface.buffer_len = 0; set_expect_bytes(HEADER_LEN); } @@ -419,7 +421,7 @@ static void handle_default(void) comm_interface_parse_result_t comm_interface_parse_data(bool ack) { - uint8_t rx_byte; + uint8_t rx_byte = 0; comm_interface_parse_result_t result = PARSE_IDLE; while ((result == PARSE_IDLE) && zpal_uart_get_available(comm_interface.transport.handle)) diff --git a/src/zwave_ncp_serial_api_controller/common_supported_func.h b/src/zwave_ncp_serial_api_controller/common_supported_func.h new file mode 100644 index 00000000..40be66c3 --- /dev/null +++ b/src/zwave_ncp_serial_api_controller/common_supported_func.h @@ -0,0 +1,69 @@ +/** + * @file + * @copyright 2022 Silicon Laboratories Inc. + */ + +/* Generated file copied from Sdk670 with std. functions supported by static controller. */ + +#define SUPPORT_LOCK_ROUTE_RESPONSE 1 /* ZW_LockRoute */ +#define SUPPORT_MEMORY_GET_BUFFER 1 /* MemoryGetBuffer */ +#define SUPPORT_MEMORY_GET_BYTE 1 /* MemoryGetByte */ +#define SUPPORT_MEMORY_GET_ID 1 /* MemoryGetID */ +#define SUPPORT_MEMORY_PUT_BUFFER 1 /* MemoryPutBuffer */ +#define SUPPORT_MEMORY_PUT_BYTE 1 /* MemoryPutByte */ +#define SUPPORT_NVM_GET_ID 1 /* NVM_get_id */ +#define SUPPORT_NVM_EXT_READ_LONG_BUFFER 1 /* NVM_ext_read_long_buffer */ +#define SUPPORT_NVM_EXT_READ_LONG_BYTE 1 /* NVM_ext_read_long_byte */ +#define SUPPORT_NVM_EXT_WRITE_LONG_BYTE 0 /* NVM_ext_write_long_byte */ +#define SUPPORT_NVM_EXT_WRITE_LONG_BUFFER 0 /* NVM_ext_write_long_buffer*/ +#define SUPPORT_STORE_HOMEID 0 /* ZW_StoreHomeID */ +#define SUPPORT_ZW_AES_ECB 0 /* ZW_AES_ECB */ +#define SUPPORT_ZW_EXPLORE_REQUEST_INCLUSION 1 /* ZW_ExploreRequestInclusion */ +#define SUPPORT_ZW_EXPLORE_REQUEST_EXCLUSION 1 /* ZW_ExploreRequestExclusion */ +#define SUPPORT_ZW_GET_NODE_PROTOCOL_INFO 1 /* ZW_GetNodeProtocolInfo */ +#define SUPPORT_ZW_GET_PROTOCOL_STATUS 1 /* ZW_GetProtocolStatus */ +#define SUPPORT_ZW_GET_PROTOCOL_VERSION 1 /* ZW_GetProtocolVersion */ +#define SUPPORT_ZW_GET_RANDOM 1 /* ZW_GetRandomWord */ +#define SUPPORT_ZW_GET_SUC_NODE_ID 1 /* ZW_GetSUCNodeID */ +#define SUPPORT_ZW_GET_VERSION 1 /* ZW_Version */ +#define SUPPORT_ZW_REQUEST_NETWORK_UPDATE 1 /* ZW_RequestNetWorkUpdate */ +#define SUPPORT_ZW_SEND_DATA 1 /* ZW_SendData */ +#define SUPPORT_ZW_SEND_DATA_ABORT 1 /* ZW_SendDataAbort */ +#define SUPPORT_ZW_SEND_DATA_MULTI 1 /* ZW_SendDataMulti */ +#define SUPPORT_ZW_SEND_NODE_INFORMATION 1 /* ZW_SendNodeInformation */ +#define SUPPORT_ZW_SET_DEFAULT 1 /* ZW_SetDefault */ +#define SUPPORT_ZW_SET_LEARN_MODE 1 /* ZW_SetLearnMode */ +#define SUPPORT_ZW_SET_PROMISCUOUS_MODE 0 /* ZW_SetPromiscuousMode */ +#define SUPPORT_ZW_SET_RF_RECEIVE_MODE 1 /* ZW_SetRFReceiveMode */ +#define SUPPORT_ZW_SET_SUC_NODE_ID 1 /* ZW_SetSUCNodeID */ +#define SUPPORT_ZW_TYPE_LIBRARY 1 /* ZW_Type_Library */ +#define SUPPORT_ZW_WATCHDOG_START 1 /* ZW_WatchDogEnable */ +#define SUPPORT_ZW_WATCHDOG_STOP 1 /* ZW_WatchDogDisable */ +#define SUPPORT_FUNC_ID_CLEAR_TX_TIMERS 1 /* ZW_ClearTxTimers */ +#define SUPPORT_FUNC_ID_GET_TX_TIMERS 1 /* ZW_GetTxTimer */ +#define SUPPORT_ZW_CLEAR_NETWORK_STATS 1 /* ZW_ClearNetworkStats */ +#define SUPPORT_ZW_GET_NETWORK_STATS 1 /* ZW_GetNetworkStats */ +#define SUPPORT_ZW_GET_BACKGROUND_RSSI 1 /* ZW_GetBackgroundRSSI */ +#define SUPPORT_ZW_SET_LISTEN_BEFORE_TALK_THRESHOLD 1 + +#define SUPPORT_ZW_NETWORK_MANAGEMENT_SET_MAX_INCLUSION_REQUEST_INTERVALS 1 + +/* SerialAPI functionality support definitions */ +#define SUPPORT_SEND_DATA_TIMING 1 +/* Only Controllers can Add/Remove other nodes */ + +/* Enable support for SerialAPI Startup Notification */ +#define SUPPORT_SERIAL_API_STARTUP_NOTIFICATION 1 + +/* Common SerialAPI functionality support definitions */ +#define SUPPORT_SERIAL_API_GET_INIT_DATA 1 +#define SUPPORT_SERIAL_API_APPL_NODE_INFORMATION 1 +#define SUPPORT_SERIAL_API_SET_TIMEOUTS 1 + +#define SUPPORT_SERIAL_API_SOFT_RESET 1 +#define SUPPORT_SERIAL_API_SETUP 1 + +#define SUPPORT_ZW_APPLICATION_UPDATE 1 + +#define SUPPORT_GET_TX_COUNTER 0 +#define SUPPORT_RESET_TX_COUNTER 0 diff --git a/src/zwave_ncp_serial_api_controller/config/FreeRTOSConfig.h b/src/zwave_ncp_serial_api_controller/config/FreeRTOSConfig.h index 66a1bb3a..d807177e 100644 --- a/src/zwave_ncp_serial_api_controller/config/FreeRTOSConfig.h +++ b/src/zwave_ncp_serial_api_controller/config/FreeRTOSConfig.h @@ -59,6 +59,11 @@ #include "SEGGER_SYSVIEW_FreeRTOS.h" #endif +#if defined(SL_CATALOG_CODE_CLASSIFICATION_VALIDATOR_PRESENT) +#include "sli_code_classification_validator.h" +#define traceTASK_SWITCHED_IN() sli_ccv_task_switched_in() +#endif + //-------- <<< Use Configuration Wizard in Context Menu >>> -------------------- // Minimal stack size [words] <0-65535> @@ -93,8 +98,8 @@ // Preemption interrupt priority // Maximum priority of interrupts that are safe to call FreeRTOS API. -// Default: 96 -#define configMAX_SYSCALL_INTERRUPT_PRIORITY 32 +// Default: 48 +#define configMAX_SYSCALL_INTERRUPT_PRIORITY 16 // Use time slicing // Enable setting to use timeslicing. @@ -153,12 +158,6 @@ // Default: 1 #define configENABLE_FPU 1 -// Use Memory Protection Unit -// Using Memory Protection Unit (MPU) requires detailed memory map definition. -// This setting is only releavant for MPU enabled ports. -// Default: 0 -#define configENABLE_MPU 0 - // Minimal secure stack size [words] <0-65535> // Stack for idle task Secure side context in words. // This setting is only relevant when TrustZone extension is enabled. @@ -182,6 +181,9 @@ //------------- <<< end of configuration section >>> --------------------------- +/* MPU feature is not supported in Silicon Labs port */ +#define configENABLE_MPU 0 + /* Defines needed by FreeRTOS to implement CMSIS RTOS2 API. Do not change! */ #define configCPU_CLOCK_HZ (SystemCoreClock) #define configSUPPORT_STATIC_ALLOCATION 1 @@ -196,7 +198,7 @@ #define configUSE_16_BIT_TICKS 0 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 #define configMAX_PRIORITIES 56 -#define configKERNEL_INTERRUPT_PRIORITY 224 +#define configKERNEL_INTERRUPT_PRIORITY 112 /* Defines that include FreeRTOS functions which implement CMSIS RTOS2 API. Do not change! */ #define INCLUDE_xEventGroupSetBitsFromISR 1 @@ -250,8 +252,8 @@ #define INCLUDE_xResumeFromISR 1 /* FreeRTOS Secure Side Only and TrustZone Security Extension */ -#define configRUN_FREERTOS_SECURE_ONLY 0 -#define configENABLE_TRUSTZONE 1 +#define configRUN_FREERTOS_SECURE_ONLY 1 +#define configENABLE_TRUSTZONE 0 /* Thread local storage pointers used by the SDK */ #ifndef configNUM_SDK_THREAD_LOCAL_STORAGE_POINTERS @@ -268,4 +270,4 @@ //#if defined(SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT) //#include "SEGGER_SYSVIEW_FreeRTOS.h" //#endif -#endif /* FREERTOS_CONFIG_H */ \ No newline at end of file +#endif /* FREERTOS_CONFIG_H */ diff --git a/src/zwave_ncp_serial_api_controller/config/app_properties_config.h b/src/zwave_ncp_serial_api_controller/config/app_properties_config.h index 6951a569..6a6b9766 100644 --- a/src/zwave_ncp_serial_api_controller/config/app_properties_config.h +++ b/src/zwave_ncp_serial_api_controller/config/app_properties_config.h @@ -62,4 +62,4 @@ // -#endif // APP_PROPERTIES_CONFIG_H \ No newline at end of file +#endif // APP_PROPERTIES_CONFIG_H diff --git a/src/zwave_ncp_serial_api_controller/config/btl_interface_cfg.h b/src/zwave_ncp_serial_api_controller/config/btl_interface_cfg.h index 13e09116..b1ab0078 100644 --- a/src/zwave_ncp_serial_api_controller/config/btl_interface_cfg.h +++ b/src/zwave_ncp_serial_api_controller/config/btl_interface_cfg.h @@ -39,10 +39,14 @@ #define BOOTLOADER_DISABLE_OLD_BOOTLOADER_MITIGATION 1 #endif +#if defined(_SILICON_LABS_32B_SERIES_2_CONFIG_6) +#define BOOTLOADER_DISABLE_OLD_BOOTLOADER_MITIGATION 1 +#endif + #if defined(_SILICON_LABS_32B_SERIES_2_CONFIG_8) #define BOOTLOADER_DISABLE_OLD_BOOTLOADER_MITIGATION 1 #endif #endif // !BOOTLOADER_APPLOADER -#endif // BTL_INTERFACE_CFG_H \ No newline at end of file +#endif // BTL_INTERFACE_CFG_H diff --git a/src/zwave_ncp_serial_api_controller/config/btl_interface_cfg_s2c3.h b/src/zwave_ncp_serial_api_controller/config/btl_interface_cfg_s2c3.h new file mode 100644 index 00000000..8e7f966e --- /dev/null +++ b/src/zwave_ncp_serial_api_controller/config/btl_interface_cfg_s2c3.h @@ -0,0 +1,338 @@ +/***************************************************************************//** + * @file + * @brief Configuration header of Bootloader Interface + ******************************************************************************* + * # License + * Copyright 2021 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + ******************************************************************************/ +#ifndef BTL_INTERFACE_CFG_S2C3_H +#define BTL_INTERFACE_CFG_S2C3_H + +// <<< Use Configuration Wizard in Context Menu >>> +// Bootloader Interface Trust Zone Security State Configuration + +// Disable multi tiered fallback logic +// The fault handling logic as well as the USART auto-detection logic will be disabled. +// The re-configuration of SMU will be handled by querying the running bootloader +// for the peripheral list. Querying the peripheral list is supported from the bootloader +// version 2.0.0. Check for the BOOTLOADER_CAPABILITY_PERIPHERAL_LIST capability to +// see if the running bootloader supports querying the peripheral list. +#define BOOTLOADER_DISABLE_OLD_BOOTLOADER_MITIGATION 0 + +// Disable peripheral access fault handling +// The fault handling triggered by an erroneous access of peripherals will be disabled. +// +// This should be disabled iff all the peripherals that are in use by the bootloader +// have been properly configured by the "Manually override security state of peripherals" option. +#define BOOTLOADER_DISABLE_NVM3_FAULT_HANDLING 0 + +// Manually override the security state of peripherals in use by the bootloader +// Default: 0. +// Manually override the security state of peripherals. Choose the peripherals touched +// by the customized code to have a valid secure access state before interacting with the bootloader +// In practice, this means that the chosen peripherals will be available at the secure address, +// which is accessible by the bootloader. Once the application is entered back the secure access state +// is changed back to the original state. +// +// The USART auto-detection logic that detects which, if any, USART is in use by the bootloader +// will be disabled. Make sure to choose the correct USART used by the bootloader. +#define BOOTLOADER_MANUAL_OVERRIDE_SECURITY_STATE 0 + +// EMU +// Update secure access state of EMU before calling into bootloader +#define BOOTLOADER_PPUSATD0_EMU 0 + +// CMU +// Update secure access state of CMU before calling into bootloader +#define BOOTLOADER_PPUSATD0_CMU 0 + +// HFRCO0 +// Update secure access state of HFRCO0 before calling into bootloader +#define BOOTLOADER_PPUSATD0_HFRCO0 0 + +// FSRCO +// Update secure access state of FSRCO before calling into bootloader +#define BOOTLOADER_PPUSATD0_FSRCO 0 + +// DPLL0 +// Update secure access state of DPLL0 before calling into bootloader +#define BOOTLOADER_PPUSATD0_DPLL0 0 + +// LFXO +// Update secure access state of LFXO before calling into bootloader +#define BOOTLOADER_PPUSATD0_LFXO 0 + +// LFRCO +// Update secure access state of LFRCO before calling into bootloader +#define BOOTLOADER_PPUSATD0_LFRCO 0 + +// ULFRCO +// Update secure access state of ULFRCO before calling into bootloader +#define BOOTLOADER_PPUSATD0_ULFRCO 0 + +// MSC +// Update secure access state of MSC before calling into bootloader +#define BOOTLOADER_PPUSATD0_MSC 0 + +// ICACHE0 +// Update secure access state of ICACHE0 before calling into bootloader +#define BOOTLOADER_PPUSATD0_ICACHE0 0 + +// PRS +// Update secure access state of PRS before calling into bootloader +#define BOOTLOADER_PPUSATD0_PRS 0 + +// GPIO +// Update secure access state of GPIO before calling into bootloader +#define BOOTLOADER_PPUSATD0_GPIO 0 + +// LDMA +// Update secure access state of LDMA before calling into bootloader +#define BOOTLOADER_PPUSATD0_LDMA 0 + +// LDMAXBAR +// Update secure access state of LDMAXBAR before calling into bootloader +#define BOOTLOADER_PPUSATD0_LDMAXBAR 0 + +// TIMER0 +// Update secure access state of TIMER0 before calling into bootloader +#define BOOTLOADER_PPUSATD0_TIMER0 0 + +// TIMER1 +// Update secure access state of TIMER1 before calling into bootloader +#define BOOTLOADER_PPUSATD0_TIMER1 0 + +// TIMER2 +// Update secure access state of TIMER2 before calling into bootloader +#define BOOTLOADER_PPUSATD0_TIMER2 0 + +// TIMER3 +// Update secure access state of TIMER3 before calling into bootloader +#define BOOTLOADER_PPUSATD0_TIMER3 0 + +// TIMER4 +// Update secure access state of TIMER4 before calling into bootloader +#define BOOTLOADER_PPUSATD0_TIMER4 0 + +// USART0 +// Update secure access state of USART0 before calling into bootloader +#define BOOTLOADER_PPUSATD0_USART0 0 + +// BURTC +// Update secure access state of BURTC before calling into bootloader +#define BOOTLOADER_PPUSATD0_BURTC 0 + +// I2C1 +// Update secure access state of I2C1 before calling into bootloader +#define BOOTLOADER_PPUSATD0_I2C1 0 + +// CHIPTESTCTRL +// Update secure access state of CHIPTESTCTRL before calling into bootloader +#define BOOTLOADER_PPUSATD0_CHIPTESTCTRL 0 + +// SYSCFGCFGNS +// Update secure access state of SYSCFGCFGNS before calling into bootloader +#define BOOTLOADER_PPUSATD0_SYSCFGCFGNS 0 + +// SYSCFG +// Update secure access state of SYSCFG before calling into bootloader +#define BOOTLOADER_PPUSATD0_SYSCFG 0 + +// BURAM +// Update secure access state of BURAM before calling into bootloader +#define BOOTLOADER_PPUSATD0_BURAM 0 + +// GPCRC +// Update secure access state of GPCRC before calling into bootloader +#define BOOTLOADER_PPUSATD0_GPCRC 0 + +// DCDC +// Update secure access state of DCDC before calling into bootloader +#define BOOTLOADER_PPUSATD0_DCDC 0 + +// HOSTMAILBOX +// Update secure access state of HOSTMAILBOX before calling into bootloader +#define BOOTLOADER_PPUSATD0_HOSTMAILBOX 0 + +// EUSART1 +// Update secure access state of EUSART1 before calling into bootloader +#define BOOTLOADER_PPUSATD0_EUSART1 0 + +// EUSART2 +// Update secure access state of EUSART2 before calling into bootloader +#define BOOTLOADER_PPUSATD0_EUSART2 0 + +// SYSRTC +// Update secure access state of SYSRTC before calling into bootloader +#define BOOTLOADER_PPUSATD1_SYSRTC 0 + +// LCD +// Update secure access state of LCD before calling into bootloader +#define BOOTLOADER_PPUSATD1_LCD 0 + +// KEYSCAN +// Update secure access state of KEYSCAN before calling into bootloader +#define BOOTLOADER_PPUSATD1_KEYSCAN 0 + +// DMEM +// Update secure access state of DMEM before calling into bootloader +#define BOOTLOADER_PPUSATD1_DMEM 0 + +// LCDRF +// Update secure access state of LCDRF before calling into bootloader +#define BOOTLOADER_PPUSATD1_LCDRF 0 + +// PFMXPPRF +// Update secure access state of PFMXPPRF before calling into bootloader +#define BOOTLOADER_PPUSATD1_PFMXPPRF 0 + +// RADIOAES +// Update secure access state of RADIOAES before calling into bootloader +#define BOOTLOADER_PPUSATD1_RADIOAES 0 + +// SMU +// Update secure access state of SMU before calling into bootloader +#define BOOTLOADER_PPUSATD1_SMU 0 + +// SMUCFGNS +// Update secure access state of SMUCFGNS before calling into bootloader +#define BOOTLOADER_PPUSATD1_SMUCFGNS 0 + +// LETIMER0 +// Update secure access state of LETIMER0 before calling into bootloader +#define BOOTLOADER_PPUSATD1_LETIMER0 0 + +// IADC0 +// Update secure access state of IADC0 before calling into bootloader +#define BOOTLOADER_PPUSATD1_IADC0 0 + +// ACMP0 +// Update secure access state of ACMP0 before calling into bootloader +#define BOOTLOADER_PPUSATD1_ACMP0 0 + +// ACMP1 +// Update secure access state of ACMP1 before calling into bootloader +#define BOOTLOADER_PPUSATD1_ACMP1 0 + +// AMUXCP0 +// Update secure access state of AMUXCP0 before calling into bootloader +#define BOOTLOADER_PPUSATD1_AMUXCP0 0 + +// VDAC0 +// Update secure access state of VDAC0 before calling into bootloader +#define BOOTLOADER_PPUSATD1_VDAC0 0 + +// PCNT +// Update secure access state of PCNT before calling into bootloader +#define BOOTLOADER_PPUSATD1_PCNT 0 + +// LESENSE +// Update secure access state of LESENSE before calling into bootloader +#define BOOTLOADER_PPUSATD1_LESENSE 0 + +// HFRCO1 +// Update secure access state of HFRCO1 before calling into bootloader +#define BOOTLOADER_PPUSATD1_HFRCO1 0 + +// HFXO0 +// Update secure access state of HFXO0 before calling into bootloader +#define BOOTLOADER_PPUSATD1_HFXO0 0 + +// I2C0 +// Update secure access state of I2C0 before calling into bootloader +#define BOOTLOADER_PPUSATD1_I2C0 0 + +// WDOG0 +// Update secure access state of WDOG0 before calling into bootloader +#define BOOTLOADER_PPUSATD1_WDOG0 0 + +// WDOG1 +// Update secure access state of WDOG1 before calling into bootloader +#define BOOTLOADER_PPUSATD1_WDOG1 0 + +// EUSART0 +// Update secure access state of EUSART0 before calling into bootloader +#define BOOTLOADER_PPUSATD1_EUSART0 0 + +// SEMAILBOX +// Update secure access state of SEMAILBOX before calling into bootloader +#define BOOTLOADER_PPUSATD1_SEMAILBOX 0 + +// AHBRADIO +// Update secure access state of AHBRADIO before calling into bootloader +#define BOOTLOADER_PPUSATD1_AHBRADIO 0 +// + +// +// <<< end of configuration section >>> + +#if BOOTLOADER_MANUAL_OVERRIDE_SECURITY_STATE == 1 +#define BOOTLOADER_PPUSATD0_MASK ((BOOTLOADER_PPUSATD0_EMU << _SMU_PPUSATD0_EMU_SHIFT) \ + | (BOOTLOADER_PPUSATD0_CMU << _SMU_PPUSATD0_CMU_SHIFT) \ + | (BOOTLOADER_PPUSATD0_HFRCO0 << _SMU_PPUSATD0_HFRCO0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_FSRCO << _SMU_PPUSATD0_FSRCO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_DPLL0 << _SMU_PPUSATD0_DPLL0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_LFXO << _SMU_PPUSATD0_LFXO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_LFRCO << _SMU_PPUSATD0_LFRCO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_ULFRCO << _SMU_PPUSATD0_ULFRCO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_MSC << _SMU_PPUSATD0_MSC_SHIFT) \ + | (BOOTLOADER_PPUSATD0_ICACHE0 << _SMU_PPUSATD0_ICACHE0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_PRS << _SMU_PPUSATD0_PRS_SHIFT) \ + | (BOOTLOADER_PPUSATD0_GPIO << _SMU_PPUSATD0_GPIO_SHIFT) \ + | (BOOTLOADER_PPUSATD0_LDMA << _SMU_PPUSATD0_LDMA_SHIFT) \ + | (BOOTLOADER_PPUSATD0_LDMAXBAR << _SMU_PPUSATD0_LDMAXBAR_SHIFT) \ + | (BOOTLOADER_PPUSATD0_TIMER0 << _SMU_PPUSATD0_TIMER0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_TIMER1 << _SMU_PPUSATD0_TIMER1_SHIFT) \ + | (BOOTLOADER_PPUSATD0_TIMER2 << _SMU_PPUSATD0_TIMER2_SHIFT) \ + | (BOOTLOADER_PPUSATD0_TIMER3 << _SMU_PPUSATD0_TIMER3_SHIFT) \ + | (BOOTLOADER_PPUSATD0_TIMER4 << _SMU_PPUSATD0_TIMER4_SHIFT) \ + | (BOOTLOADER_PPUSATD0_USART0 << _SMU_PPUSATD0_USART0_SHIFT) \ + | (BOOTLOADER_PPUSATD0_BURTC << _SMU_PPUSATD0_BURTC_SHIFT) \ + | (BOOTLOADER_PPUSATD0_I2C1 << _SMU_PPUSATD0_I2C1_SHIFT) \ + | (BOOTLOADER_PPUSATD0_CHIPTESTCTRL << _SMU_PPUSATD0_CHIPTESTCTRL_SHIFT) \ + | (BOOTLOADER_PPUSATD0_SYSCFGCFGNS << _SMU_PPUSATD0_SYSCFGCFGNS_SHIFT) \ + | (BOOTLOADER_PPUSATD0_SYSCFG << _SMU_PPUSATD0_SYSCFG_SHIFT) \ + | (BOOTLOADER_PPUSATD0_BURAM << _SMU_PPUSATD0_BURAM_SHIFT) \ + | (BOOTLOADER_PPUSATD0_GPCRC << _SMU_PPUSATD0_GPCRC_SHIFT) \ + | (BOOTLOADER_PPUSATD0_DCDC << _SMU_PPUSATD0_DCDC_SHIFT) \ + | (BOOTLOADER_PPUSATD0_HOSTMAILBOX << _SMU_PPUSATD0_HOSTMAILBOX_SHIFT) \ + | (BOOTLOADER_PPUSATD0_EUSART1 << _SMU_PPUSATD0_EUSART1_SHIFT) \ + | (BOOTLOADER_PPUSATD0_EUSART2 << _SMU_PPUSATD0_EUSART2_SHIFT)) +#define BOOTLOADER_PPUSATD1_MASK ((BOOTLOADER_PPUSATD1_SYSRTC << _SMU_PPUSATD1_SYSRTC_SHIFT) \ + | (BOOTLOADER_PPUSATD1_LCD << _SMU_PPUSATD1_LCD_SHIFT) \ + | (BOOTLOADER_PPUSATD1_KEYSCAN << _SMU_PPUSATD1_KEYSCAN_SHIFT) \ + | (BOOTLOADER_PPUSATD1_DMEM << _SMU_PPUSATD1_DMEM_SHIFT) \ + | (BOOTLOADER_PPUSATD1_LCDRF << _SMU_PPUSATD1_LCDRF_SHIFT) \ + | (BOOTLOADER_PPUSATD1_PFMXPPRF << _SMU_PPUSATD1_PFMXPPRF_SHIFT) \ + | (BOOTLOADER_PPUSATD1_RADIOAES << _SMU_PPUSATD1_RADIOAES_SHIFT) \ + | (BOOTLOADER_PPUSATD1_SMU << _SMU_PPUSATD1_SMU_SHIFT) \ + | (BOOTLOADER_PPUSATD1_SMUCFGNS << _SMU_PPUSATD1_SMUCFGNS_SHIFT) \ + | (BOOTLOADER_PPUSATD1_LETIMER0 << _SMU_PPUSATD1_LETIMER0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_IADC0 << _SMU_PPUSATD1_IADC0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_ACMP0 << _SMU_PPUSATD1_ACMP0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_ACMP1 << _SMU_PPUSATD1_ACMP1_SHIFT) \ + | (BOOTLOADER_PPUSATD1_AMUXCP0 << _SMU_PPUSATD1_AMUXCP0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_VDAC0 << _SMU_PPUSATD1_VDAC0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_PCNT << _SMU_PPUSATD1_PCNT_SHIFT) \ + | (BOOTLOADER_PPUSATD1_LESENSE << _SMU_PPUSATD1_LESENSE_SHIFT) \ + | (BOOTLOADER_PPUSATD1_HFRCO1 << _SMU_PPUSATD1_HFRCO1_SHIFT) \ + | (BOOTLOADER_PPUSATD1_HFXO0 << _SMU_PPUSATD1_HFXO0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_I2C0 << _SMU_PPUSATD1_I2C0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_WDOG0 << _SMU_PPUSATD1_WDOG0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_WDOG1 << _SMU_PPUSATD1_WDOG1_SHIFT) \ + | (BOOTLOADER_PPUSATD1_EUSART0 << _SMU_PPUSATD1_EUSART0_SHIFT) \ + | (BOOTLOADER_PPUSATD1_SEMAILBOX << _SMU_PPUSATD1_SEMAILBOX_SHIFT) \ + | (BOOTLOADER_PPUSATD1_AHBRADIO << _SMU_PPUSATD1_AHBRADIO_SHIFT)) + +#endif // BOOTLOADER_MANUAL_OVERRIDE_SECURITY_STATE + +#endif // BTL_INTERFACE_CFG_S2C3_H diff --git a/src/zwave_ncp_serial_api_controller/config/emlib_core_debug_config.h b/src/zwave_ncp_serial_api_controller/config/emlib_core_debug_config.h index e4a01682..07ee9b9e 100644 --- a/src/zwave_ncp_serial_api_controller/config/emlib_core_debug_config.h +++ b/src/zwave_ncp_serial_api_controller/config/emlib_core_debug_config.h @@ -42,4 +42,4 @@ // // <<< end of configuration section >>> -#endif // EM_CORE_CONFIG_H \ No newline at end of file +#endif // EM_CORE_CONFIG_H diff --git a/src/zwave_ncp_serial_api_controller/config/extension_board_8029a_efr32xg13.h b/src/zwave_ncp_serial_api_controller/config/extension_board_8029a_efr32xg13.h deleted file mode 100644 index f83a5e81..00000000 --- a/src/zwave_ncp_serial_api_controller/config/extension_board_8029a_efr32xg13.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Provides support for BRD8029A (Buttons and LEDs EXP Board) - * - * @copyright 2018 Silicon Laboratories Inc. - */ - -#ifndef EXTENSION_BOARD_8029A_EFR32XG13_H -#define EXTENSION_BOARD_8029A_EFR32XG13_H - -#include "extension_board_8029a_efr32xg13_button.h" -#include "extension_board_8029a_efr32xg13_led.h" -#include "extension_board_8029a_efr32xg13_slider.h" - -/*************************************************************************/ -/* Map physical board IO devices to application LEDs and buttons */ -/*************************************************************************/ - -/* Map application LEDs to board LEDs */ -#define APP_LED_A BOARD_LED1 -#define APP_LED_INDICATOR BOARD_LED2 // Positioned opposite APP_BUTTON_LEARN_RESET -#define APP_LED_B BOARD_LED4 -#define APP_LED_C BOARD_LED3 - -#define APP_RGB_R BOARD_RGB1_R -#define APP_RGB_G BOARD_RGB1_G -#define APP_RGB_B BOARD_RGB1_B - -/* Mapping application buttons to board buttons */ -#if defined(RADIO_BOARD_EFR32ZG13P32) || defined(RADIO_BOARD_EFR32ZG13L) || defined(RADIO_BOARD_EFR32ZG13S) -// The EFR32ZG13P32 device has reduced number of GPIO pins and therefore -// supports only two of our buttons -#define APP_BUTTON_A BOARD_BUTTON_PB4 -#define APP_BUTTON_LEARN_RESET BOARD_BUTTON_PB3 // Supports EM4 wakeup -#else -#define APP_BUTTON_A BOARD_BUTTON_PB1 -#define APP_BUTTON_LEARN_RESET BOARD_BUTTON_PB2 // Supports EM4 wakeup -#define APP_BUTTON_B BOARD_BUTTON_PB3 // Supports EM4 wakeup -#define APP_BUTTON_C BOARD_BUTTON_PB4 -#define APP_SLIDER_A BOARD_BUTTON_SLIDER1 -#endif - -/* The next two are identical since on the BRD8029A only PB2 and PB3 - * can trigger a wakeup from EM4. PB2 is already used for learn/reset - */ -#define APP_WAKEUP_BTN_SLDR BOARD_BUTTON_PB3 // Use this one when wakeup capability is required and button is preferred to slider -#define APP_WAKEUP_SLDR_BTN BOARD_BUTTON_PB3 // Use this one when wakeup capability is required and slider is preferred to button - -#endif /* EXTENSION_BOARD_8029A_EFR32XG13_H */ \ No newline at end of file diff --git a/src/zwave_ncp_serial_api_controller/config/extension_board_8029a_efr32xg13_button.h b/src/zwave_ncp_serial_api_controller/config/extension_board_8029a_efr32xg13_button.h deleted file mode 100644 index 0cc9a7a2..00000000 --- a/src/zwave_ncp_serial_api_controller/config/extension_board_8029a_efr32xg13_button.h +++ /dev/null @@ -1,138 +0,0 @@ -/** - * Provides support for BRD8029A (Buttons on EXP Board) - * - * @copyright 2022 Silicon Laboratories Inc. - */ - -#ifndef EXTENSION_BOARD_8029A_EFR32XG13_BUTTON_H -#define EXTENSION_BOARD_8029A_EFR32XG13_BUTTON_H - -/*************************************************************************/ -/* Configure push buttons */ -/*************************************************************************/ - -/* NB: BTN0 on BRD8029A is connected in parallel with PB0 on BRD4001A - * (Wireless Starter Kit mainboard). Not a problem, the two buttons - * simply provide the same functionality. - */ - -// <<< Use Configuration Wizard in Context Menu >>> - -// Button Configuration - -#define PB1_LABEL "BTN0" - -// Button1 ON value -// <1=> Active high -// <0=> Active low -// 0 -#define PB1_ON_VALUE 0 - -// Button1 interrupt pin number -// 6 -#define PB1_INT_NO 6 - -// Button1 wake up from EM4 -// 0 -#define PB1_CAN_WAKEUP_EM4 0 - - -#define PB2_LABEL "BTN1" - -// Button2 ON value -// <1=> Active high -// <0=> Active low -// 0 -#define PB2_ON_VALUE 0 - -// Button2 interrupt pin number -// 7 -#define PB2_INT_NO 7 - -// Button2 wake up from EM4 -// 1 -#define PB2_CAN_WAKEUP_EM4 1 - - -#define PB3_LABEL "BTN2" - -// Button3 ON value -// <1=> Active high -// <0=> Active low -// 0 -#define PB3_ON_VALUE 0 - -// Button3 interrupt pin number -// 10 -#define PB3_INT_NO 10 - -// Button3 wake up from EM4 -// 1 -#define PB3_CAN_WAKEUP_EM4 1 - - -#define PB4_LABEL "BTN3" - -// Button4 ON value -// <1=> Active high -// <0=> Active low -// 0 -#define PB4_ON_VALUE 0 - -// Button4 interrupt pin number -// 11 -#define PB4_INT_NO 11 - -// Button4 wake up from EM4 -// 0 -#define PB4_CAN_WAKEUP_EM4 0 - -// - -// <<< end of configuration section >>> - -// <<< sl:start pin_tool >>> - -// PB1_GPIO -// $[GPIO_PB1_GPIO] -#ifndef PB1_GPIO_PORT -#define PB1_GPIO_PORT gpioPortF -#endif -#ifndef PB1_GPIO_PIN -#define PB1_GPIO_PIN 6 -#endif -// [GPIO_PB1_GPIO]$ - -// PB2_GPIO -// $[GPIO_PB2_GPIO] -#ifndef PB2_GPIO_PORT -#define PB2_GPIO_PORT gpioPortF -#endif -#ifndef PB2_GPIO_PIN -#define PB2_GPIO_PIN 7 -#endif -// [GPIO_PB2_GPIO]$ - -// PB3_GPIO -// $[GPIO_PB3_GPIO] -#ifndef PB3_GPIO_PORT -#define PB3_GPIO_PORT gpioPortC -#endif -#ifndef PB3_GPIO_PIN -#define PB3_GPIO_PIN 10 -#endif -// [GPIO_PB3_GPIO]$ - -// PB4_GPIO -// $[GPIO_PB4_GPIO] -#ifndef PB4_GPIO_PORT -#define PB4_GPIO_PORT gpioPortC -#endif -#ifndef PB4_GPIO_PIN -#define PB4_GPIO_PIN 11 -#endif -// [GPIO_PB4_GPIO]$ - -// <<< sl:end pin_tool >>> - -#endif /* EXTENSION_BOARD_8029A_EFR32XG13_BUTTON_H */ \ No newline at end of file diff --git a/src/zwave_ncp_serial_api_controller/config/extension_board_8029a_efr32xg13_led.h b/src/zwave_ncp_serial_api_controller/config/extension_board_8029a_efr32xg13_led.h deleted file mode 100644 index a440c525..00000000 --- a/src/zwave_ncp_serial_api_controller/config/extension_board_8029a_efr32xg13_led.h +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Provides support for BRD8029A (LEDs on EXP Board) - * - * @copyright 2022 Silicon Laboratories Inc. - */ - -#ifndef EXTENSION_BOARD_8029A_EFR32XG13_LED_H -#define EXTENSION_BOARD_8029A_EFR32XG13_LED_H - -/*************************************************************************/ -/* Configure LEDs */ -/*************************************************************************/ - -/* NB: Mounted in parallel with "LED0" on the mainboard. - * - * EFR32 peripheral: (none) - */ - -// <<< Use Configuration Wizard in Context Menu >>> - -// LED Configuration - -// LED1 ON value -// <0=> Active low -// <1=> Active high -// 1 -#define LED1_ON_VALUE 1 - -// LED2 ON value -// <0=> Active low -// <1=> Active high -// 1 -#define LED2_ON_VALUE 1 - -// LED3 ON value -// <0=> Active low -// <1=> Active high -// 1 -#define LED3_ON_VALUE 1 - -// LED4 ON value -// <0=> Active low -// <1=> Active high -// 1 -#define LED4_ON_VALUE 1 - -// - -// <<< end of configuration section >>> - -// <<< sl:start pin_tool >>> - -#define LED1_LABEL "LED0" -// LED1_GPIO -// $[GPIO_LED1_GPIO] -#ifndef LED1_GPIO_PORT -#define LED1_GPIO_PORT gpioPortF -#endif -#ifndef LED1_GPIO_PIN -#define LED1_GPIO_PIN 4 -#endif -// [GPIO_LED1_GPIO]$ - -#define LED2_LABEL "LED1" -// LED2_GPIO -// $[GPIO_LED2_GPIO] -#ifndef LED2_GPIO_PORT -#define LED2_GPIO_PORT gpioPortF -#endif -#ifndef LED2_GPIO_PIN -#define LED2_GPIO_PIN 3 -#endif -// [GPIO_LED2_GPIO]$ - -#define LED3_LABEL "LED2" -// LED3_GPIO -// $[GPIO_LED3_GPIO] -#ifndef LED3_GPIO_PORT -#define LED3_GPIO_PORT gpioPortA -#endif -#ifndef LED3_GPIO_PIN -#define LED3_GPIO_PIN 2 -#endif -// [GPIO_LED3_GPIO]$ - -/* NB: EFR32 peripheral: US0_CS#0 - */ -#define LED4_LABEL "LED3" -// LED4_GPIO -// $[GPIO_LED4_GPIO] -#ifndef LED4_GPIO_PORT -#define LED4_GPIO_PORT gpioPortA -#endif -#ifndef LED4_GPIO_PIN -#define LED4_GPIO_PIN 3 -#endif -// [GPIO_LED4_GPIO]$ - -// <<< sl:end pin_tool >>> - - -/*************************************************************************/ -/* Configure RGB LEDs */ -/*************************************************************************/ - -/* BRD8029A does not have any RGB led! - * If paired with radio board ZGM13 then the RGB on that board can be used - */ - -#endif /* EXTENSION_BOARD_8029A_EFR32XG13_LED_H */ \ No newline at end of file diff --git a/src/zwave_ncp_serial_api_controller/config/extension_board_8029a_efr32xg13_slider.h b/src/zwave_ncp_serial_api_controller/config/extension_board_8029a_efr32xg13_slider.h deleted file mode 100644 index 68cc8856..00000000 --- a/src/zwave_ncp_serial_api_controller/config/extension_board_8029a_efr32xg13_slider.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Provides support for BRD8029A (Slider on EXP Board) - * - * @copyright 2022 Silicon Laboratories Inc. - */ - -#ifndef EXTENSION_BOARD_8029A_EFR32XG13_SLIDER_H -#define EXTENSION_BOARD_8029A_EFR32XG13_SLIDER_H - -/*************************************************************************/ -/* Configure slider button */ -/*************************************************************************/ - -// <<< Use Configuration Wizard in Context Menu >>> - -// Slider Configuration - -#define SLIDER1_LABEL "SW1" - -// Slider ON value -// <1=> Active high -// <0=> Active low -// 0 -#define SLIDER1_ON_VALUE 0 - -// Interrupt pin number -// 9 -#define SLIDER1_INT_NO 9 - -// Wake up from EM4 -// 0 -#define SLIDER1_CAN_WAKEUP_EM4 0 - -// - -// <<< end of configuration section >>> - -// <<< sl:start pin_tool >>> - -// SLIDER1_GPIO -// $[GPIO_SLIDER1_GPIO] -#ifndef SLIDER1_GPIO_PORT -#define SLIDER1_GPIO_PORT gpioPortC -#endif -#ifndef SLIDER1_GPIO_PIN -#define SLIDER1_GPIO_PIN 9 -#endif -// [GPIO_SLIDER1_GPIO]$ - -// <<< sl:end pin_tool >>> - -#endif /* EXTENSION_BOARD_8029A_EFR32XG13_SLIDER_H */ \ No newline at end of file diff --git a/src/zwave_ncp_serial_api_controller/config/nvm3_default_config.h b/src/zwave_ncp_serial_api_controller/config/nvm3_default_config.h index 71bb6563..5c608fc7 100644 --- a/src/zwave_ncp_serial_api_controller/config/nvm3_default_config.h +++ b/src/zwave_ncp_serial_api_controller/config/nvm3_default_config.h @@ -34,12 +34,12 @@ // NVM3 Default Instance Size // Size of the NVM3 storage region in flash. This size should be aligned with // the flash page size of the device. -// Default: 36864 -#define NVM3_DEFAULT_NVM_SIZE 36864 +// Default: 40960 +#define NVM3_DEFAULT_NVM_SIZE 40960 #endif // // <<< end of configuration section >>> -#endif // NVM3_DEFAULT_CONFIG_H \ No newline at end of file +#endif // NVM3_DEFAULT_CONFIG_H diff --git a/src/zwave_ncp_serial_api_controller/config/pin_config.h b/src/zwave_ncp_serial_api_controller/config/pin_config.h index 740e8856..2c724099 100644 --- a/src/zwave_ncp_serial_api_controller/config/pin_config.h +++ b/src/zwave_ncp_serial_api_controller/config/pin_config.h @@ -1,106 +1,62 @@ #ifndef PIN_CONFIG_H #define PIN_CONFIG_H -// $[ACMP0] -// [ACMP0]$ - -// $[ACMP1] -// [ACMP1]$ - -// $[ADC0] -// [ADC0]$ - // $[CMU] // [CMU]$ -// $[CSEN] -// [CSEN]$ - -// $[DBG] -// DBG SWV on PF2 -#ifndef DBG_SWV_PORT -#define DBG_SWV_PORT gpioPortF -#endif -#ifndef DBG_SWV_PIN -#define DBG_SWV_PIN 2 -#endif -#ifndef DBG_SWV_LOC -#define DBG_SWV_LOC 0 -#endif - -// [DBG]$ - -// $[ETM] -// [ETM]$ - -// $[PTI] -// [PTI]$ - -// $[GPIO] -// [GPIO]$ - -// $[I2C0] -// [I2C0]$ - -// $[I2C1] -// [I2C1]$ - -// $[IDAC0] -// [IDAC0]$ - -// $[LESENSE] -// [LESENSE]$ +// $[LFXO] +// [LFXO]$ -// $[LETIMER0] -// [LETIMER0]$ +// $[PRS.ASYNCH0] +// [PRS.ASYNCH0]$ -// $[LEUART0] -// [LEUART0]$ +// $[PRS.ASYNCH1] +// [PRS.ASYNCH1]$ -// $[LFXO] -// [LFXO]$ +// $[PRS.ASYNCH2] +// [PRS.ASYNCH2]$ -// $[MODEM] -// [MODEM]$ +// $[PRS.ASYNCH3] +// [PRS.ASYNCH3]$ -// $[PCNT0] -// [PCNT0]$ +// $[PRS.ASYNCH4] +// [PRS.ASYNCH4]$ -// $[PRS.CH0] -// [PRS.CH0]$ +// $[PRS.ASYNCH5] +// [PRS.ASYNCH5]$ -// $[PRS.CH1] -// [PRS.CH1]$ +// $[PRS.ASYNCH6] +// [PRS.ASYNCH6]$ -// $[PRS.CH2] -// [PRS.CH2]$ +// $[PRS.ASYNCH7] +// [PRS.ASYNCH7]$ -// $[PRS.CH3] -// [PRS.CH3]$ +// $[PRS.ASYNCH8] +// [PRS.ASYNCH8]$ -// $[PRS.CH4] -// [PRS.CH4]$ +// $[PRS.ASYNCH9] +// [PRS.ASYNCH9]$ -// $[PRS.CH5] -// [PRS.CH5]$ +// $[PRS.ASYNCH10] +// [PRS.ASYNCH10]$ -// $[PRS.CH6] -// [PRS.CH6]$ +// $[PRS.ASYNCH11] +// [PRS.ASYNCH11]$ -// $[PRS.CH7] -// [PRS.CH7]$ +// $[PRS.SYNCH0] +// [PRS.SYNCH0]$ -// $[PRS.CH8] -// [PRS.CH8]$ +// $[PRS.SYNCH1] +// [PRS.SYNCH1]$ -// $[PRS.CH9] -// [PRS.CH9]$ +// $[PRS.SYNCH2] +// [PRS.SYNCH2]$ -// $[PRS.CH10] -// [PRS.CH10]$ +// $[PRS.SYNCH3] +// [PRS.SYNCH3]$ -// $[PRS.CH11] -// [PRS.CH11]$ +// $[GPIO] +// [GPIO]$ // $[TIMER0] // [TIMER0]$ @@ -108,42 +64,84 @@ // $[TIMER1] // [TIMER1]$ +// $[TIMER2] +// [TIMER2]$ + +// $[TIMER3] +// [TIMER3]$ + +// $[TIMER4] +// [TIMER4]$ + // $[USART0] -// USART0 RX on PA1 +// USART0 RX on PA09 #ifndef USART0_RX_PORT #define USART0_RX_PORT gpioPortA #endif #ifndef USART0_RX_PIN -#define USART0_RX_PIN 1 -#endif -#ifndef USART0_RX_LOC -#define USART0_RX_LOC 0 +#define USART0_RX_PIN 9 #endif -// USART0 TX on PA0 +// USART0 TX on PA08 #ifndef USART0_TX_PORT #define USART0_TX_PORT gpioPortA #endif #ifndef USART0_TX_PIN -#define USART0_TX_PIN 0 -#endif -#ifndef USART0_TX_LOC -#define USART0_TX_LOC 0 +#define USART0_TX_PIN 8 #endif // [USART0]$ -// $[USART1] -// [USART1]$ +// $[I2C1] +// [I2C1]$ + +// $[EUSART1] +// [EUSART1]$ + +// $[EUSART2] +// [EUSART2]$ + +// $[LCD] +// [LCD]$ + +// $[KEYSCAN] +// [KEYSCAN]$ + +// $[LETIMER0] +// [LETIMER0]$ + +// $[IADC0] +// [IADC0]$ + +// $[ACMP0] +// [ACMP0]$ -// $[USART2] -// [USART2]$ +// $[ACMP1] +// [ACMP1]$ // $[VDAC0] // [VDAC0]$ -// $[WTIMER0] -// [WTIMER0]$ +// $[PCNT0] +// [PCNT0]$ + +// $[LESENSE] +// [LESENSE]$ + +// $[HFXO0] +// [HFXO0]$ + +// $[I2C0] +// [I2C0]$ + +// $[EUSART0] +// [EUSART0]$ + +// $[PTI] +// [PTI]$ + +// $[MODEM] +// [MODEM]$ // $[CUSTOM_PIN_NAME] #ifndef _PORT diff --git a/src/zwave_ncp_serial_api_controller/config/psa_crypto_config.h b/src/zwave_ncp_serial_api_controller/config/psa_crypto_config.h new file mode 100644 index 00000000..796c42b6 --- /dev/null +++ b/src/zwave_ncp_serial_api_controller/config/psa_crypto_config.h @@ -0,0 +1,170 @@ +#ifndef PSA_CRYPTO_CONFIG_H +#define PSA_CRYPTO_CONFIG_H + +// ----------------------------------------------------------------------------- +// User exposed config options + +// <<< Use Configuration Wizard in Context Menu >>> + +// Key management configuration + +// PSA User Maximum Open Keys Count <0-128> +// Maximum amount of keys that the user application will have open +// simultaneously. In context of PSA Crypto, an open key means any key +// either stored in RAM (lifetime set to PSA_KEY_LIFETIME_VOLATILE), or +// used as part of a cryptographic operation. +// When using a key for a multi-part (setup/update/finish) operation, a key +// is considered to be open from the moment the operation is successfully +// setup, until it finishes or aborts. +// When an application tries to open more keys than this value accounts for, +// the PSA API may return PSA_ERROR_INSUFFICIENT_MEMORY. Keep in mind that +// other software included in the application (e.g. wireless protocol stacks) +// also can have a need to have open keys in PSA Crypto. This could lead to +// a race condition when the application key slot count is set too low for +// the actual usage of the application, as a software stack may not fail +// gracefully in case an application opens more than its declared amount of +// keys, thereby precluding the stack from functioning. +// Default: 4 +#define SL_PSA_KEY_USER_SLOT_COUNT 14 + +// PSA Maximum User Persistent Keys Count <0-1024> +// Maximum amount of keys (or other files) that can be stored persistently +// by the application through the PSA interface, when persistent storage +// support for PSA Crypto is included in the project. +// Due to caching logic, this setting does have an impact on static RAM usage. +// Note that this number is added to the potential requirements from other +// software components in the project, such that the total amount of keys +// which can be stored through the ITS backend can be higher than what is +// configured here. +// +// WARNING: When changing this setting on an application that is already +// deployed, and thus will get the change through an application upgrade, +// care should be taken to ensure that the setting is only ever increased, +// and never decreased. Decreasing this setting might cause previously +// stored keys/files to become inaccessible. +// +// It is not possible to change this setting when using V3 ITS Driver. +// The file-storage indexing is dependent on the maximum number of files, +// and if SL_PSA_ITS_USER_MAX_FILES is changed, ITS should be cleared and +// all files need to be stored again. +// Default: 128 +#define SL_PSA_ITS_USER_MAX_FILES 32 + +// Enable V1 Format Support For ITS Files <0-1> +// Devices that used PSA ITS together with gecko_sdk_3.1.x or earlier +// might have keys (or other files) stored in V1 format. +// If no v1 files are used, its support can be disabled for space +// optimization. +// Default: 0 +#define SL_PSA_ITS_SUPPORT_V1_DRIVER 0 + +// Enable V2 ITS Driver Support <0-1> +// Devices that have used GSDK 4.1.x and earlier, and used ITS have the keys +// (or other files) stored using different address range. Enabling this +// config option adds upgrade code which converts V2 (and V1 if +// supported) format ITS keys/files to the latest V3 format. Update is +// fully automatic, needs to be run once and require extra flash space of +// approximately the size of the largest key. +// V1 ITS driver support can be disabled if the device has never used ITS +// driver before in GSDK 4.1.x and earlier, or the keys has been already +// migrated. +// Default: 0 +#define SL_PSA_ITS_SUPPORT_V2_DRIVER 0 + +// Enable support for V3 ITS Driver <0-1> +// Devices that have used GSDK 4.1.x and earlier, and used ITS have the keys +// (or other files) stored using different address range. In rare case +// that those devices have full nvm3 and not enough space for the +// upgrade, (that requires an extra space to store largest key in memory +// twice), this config option can disable v3 driver and use v2 one. +// To upgrade the device, make space for the upgrade, and enable v3 driver again. +// +// WARNING: When using V3 driver, it is not possible to increase or decrease +// the value of SL_PSA_ITS_USER_MAX_FILES. If the change of +// SL_PSA_ITS_USER_MAX_FILES is required, ITS should be cleared and +// all files need to be stored again. +// Default: 1 +#define SL_PSA_ITS_SUPPORT_V3_DRIVER 1 + +// Built-in AES Key Mode of Operation +// CTR Mode +// CFB Mode +// OFB Mode +// ECB Mode +// CBC Mode (no padding) +// CBC Mode (PKCS#7 padding) +// PSA Crypto only allows one specific usage algorithm per built-in key ID. +// Default: PSA_ALG_CTR +#define SL_SE_BUILTIN_KEY_AES128_ALG_CONFIG (PSA_ALG_CTR) + +#ifndef SL_CRYPTOACC_BUILTIN_KEY_PUF_ALG +// Built-in PUF Key Algorithm +// PBKDF2 (CMAC-AES-128-PRF) +// CMAC +// PSA Crypto only allows one specific usage algorithm per built-in key ID. +// It is recommended to only use the PUF key for deriving further key +// material. +// Default: PSA_ALG_PBKDF2_AES_CMAC_PRF_128 +#define SL_CRYPTOACC_BUILTIN_KEY_PUF_ALG (PSA_ALG_PBKDF2_AES_CMAC_PRF_128) +#endif // SL_CRYPTOACC_BUILTIN_KEY_PUF_ALG + +// + +// Power optimization configuration + +// Store already-generated random bytes before putting the device to sleep +// Using the hardware TRNG (for example through psa_generate_random()) will +// consume a non-negligible amount of power. A start-up routine must pass +// and a relatively large minimum amount of random bytes will be generated. +// Use cases where the device is frequently entering EM2/EM3 and thereafter +// consumes a small amount of data from the TRNG may benefit from buffering +// the existing random bytes before putting the device to sleep. These +// buffered bytes are then consumed until exhaustion before the TRNG needs +// to be initialized and used again. +// +// NOTE: this configuration option is only applicable for devices with a +// Virtual Secure Engine (VSE), and requires the 'Power Manager' component +// to be included in the project. +// +// Default: 0 +#define SL_VSE_BUFFER_TRNG_DATA_DURING_SLEEP (0) + +// Number of random words to buffer before putting the device to sleep <1-63> +// This option can be used to decrease the amount of random words that +// (if enabled) are buffered before the device enters EM2/EM3. Lowering this +// number will result in less static RAM usage, but also means that the TRNG +// potentially has to be initialized more times--leading to increased power +// consumption. By default this option in configured to buffer as much TRNG +// data as possible (limited by the depth of the TRNG FIFO). +// +// NOTE: this configuration option is only applicable when +// SL_VSE_BUFFER_TRNG_DATA_DURING_SLEEP is enabled. +// +// Default: 63 +#define SL_VSE_MAX_TRNG_WORDS_BUFFERED_DURING_SLEEP (63) +// + +// + +// <<< end of configuration section >>> + +// ----------------------------------------------------------------------------- +// Sub-files + +#if defined(SLI_PSA_CONFIG_AUTOGEN_OVERRIDE_FILE) + #include SLI_PSA_CONFIG_AUTOGEN_OVERRIDE_FILE +#else + #include "sli_psa_config_autogen.h" +#endif + +#if defined(TFM_CONFIG_SL_SECURE_LIBRARY) + #include "sli_psa_tfm_translation.h" +#endif + +#if SL_MBEDTLS_DRIVERS_ENABLED + #include "sli_psa_acceleration.h" +#endif + +#include "sli_psa_builtin_config_autogen.h" + +#endif // PSA_CRYPTO_CONFIG_H diff --git a/src/zwave_ncp_serial_api_controller/config/radio_board_brd2603a.h b/src/zwave_ncp_serial_api_controller/config/radio_board_brd2603a.h new file mode 100644 index 00000000..14fa2d63 --- /dev/null +++ b/src/zwave_ncp_serial_api_controller/config/radio_board_brd2603a.h @@ -0,0 +1,30 @@ +/** + * Provides support for BRD2603A (ZGM230S radio board) + * + * @copyright 2022 Silicon Laboratories Inc. + */ + +#ifndef RADIO_BOARD_BRD2603A_H +#define RADIO_BOARD_BRD2603A_H + +#include "radio_board_brd2603a_button.h" +#if defined(ZW_APPSHW_POWERSTRIP) +#include "radio_board_brd2603a_led_pwm.h" +#else +#include "radio_board_brd2603a_led.h" +#endif + +/*************************************************************************/ +/* Map physical board IO devices to application LEDs and buttons */ +/*************************************************************************/ + +#define APP_LED_A BOARD_LED1 +#define APP_LED_INDICATOR BOARD_LED2 // Positioned opposite APP_BUTTON_LEARN_RESET + +#define APP_BUTTON_A BOARD_BUTTON_PB1 // Supports EM4 wakeup +#define APP_BUTTON_LEARN_RESET BOARD_BUTTON_PB2 + +#define APP_WAKEUP_BTN_SLDR BOARD_BUTTON_PB1 // Use this one when wakeup capability is required and button is preferred to slider +#define APP_WAKEUP_SLDR_BTN BOARD_BUTTON_PB1 // Use this one when wakeup capability is required and slider is preferred to button + +#endif /* RADIO_BOARD_BRD2603A_H */ diff --git a/src/zwave_ncp_serial_api_controller/config/radio_board_brd2603a_button.h b/src/zwave_ncp_serial_api_controller/config/radio_board_brd2603a_button.h new file mode 100644 index 00000000..065ae3e5 --- /dev/null +++ b/src/zwave_ncp_serial_api_controller/config/radio_board_brd2603a_button.h @@ -0,0 +1,76 @@ +/** + * Provides support for BRD8029A (Buttons on EXP Board) + * + * @copyright 2022 Silicon Laboratories Inc. + */ + +#ifndef RADIO_BOARD_BRD2603A_BUTTON_H +#define RADIO_BOARD_BRD2603A_BUTTON_H + +/*************************************************************************/ +/* Configure push buttons */ +/*************************************************************************/ + +// <<< Use Configuration Wizard in Context Menu >>> +// Button Configuration +#define PB1_LABEL "BTN0" + +// Button1 ON value +// <1=> Active high +// <0=> Active low +// 0 +#define PB1_ON_VALUE 0 + +// Button1 interrupt pin number +// 3 +#define PB1_INT_NO 3 + +// Button1 wake up from EM4 +// 1 +#define PB1_CAN_WAKEUP_EM4 1 + +#define PB2_LABEL "BTN1" + +// Button2 ON value +// <1=> Active high +// <0=> Active low +// 0 +#define PB2_ON_VALUE 0 + +// Button2 interrupt pin number +// 2 +#define PB2_INT_NO 2 + +// Button2 wake up from EM4 +// 0 +#define PB2_CAN_WAKEUP_EM4 0 + +// + +// <<< end of configuration section >>> + +// <<< sl:start pin_tool >>> + +// PB1_GPIO +// $[GPIO_PB1_GPIO] +#ifndef PB1_GPIO_PORT +#define PB1_GPIO_PORT gpioPortB +#endif +#ifndef PB1_GPIO_PIN +#define PB1_GPIO_PIN 3 +#endif +// [GPIO_PB1_GPIO]$ + +// PB2_GPIO +// $[GPIO_PB2_GPIO] +#ifndef PB2_GPIO_PORT +#define PB2_GPIO_PORT gpioPortB +#endif +#ifndef PB2_GPIO_PIN +#define PB2_GPIO_PIN 2 +#endif +// [GPIO_PB2_GPIO]$ + +// <<< sl:end pin_tool >>> + +#endif /* RADIO_BOARD_BRD2603A_BUTTON_H */ diff --git a/src/zwave_ncp_serial_api_controller/config/radio_board_brd2603a_led.h b/src/zwave_ncp_serial_api_controller/config/radio_board_brd2603a_led.h new file mode 100644 index 00000000..65d1487f --- /dev/null +++ b/src/zwave_ncp_serial_api_controller/config/radio_board_brd2603a_led.h @@ -0,0 +1,58 @@ +/** + * Provides support for BRD8029A (LEDs on EXP Board) + * + * @copyright 2022 Silicon Laboratories Inc. + */ + +#ifndef RADIO_BOARD_BRD2603A_LED_H +#define RADIO_BOARD_BRD2603A_LED_H + +/*************************************************************************/ +/* Configure LEDs */ +/*************************************************************************/ + +// <<< Use Configuration Wizard in Context Menu >>> +// LED Configuration +// LED1 ON value +// <0=> Active low +// <1=> Active high +// 1 +#define LED1_ON_VALUE 1 + +// LED2 ON value +// <0=> Active low +// <1=> Active high +// 1 +#define LED2_ON_VALUE 1 + +// + +// <<< end of configuration section >>> + +// <<< sl:start pin_tool >>> + +#define LED1_LABEL "LED0" +// LED1_GPIO +// $[GPIO_LED1_GPIO] +#ifndef LED1_GPIO_PORT +#define LED1_GPIO_PORT gpioPortC +#endif +#ifndef LED1_GPIO_PIN +#define LED1_GPIO_PIN 8 +#endif +// [GPIO_LED1_GPIO]$ + +#define LED2_LABEL "LED1" +// LED2_GPIO +// $[GPIO_LED2_GPIO] +#ifndef LED2_GPIO_PORT +#define LED2_GPIO_PORT gpioPortC +#endif +#ifndef LED2_GPIO_PIN +#define LED2_GPIO_PIN 9 +#endif +// [GPIO_LED2_GPIO]$ + +// <<< sl:end pin_tool >>> + +#endif /* RADIO_BOARD_BRD2603A_LED_H */ diff --git a/src/zwave_ncp_serial_api_controller/config/serial_api_config.h b/src/zwave_ncp_serial_api_controller/config/serial_api_config.h index ad4a51a3..db3a7c01 100644 --- a/src/zwave_ncp_serial_api_controller/config/serial_api_config.h +++ b/src/zwave_ncp_serial_api_controller/config/serial_api_config.h @@ -20,29 +20,23 @@ #define SERIAL_API_PERIPHERAL_NO 0 #endif -// USART0 TX on PA0 +// USART0 TX on PA08 #ifndef SERIAL_API_TX_PORT #define SERIAL_API_TX_PORT gpioPortA #endif #ifndef SERIAL_API_TX_PIN -#define SERIAL_API_TX_PIN 0 -#endif -#ifndef SERIAL_API_TX_LOC -#define SERIAL_API_TX_LOC 0 +#define SERIAL_API_TX_PIN 8 #endif -// USART0 RX on PA1 +// USART0 RX on PA09 #ifndef SERIAL_API_RX_PORT #define SERIAL_API_RX_PORT gpioPortA #endif #ifndef SERIAL_API_RX_PIN -#define SERIAL_API_RX_PIN 1 -#endif -#ifndef SERIAL_API_RX_LOC -#define SERIAL_API_RX_LOC 0 +#define SERIAL_API_RX_PIN 9 #endif // [USART_SERIAL_API]$ // <<< sl:end pin_tool >>> -#endif // SERIAL_API_CONFIG_H \ No newline at end of file +#endif // SERIAL_API_CONFIG_H diff --git a/src/zwave_ncp_serial_api_controller/config/sl_board_control_config.h b/src/zwave_ncp_serial_api_controller/config/sl_board_control_config.h index ad15ebb1..f430ee19 100644 --- a/src/zwave_ncp_serial_api_controller/config/sl_board_control_config.h +++ b/src/zwave_ncp_serial_api_controller/config/sl_board_control_config.h @@ -33,52 +33,84 @@ // <<< Use Configuration Wizard in Context Menu >>> -// Enable Virtual COM UART +// Enable Relative Humidity and Temperature sensor // Default: 0 -#define SL_BOARD_ENABLE_VCOM 1 +#define SL_BOARD_ENABLE_SENSOR_RHT 0 -// Enable Display +// Enable Hall Effect sensor // Default: 0 -#define SL_BOARD_ENABLE_DISPLAY 0 +#define SL_BOARD_ENABLE_SENSOR_HALL 0 -// Enable Relative Humidity and Temperature sensor +// Enable Barometric Pressure sensor // Default: 0 -#define SL_BOARD_ENABLE_SENSOR_RHT 0 +#define SL_BOARD_ENABLE_SENSOR_PRESSURE 0 + +// Enable Light sensor +// Default: 0 +#define SL_BOARD_ENABLE_SENSOR_LIGHT 0 + +// Enable Inertial Measurement Unit +// Default: 0 +#define SL_BOARD_ENABLE_SENSOR_IMU 0 + +// Disable SPI Flash +// Default: 1 +#define SL_BOARD_DISABLE_MEMORY_SPI 1 // <<< end of configuration section >>> // <<< sl:start pin_tool >>> -// SL_BOARD_ENABLE_VCOM -// $[GPIO_SL_BOARD_ENABLE_VCOM] -#ifndef SL_BOARD_ENABLE_VCOM_PORT -#define SL_BOARD_ENABLE_VCOM_PORT gpioPortA +// SL_BOARD_ENABLE_SENSOR_RHT +// $[GPIO_SL_BOARD_ENABLE_SENSOR_RHT] +#ifndef SL_BOARD_ENABLE_SENSOR_RHT_PORT +#define SL_BOARD_ENABLE_SENSOR_RHT_PORT gpioPortC #endif -#ifndef SL_BOARD_ENABLE_VCOM_PIN -#define SL_BOARD_ENABLE_VCOM_PIN 5 +#ifndef SL_BOARD_ENABLE_SENSOR_RHT_PIN +#define SL_BOARD_ENABLE_SENSOR_RHT_PIN 7 #endif -// [GPIO_SL_BOARD_ENABLE_VCOM]$ +// [GPIO_SL_BOARD_ENABLE_SENSOR_RHT]$ -// SL_BOARD_ENABLE_DISPLAY -// $[GPIO_SL_BOARD_ENABLE_DISPLAY] -#ifndef SL_BOARD_ENABLE_DISPLAY_PORT -#define SL_BOARD_ENABLE_DISPLAY_PORT gpioPortD +// SL_BOARD_ENABLE_SENSOR_HALL +// $[GPIO_SL_BOARD_ENABLE_SENSOR_HALL] +#ifndef SL_BOARD_ENABLE_SENSOR_HALL_PORT +#define SL_BOARD_ENABLE_SENSOR_HALL_PORT gpioPortC #endif -#ifndef SL_BOARD_ENABLE_DISPLAY_PIN -#define SL_BOARD_ENABLE_DISPLAY_PIN 15 +#ifndef SL_BOARD_ENABLE_SENSOR_HALL_PIN +#define SL_BOARD_ENABLE_SENSOR_HALL_PIN 7 #endif -// [GPIO_SL_BOARD_ENABLE_DISPLAY]$ +// [GPIO_SL_BOARD_ENABLE_SENSOR_HALL]$ -// SL_BOARD_ENABLE_SENSOR_RHT -// $[GPIO_SL_BOARD_ENABLE_SENSOR_RHT] -#ifndef SL_BOARD_ENABLE_SENSOR_RHT_PORT -#define SL_BOARD_ENABLE_SENSOR_RHT_PORT gpioPortD +// SL_BOARD_ENABLE_SENSOR_PRESSURE +// $[GPIO_SL_BOARD_ENABLE_SENSOR_PRESSURE] +#ifndef SL_BOARD_ENABLE_SENSOR_PRESSURE_PORT +#define SL_BOARD_ENABLE_SENSOR_PRESSURE_PORT gpioPortC #endif -#ifndef SL_BOARD_ENABLE_SENSOR_RHT_PIN -#define SL_BOARD_ENABLE_SENSOR_RHT_PIN 15 +#ifndef SL_BOARD_ENABLE_SENSOR_PRESSURE_PIN +#define SL_BOARD_ENABLE_SENSOR_PRESSURE_PIN 7 #endif -// [GPIO_SL_BOARD_ENABLE_SENSOR_RHT]$ +// [GPIO_SL_BOARD_ENABLE_SENSOR_PRESSURE]$ + +// SL_BOARD_ENABLE_SENSOR_LIGHT +// $[GPIO_SL_BOARD_ENABLE_SENSOR_LIGHT] +#ifndef SL_BOARD_ENABLE_SENSOR_LIGHT_PORT +#define SL_BOARD_ENABLE_SENSOR_LIGHT_PORT gpioPortC +#endif +#ifndef SL_BOARD_ENABLE_SENSOR_LIGHT_PIN +#define SL_BOARD_ENABLE_SENSOR_LIGHT_PIN 7 +#endif +// [GPIO_SL_BOARD_ENABLE_SENSOR_LIGHT]$ + +// SL_BOARD_ENABLE_SENSOR_IMU +// $[GPIO_SL_BOARD_ENABLE_SENSOR_IMU] +#ifndef SL_BOARD_ENABLE_SENSOR_IMU_PORT +#define SL_BOARD_ENABLE_SENSOR_IMU_PORT gpioPortD +#endif +#ifndef SL_BOARD_ENABLE_SENSOR_IMU_PIN +#define SL_BOARD_ENABLE_SENSOR_IMU_PIN 3 +#endif +// [GPIO_SL_BOARD_ENABLE_SENSOR_IMU]$ // <<< sl:end pin_tool >>> -#endif // SL_BOARD_CONTROL_CONFIG_H \ No newline at end of file +#endif // SL_BOARD_CONTROL_CONFIG_H diff --git a/src/zwave_ncp_serial_api_controller/config/sl_rail_util_sequencer_config.h b/src/zwave_ncp_serial_api_controller/config/sl_core_config.h similarity index 76% rename from src/zwave_ncp_serial_api_controller/config/sl_rail_util_sequencer_config.h rename to src/zwave_ncp_serial_api_controller/config/sl_core_config.h index 9a584a07..27b173d2 100644 --- a/src/zwave_ncp_serial_api_controller/config/sl_rail_util_sequencer_config.h +++ b/src/zwave_ncp_serial_api_controller/config/sl_core_config.h @@ -1,6 +1,6 @@ /***************************************************************************//** * @file - * @brief + * @brief sl_core Configuration ******************************************************************************* * # License * Copyright 2023 Silicon Laboratories Inc. www.silabs.com @@ -28,21 +28,17 @@ * ******************************************************************************/ -#ifndef SL_RAIL_UTIL_SEQUENCER_H -#define SL_RAIL_UTIL_SEQUENCER_H +#ifndef SL_CORE_CONFIG_H +#define SL_CORE_CONFIG_H -#include "rail.h" +// <<< Use Configuration Wizard in Context Menu >>> -#ifdef __cplusplus -extern "C" { -#endif +// Core Abstraction Configuration -#define SL_RAIL_UTIL_SEQUENCER_RUNTIME_IMAGE_SELECTION 0 +// Enables measurement of interrupt masking time for debugging purposes. +// Default: 0 +#define SL_CORE_DEBUG_INTERRUPTS_MASKED_TIMING 0 +// -#define SL_RAIL_UTIL_SEQUENCER_IMAGE RAIL_SEQ_IMAGE_ZWAVE - -#ifdef __cplusplus -} -#endif - -#endif // SL_RAIL_UTIL_SEQUENCER_H \ No newline at end of file +// <<< end of configuration section >>> +#endif // SL_CORE_CONFIG_H diff --git a/src/zwave_ncp_serial_api_controller/config/sl_debug_swo_config.h b/src/zwave_ncp_serial_api_controller/config/sl_debug_swo_config.h deleted file mode 100644 index 5ed74316..00000000 --- a/src/zwave_ncp_serial_api_controller/config/sl_debug_swo_config.h +++ /dev/null @@ -1,109 +0,0 @@ -/***************************************************************************//** - * @file - * @brief SWO configuration - ******************************************************************************* - * # License - * Copyright 2020 Silicon Laboratories Inc. www.silabs.com - ******************************************************************************* - * - * SPDX-License-Identifier: Zlib - * - * The licensor of this software is Silicon Laboratories Inc. - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - * - ******************************************************************************/ - -#ifndef SL_DEBUG_SWO_CONFIG_H -#define SL_DEBUG_SWO_CONFIG_H - -// <<< Use Configuration Wizard in Context Menu >>> - -// SWO Configuration - -// SWO Frequency -// Must be 875 kHz for communication with Silicon Labs debuggers -// Default: 875000 -#define SL_DEBUG_SWO_FREQ 875000 - -// Enable interrupt event trace -// Default: 0 -#define SL_DEBUG_SWO_SAMPLE_IRQ 0 - -// Enable Program Counter samples -// Default: 0 -#define SL_DEBUG_SWO_SAMPLE_PC 0 - -// SWO debug sample intervals -// <64=> 64 -// <128=> 128 -// <192=> 192 -// <256=> 256 -// <320=> 320 -// <384=> 384 -// <448=> 448 -// <512=> 512 -// <576=> 576 -// <640=> 640 -// <704=> 704 -// <768=> 768 -// <832=> 832 -// <896=> 896 -// <960=> 960 -// <1024=> 1024 -// <2048=> 2048 -// <3072=> 3072 -// <4096=> 4096 -// <5102=> 5102 -// <6144=> 6144 -// <7168=> 7168 -// <8192=> 8192 -// <9216=> 9216 -// <10240=> 10240 -// <11264=> 11264 -// <12288=> 12288 -// <13312=> 13312 -// <14336=> 14336 -// <15360=> 15360 -// Must be 64, 128, 192, [ n * 64 ], 1024, 2048, 3072, [ n * 1024 ] , 15360 -// Default: 15360 -#define SL_DEBUG_SWO_SAMPLE_INTERVAL 15360 -// - -// <<< end of configuration section >>> - -// <<< sl:start pin_tool >>> -// SL_DEBUG -// $[DBG_SL_DEBUG] -#ifndef SL_DEBUG_PERIPHERAL -#define SL_DEBUG_PERIPHERAL DBG -#endif - -// DBG SWV on PF2 -#ifndef SL_DEBUG_SWV_PORT -#define SL_DEBUG_SWV_PORT gpioPortF -#endif -#ifndef SL_DEBUG_SWV_PIN -#define SL_DEBUG_SWV_PIN 2 -#endif -#ifndef SL_DEBUG_SWV_LOC -#define SL_DEBUG_SWV_LOC 0 -#endif -// [DBG_SL_DEBUG]$ -// <<< sl:end pin_tool >>> - -#endif // SL_DEBUG_SWO_CONFIG_H \ No newline at end of file diff --git a/src/zwave_ncp_serial_api_controller/config/sl_device_init_dcdc_config.h b/src/zwave_ncp_serial_api_controller/config/sl_device_init_dcdc_config.h index e3deec07..26582ae2 100644 --- a/src/zwave_ncp_serial_api_controller/config/sl_device_init_dcdc_config.h +++ b/src/zwave_ncp_serial_api_controller/config/sl_device_init_dcdc_config.h @@ -45,14 +45,14 @@ // Override for DCDC PFMX Mode Peak Current Setting // -// Default: 0 -#define SL_DEVICE_INIT_DCDC_PFMX_IPKVAL_OVERRIDE 0 +// Default: 1 +#define SL_DEVICE_INIT_DCDC_PFMX_IPKVAL_OVERRIDE 1 // DCDC PFMX Mode Peak Current Setting <0-15> // // Default: DCDC_PFMXCTRL_IPKVAL_DEFAULT -#define SL_DEVICE_INIT_DCDC_PFMX_IPKVAL DCDC_PFMXCTRL_IPKVAL_DEFAULT +#define SL_DEVICE_INIT_DCDC_PFMX_IPKVAL 9 // <<< end of configuration section >>> -#endif // SL_DEVICE_INIT_DCDC_CONFIG_H \ No newline at end of file +#endif // SL_DEVICE_INIT_DCDC_CONFIG_H diff --git a/src/zwave_ncp_serial_api_controller/config/sl_device_init_emu_config.h b/src/zwave_ncp_serial_api_controller/config/sl_device_init_emu_config.h deleted file mode 100644 index 68a04c23..00000000 --- a/src/zwave_ncp_serial_api_controller/config/sl_device_init_emu_config.h +++ /dev/null @@ -1,68 +0,0 @@ -/***************************************************************************//** - * @file - * @brief DEVICE_INIT_EMU Config - ******************************************************************************* - * # License - * Copyright 2019 Silicon Laboratories Inc. www.silabs.com - ******************************************************************************* - * - * SPDX-License-Identifier: Zlib - * - * The licensor of this software is Silicon Laboratories Inc. - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - * - ******************************************************************************/ - -#ifndef SL_DEVICE_INIT_EMU_CONFIG_H -#define SL_DEVICE_INIT_EMU_CONFIG_H - -#include "em_emu.h" - -// <<< Use Configuration Wizard in Context Menu >>> - -// EM4H Voltage scaling level -// Fast-wakeup voltage level -// Low-power optimized voltage level -// Default: emuVScaleEM4H_LowPower -#define SL_DEVICE_INIT_EMU_EM4_VSCALE emuVScaleEM4H_LowPower - -// Retain LFXO in EM4 -#define SL_DEVICE_INIT_EMU_EM4_RETAIN_LFXO 0 - -// Retain LFRCO in EM4 -#define SL_DEVICE_INIT_EMU_EM4_RETAIN_LFRCO 1 - -// Retain ULFRCO in EM4S -#define SL_DEVICE_INIT_EMU_EM4_RETAIN_ULFRCO 0 - -// Hibernate or shutoff EM4 state -// EM4 Shutoff -// EM4 Hibernate -// Default: emuEM4Shutoff -#define SL_DEVICE_INIT_EMU_EM4_STATE emuEM4Hibernate - -// EM4 pin retention mode -// No Retention: Pads enter reset state when entering EM4. -// Retention through EM4: Pads enter reset state when exiting EM4. -// Retention through EM4 and wakeup. -// Default: emuPinRetentionDisable -#define SL_DEVICE_INIT_EMU_EM4_PIN_RETENTION_MODE emuPinRetentionLatch - -// <<< end of configuration section >>> - -#endif // SL_DEVICE_INIT_EMU_CONFIG_H \ No newline at end of file diff --git a/src/zwave_ncp_serial_api_controller/config/sl_device_init_hfxo_config.h b/src/zwave_ncp_serial_api_controller/config/sl_device_init_hfxo_config.h index 102818c0..78b14ee2 100644 --- a/src/zwave_ncp_serial_api_controller/config/sl_device_init_hfxo_config.h +++ b/src/zwave_ncp_serial_api_controller/config/sl_device_init_hfxo_config.h @@ -35,10 +35,10 @@ // Mode // -// Crystal oscillator -// External digital clock -// Default: cmuOscMode_Crystal -#define SL_DEVICE_INIT_HFXO_MODE cmuOscMode_Crystal +// Crystal oscillator +// External sine wave +// Default: cmuHfxoOscMode_Crystal +#define SL_DEVICE_INIT_HFXO_MODE cmuHfxoOscMode_Crystal // Frequency <38000000-40000000> // Default: 39000000 @@ -48,25 +48,10 @@ // Default: 50 #define SL_DEVICE_INIT_HFXO_PRECISION 50 -// CTUNE <0-511> -// Default: 360 -#define SL_DEVICE_INIT_HFXO_CTUNE 319 - -// Advanced Configurations -// Auto-start HFXO. This feature is incompatible with Power Manager and can only be enabled in applications that do not use Power Manager or a radio protocol stack. - DEPRECATED -// True -// False -// Default: false -#define SL_DEVICE_INIT_HFXO_AUTOSTART false - -// Auto-select HFXO. This feature is incompatible with Power Manager and can only be enabled in applications that do not use Power Manager or a radio protocol stack. - DEPRECATED -// True -// False -// Default: false -#define SL_DEVICE_INIT_HFXO_AUTOSELECT false - -// +// CTUNE <0-255> +// Default: 140 +#define SL_DEVICE_INIT_HFXO_CTUNE 140 // <<< end of configuration section >>> -#endif // SL_DEVICE_INIT_HFXO_CONFIG_H \ No newline at end of file +#endif // SL_DEVICE_INIT_HFXO_CONFIG_H diff --git a/src/zwave_ncp_serial_api_controller/config/sl_device_init_lfxo_config.h b/src/zwave_ncp_serial_api_controller/config/sl_device_init_lfxo_config.h new file mode 100644 index 00000000..e331b00d --- /dev/null +++ b/src/zwave_ncp_serial_api_controller/config/sl_device_init_lfxo_config.h @@ -0,0 +1,66 @@ +/***************************************************************************//** + * @file + * @brief DEVICE_INIT_LFXO Config + ******************************************************************************* + * # License + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +#ifndef SL_DEVICE_INIT_LFXO_CONFIG_H +#define SL_DEVICE_INIT_LFXO_CONFIG_H + +// <<< Use Configuration Wizard in Context Menu >>> + +// Mode +// +// Crystal oscillator +// AC-coupled buffer +// External digital clock +// Default: cmuLfxoOscMode_Crystal +#define SL_DEVICE_INIT_LFXO_MODE cmuLfxoOscMode_Crystal + +// CTUNE <0-127> +// Default: 63 +#define SL_DEVICE_INIT_LFXO_CTUNE 63 + +// LFXO precision in PPM <0-65535> +// Default: 50 +#define SL_DEVICE_INIT_LFXO_PRECISION 50 + +// Startup Timeout Delay +// +// 2 cycles +// 256 cycles +// 1K cycles +// 2K cycles +// 4K cycles +// 8K cycles +// 16K cycles +// 32K cycles +// Default: cmuLfxoStartupDelay_4KCycles +#define SL_DEVICE_INIT_LFXO_TIMEOUT cmuLfxoStartupDelay_4KCycles +// <<< end of configuration section >>> + +#endif // SL_DEVICE_INIT_LFXO_CONFIG_H diff --git a/src/zwave_ncp_serial_api_controller/config/sl_fem_util_config.h b/src/zwave_ncp_serial_api_controller/config/sl_fem_util_config.h index f7d358dd..7cf4f4fb 100644 --- a/src/zwave_ncp_serial_api_controller/config/sl_fem_util_config.h +++ b/src/zwave_ncp_serial_api_controller/config/sl_fem_util_config.h @@ -92,4 +92,4 @@ #define SL_FEM_UTIL_OPTIMIZED_PHY_ENABLE 0 #define SL_FEM_UTIL_RUNTIME_PHY_SELECT 0 -#endif // SL_FEM_UTIL_CONFIG_H \ No newline at end of file +#endif // SL_FEM_UTIL_CONFIG_H diff --git a/src/zwave_ncp_serial_api_controller/config/sl_hfxo_manager_config.h b/src/zwave_ncp_serial_api_controller/config/sl_hfxo_manager_config.h new file mode 100644 index 00000000..d9ccd3c7 --- /dev/null +++ b/src/zwave_ncp_serial_api_controller/config/sl_hfxo_manager_config.h @@ -0,0 +1,56 @@ +/***************************************************************************//** + * @file + * @brief HFXO Manager configuration file. + ******************************************************************************* + * # License + * Copyright 2020 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +// <<< Use Configuration Wizard in Context Menu >>> + +#ifndef SL_HFXO_MANAGER_CONFIG_H +#define SL_HFXO_MANAGER_CONFIG_H + +// HFXO Manager Configuration + +// Enable custom IRQ handler for crystal HF oscillator. +// Enable if HFXO0_IRQHandler is needed from your application. +// The HFXO IRQ priority must not be changed as the HFXO Manager module needs it to be high priority +// and to stay enabled through atomic sections. +// The function sl_hfxo_manager_irq_handler() will have to be called from you custom handler if this is enabled. +// Default: 0 +#define SL_HFXO_MANAGER_CUSTOM_HFXO_IRQ_HANDLER 0 + +// Enable support for Sleepy Crystals. +// If Enabled and if HFXO fails to startup due to a sleepy crystal, HFXO Manager will retry the startup with more aggressive settings +// before falling back to the configured settings. +// Default: 0 +#define SL_HFXO_MANAGER_SLEEPY_CRYSTAL_SUPPORT 0 + +// + +#endif /* SL_HFXO_MANAGER_CONFIG_H */ + +// <<< end of configuration section >>> diff --git a/src/zwave_ncp_serial_api_controller/config/sl_interrupt_manager_s2_config.h b/src/zwave_ncp_serial_api_controller/config/sl_interrupt_manager_s2_config.h new file mode 100644 index 00000000..714893aa --- /dev/null +++ b/src/zwave_ncp_serial_api_controller/config/sl_interrupt_manager_s2_config.h @@ -0,0 +1,47 @@ +/***************************************************************************//** + * @file + * @brief Interrupt Manager configuration file for series 2 devices. + ******************************************************************************* + * # License + * Copyright 2023 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +// <<< Use Configuration Wizard in Context Menu >>> + +#ifndef SL_INTERRUPT_MANAGER_S2_CONFIG_H +#define SL_INTERRUPT_MANAGER_S2_CONFIG_H + +// Interrupt Manager Configuration + +// Put the interrupt vector table in RAM. +// Set to 1 to put the vector table in RAM. +// Default: 0 +#define SL_INTERRUPT_MANAGER_S2_INTERRUPTS_IN_RAM 0 + +// + +#endif /* SSL_INTERRUPT_MANAGER_S2_CONFIG_H */ + +// <<< end of configuration section >>> diff --git a/src/zwave_ncp_serial_api_controller/config/sl_mbedtls_config.h b/src/zwave_ncp_serial_api_controller/config/sl_mbedtls_config.h new file mode 100644 index 00000000..39b51496 --- /dev/null +++ b/src/zwave_ncp_serial_api_controller/config/sl_mbedtls_config.h @@ -0,0 +1,118 @@ +#ifndef SL_MBEDTLS_CONFIG_H +#define SL_MBEDTLS_CONFIG_H + +// ----------------------------------------------------------------------------- +// User exposed config options + +// <<< Use Configuration Wizard in Context Menu >>> + +// TLS/DTLS configuration + +// Complete list of ciphersuites to use, in order of preference. +// Default: MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8 +// Complete list of ciphersuites to use, in order of preference. +// The value of this configuration should be updated for the application needs. +#define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8 + +// Maximum TLS/DTLS fragment length in bytes (input). +// Default: 768 +// The size configured here determines the size of the internal I/O +// buffer used in mbedTLS when receiving data. +#define SL_MBEDTLS_SSL_IN_CONTENT_LEN 768 + +// Maximum TLS/DTLS fragment length in bytes (output). +// Default: 768 +// The size configured here determines the size of the internal I/O +// buffer used in mbedTLS when sending data. +#define SL_MBEDTLS_SSL_OUT_CONTENT_LEN 768 + +// Enable support for RFC 6066 max_fragment_length extension in SSL. +// Default: 1 +// Enable support for RFC 6066 max_fragment_length extension in SSL. +#define SL_MBEDTLS_SSL_MAX_FRAGMENT_LENGTH 1 + +// Enable support for exporting key block and master secret. +// Default: 1 +// Enable support for exporting key block and master secret. +// This is required for certain users of TLS, e.g. EAP-TLS. +#define SL_MBEDTLS_SSL_EXPORT_KEYS 1 + +// Enable the PSK based ciphersuite modes in SSL / TLS. +// Default: 0 +// Enable the PSK based ciphersuite modes in SSL / TLS. +#define SL_MBEDTLS_KEY_EXCHANGE_PSK_ENABLED 0 + +// Enable the ECDHE-PSK based ciphersuite modes in SSL / TLS. +// Default: 0 +// Enable the ECDHE-PSK based ciphersuite modes in SSL / TLS. +#define SL_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED 0 + +// Enable the ECDHE-ECDSA based ciphersuite modes in SSL / TLS. +// Default: 0 +// Enable the ECDHE-ECDSA based ciphersuite modes in SSL / TLS. +#define SL_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED 0 + +// Enable the ECDHE-RSA based ciphersuite modes in SSL / TLS. +// Default: 0 +// Enable the ECDHE-RSA based ciphersuite modes in SSL / TLS. +#define SL_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED 0 + +// Enable the ECDH-ECDSA based ciphersuite modes in SSL / TLS. +// Default: 0 +// Enable the ECDH-ECDSA based ciphersuite modes in SSL / TLS. +#define SL_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED 0 + +// Enable parsing of the compressed curves. +// Default: 0 +// Enable parsing of the compressed curves. +#define SL_MBEDTLS_ECP_ENABLE_COMPRESSED_CURVE_PARSING 0 + +// + +// RSA configuration + +// Disable use of the Chinese Remainder Theorem for RSA. +// Default: 0 +// Disable use of the Chinese Remainder Theorem for RSA private key +// computations. +#define SL_MBEDTLS_RSA_NO_CRT 0 + +// + +// Miscellaneous configuration + +// Enable Silicon Labs' Mbed TLS- and PSA Crypto drivers. +// Default: 1 +// Enable drivers for hardware acceleration (Mbed TLS and PSA Crypto) and +// secure key handling (PSA Crypto). +#define SL_MBEDTLS_DRIVERS_ENABLED 1 + +// + +// <<< end of configuration section >>> + +// ----------------------------------------------------------------------------- +// Sub-files + +#if defined(SLI_MBEDTLS_CONFIG_AUTOGEN_OVERRIDE_FILE) + #include SLI_MBEDTLS_CONFIG_AUTOGEN_OVERRIDE_FILE +#else + #include "sli_mbedtls_config_autogen.h" +#endif + +#include "sli_mbedtls_omnipresent.h" + +#if SL_MBEDTLS_DRIVERS_ENABLED + #include "sli_mbedtls_acceleration.h" +#endif + +#include "sl_mbedtls_device_config.h" + +// Include transformation logic to apply CMSIS-config configuration options to +// the correct Mbed TLS / PSA Crypto options. +#include "sli_mbedtls_config_transform_autogen.h" + +// Included for backward compatibility reasons. +#include "mbedtls/build_info.h" + +#endif // SL_MBEDTLS_CONFIG_H diff --git a/src/zwave_ncp_serial_api_controller/config/sl_mbedtls_device_config.h b/src/zwave_ncp_serial_api_controller/config/sl_mbedtls_device_config.h new file mode 100644 index 00000000..33c34c42 --- /dev/null +++ b/src/zwave_ncp_serial_api_controller/config/sl_mbedtls_device_config.h @@ -0,0 +1,72 @@ +#ifndef SL_MBEDTLS_DEVICE_CONFIG_H +#define SL_MBEDTLS_DEVICE_CONFIG_H + +// ----------------------------------------------------------------------------- +// User exposed config options + +// <<< Use Configuration Wizard in Context Menu >>> + +// Secure Engine (SE) version configuration + +// Support SE firmware versions older than 1.2.2 <0-1> +// Enable software fallback for ECDH and ECC public key validation on xG21 +// devices running SE firmware versions lower than 1.2.2. +// +// Due to other stability concerns, it is strongly recommended to upgrade +// these devices to the latest firmware revision instead of turning on +// software fallback support. +// +// Not having fallback support will make ECDH operations, as well as PSA +// Crypto public key import, return an error code on affected devices. +// +// Default: 0 +#define SL_SE_SUPPORT_FW_PRIOR_TO_1_2_2 0 + +// Assume an SE firmware version newer than 1.2.2 <0-1> +// For enhanced performance: if it is guaranteed that all devices on which +// this library will run are updated to at least SE FW 1.2.2, then turning +// on this option will remove certain fallback checks, thereby reducing the +// amount of processing required for ECDH and public key verification +// operations. +// Default: 0 +#define SL_SE_ASSUME_FW_AT_LEAST_1_2_2 0 + +// Assume an SE firmware version that is unaffected by Ed25519 errata <0-1> +// For minimal code size and performance savings: if it is guaranteed that +// none of the devices running this library has SE FWs in the range +// [1.2.2, 1.2.8], then enabling this option will disable runtime version +// checks. +// Default: 0 +#define SL_SE_ASSUME_FW_UNAFFECTED_BY_ED25519_ERRATA 0 + +// + +// <<< end of configuration section >>> + +// ----------------------------------------------------------------------------- +// Additional SE version related logic (DO NOT MODIFY) + +// SL_SE_ASSUME_FW_AT_LEAST_1_2_10 is no longer in use, however, it is kept here +// for backwards compatibility. */ +#if defined(SL_SE_ASSUME_FW_AT_LEAST_1_2_10) + #undef SL_SE_ASSUME_FW_AT_LEAST_1_2_2 + #define SL_SE_ASSUME_FW_AT_LEAST_1_2_2 1 + #undef SL_SE_ASSUME_FW_UNAFFECTED_BY_ED25519_ERRATA + #define SL_SE_ASSUME_FW_UNAFFECTED_BY_ED25519_ERRATA 1 +#endif + +// SLI_SE_SUPPORT_FW_PRIOR_TO_1_2_2 is no longer in use, however, it is kept +// here for backwards compatibility. */ +#if defined(SLI_SE_SUPPORT_FW_PRIOR_TO_1_2_2) + #undef SL_SE_SUPPORT_FW_PRIOR_TO_1_2_2 + #define SL_SE_SUPPORT_FW_PRIOR_TO_1_2_2 1 +#endif + +// SLI_SE_ASSUME_FW_AT_LEAST_1_2_2 is no longer in use, however, it is kept +// here for backwards compatibility. */ +#if defined(SLI_SE_ASSUME_FW_AT_LEAST_1_2_2) + #undef SL_SE_ASSUME_FW_AT_LEAST_1_2_2 + #define SL_SE_ASSUME_FW_AT_LEAST_1_2_2 1 +#endif + +#endif // SL_MBEDTLS_DEVICE_CONFIG_H diff --git a/src/zwave_ncp_serial_api_controller/config/sl_memory_config.h b/src/zwave_ncp_serial_api_controller/config/sl_memory_config.h index 1c580349..3afe6966 100644 --- a/src/zwave_ncp_serial_api_controller/config/sl_memory_config.h +++ b/src/zwave_ncp_serial_api_controller/config/sl_memory_config.h @@ -1,28 +1,11 @@ #ifndef SL_MEMORY_CONFIG_H #define SL_MEMORY_CONFIG_H -// <<< Use Configuration Wizard in Context Menu >>> -// Memory configuration +#include "sl_memory_manager_region_config.h" +#include "sl_common.h" -// Stack size for the application. -// Default: 4096 -// The stack size configured here will be used by the stack that the -// application uses when coming out of a reset. -#ifndef SL_STACK_SIZE - #define SL_STACK_SIZE 1280 +#ifndef SL_SUPPRESS_DEPRECATION_WARNINGS_SDK_2024_6 +#warning "This file is deprecated as of Simplicity SDK 2024.6. Content was moved to sl_memory_manager_region_config.h." #endif -// Minimum heap size for the application. -// Default: 2048 -// Note that this value will configure the c heap which is normally used by -// malloc() and free() from the c library. The value defines a minimum heap -// size that is guaranteed to be available. The available heap may be larger -// to make use of any memory that would otherwise remain unused. -#ifndef SL_HEAP_SIZE - #define SL_HEAP_SIZE 128 -#endif - -// -// <<< end of configuration section >>> - #endif diff --git a/src/zwave_ncp_serial_api_controller/config/sl_memory_manager_config.h b/src/zwave_ncp_serial_api_controller/config/sl_memory_manager_config.h new file mode 100644 index 00000000..7e4b0567 --- /dev/null +++ b/src/zwave_ncp_serial_api_controller/config/sl_memory_manager_config.h @@ -0,0 +1,49 @@ +/***************************************************************************//** + * @file + * @brief Memory Heap Allocator configuration file. + ******************************************************************************* + * # License + * Copyright 2024 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +// <<< Use Configuration Wizard in Context Menu >>> + +#ifndef SL_MEMORY_MANAGER_CONFIG_H +#define SL_MEMORY_MANAGER_CONFIG_H + +// Memory Manager Configuration + +// Minimum block allocation size +// <32-128:8> +// Minimum block allocation size to avoid creating a block too small while splitting up an allocated block. +// Size expressed in bytes and can only be a multiple of 8 bytes for the proper data alignment management done by the dynamic allocator malloc() function. +// Default: 32 +#define SL_MEMORY_MANAGER_BLOCK_ALLOCATION_MIN_SIZE (32) + +// + +// <<< end of configuration section >>> + +#endif /* SL_MEMORY_MANAGER_CONFIG_H */ diff --git a/src/zwave_ncp_serial_api_controller/config/sl_memory_manager_region_config.h b/src/zwave_ncp_serial_api_controller/config/sl_memory_manager_region_config.h new file mode 100644 index 00000000..f35503d7 --- /dev/null +++ b/src/zwave_ncp_serial_api_controller/config/sl_memory_manager_region_config.h @@ -0,0 +1,49 @@ +/***************************************************************************//** + * @file + * @brief Memory Heap and stack size configuration file. + ******************************************************************************* + * # License + * Copyright 2024 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +// <<< Use Configuration Wizard in Context Menu >>> + +#ifndef SL_MEMORY_MANAGER_REGION_CONFIG_H +#define SL_MEMORY_MANAGER_REGION_CONFIG_H + +// Memory configuration + +// Stack size for the application. +// Default: 4096 +// The stack size configured here will be used by the stack that the +// application uses when coming out of a reset. +#ifndef SL_STACK_SIZE +#define SL_STACK_SIZE 1280 +#endif +// + +// <<< end of configuration section >>> + +#endif /* SL_MEMORY_MANAGER_REGION_CONFIG_H */ diff --git a/src/zwave_ncp_serial_api_controller/config/sl_mx25_flash_shutdown_usart_config.h b/src/zwave_ncp_serial_api_controller/config/sl_mx25_flash_shutdown_usart_config.h new file mode 100644 index 00000000..1a380b3e --- /dev/null +++ b/src/zwave_ncp_serial_api_controller/config/sl_mx25_flash_shutdown_usart_config.h @@ -0,0 +1,67 @@ +/***************************************************************************//** + * @file + * @brief SL_MX25_FLASH_SHUTDOWN_USART Config + ******************************************************************************* + * # License + * Copyright 2020 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +#ifndef SL_MX25_FLASH_SHUTDOWN_CONFIG_H +#define SL_MX25_FLASH_SHUTDOWN_CONFIG_H + +// <<< sl:start pin_tool >>> +// {usart signal=TX,RX,CLK} SL_MX25_FLASH_SHUTDOWN +// [USART_SL_MX25_FLASH_SHUTDOWN] +#define SL_MX25_FLASH_SHUTDOWN_PERIPHERAL USART0 +#define SL_MX25_FLASH_SHUTDOWN_PERIPHERAL_NO 0 + +// USART0 TX on PC01 +#define SL_MX25_FLASH_SHUTDOWN_TX_PORT gpioPortC +#define SL_MX25_FLASH_SHUTDOWN_TX_PIN 1 + +// USART0 RX on PC02 +#define SL_MX25_FLASH_SHUTDOWN_RX_PORT gpioPortC +#define SL_MX25_FLASH_SHUTDOWN_RX_PIN 2 + +// USART0 CLK on PC03 +#define SL_MX25_FLASH_SHUTDOWN_CLK_PORT gpioPortC +#define SL_MX25_FLASH_SHUTDOWN_CLK_PIN 3 + +// [USART_SL_MX25_FLASH_SHUTDOWN] + +// SL_MX25_FLASH_SHUTDOWN_CS + +// $[GPIO_SL_MX25_FLASH_SHUTDOWN_CS] +#ifndef SL_MX25_FLASH_SHUTDOWN_CS_PORT +#define SL_MX25_FLASH_SHUTDOWN_CS_PORT gpioPortA +#endif +#ifndef SL_MX25_FLASH_SHUTDOWN_CS_PIN +#define SL_MX25_FLASH_SHUTDOWN_CS_PIN 6 +#endif +// [GPIO_SL_MX25_FLASH_SHUTDOWN_CS]$ + +// <<< sl:end pin_tool >>> + +#endif // SL_MX25_FLASH_SHUTDOWN_CONFIG_H diff --git a/src/zwave_ncp_serial_api_controller/config/sl_power_manager_config.h b/src/zwave_ncp_serial_api_controller/config/sl_power_manager_config.h index e4b1da09..42f59d7d 100644 --- a/src/zwave_ncp_serial_api_controller/config/sl_power_manager_config.h +++ b/src/zwave_ncp_serial_api_controller/config/sl_power_manager_config.h @@ -57,8 +57,22 @@ #define SL_POWER_MANAGER_DEBUG_POOL_SIZE 10 // +// Pin retention mode +// +// No retention +// Retention through EM4 +// Retention through EM4 and wakeup +// power_manager_pin_retention_disable +#define SL_POWER_MANAGER_INIT_EMU_EM4_PIN_RETENTION_MODE EMU_EM4CTRL_EM4IORETMODE_DISABLE + +// Enable EM2 debugging feature +// Enable or disable debugging features. +// Default: 1 +#define SL_POWER_MANAGER_INIT_EMU_EM2_DEBUG_ENABLE 1 +// + // #endif /* SL_POWER_MANAGER_CONFIG_H */ -// <<< end of configuration section >>> \ No newline at end of file +// <<< end of configuration section >>> diff --git a/src/zwave_ncp_serial_api_controller/config/sl_rail_util_pa_config.h b/src/zwave_ncp_serial_api_controller/config/sl_rail_util_pa_config.h index 0c983c34..9c389c7a 100644 --- a/src/zwave_ncp_serial_api_controller/config/sl_rail_util_pa_config.h +++ b/src/zwave_ncp_serial_api_controller/config/sl_rail_util_pa_config.h @@ -46,18 +46,16 @@ // Milli-volts on PA supply pin (PA_VDD) // <0-65535:1> // Default: 3300 -#define SL_RAIL_UTIL_PA_VOLTAGE_MV 1800 +#define SL_RAIL_UTIL_PA_VOLTAGE_MV 3300 // 2.4 GHz PA Selection -// High Power -// Low Power // Disable -// Default: RAIL_TX_POWER_MODE_2P4GIG_HP +// Default: RAIL_TX_POWER_MODE_NONE #define SL_RAIL_UTIL_PA_SELECTION_2P4GHZ RAIL_TX_POWER_MODE_NONE // Sub-1 GHz PA Selection -// Enable +// Enable // Disable -// Default: RAIL_TX_POWER_MODE_SUBGIG -#define SL_RAIL_UTIL_PA_SELECTION_SUBGHZ RAIL_TX_POWER_MODE_SUBGIG +// Default: RAIL_TX_POWER_MODE_SUBGIG_HIGHEST +#define SL_RAIL_UTIL_PA_SELECTION_SUBGHZ RAIL_TX_POWER_MODE_SUBGIG_HIGHEST // // PA Curve Configuration @@ -77,4 +75,4 @@ // <<< end of configuration section >>> -#endif // SL_RAIL_UTIL_PA_CONFIG_H \ No newline at end of file +#endif // SL_RAIL_UTIL_PA_CONFIG_H diff --git a/src/zwave_ncp_serial_api_controller/config/sl_rail_util_power_manager_init_config.h b/src/zwave_ncp_serial_api_controller/config/sl_rail_util_power_manager_init_config.h index a9df48b4..08dc1fe8 100644 --- a/src/zwave_ncp_serial_api_controller/config/sl_rail_util_power_manager_init_config.h +++ b/src/zwave_ncp_serial_api_controller/config/sl_rail_util_power_manager_init_config.h @@ -41,4 +41,4 @@ // // <<< end of configuration section >>> -#endif // SL_RAIL_UTIL_POWER_MANAGER_INIT_CONFIG_H \ No newline at end of file +#endif // SL_RAIL_UTIL_POWER_MANAGER_INIT_CONFIG_H diff --git a/src/zwave_ncp_serial_api_controller/config/sl_sleeptimer_config.h b/src/zwave_ncp_serial_api_controller/config/sl_sleeptimer_config.h index bba646d6..507f03c6 100644 --- a/src/zwave_ncp_serial_api_controller/config/sl_sleeptimer_config.h +++ b/src/zwave_ncp_serial_api_controller/config/sl_sleeptimer_config.h @@ -52,7 +52,7 @@ // WTIMER // TIMER // Selection of the Timer Peripheral Used by the Sleeptimer -#define SL_SLEEPTIMER_PERIPHERAL SL_SLEEPTIMER_PERIPHERAL_DEFAULT +#define SL_SLEEPTIMER_PERIPHERAL SL_SLEEPTIMER_PERIPHERAL_BURTC // TIMER/WTIMER Instance Used by Sleeptimer (not applicable for other peripherals) // Make sure TIMER instance size is 32bits. Check datasheet for 32bits TIMERs. @@ -79,4 +79,4 @@ #endif /* SLEEPTIMER_CONFIG_H */ -// <<< end of configuration section >>> \ No newline at end of file +// <<< end of configuration section >>> diff --git a/src/zwave_ncp_serial_api_controller/config/zaf_appname_config.h b/src/zwave_ncp_serial_api_controller/config/zaf_appname_config.h index c52bf4a4..7a35fafc 100644 --- a/src/zwave_ncp_serial_api_controller/config/zaf_appname_config.h +++ b/src/zwave_ncp_serial_api_controller/config/zaf_appname_config.h @@ -1,6 +1,6 @@ /***************************************************************************//** * # License - * Copyright 2023 Silicon Laboratories Inc. www.silabs.com + * Copyright 2024 Silicon Laboratories Inc. www.silabs.com ******************************************************************************* * * The licensor of this software is Silicon Laboratories Inc. Your use of this @@ -27,4 +27,4 @@ // <<< end of configuration section >>> -#endif /* _ZAF_APPNAME_CONFIG_H_ */ \ No newline at end of file +#endif /* _ZAF_APPNAME_CONFIG_H_ */ diff --git a/src/zwave_ncp_serial_api_controller/config/zaf_config.h b/src/zwave_ncp_serial_api_controller/config/zaf_config.h index a51b4bf3..df81602f 100644 --- a/src/zwave_ncp_serial_api_controller/config/zaf_config.h +++ b/src/zwave_ncp_serial_api_controller/config/zaf_config.h @@ -1,6 +1,6 @@ /***************************************************************************//** * # License - * Copyright 2023 Silicon Laboratories Inc. www.silabs.com + * Copyright 2024 Silicon Laboratories Inc. www.silabs.com ******************************************************************************* * * The licensor of this software is Silicon Laboratories Inc. Your use of this @@ -27,8 +27,8 @@ // Indicates if the bootloader can be updated // Includes the bootloader as a target -// Default: 0 -#define ZAF_CONFIG_BOOTLOADER_UPGRADABLE 0 +// Default: 1 +#define ZAF_CONFIG_BOOTLOADER_UPGRADABLE 1 // // Command Class Firmware Update - Firmware targets @@ -330,7 +330,7 @@ // Entry Control // Generic Controller // Meter -// Repeater End Device +// Repeater End Device // Sensor Multilevel // Switch Binary // Switch Multilevel @@ -338,7 +338,7 @@ // Wall Controller // Sensor Notification // Default: 0 -#define ZAF_CONFIG_GENERIC_TYPE 0 +#define ZAF_CONFIG_GENERIC_TYPE GENERIC_TYPE_STATIC_CONTROLLER // The specific type of a device. // The specific type of a device. A certain device type requires a specific type, e.g., the Lock device type requires the specific type to be Door Lock. @@ -358,10 +358,10 @@ // Secure Keypad // Routing Sensor Multilevel // Notification Sensor -// Repeater End Device +// Repeater End Device // Infrared Repeater // Default: SPECIFIC_TYPE_NOT_USED -#define ZAF_CONFIG_SPECIFIC_TYPE 0 +#define ZAF_CONFIG_SPECIFIC_TYPE SPECIFIC_TYPE_PC_CONTROLLER // // Multi Channel Configuration @@ -397,4 +397,4 @@ // <<< end of configuration section >>> -#endif /* _ZAF_CONFIG_H_ */ \ No newline at end of file +#endif /* _ZAF_CONFIG_H_ */ diff --git a/src/zwave_ncp_serial_api_controller/config/zaf_event_distributor_core_config.h b/src/zwave_ncp_serial_api_controller/config/zaf_event_distributor_core_config.h index b5cd3958..285300cc 100644 --- a/src/zwave_ncp_serial_api_controller/config/zaf_event_distributor_core_config.h +++ b/src/zwave_ncp_serial_api_controller/config/zaf_event_distributor_core_config.h @@ -1,6 +1,6 @@ /***************************************************************************//** * # License - * Copyright 2023 Silicon Laboratories Inc. www.silabs.com + * Copyright 2024 Silicon Laboratories Inc. www.silabs.com ******************************************************************************* * * The licensor of this software is Silicon Laboratories Inc. Your use of this @@ -27,4 +27,4 @@ // <<< end of configuration section >>> -#endif /* _ZAF_EVENT_DISTRIBUTOR_CORE_CONFIG_H_ */ \ No newline at end of file +#endif /* _ZAF_EVENT_DISTRIBUTOR_CORE_CONFIG_H_ */ diff --git a/src/zwave_ncp_serial_api_controller/config/zpal_zwave_nvm_instance_config.h b/src/zwave_ncp_serial_api_controller/config/zpal_zwave_nvm_instance_config.h deleted file mode 100644 index d6ffa898..00000000 --- a/src/zwave_ncp_serial_api_controller/config/zpal_zwave_nvm_instance_config.h +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************//** - * # License - * Copyright 2023 Silicon Laboratories Inc. www.silabs.com - ******************************************************************************* - * - * The licensor of this software is Silicon Laboratories Inc. Your use of this - * software is governed by the terms of the Silicon Labs Master Software License - * Agreement (MSLA) available at - * https://www.silabs.com/about-us/legal/master-software-license-agreement - * By installing, copying or otherwise using this software, you agree to the - * terms of the MSLA. - * - ******************************************************************************/ - -#ifndef _ZPAL_ZWAVE_NVM_INSTANCE_CONFIG_H_ -#define _ZPAL_ZWAVE_NVM_INSTANCE_CONFIG_H_ - -// <<< Use Configuration Wizard in Context Menu >>> - -// ZAF NVM3 config - -#ifndef ZPAL_ZW_NVM_CACHE_SIZE -// NVM3 Z-Wave Instance Cache Size -// Number of NVM3 objects to cache. To reduce access times this number -// should be equal to or higher than the number of NVM3 objects in the -// Z-Wave NVM3 instance (all ZAF and application NVM3 objects). -// Count of objects stored by ZAF depend on the application. At least -// 11 object should be reserved for ZAF. -// see [TODO add a user documentation] for more details -// Default: 11 -#define ZPAL_ZW_NVM_CACHE_SIZE 11 -#endif - -#ifndef ZPAL_ZW_NVM_MAX_OBJECT_SIZE -// NVM3 Z-Wave Instance Max Object Size -// Size of the largest object that can be stored by ZAF or application. -// For ZAF, it should be at least the largest of: -// - CC_NOTIFICATION_MAX_NOTIFICATIONS -// - 3 * CC_ASSOCIATION_MAX_NODES_IN_GROUP * (1+ZAF_CONFIG_NUMBER_OF_END_POINTS) + CC_ASSOCIATION_MAX_GROUPS_PER_ENDPOINT -// - 204 (minimum required by nvm3 library) -// - 512 (minimum required for controller) -// Default: 512 -#define ZPAL_ZW_NVM_MAX_OBJECT_SIZE 512 -#endif - -#ifndef ZPAL_ZW_NVM_INSTANCE_REPACK_HEADROOM -// NVM3 Z-Wave Instance User Repack Headroom -// Headroom determining how many bytes below the forced repack limit the user -// repack limit should be placed. -// Default: 12 -#define ZPAL_ZW_NVM_INSTANCE_REPACK_HEADROOM 12 -#endif - -// - -// <<< end of configuration section >>> - -#endif /* _ZPAL_ZWAVE_NVM_INSTANCE_CONFIG_H_ */ \ No newline at end of file diff --git a/src/zwave_ncp_serial_api_controller/config/zw_build_no.h b/src/zwave_ncp_serial_api_controller/config/zw_build_no.h deleted file mode 100644 index 09377ef4..00000000 --- a/src/zwave_ncp_serial_api_controller/config/zw_build_no.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @file - * @copyright 2021 Silicon Laboratories Inc. - */ - -#ifndef _ZW_BUILD_NO_H_ -#define _ZW_BUILD_NO_H_ - -#include - -// Application Framework Build number. -// If not otherwise specified, it is the same as Z-Wave Protocol Build number -#ifndef ZAF_BUILD_NO -#define ZAF_BUILD_NO ZW_GetProtocolBuildNumber() -#endif - -#endif /* _ZW_BUILD_NO_H_ */ \ No newline at end of file diff --git a/src/zwave_ncp_serial_api_controller/config/zw_config_rf.h b/src/zwave_ncp_serial_api_controller/config/zw_config_rf.h index 920d318e..b8888241 100644 --- a/src/zwave_ncp_serial_api_controller/config/zw_config_rf.h +++ b/src/zwave_ncp_serial_api_controller/config/zw_config_rf.h @@ -1,6 +1,6 @@ /***************************************************************************//** * # License - * Copyright 2023 Silicon Laboratories Inc. www.silabs.com + * Copyright 2024 Silicon Laboratories Inc. www.silabs.com ******************************************************************************* * * The licensor of this software is Silicon Laboratories Inc. Your use of this @@ -24,7 +24,7 @@ // Default: 140 #define APP_MAX_TX_POWER_LR 140 -// The maximum allowed Tx power in deci dBm for Z-Wave network <-100..140:1> +// The maximum allowed Tx power in deci dBm for Z-Wave network <-100..200:1> // The maximum allowed Tx power in deci dBm for Z-Wave network // Default: 0 #define APP_MAX_TX_POWER 0 @@ -43,4 +43,4 @@ // <<< end of configuration section >>> -#endif /* _ZW_CONFIG_RF_H_ */ \ No newline at end of file +#endif /* _ZW_CONFIG_RF_H_ */ diff --git a/src/zwave_ncp_serial_api_controller/config/zw_region_config.h b/src/zwave_ncp_serial_api_controller/config/zw_region_config.h index 60dc9f9a..43f75511 100644 --- a/src/zwave_ncp_serial_api_controller/config/zw_region_config.h +++ b/src/zwave_ncp_serial_api_controller/config/zw_region_config.h @@ -1,6 +1,6 @@ /***************************************************************************//** * # License - * Copyright 2023 Silicon Laboratories Inc. www.silabs.com + * Copyright 2024 Silicon Laboratories Inc. www.silabs.com ******************************************************************************* * * The licensor of this software is Silicon Laboratories Inc. Your use of this @@ -33,6 +33,7 @@ // Russia // United States // United States Long Range +// Europe Long Range // Default: REGION_DEFAULT #define ZW_REGION REGION_DEFAULT @@ -40,4 +41,4 @@ // <<< end of configuration section >>> -#endif /* _ZW_REGION_CONFIG_H_ */ \ No newline at end of file +#endif /* _ZW_REGION_CONFIG_H_ */ diff --git a/src/zwave_ncp_serial_api_controller/config/zw_version_config.h b/src/zwave_ncp_serial_api_controller/config/zw_version_config.h index ba8b15af..423000ef 100644 --- a/src/zwave_ncp_serial_api_controller/config/zw_version_config.h +++ b/src/zwave_ncp_serial_api_controller/config/zw_version_config.h @@ -1,6 +1,6 @@ /***************************************************************************//** * # License - * Copyright 2023 Silicon Laboratories Inc. www.silabs.com + * Copyright 2024 Silicon Laboratories Inc. www.silabs.com ******************************************************************************* * * The licensor of this software is Silicon Laboratories Inc. Your use of this @@ -57,4 +57,4 @@ #define APP_PATCH SDK_VERSION_PATCH #endif #endif -#endif /* _ZW_VERSION_CONFIG_H_ */ \ No newline at end of file +#endif /* _ZW_VERSION_CONFIG_H_ */ diff --git a/src/zwave_ncp_serial_api_controller/controller_supported_func.h b/src/zwave_ncp_serial_api_controller/controller_supported_func.h index d2789b5a..afe5698e 100644 --- a/src/zwave_ncp_serial_api_controller/controller_supported_func.h +++ b/src/zwave_ncp_serial_api_controller/controller_supported_func.h @@ -3,134 +3,39 @@ * @copyright 2022 Silicon Laboratories Inc. */ -/* Generated file copied from Sdk670 with std. functions supported by static controller. */ -/* Following defines has been disable for build purposes: - * SUPPORT_ZW_AES_ECB - * SUPPORT_ZW_SET_EXT_INT_LEVEL - */ +#include "common_supported_func.h" + #define SUPPORT_GET_ROUTING_TABLE_LINE 1 /* ZW_GetRoutingInfo */ -#define SUPPORT_LOCK_ROUTE_RESPONSE 1 /* ZW_LockRoute */ -#define SUPPORT_MEMORY_GET_BUFFER 1 /* MemoryGetBuffer */ -#define SUPPORT_MEMORY_GET_BYTE 1 /* MemoryGetByte */ -#define SUPPORT_MEMORY_GET_ID 1 /* MemoryGetID */ -#define SUPPORT_MEMORY_PUT_BUFFER 1 /* MemoryPutBuffer */ -#define SUPPORT_MEMORY_PUT_BYTE 1 /* MemoryPutByte */ -#define SUPPORT_NVM_GET_ID 1 /* NVM_get_id */ -#define SUPPORT_NVM_EXT_READ_LONG_BUFFER 1 /* NVM_ext_read_long_buffer */ -#define SUPPORT_NVM_EXT_READ_LONG_BYTE 1 /* NVM_ext_read_long_byte */ -#define SUPPORT_NVM_EXT_WRITE_LONG_BYTE 0 /* NVM_ext_write_long_byte */ -#define SUPPORT_NVM_EXT_WRITE_LONG_BUFFER 0 /* NVM_ext_write_long_buffer*/ #define SUPPORT_NVM_BACKUP_RESTORE 1 /* NVM_backup_restore */ -#define SUPPORT_PWR_CLK_PD 0 /* PWR_Clk_PD */ -#define SUPPORT_PWR_CLK_PUP 0 /* PWR_Clk_PUp */ -#define SUPPORT_PWR_SELECT_CLK 0 /* PWR_Select_Clk */ -#define SUPPORT_PWR_SETSTOPMODE 0 /* PWR_SetStopMode */ -#define SUPPORT_STORE_HOMEID 0 /* ZW_StoreHomeID */ -#define SUPPORT_STORE_NODEINFO 0 /* notUsed */ +#define SUPPORT_NVM_EXT_BACKUP_RESTORE 1 /* NVM_backup_restore extended */ #define SUPPORT_ZW_ADD_NODE_TO_NETWORK 1 /* ZW_AddNodeToNetwork */ -#define SUPPORT_ZW_AES_ECB 0 /* ZW_AES_ECB */ -#define SUPPORT_ZW_ARE_NODES_NEIGHBOURS 0 /* notUsed */ #define SUPPORT_ZW_ASSIGN_RETURN_ROUTE 1 /* ZW_AssignReturnRoute */ #define SUPPORT_ZW_ASSIGN_PRIORITY_RETURN_ROUTE 1 /* ZW_AssignPriorityReturnRoute */ #define SUPPORT_ZW_ASSIGN_SUC_RETURN_ROUTE 1 /* ZW_AssignSUCReturnRoute */ #define SUPPORT_ZW_ASSIGN_PRIORITY_SUC_RETURN_ROUTE 1 /* ZW_AssignPrioritySUCReturnRoute */ #define SUPPORT_ZW_CONTROLLER_CHANGE 1 /* ZW_ControllerChange */ -#define SUPPORT_ZW_CREATE_NEW_PRIMARY 0 /* NotUsed */ #define SUPPORT_ZW_DELETE_RETURN_ROUTE 1 /* ZW_DeleteReturnRoute */ #define SUPPORT_ZW_DELETE_SUC_RETURN_ROUTE 1 /* ZW_DeleteSUCReturnRoute */ -#define SUPPORT_ZW_ENABLE_SUC 0 /* ZW_EnableSUC */ -#define SUPPORT_ZW_EXPLORE_REQUEST_INCLUSION 1 /* ZW_ExploreRequestInclusion */ -#define SUPPORT_ZW_EXPLORE_REQUEST_EXCLUSION 1 /* ZW_ExploreRequestExclusion */ #define SUPPORT_ZW_GET_CONTROLLER_CAPABILITIES 1 /* ZW_GetControllerCapabilities */ #define SUPPORT_ZW_GET_PRIORITY_ROUTE 1 /* ZW_GetPriorityRoute */ #define SUPPORT_ZW_SET_PRIORITY_ROUTE 1 /* ZW_SetPriorityRoute */ -#define SUPPORT_ZW_GET_NEIGHBOR_COUNT 0 /*notUsed */ -#define SUPPORT_ZW_GET_NODE_PROTOCOL_INFO 1 /* ZW_GetNodeProtocolInfo */ -#define SUPPORT_ZW_GET_PROTOCOL_STATUS 1 /* ZW_GetProtocolStatus */ -#define SUPPORT_ZW_GET_PROTOCOL_VERSION 1 /* ZW_GetProtocolVersion */ -#define SUPPORT_ZW_GET_RANDOM 1 /* ZW_GetRandomWord */ -#define SUPPORT_ZW_GET_ROUTING_MAX 0 /* ZW_GetRoutingMAX */ -#define SUPPORT_ZW_GET_SUC_NODE_ID 1 /* ZW_GetSUCNodeID */ -#define SUPPORT_ZW_GET_VERSION 1 /* ZW_Version */ #define SUPPORT_ZW_IS_FAILED_NODE_ID 1 /* ZW_isFailedNode */ -#define SUPPORT_ZW_IS_NODE_WITHIN_DIRECT_RANGE 0 /* NotUsed */ -#define SUPPORT_ZW_IS_PRIMARY_CTRL 0 /* NotUsed */ -#define SUPPORT_ZW_IS_WUT_KICKED 0 /* ZW_IsWutKicked */ -#define SUPPORT_ZW_NEW_CONTROLLER 0 /* ZW_NewController */ -#define SUPPORT_ZW_RANDOM 0 /* NotUsed */ -#define SUPPORT_ZW_REDISCOVERY_NEEDED 0 /* ZW_RediscoveryNeeded */ #define SUPPORT_ZW_REMOVE_FAILED_NODE_ID 1 /* ZW_RemoveFailedNode */ #define SUPPORT_ZW_REMOVE_NODE_FROM_NETWORK 1 /* ZW_RemoveNodeFromNetwork */ #define SUPPORT_ZW_REMOVE_NODE_ID_FROM_NETWORK 1 /* ZW_RemoveNodeIDFromNetwork */ #define SUPPORT_ZW_REPLACE_FAILED_NODE 1 /* ZW_ReplaceFailedNode */ #define SUPPORT_ZW_REPLICATION_COMMAND_COMPLETE 1 /* ZW_ReplicationReceiveComplete */ #define SUPPORT_ZW_REPLICATION_SEND_DATA 1 /* ZW_ReplicationSend */ -#define SUPPORT_ZW_REQUEST_NETWORK_UPDATE 1 /* ZW_RequestNetWorkUpdate */ -#define SUPPORT_ZW_REQUEST_NEW_ROUTE_DESTINATIONS 0 /* NotUsed */ #define SUPPORT_ZW_REQUEST_NODE_INFO 1 /* ZW_RequestNodeInfo */ #define SUPPORT_ZW_REQUEST_NODE_NEIGHBOR_UPDATE 1 /* ZW_RequestNodeNeighborUpdate */ -#define SUPPORT_ZW_RF_POWER_LEVEL_GET 0 /* ZW_RFPowerLevelGet */ -#define SUPPORT_ZW_RF_POWER_LEVEL_REDISCOVERY_SET 0 /* NotUsed */ -#define SUPPORT_ZW_RF_POWER_LEVEL_SET 0 /* ZW_RFPowerLevelSet */ -#define SUPPORT_ZW_SEND_DATA 1 /* ZW_SendData */ #define SUPPORT_ZW_SEND_DATA_EX 0 /* ZW_SendDataEx */ -#define SUPPORT_ZW_SEND_DATA_ABORT 1 /* ZW_SendDataAbort */ -#define SUPPORT_ZW_SEND_DATA_META 0 /* ZW_SendDataMeta */ -#define SUPPORT_ZW_SEND_DATA_META_BRIDGE 0 /* ZW_SendDataMeta_Bridge */ -#define SUPPORT_ZW_SEND_DATA_META_MR 0 /* NotUsed */ -#define SUPPORT_ZW_SEND_DATA_MR 0 /* NotUsed */ -#define SUPPORT_ZW_SEND_DATA_MULTI 1 /* ZW_SendDataMulti */ #define SUPPORT_ZW_SEND_DATA_MULTI_EX 0 /* ZW_SendDataMultiEx */ -#define SUPPORT_ZW_SET_NETWORK_KEY_S0 0 /* ZW_SetNetworkKeyS0 */ #define SUPPORT_ZW_GET_SECURITY_KEYS 0 /* ZW_GetSecurityKeys */ -#define SUPPORT_ZW_SEND_NODE_INFORMATION 1 /* ZW_SendNodeInformation */ -#define SUPPORT_ZW_SEND_SLAVE_DATA 0 /* ZW_SendSlaveData */ #define SUPPORT_ZW_SEND_SUC_ID 1 /* ZW_SendSUCID */ #define SUPPORT_ZW_SEND_TEST_FRAME 1 /* ZW_SendTestFrame */ -#define SUPPORT_ZW_SET_DEFAULT 1 /* ZW_SetDefault */ -#define SUPPORT_ZW_SET_EXT_INT_LEVEL 0 /* ZW_SetExtIntLevel */ -#define SUPPORT_ZW_SET_LEARN_MODE 1 /* ZW_SetLearnMode */ -#define SUPPORT_ZW_SET_LEARN_NODE_STATE 0 /* ZW_SetLearnNodeState */ -#define SUPPORT_ZW_SET_PROMISCUOUS_MODE 0 /* ZW_SetPromiscuousMode */ -#define SUPPORT_ZW_SET_RF_RECEIVE_MODE 1 /* ZW_SetRFReceiveMode */ -#define SUPPORT_ZW_SET_ROUTING_INFO 0 /* NotUsed */ #define SUPPORT_ZW_SET_ROUTING_MAX 1 /* ZW_SetRoutingMAX*/ -#define SUPPORT_ZW_SET_SLEEP_MODE 0 /* ZW_SetSleepMode */ -#define SUPPORT_ZW_SET_SUC_NODE_ID 1 /* ZW_SetSUCNodeID */ -#define SUPPORT_ZW_SET_WUT_TIMEOUT 0 /* ZW_SetWutTimeout */ -#define SUPPORT_ZW_SUPPORT9600_ONLY 0 /* ZW_Support9600Only */ -#define SUPPORT_ZW_TYPE_LIBRARY 1 /* ZW_Type_Library */ -#define SUPPORT_ZW_WATCHDOG_DISABLE 0 /* ZW_WatchDogDisable */ -#define SUPPORT_ZW_WATCHDOG_ENABLE 0 /* ZW_WatchDogEnable */ -#define SUPPORT_ZW_WATCHDOG_KICK 0 /* ZW_WatchDogKick */ -#define SUPPORT_ZW_WATCHDOG_START 1 /* ZW_WatchDogEnable */ -#define SUPPORT_ZW_WATCHDOG_STOP 1 /* ZW_WatchDogDisable */ #define SUPPORT_ZW_NVR_GET_VALUE 1 /* ZW_NVRGetValue */ -#define SUPPORT_FUNC_ID_CLEAR_TX_TIMERS 1 /* ZW_ClearTxTimers */ -#define SUPPORT_FUNC_ID_GET_TX_TIMERS 1 /* ZW_GetTxTimer */ -#define SUPPORT_ZW_CLEAR_NETWORK_STATS 1 /* ZW_ClearNetworkStats */ -#define SUPPORT_ZW_GET_NETWORK_STATS 1 /* ZW_GetNetworkStats */ -#define SUPPORT_ZW_GET_BACKGROUND_RSSI 1 /* ZW_GetBackgroundRSSI */ -#define SUPPORT_ZW_SET_LISTEN_BEFORE_TALK_THRESHOLD 1 - -#define SUPPORT_ZW_NETWORK_MANAGEMENT_SET_MAX_INCLUSION_REQUEST_INTERVALS 1 - -/* SerialAPI functionality support definitions */ -#define SUPPORT_SEND_DATA_TIMING 1 -/* Only Controllers can Add/Remove other nodes */ - -/* Enable support for SerialAPI Startup Notification */ -#define SUPPORT_SERIAL_API_STARTUP_NOTIFICATION 1 - -/* Common SerialAPI functionality support definitions */ -#define SUPPORT_SERIAL_API_GET_INIT_DATA 1 -#define SUPPORT_SERIAL_API_APPL_NODE_INFORMATION 1 #define SUPPORT_APPLICATION_COMMAND_HANDLER_BRIDGE 1 -#define SUPPORT_APPLICATION_COMMAND_HANDLER 0 -#define SUPPORT_SERIAL_API_SET_TIMEOUTS 1 - -#define SUPPORT_SERIAL_API_SOFT_RESET 1 -#define SUPPORT_SERIAL_API_SETUP 1 #define SUPPORT_ZW_INITIATE_SHUTDOWN 1 #define SUPPORT_SERIAL_API_GET_LR_NODES 1 #define SUPPORT_SERIAL_GET_LR_CHANNEL 1 @@ -145,67 +50,34 @@ /* Common for all Controllers */ /* SerialAPI functionality support definitions */ #define SUPPORT_ZW_APPLICATION_CONTROLLER_UPDATE 1 -#define SUPPORT_ZW_APPLICATION_UPDATE 1 /**************************************************************************/ /* Controller */ /* Specific SerialAPI functionality support definitions */ /**************************************************************************/ -/* Installer Controller */ -/* Specific SerialAPI functionality support definitions */ -#if defined(ZW_INSTALLER) - -#define SUPPORT_GET_TX_COUNTER 1 -#define SUPPORT_RESET_TX_COUNTER 1 -#define SUPPORT_SERIAL_API_APPL_SLAVE_NODE_INFORMATION 0 -#define SUPPORT_APPLICATION_SLAVE_COMMAND_HANDLER 0 -#define SUPPORT_ZW_SEND_SLAVE_NODE_INFORMATION 0 +#define SUPPORT_ZW_SEND_SLAVE_NODE_INFORMATION 1 -/* Not supported by any controllers except controller portable and installer libs */ -#endif /* ZW_INSTALLER */ /**************************************************************************/ /* Bridge Controller */ /* specific SerialAPI functionality support definitions */ #ifdef ZW_CONTROLLER_BRIDGE -#define SUPPORT_ZW_SEND_DATA 1 /* ZW_SendData */ -#define SUPPORT_GET_TX_COUNTER 0 -#define SUPPORT_RESET_TX_COUNTER 0 #define SUPPORT_ZW_GET_VIRTUAL_NODES 1 /* ZW_GetVirtualNodes */ #define SUPPORT_ZW_IS_VIRTUAL_NODE 1 /* ZW_IsVirtualNode */ #define SUPPORT_ZW_SEND_DATA_BRIDGE 1 /* ZW_SendData_Bridge */ #define SUPPORT_ZW_SEND_DATA_MULTI_BRIDGE 1 /* ZW_SendDataMulti_Bridge */ #define SUPPORT_ZW_SET_SLAVE_LEARN_MODE 1 /* ZW_SetSlaveLearnMode */ #define SUPPORT_SERIAL_API_APPL_SLAVE_NODE_INFORMATION 1 - -#if SUPPORT_APPLICATION_COMMAND_HANDLER_BRIDGE -#define SUPPORT_APPLICATION_SLAVE_COMMAND_HANDLER 0 -#else -#define SUPPORT_APPLICATION_SLAVE_COMMAND_HANDLER 1 -#endif -#define SUPPORT_ZW_SEND_SLAVE_NODE_INFORMATION 1 - /* Not supported by any controllers except controller portable and installer libs */ #else -#define SUPPORT_ZW_SEND_DATA 1 /* ZW_SendData */ -#define SUPPORT_GET_TX_COUNTER 0 -#define SUPPORT_RESET_TX_COUNTER 0 #define SUPPORT_ZW_GET_VIRTUAL_NODES 0 /* ZW_GetVirtualNodes */ #define SUPPORT_ZW_IS_VIRTUAL_NODE 0 /* ZW_IsVirtualNode */ #define SUPPORT_ZW_SEND_DATA_BRIDGE 0 /* ZW_SendData_Bridge */ #define SUPPORT_ZW_SEND_DATA_MULTI_BRIDGE 0 /* ZW_SendDataMulti_Bridge */ #define SUPPORT_ZW_SET_SLAVE_LEARN_MODE 0 /* ZW_SetSlaveLearnMode */ #define SUPPORT_SERIAL_API_APPL_SLAVE_NODE_INFORMATION 0 -#define SUPPORT_APPLICATION_SLAVE_COMMAND_HANDLER 0 -#define SUPPORT_ZW_SEND_SLAVE_NODE_INFORMATION 1 #endif /* ZW_CONTROLLER_BRIDGE */ - -#ifdef ZW_CONTROLLER_SINGLE -#define SUPPORT_SERIAL_API_TEST 1 -#else -#define SUPPORT_SERIAL_API_TEST 0 -#endif diff --git a/src/zwave_ncp_serial_api_controller/gbl_metadata.yaml b/src/zwave_ncp_serial_api_controller/gbl_metadata.yaml deleted file mode 100644 index 33221b6e..00000000 --- a/src/zwave_ncp_serial_api_controller/gbl_metadata.yaml +++ /dev/null @@ -1,6 +0,0 @@ -baudrate: 115200 -dynamic: [zwave_version] -fw_type: z-wave -compression: lz4 -sign_key: "{SDK_DIR}/protocol/z-wave/platform/SiliconLabs/PAL/BootLoader/controller-keys/controller_sign.key" -encrypt_key: "{SDK_DIR}/protocol/z-wave/platform/SiliconLabs/PAL/BootLoader/controller-keys/controller_encrypt.key" \ No newline at end of file diff --git a/src/zwave_ncp_serial_api_controller/main.c b/src/zwave_ncp_serial_api_controller/main.c index d760d1b2..edc48c8a 100644 --- a/src/zwave_ncp_serial_api_controller/main.c +++ b/src/zwave_ncp_serial_api_controller/main.c @@ -14,7 +14,6 @@ * sections of the MSLA applicable to Source Code. * ******************************************************************************/ -#include "sl_component_catalog.h" #include "sl_system_init.h" #include "sl_system_kernel.h" diff --git a/src/zwave_ncp_serial_api_controller/nvm_backup_restore.c b/src/zwave_ncp_serial_api_controller/nvm_backup_restore.c index 7c0b848b..63404525 100644 --- a/src/zwave_ncp_serial_api_controller/nvm_backup_restore.c +++ b/src/zwave_ncp_serial_api_controller/nvm_backup_restore.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include @@ -37,8 +36,76 @@ offset(LSB) buffer[] buffer only returned for operation=read */ + +/* Macro and definitions used to get index of the different fields in NVM backup & restore buffer. */ +#define NVMBACKUP_RX_SUB_CMD_IDX (0) /** index of sub command field in rx buffer. */ +#define NVMBACKUP_RX_DATA_LEN_IDX (1) /** index of data length field in rx buffer. */ +#define NVMBACKUP_RX_ADDR_IDX (2) /** index of address field in rx buffer. */ +/** macro used the get index of the data in NVM Backup Restore received buffer. +@param size size of the address field.*/ +#define NVMBACKUP_RX_DATA_IDX(size) (NVMBACKUP_RX_ADDR_IDX + (size)) + +#define NVMBACKUP_TX_STATUS_IDX (0) /** index of command status field in tx buffer. */ +#define NVMBACKUP_TX_DATA_LEN_IDX (1) /** index of data length field in tx buffer. */ +#define NVMBACKUP_TX_ADDR_IDX (2) /** index of address field in tx buffer. */ +/** macro used to get index of the data in NVM Backup Restore send buffer. +@param size size of the address field.*/ +#define NVMBACKUP_TX_DATA_IDX(size) (NVMBACKUP_TX_ADDR_IDX + (size)) + +#define NVMBACKUP_STATUS_SIZE (1) /** size of command status. */ +#define NVMBACKUP_DATA_LEN_SIZE (1) /** size of Data length field. */ + + static eNVMBackupRestoreOperation NVMBackupRestoreOperationInProgress = NVMBackupRestoreOperationClose; +/** + * This function is used to extract the address from a received frame (on serial API). + * This address is extracted depending on the size of the address field (which depend on the command type: + * 2 bytes for the legacy NVM_BACKUP_RESTORE, 4bytes for the new NVM_EXT_BACKUP_RESTORE). + * + * @param pAddr[in] pointer on the first address byte in the rx buffer. + * @param addrSize[in] size of the address field (in bytes). + * + * @return NVM address + */ +static uint32_t NvmBackupAddrGet(uint8_t* pAddr, const nvm_backup_restore_addr_size_t addrSize) +{ + uint32_t address = 0; + + /* Build the address starting from the most significant byte. + For each new byte, shift the address then add the new byte.*/ + for (uint8_t i = 0; i < addrSize; i++) + { + address = (address << 8) + *pAddr; + pAddr++; + } + + return address; +} + +/** + * This function is used to fill the address in a frame (on serial API). + * This address is set depending on the size of the address field (which depend on the command type: + * 2 bytes for the legacy NVM_BACKUP_RESTORE, 4bytes for the new EXT_NVM_BACKUP_RESTORE). + * + * @param pAddr[in] pointer on the first address byte in the tx buffer. + * @param addrSize[in] size of the address field (in bytes). + * @param address[in] address to fill in the tx frame + */ +static void NvmBackupAddrSet(uint8_t* pAddr, const nvm_backup_restore_addr_size_t addrSize, uint32_t address) +{ + int8_t i = 0; //must be signed to avoid infinite loop. + + /*fill the buffer starting from the lowest significant byte. + addrSize can be 2 or 4, so there can't be any sign issue with the cast.*/ + for (i = (int8_t)addrSize-1; i >= 0; i--) + { + pAddr[i] = address & 0x000000FF; + address >>= 8; + } +} + + /** * Must be called to open the backup restore feature * The function will shut down the RF, Z-Wave timer system , close the NVM system, and disable the watchdog timer @@ -56,13 +123,11 @@ static bool NvmBackupOpen(void) uint8_t bReturn = QueueProtocolCommand((uint8_t*)&nvmOpen); if (EQUEUENOTIFYING_STATUS_SUCCESS == bReturn) { - SZwaveCommandStatusPackage cmdStatus = { 0 }; - if (GetCommandResponse(&cmdStatus, EZWAVECOMMANDSTATUS_NVM_BACKUP_RESTORE)) + SZwaveCommandStatusPackage cmdStatus = { .eStatusType = EZWAVECOMMANDSTATUS_NVM_BACKUP_RESTORE}; + if ((GetCommandResponse(&cmdStatus, cmdStatus.eStatusType)) + && (cmdStatus.Content.NvmBackupRestoreStatus.status)) { - if (cmdStatus.Content.NvmBackupRestoreStatus.status) - { - return true; - } + return true; } } return false; @@ -153,40 +218,73 @@ static uint8_t NvmBackupRestore( uint32_t offset, uint8_t length, uint8_t* pNvmD return false; } -void func_id_serial_api_nvm_backup_restore(__attribute__((unused)) uint8_t inputLength, uint8_t *pInputBuffer, uint8_t *pOutputBuffer, uint8_t *pOutputLength) +bool NvmBackupLegacyCmdAvailable(void) +{ + /* If NVM size is 0x10000, the legacy command should be forbidden. However, for backward + compatibility, a controller with exactly 0x10000 bytes of NVM must be able to use it. + WARNING: in that case, the legacy NVM backup & restore command will return a size equal to 0. */ + if (0x10000 < zpal_nvm_backup_get_size()) + { + return false; + } + else + { + return true; + } +} + +void func_id_serial_api_nvm_backup_restore(__attribute__((unused)) uint8_t inputLength, uint8_t *pInputBuffer, uint8_t *pOutputBuffer, uint8_t *pOutputLength, bool extended) { - uint32_t NVM_WorkPtr; + uint32_t NVM_WorkPtr = 0; uint8_t dataLength; const uint32_t nvm_storage_size = zpal_nvm_backup_get_size(); + nvm_backup_restore_addr_size_t addrSize; + + //set address size according to the command (legacy or extended backup & restore) + if (true == extended) + { + addrSize = NVM_EXT_BACKUP_RESTORE_ADDR_SIZE; + } + else + { + addrSize = NVM_BACKUP_RESTORE_ADDR_SIZE; + } dataLength = 0; /* Assume nothing is read or written */ - pOutputBuffer[0] = NVMBackupRestoreReturnValueOK; /* Assume not at EOF and no ERROR */ - pOutputBuffer[1] = 0; /* Assume no data */ - pOutputBuffer[2] = 0; - pOutputBuffer[3] = 0; - switch (pInputBuffer[0]) /* operation */ + memset(pOutputBuffer, 0, NVMBACKUP_STATUS_SIZE + NVMBACKUP_DATA_LEN_SIZE + addrSize); + pOutputBuffer[NVMBACKUP_TX_STATUS_IDX] = NVMBackupRestoreReturnValueOK; /* Assume not at EOF and no ERROR */ + + switch (pInputBuffer[NVMBACKUP_RX_SUB_CMD_IDX]) /* operation */ { case NVMBackupRestoreOperationOpen: /* open */ { if (NVMBackupRestoreOperationClose == NVMBackupRestoreOperationInProgress) { - /* Lock everyone else out from making changes to the NVM content */ - /* Remember to have some kind of dead-mans-pedal to release lock again. */ - /* TODO */ - // here we have to shut down RF and disable power management and close NVM subsystem + /* Lock everyone else out from making changes to the NVM content */ + /* Remember to have some kind of dead-mans-pedal to release lock again. */ + /* TODO */ + // here we have to shut down RF and disable power management and close NVM subsystem if (NvmBackupOpen()) { NVMBackupRestoreOperationInProgress = NVMBackupRestoreOperationOpen; - NVM_WorkPtr = 0; + /* Set the size of the backup/restore. (Number of bytes in flash used for file systems) */ + /* Please note that the special case where nvm_storage_size == 0x10000 is indicated by 0x00 0x00 */ + NvmBackupAddrSet( &(pOutputBuffer[NVMBACKUP_TX_ADDR_IDX]), addrSize, nvm_storage_size); - /* Set the size of the backup/restore. (Number of bytes in flash used for file systems) */ - /* Please note that the special case where nvm_storage_size == 0x10000 is indicated by 0x00 0x00 */ - pOutputBuffer[2] = (uint8_t)(nvm_storage_size >> 8); - pOutputBuffer[3] = (uint8_t)nvm_storage_size; + /* in case of extended command, set the sub commands capability*/ + if (true == extended) + { + pOutputBuffer[NVMBACKUP_TX_DATA_IDX(addrSize) + (dataLength++)] = + (1 << NVMBackupRestoreOperationOpen) + + (1 << NVMBackupRestoreOperationRead) + + (1 << NVMBackupRestoreOperationWrite) + + (1 << NVMBackupRestoreOperationClose); + } + pOutputBuffer[NVMBACKUP_TX_DATA_LEN_IDX] = dataLength; } else { - pOutputBuffer[0] = NVMBackupRestoreReturnValueError; /*Report error we can't open backup restore feature*/ + pOutputBuffer[NVMBACKUP_TX_STATUS_IDX] = NVMBackupRestoreReturnValueError; /*Report error we can't open backup restore feature*/ } } } @@ -194,54 +292,56 @@ void func_id_serial_api_nvm_backup_restore(__attribute__((unused)) uint8_t input case NVMBackupRestoreOperationRead: /* read */ { - /* Validate input */ DPRINT("NVM_Read_ \r\n"); + /* Check that NVM is ready */ if ((NVMBackupRestoreOperationInProgress != NVMBackupRestoreOperationRead) && (NVMBackupRestoreOperationInProgress != NVMBackupRestoreOperationOpen)) { - DPRINT("NVM_Read_Mis \r\n"); - pOutputBuffer[0] = NVMBackupRestoreReturnValueOperationMismatch; + DPRINT("NVM_Read_Mis \r\n"); + pOutputBuffer[NVMBACKUP_TX_STATUS_IDX] = NVMBackupRestoreReturnValueOperationMismatch; break; } NVMBackupRestoreOperationInProgress = NVMBackupRestoreOperationRead; - dataLength = pInputBuffer[1]; /* Requested dataLength */ - NVM_WorkPtr = (((uint32_t)pInputBuffer[2] << 8) + pInputBuffer[3]); - /* Make sure that length isn't larger than the available buffer size */ - if (dataLength > WORK_BUFFER_SIZE) + /* Load input */ + dataLength = pInputBuffer[NVMBACKUP_RX_DATA_LEN_IDX]; /* Requested dataLength */ + NVM_WorkPtr = NvmBackupAddrGet( &(pInputBuffer[NVMBACKUP_RX_ADDR_IDX]), addrSize); + /* Validate Input */ + if (dataLength > WORK_BUFFER_SIZE)/* Make sure that length isn't larger than the available buffer size */ { dataLength = WORK_BUFFER_SIZE; } - /* Make sure that we don't go beyond valid NVM content */ - if ((NVM_WorkPtr + dataLength) >= nvm_storage_size) + if ((NVM_WorkPtr + dataLength) >= nvm_storage_size)/* Make sure that we don't go beyond valid NVM content */ { - DPRINT("NVM_Read_EOF \r\n"); + DPRINT("NVM_Read_EOF \r\n"); dataLength = (uint8_t)(nvm_storage_size - NVM_WorkPtr); - pOutputBuffer[0] = (uint8_t)NVMBackupRestoreReturnValueEOF; /* Indicate at EOF */ + pOutputBuffer[NVMBACKUP_TX_STATUS_IDX] = (uint8_t)NVMBackupRestoreReturnValueEOF; /* Indicate at EOF */ } - pOutputBuffer[1] = dataLength; - pOutputBuffer[2] = pInputBuffer[2]; - pOutputBuffer[3] = pInputBuffer[3]; - NvmBackupRead(NVM_WorkPtr, dataLength, &pOutputBuffer[4]); + /* fill output buffer */ + pOutputBuffer[NVMBACKUP_TX_DATA_LEN_IDX] = dataLength; + NvmBackupAddrSet( &(pOutputBuffer[NVMBACKUP_TX_ADDR_IDX]), addrSize, NVM_WorkPtr); + NvmBackupRead(NVM_WorkPtr, dataLength, &pOutputBuffer[NVMBACKUP_TX_DATA_IDX(addrSize)]); } break; case NVMBackupRestoreOperationWrite: /* write */ { - /* Validate input */ + /* Check that NVM is ready */ if ((NVMBackupRestoreOperationInProgress != NVMBackupRestoreOperationWrite) && (NVMBackupRestoreOperationInProgress != NVMBackupRestoreOperationOpen)) { DPRINT("NVM_Write_mis \r\n"); - pOutputBuffer[0] = NVMBackupRestoreReturnValueOperationMismatch; + pOutputBuffer[NVMBACKUP_TX_STATUS_IDX] = NVMBackupRestoreReturnValueOperationMismatch; break; } NVMBackupRestoreOperationInProgress = NVMBackupRestoreOperationWrite; - dataLength = pInputBuffer[1]; /* Requested dataLength */ - NVM_WorkPtr = (uint32_t)(((uint16_t)pInputBuffer[2] << 8) + pInputBuffer[3]); + /* Load input */ + dataLength = pInputBuffer[NVMBACKUP_RX_DATA_LEN_IDX]; /* Requested dataLength */ + NVM_WorkPtr = NvmBackupAddrGet( &(pInputBuffer[NVMBACKUP_RX_ADDR_IDX]), addrSize); + /* Validate input */ if (dataLength > WORK_BUFFER_SIZE) { DPRINT("NVM_Write_buff_err \r\n"); - pOutputBuffer[0] = NVMBackupRestoreReturnValueError; /* ERROR: ignore request if length is larger than available buffer */ + pOutputBuffer[NVMBACKUP_TX_STATUS_IDX] = NVMBackupRestoreReturnValueError; /* ERROR: ignore request if length is larger than available buffer */ } else { @@ -251,15 +351,17 @@ void func_id_serial_api_nvm_backup_restore(__attribute__((unused)) uint8_t input { DPRINT("NVM_Write_EOF \r\n"); dataLength = (uint8_t)(nvm_storage_size - NVM_WorkPtr); - pOutputBuffer[0] = (uint8_t)NVMBackupRestoreReturnValueEOF; /* Indicate at EOF */ + pOutputBuffer[NVMBACKUP_TX_STATUS_IDX] = (uint8_t)NVMBackupRestoreReturnValueEOF; /* Indicate at EOF */ } - memcpy(tmp_buf, (uint8_t*)&pInputBuffer[4], dataLength); + /* copy data into another buffer because write operation will be done in another task. */ + memcpy(tmp_buf, (uint8_t*)&pInputBuffer[NVMBACKUP_RX_DATA_IDX(addrSize)], dataLength); NvmBackupRestore(NVM_WorkPtr , dataLength, tmp_buf); - pOutputBuffer[1] = dataLength; /* Data written */ - pOutputBuffer[2] = pInputBuffer[2]; - pOutputBuffer[3] = pInputBuffer[3]; + /* fill output buffer */ + pOutputBuffer[NVMBACKUP_TX_DATA_LEN_IDX] = dataLength; + NvmBackupAddrSet( &(pOutputBuffer[NVMBACKUP_TX_ADDR_IDX]), addrSize, NVM_WorkPtr); } + /* reset data length because there is no data in output buffer. */ dataLength = 0; } break; @@ -279,14 +381,15 @@ void func_id_serial_api_nvm_backup_restore(__attribute__((unused)) uint8_t input } else { - pOutputBuffer[0] = NVMBackupRestoreReturnValueError; /*repoert error we canot close backup restore feature*/ + pOutputBuffer[NVMBACKUP_TX_STATUS_IDX] = NVMBackupRestoreReturnValueError; /*report error we canot close backup restore feature*/ } } break; default: + pOutputBuffer[NVMBACKUP_TX_STATUS_IDX] = NVMBackupRestoreReturnValueError; break; } - *pOutputLength = dataLength + 4; - + //build output buffer length + *pOutputLength = (uint8_t)(NVMBACKUP_STATUS_SIZE + NVMBACKUP_DATA_LEN_SIZE + addrSize + dataLength); } diff --git a/src/zwave_ncp_serial_api_controller/nvm_backup_restore.h b/src/zwave_ncp_serial_api_controller/nvm_backup_restore.h index a7967c97..42ef75e6 100644 --- a/src/zwave_ncp_serial_api_controller/nvm_backup_restore.h +++ b/src/zwave_ncp_serial_api_controller/nvm_backup_restore.h @@ -7,6 +7,14 @@ #define APPS_SERIALAPI_NVM_BACKUP_RESTROE_H_ #include +#include "SerialAPI.h" + +/** + * This function is used to check if the legacy nvm backup & restore command can be used. + * The legacy command cannot be used if address of the NVM are larger than 2 bytes. + * @return true or false depending on the NVM size + */ +bool NvmBackupLegacyCmdAvailable(void); /** * Must be called upon receiving a "Serial API NVM Backup/restore commands". @@ -14,10 +22,12 @@ * @param pInputBuffer Input buffer * @param pOutputBuffer Output buffer * @param pOutputLength Length of data in output buffer. + * @param extended Input Length of the address field */ void func_id_serial_api_nvm_backup_restore(uint8_t inputLength, uint8_t* pInputBuffer, uint8_t* pOutputBuffer, - uint8_t* pOutputLength); + uint8_t* pOutputLength, + bool extended); #endif /* APPS_SERIALAPI_NVM_BACKUP_RESTROE_H_ */ diff --git a/src/zwave_ncp_serial_api_controller/serialapi_file.c b/src/zwave_ncp_serial_api_controller/serialapi_file.c index e0c4dab8..9338e55b 100644 --- a/src/zwave_ncp_serial_api_controller/serialapi_file.c +++ b/src/zwave_ncp_serial_api_controller/serialapi_file.c @@ -21,8 +21,7 @@ #include #include #include "SizeOf.h" -#include "Assert.h" -#include "DebugPrintConfig.h" +#include //#define DEBUGPRINT //#include "DebugPrint.h" #include "SyncEvent.h" @@ -106,10 +105,6 @@ typedef struct __attribute__((packed)) SApplicationConfiguration // Must be pac static void WriteDefault(void); -// Application file system -static zpal_nvm_handle_t pFileSystemApplication; - - static void WriteDefaultApplicationConfiguration(void); static bool ObjectExist(zpal_nvm_object_key_t key); @@ -127,8 +122,8 @@ static void SerialAPI_FileSystemMigrationManagement(void) { //Read present file system version file - uint32_t presentFilesysVersion; - uint32_t expectedFilesysVersion; // This will hold the file system version that current SW will support. + uint32_t presentFilesysVersion = 0; + uint32_t expectedFilesysVersion = 0; // This will hold the file system version that current SW will support. SerialAPI_GetZWVersion(&presentFilesysVersion); @@ -137,7 +132,7 @@ SerialAPI_FileSystemMigrationManagement(void) if(expectedFilesysVersion < presentFilesysVersion) { //System downgrade. Should not be allowed. - ASSERT(false); + assert(false); } else if(expectedFilesysVersion > presentFilesysVersion) // File system upgrade needed. Initiating file system migration... { @@ -152,18 +147,18 @@ SerialAPI_FileSystemMigrationManagement(void) // Add code for migration of file system to version APP_VERSION_7_15_3 (7.15.3). //Get length of legacy file - size_t dataLen; - zpal_nvm_get_object_size(pFileSystemApplication, FILE_ID_APPLICATIONCONFIGURATION, &dataLen); + size_t dataLen = 0; + ZAF_nvm_app_get_object_size(FILE_ID_APPLICATIONCONFIGURATION, &dataLen); //Read legacy file to first members of tApplicationConfiguration - SApplicationConfiguration_v7_15_3 tApplicationConfiguration = { 0 }; + SApplicationConfiguration_v7_15_3 tApplicationConfiguration = { .rfRegion = REGION_UNDEFINED }; // Initialize, since zpal_nvm_read() might fail. - zpal_nvm_read(pFileSystemApplication, FILE_ID_APPLICATIONCONFIGURATION, &tApplicationConfiguration, dataLen); + ZAF_nvm_app_read(FILE_ID_APPLICATIONCONFIGURATION, &tApplicationConfiguration, dataLen); //Write default values to new members of tApplicationConfiguration and update the file. tApplicationConfiguration.radio_debug_enable = 0; tApplicationConfiguration.maxTxPower = 140; - zpal_status_t status = zpal_nvm_write(pFileSystemApplication, FILE_ID_APPLICATIONCONFIGURATION, &tApplicationConfiguration, + zpal_status_t status = ZAF_nvm_app_write(FILE_ID_APPLICATIONCONFIGURATION, &tApplicationConfiguration, sizeof(tApplicationConfiguration)); if (ZPAL_STATUS_OK == status) { @@ -174,11 +169,11 @@ SerialAPI_FileSystemMigrationManagement(void) // Migrate files from file system version APP_VERSION_7_15_3 to APP_VERSION_7_18_1. if ( presentFilesysVersion < APP_VERSION_7_18_1 ) { - SApplicationConfiguration_v7_15_3 tApplicationConfiguration_v7_15_3 = { 0 }; - SApplicationConfiguration_V7_18_1 tApplicationConfiguration = { 0 }; + SApplicationConfiguration_v7_15_3 tApplicationConfiguration_v7_15_3 = { .rfRegion = REGION_UNDEFINED }; + SApplicationConfiguration_V7_18_1 tApplicationConfiguration = { .rfRegion = REGION_UNDEFINED }; zpal_status_t status; - status = zpal_nvm_read(pFileSystemApplication, FILE_ID_APPLICATIONCONFIGURATION, &tApplicationConfiguration_v7_15_3, + status = ZAF_nvm_app_read(FILE_ID_APPLICATIONCONFIGURATION, &tApplicationConfiguration_v7_15_3, sizeof(tApplicationConfiguration_v7_15_3)); if (ZPAL_STATUS_OK != status) { @@ -192,7 +187,7 @@ SerialAPI_FileSystemMigrationManagement(void) tApplicationConfiguration.radio_debug_enable = tApplicationConfiguration_v7_15_3.radio_debug_enable; tApplicationConfiguration.maxTxPower = tApplicationConfiguration_v7_15_3.maxTxPower; - status = zpal_nvm_write(pFileSystemApplication, FILE_ID_APPLICATIONCONFIGURATION, &tApplicationConfiguration, + status = ZAF_nvm_app_write(FILE_ID_APPLICATIONCONFIGURATION, &tApplicationConfiguration, sizeof(tApplicationConfiguration)); /* Do not use FILE_SIZE_APPLICATIONCONFIGURATION in * migration functions, instead hard-code the size as * sizes do change with FW upgrades. */ @@ -209,11 +204,11 @@ SerialAPI_FileSystemMigrationManagement(void) // Migrate files from file system version APP_VERSION_7_20_0 (same as 7_18_1) to APP_VERSION_7_21_0. if ( presentFilesysVersion < APP_VERSION_7_21_0 ) { - SApplicationConfiguration sAppCfgMigration = { 0 }; + SApplicationConfiguration sAppCfgMigration = { .rfRegion = REGION_UNDEFINED }; zpal_status_t status; //cannot migrate if the file system is older than V7.18.1. Other migration script should have been called before. - ASSERT(APP_VERSION_7_18_1 <= presentFilesysVersion); + assert(APP_VERSION_7_18_1 <= presentFilesysVersion); /*New application configuration has only a new member (no change in the legacy part). So read the legacy structure directly in the new one, then just set value for new member.*/ @@ -243,7 +238,7 @@ SerialAPI_FileSystemMigrationManagement(void) /* * If this fails, some of the migrations were not performed due to earlier migrations that have failed. */ - ASSERT(APP_VERSION_7_21_0 <= presentFilesysVersion); + assert(APP_VERSION_7_21_0 <= presentFilesysVersion); /** * @attention This implementation assumes that the build is going to update the ZAF_FILE_ID_APP_VERSION to the current! @@ -262,16 +257,16 @@ uint8_t SerialApiFileInit(void) bool initStatus = ZAF_nvm_app_init(); if (!initStatus) { - ASSERT(false); //Assert has been kept for debugging , can be removed from production code. This error can only be caused by some internal flash HW failure + assert(false); //Assert has been kept for debugging , can be removed from production code. This error can only be caused by some internal flash HW failure } initStatus = ZAF_nvm_init(); if (!initStatus) { - ASSERT(false); //Assert has been kept for debugging , can be removed from production code. This error can only be caused by some internal flash HW failure + assert(false); //Assert has been kept for debugging , can be removed from production code. This error can only be caused by some internal flash HW failure } - uint32_t appVersion; + uint32_t appVersion = 0; bool status = SerialAPI_GetZWVersion(&appVersion); if (status) @@ -569,16 +564,13 @@ ReadApplicationRfRegion(zpal_radio_region_t* rfRegion) uint8_t SaveApplicationNodeIdBaseType(eSerialAPISetupNodeIdBaseType nodeIdBaseType) { - SApplicationConfiguration tApplicationConfiguration = { 0 }; + SApplicationConfiguration tApplicationConfiguration = { .rfRegion = REGION_UNDEFINED }; uint8_t dataIsWritten = false; - zpal_status_t status; - - status = ZAF_nvm_app_read(FILE_ID_APPLICATIONCONFIGURATION, &tApplicationConfiguration, FILE_SIZE_APPLICATIONCONFIGURATION); - if (ZPAL_STATUS_OK == status) + + if (ZPAL_STATUS_OK == ZAF_nvm_app_read(FILE_ID_APPLICATIONCONFIGURATION, &tApplicationConfiguration, FILE_SIZE_APPLICATIONCONFIGURATION)) { tApplicationConfiguration.nodeIdBaseType = nodeIdBaseType; - status = ZAF_nvm_app_write(FILE_ID_APPLICATIONCONFIGURATION, &tApplicationConfiguration, FILE_SIZE_APPLICATIONCONFIGURATION); - if (ZPAL_STATUS_OK == status) + if (ZPAL_STATUS_OK == ZAF_nvm_app_write(FILE_ID_APPLICATIONCONFIGURATION, &tApplicationConfiguration, FILE_SIZE_APPLICATIONCONFIGURATION)) { dataIsWritten = true; } @@ -589,18 +581,14 @@ SaveApplicationNodeIdBaseType(eSerialAPISetupNodeIdBaseType nodeIdBaseType) uint8_t ReadApplicationNodeIdBaseType(eSerialAPISetupNodeIdBaseType* nodeIdBaseType) { - SApplicationConfiguration tApplicationConfiguration; + SApplicationConfiguration tApplicationConfiguration = { .rfRegion = REGION_UNDEFINED }; uint8_t dataIsRead = false; - zpal_status_t status; - - if (ObjectExist(FILE_ID_APPLICATIONCONFIGURATION)) + + if (ObjectExist(FILE_ID_APPLICATIONCONFIGURATION) + && (ZPAL_STATUS_OK == ZAF_nvm_app_read(FILE_ID_APPLICATIONCONFIGURATION, &tApplicationConfiguration, FILE_SIZE_APPLICATIONCONFIGURATION))) { - status = ZAF_nvm_app_read(FILE_ID_APPLICATIONCONFIGURATION, &tApplicationConfiguration, FILE_SIZE_APPLICATIONCONFIGURATION); - if (ZPAL_STATUS_OK == status) - { - *nodeIdBaseType = tApplicationConfiguration.nodeIdBaseType; + *nodeIdBaseType = tApplicationConfiguration.nodeIdBaseType; dataIsRead = true; - } } return dataIsRead; @@ -734,9 +722,8 @@ ReadApplicationEnablePTI(uint8_t *radio_debug_enable) uint32_t ReadApplicationVersion(void) { - uint32_t appVersion; + uint32_t appVersion = 0; SerialAPI_GetZWVersion(&appVersion); - return appVersion; } diff --git a/src/zwave_ncp_serial_api_controller/slave_supported_func.h b/src/zwave_ncp_serial_api_controller/slave_supported_func.h index 2ed9c2ab..797f9480 100644 --- a/src/zwave_ncp_serial_api_controller/slave_supported_func.h +++ b/src/zwave_ncp_serial_api_controller/slave_supported_func.h @@ -3,131 +3,37 @@ * @copyright 2022 Silicon Laboratories Inc. */ -/* Generated file copied from Sdk670 with std. functions supported by static controller. */ -/* Following defines has been disable for build purposes: - * SUPPORT_ZW_AES_ECB - * SUPPORT_ZW_SET_EXT_INT_LEVEL - */ +#include "common_supported_func.h" + #define SUPPORT_GET_ROUTING_TABLE_LINE 0 /* ZW_GetRoutingInfo */ -#define SUPPORT_LOCK_ROUTE_RESPONSE 1 /* ZW_LockRoute */ -#define SUPPORT_MEMORY_GET_BUFFER 1 /* MemoryGetBuffer */ -#define SUPPORT_MEMORY_GET_BYTE 1 /* MemoryGetByte */ -#define SUPPORT_MEMORY_GET_ID 1 /* MemoryGetID */ -#define SUPPORT_MEMORY_PUT_BUFFER 1 /* MemoryPutBuffer */ -#define SUPPORT_MEMORY_PUT_BYTE 1 /* MemoryPutByte */ -#define SUPPORT_NVM_GET_ID 1 /* NVM_get_id */ -#define SUPPORT_NVM_EXT_READ_LONG_BUFFER 1 /* NVM_ext_read_long_buffer */ -#define SUPPORT_NVM_EXT_READ_LONG_BYTE 1 /* NVM_ext_read_long_byte */ -#define SUPPORT_NVM_EXT_WRITE_LONG_BYTE 0 /* NVM_ext_write_long_byte */ -#define SUPPORT_NVM_EXT_WRITE_LONG_BUFFER 0 /* NVM_ext_write_long_buffer*/ #define SUPPORT_NVM_BACKUP_RESTORE 0 /* MemoryGetBuffer */ -#define SUPPORT_PWR_CLK_PD 0 /* PWR_Clk_PD */ -#define SUPPORT_PWR_CLK_PUP 0 /* PWR_Clk_PUp */ -#define SUPPORT_PWR_SELECT_CLK 0 /* PWR_Select_Clk */ -#define SUPPORT_PWR_SETSTOPMODE 0 /* PWR_SetStopMode */ -#define SUPPORT_STORE_HOMEID 0 /* ZW_StoreHomeID */ -#define SUPPORT_STORE_NODEINFO 0 /* notUsed */ #define SUPPORT_ZW_ADD_NODE_TO_NETWORK 0 /* ZW_AddNodeToNetwork */ -#define SUPPORT_ZW_AES_ECB 0 /* ZW_AES_ECB */ -#define SUPPORT_ZW_ARE_NODES_NEIGHBOURS 0 /* notUsed */ #define SUPPORT_ZW_ASSIGN_RETURN_ROUTE 0 /* ZW_AssignReturnRoute */ #define SUPPORT_ZW_ASSIGN_PRIORITY_RETURN_ROUTE 0 /* ZW_AssignPriorityReturnRoute */ #define SUPPORT_ZW_ASSIGN_SUC_RETURN_ROUTE 0 /* ZW_AssignSUCReturnRoute */ #define SUPPORT_ZW_ASSIGN_PRIORITY_SUC_RETURN_ROUTE 0 /* ZW_AssignPrioritySUCReturnRoute */ #define SUPPORT_ZW_CONTROLLER_CHANGE 0 /* ZW_ControllerChange */ -#define SUPPORT_ZW_CREATE_NEW_PRIMARY 0 /* NotUsed */ #define SUPPORT_ZW_DELETE_RETURN_ROUTE 0 /* ZW_DeleteReturnRoute */ #define SUPPORT_ZW_DELETE_SUC_RETURN_ROUTE 0 /* ZW_DeleteSUCReturnRoute */ -#define SUPPORT_ZW_ENABLE_SUC 0 /* ZW_EnableSUC */ -#define SUPPORT_ZW_EXPLORE_REQUEST_INCLUSION 1 /* ZW_ExploreRequestInclusion */ -#define SUPPORT_ZW_EXPLORE_REQUEST_EXCLUSION 1 /* ZW_ExploreRequestExclusion */ #define SUPPORT_ZW_GET_CONTROLLER_CAPABILITIES 0 /* ZW_GetControllerCapabilities */ #define SUPPORT_ZW_GET_PRIORITY_ROUTE 0 /* ZW_GetPriorityRoute */ #define SUPPORT_ZW_SET_PRIORITY_ROUTE 0 /* ZW_SetPriorityRoute */ -#define SUPPORT_ZW_GET_NEIGHBOR_COUNT 0 /*notUsed */ -#define SUPPORT_ZW_GET_NODE_PROTOCOL_INFO 1 /* ZW_GetNodeProtocolInfo */ -#define SUPPORT_ZW_GET_PROTOCOL_STATUS 1 /* ZW_GetProtocolStatus */ -#define SUPPORT_ZW_GET_PROTOCOL_VERSION 1 /* ZW_GetProtocolVersion */ -#define SUPPORT_ZW_GET_RANDOM 1 /* ZW_GetRandomWord */ -#define SUPPORT_ZW_GET_ROUTING_MAX 0 /* ZW_GetRoutingMAX */ -#define SUPPORT_ZW_GET_SUC_NODE_ID 1 /* ZW_GetSUCNodeID */ -#define SUPPORT_ZW_GET_VERSION 1 /* ZW_Version */ #define SUPPORT_ZW_IS_FAILED_NODE_ID 0 /* ZW_isFailedNode */ -#define SUPPORT_ZW_IS_NODE_WITHIN_DIRECT_RANGE 0 /* NotUsed */ -#define SUPPORT_ZW_IS_PRIMARY_CTRL 0 /* NotUsed */ -#define SUPPORT_ZW_IS_WUT_KICKED 0 /* ZW_IsWutKicked */ -#define SUPPORT_ZW_NEW_CONTROLLER 0 /* ZW_NewController */ -#define SUPPORT_ZW_RANDOM 0 /* NotUsed */ -#define SUPPORT_ZW_REDISCOVERY_NEEDED 0 /* ZW_RediscoveryNeeded */ #define SUPPORT_ZW_REMOVE_FAILED_NODE_ID 0 /* ZW_RemoveFailedNode */ #define SUPPORT_ZW_REMOVE_NODE_FROM_NETWORK 0 /* ZW_RemoveNodeFromNetwork */ #define SUPPORT_ZW_REMOVE_NODE_ID_FROM_NETWORK 0 /* ZW_RemoveNodeIDFromNetwork */ #define SUPPORT_ZW_REPLACE_FAILED_NODE 0 /* ZW_ReplaceFailedNode */ #define SUPPORT_ZW_REPLICATION_COMMAND_COMPLETE 0 /* ZW_ReplicationReceiveComplete */ #define SUPPORT_ZW_REPLICATION_SEND_DATA 0 /* ZW_ReplicationSend */ -#define SUPPORT_ZW_REQUEST_NETWORK_UPDATE 1 /* ZW_RequestNetWorkUpdate */ -#define SUPPORT_ZW_REQUEST_NEW_ROUTE_DESTINATIONS 0 /* NotUsed */ #define SUPPORT_ZW_REQUEST_NODE_INFO 0 /* ZW_RequestNodeInfo */ #define SUPPORT_ZW_REQUEST_NODE_NEIGHBOR_UPDATE 0 /* ZW_RequestNodeNeighborUpdate */ -#define SUPPORT_ZW_RF_POWER_LEVEL_GET 0 /* ZW_RFPowerLevelGet */ -#define SUPPORT_ZW_RF_POWER_LEVEL_REDISCOVERY_SET 0 /* NotUsed */ -#define SUPPORT_ZW_RF_POWER_LEVEL_SET 0 /* ZW_RFPowerLevelSet */ -#define SUPPORT_ZW_SEND_DATA 1 /* ZW_SendData */ #define SUPPORT_ZW_SEND_DATA_EX 1 /* ZW_SendDataEx */ -#define SUPPORT_ZW_SEND_DATA_ABORT 1 /* ZW_SendDataAbort */ -#define SUPPORT_ZW_SEND_DATA_META 0 /* ZW_SendDataMeta */ -#define SUPPORT_ZW_SEND_DATA_META_BRIDGE 0 /* ZW_SendDataMeta_Bridge */ -#define SUPPORT_ZW_SEND_DATA_META_MR 0 /* NotUsed */ -#define SUPPORT_ZW_SEND_DATA_MR 0 /* NotUsed */ -#define SUPPORT_ZW_SEND_DATA_MULTI 1 /* ZW_SendDataMulti */ #define SUPPORT_ZW_SEND_DATA_MULTI_EX 1 /* ZW_SendDataMultiEx */ -#define SUPPORT_ZW_SET_NETWORK_KEY_S0 0 /* ZW_SetNetworkKeyS0 */ #define SUPPORT_ZW_GET_SECURITY_KEYS 1 /* ZW_GetSecurityKeys */ -#define SUPPORT_ZW_SEND_NODE_INFORMATION 1 /* ZW_SendNodeInformation */ -#define SUPPORT_ZW_SEND_SLAVE_DATA 0 /* ZW_SendSlaveData */ #define SUPPORT_ZW_SEND_SUC_ID 0 /* ZW_SendSUCID */ #define SUPPORT_ZW_SEND_TEST_FRAME 0 /* ZW_SendTestFrame */ -#define SUPPORT_ZW_SET_DEFAULT 1 /* ZW_SetDefault */ -#define SUPPORT_ZW_SET_EXT_INT_LEVEL 0 /* ZW_SetExtIntLevel */ -#define SUPPORT_ZW_SET_LEARN_MODE 1 /* ZW_SetLearnMode */ -#define SUPPORT_ZW_SET_LEARN_NODE_STATE 0 /* ZW_SetLearnNodeState */ -#define SUPPORT_ZW_SET_PROMISCUOUS_MODE 0 /* ZW_SetPromiscuousMode */ -#define SUPPORT_ZW_SET_RF_RECEIVE_MODE 1 /* ZW_SetRFReceiveMode */ -#define SUPPORT_ZW_SET_ROUTING_INFO 0 /* NotUsed */ #define SUPPORT_ZW_SET_ROUTING_MAX 0 /*notUsed*/ -#define SUPPORT_ZW_SET_SLEEP_MODE 0 /* ZW_SetSleepMode */ -#define SUPPORT_ZW_SET_SUC_NODE_ID 1 /* ZW_SetSUCNodeID */ -#define SUPPORT_ZW_SET_WUT_TIMEOUT 0 /* ZW_SetWutTimeout */ -#define SUPPORT_ZW_SUPPORT9600_ONLY 0 /* ZW_Support9600Only */ -#define SUPPORT_ZW_TYPE_LIBRARY 1 /* ZW_Type_Library */ -#define SUPPORT_ZW_WATCHDOG_DISABLE 0 /* ZW_WatchDogDisable */ -#define SUPPORT_ZW_WATCHDOG_ENABLE 0 /* ZW_WatchDogEnable */ -#define SUPPORT_ZW_WATCHDOG_KICK 0 /* ZW_WatchDogKick */ -#define SUPPORT_ZW_WATCHDOG_START 1 /* ZW_WatchDogEnable */ -#define SUPPORT_ZW_WATCHDOG_STOP 1 /* ZW_WatchDogDisable */ #define SUPPORT_ZW_NVR_GET_VALUE 0 /* ZW_NVRGetValue */ -#define SUPPORT_FUNC_ID_CLEAR_TX_TIMERS 1 /* ZW_ClearTxTimers */ -#define SUPPORT_FUNC_ID_GET_TX_TIMERS 1 /* ZW_GetTxTimer */ -#define SUPPORT_ZW_CLEAR_NETWORK_STATS 1 /* ZW_ClearNetworkStats */ -#define SUPPORT_ZW_GET_NETWORK_STATS 1 /* ZW_GetNetworkStats */ -#define SUPPORT_ZW_GET_BACKGROUND_RSSI 1 /* ZW_GetBackgroundRSSI */ -/* SerialAPI functionality support definitions */ -#define SUPPORT_SEND_DATA_TIMING 1 -/* Enable support for SerialAPI Startup Notification */ -#define SUPPORT_SERIAL_API_STARTUP_NOTIFICATION 1 - -/* Common SerialAPI functionality support definitions */ -#define SUPPORT_SERIAL_API_GET_INIT_DATA 1 -#define SUPPORT_SERIAL_API_APPL_NODE_INFORMATION 1 - -#define SUPPORT_APPLICATION_COMMAND_HANDLER_BRIDGE 0 -#define SUPPORT_APPLICATION_COMMAND_HANDLER 1 - - -#define SUPPORT_SERIAL_API_SET_TIMEOUTS 1 - -#define SUPPORT_SERIAL_API_SOFT_RESET 1 -#define SUPPORT_SERIAL_API_SETUP 1 #define SUPPORT_ZW_INITIATE_SHUTDOWN 0 #define SUPPORT_SERIAL_API_GET_LR_NODES 0 #define SUPPORT_SERIAL_GET_LR_CHANNEL 0 @@ -135,20 +41,17 @@ #define SUPPORT_SERIAL_SET_LR_VIRTUAL_IDS 0 #define SUPPORT_SERIAL_ENABLE_RADIO_PTI 0 -/* ZW_EnableSUC() no longer exists in the library */ - /* */ #define SUPPORT_SERIAL_API_GET_APPL_HOST_MEMORY_OFFSET 0 -#define SUPPORT_ZW_SET_LISTEN_BEFORE_TALK_THRESHOLD 1 - -#define SUPPORT_ZW_NETWORK_MANAGEMENT_SET_MAX_INCLUSION_REQUEST_INTERVALS 1 - /**************************************************************************/ /* Common for all slaves */ /* SerialAPI functionality support definitions */ -#define SUPPORT_ZW_APPLICATION_UPDATE 1 -#define SUPPORT_APPLICATION_RF_NOTIFY 0 +#define SUPPORT_ZW_APPLICATION_CONTROLLER_UPDATE 0 + +/**************************************************************************/ +/* Slave enhanced */ +/* Specific SerialAPI functionality support definitions */ #define SUPPORT_ZW_GET_VIRTUAL_NODES 0 /* ZW_GetVirtualNodes */ #define SUPPORT_ZW_IS_VIRTUAL_NODE 0 /* ZW_IsVirtualNode */ @@ -156,26 +59,4 @@ #define SUPPORT_ZW_SEND_DATA_MULTI_BRIDGE 0 /* ZW_SendDataMulti_Bridge */ #define SUPPORT_ZW_SET_SLAVE_LEARN_MODE 0 /* ZW_SetSlaveLearnMode */ #define SUPPORT_SERIAL_API_APPL_SLAVE_NODE_INFORMATION 0 -/**************************************************************************/ -/* Slave enhanced */ -/* Specific SerialAPI functionality support definitions */ - -#define SUPPORT_ZW_APPLICATION_CONTROLLER_UPDATE 0 - -#define SUPPORT_GET_TX_COUNTER 0 -#define SUPPORT_RESET_TX_COUNTER 0 - -#define SUPPORT_SERIAL_API_APPL_SLAVE_NODE_INFORMATION 0 -#define SUPPORT_APPLICATION_SLAVE_COMMAND_HANDLER 0 -#define SUPPORT_ZW_SEND_SLAVE_NODE_INFORMATION 0 - - -#define SUPPORT_SERIAL_API_TEST 0 -#define SUPPORT_ZW_APPLICATION_CONTROLLER_UPDATE 0 - -#define SUPPORT_GET_TX_COUNTER 0 -#define SUPPORT_RESET_TX_COUNTER 0 - -#define SUPPORT_SERIAL_API_APPL_SLAVE_NODE_INFORMATION 0 -#define SUPPORT_APPLICATION_SLAVE_COMMAND_HANDLER 0 #define SUPPORT_ZW_SEND_SLAVE_NODE_INFORMATION 0 diff --git a/src/zwave_ncp_serial_api_controller/utils.c b/src/zwave_ncp_serial_api_controller/utils.c index bec51e15..75eafc20 100644 --- a/src/zwave_ncp_serial_api_controller/utils.c +++ b/src/zwave_ncp_serial_api_controller/utils.c @@ -3,6 +3,7 @@ * @copyright 2022 Silicon Laboratories Inc. */ +#include #include #include #include @@ -26,16 +27,16 @@ uint8_t GetCommandResponse(SZwaveCommandStatusPackage *pCmdStatus, EZwaveCommand if (m_pAppTaskHandle && (0 < uxQueueMessagesWaiting(Queue))) { /* More elements in queue call xTaskNotify */ - BaseType_t Status = xTaskNotify(m_pAppTaskHandle, 1 << EAPPLICATIONEVENT_ZWCOMMANDSTATUS, eSetBits); - ASSERT(Status == pdPASS); // We probably received a bad Task handle + __attribute__((unused)) BaseType_t Status = xTaskNotify(m_pAppTaskHandle, 1 << EAPPLICATIONEVENT_ZWCOMMANDSTATUS, eSetBits); + assert(Status == pdPASS); // We probably received a bad Task handle } return true; } else { /* Re-insert none-matching message into Queue */ - BaseType_t result = xQueueSendToBack(Queue, (uint8_t*)pCmdStatus, 0); - ASSERT(pdTRUE == result); + __attribute__((unused)) BaseType_t result = xQueueSendToBack(Queue, (uint8_t*)pCmdStatus, 0); + assert(pdTRUE == result); } } } @@ -44,8 +45,8 @@ uint8_t GetCommandResponse(SZwaveCommandStatusPackage *pCmdStatus, EZwaveCommand if (m_pAppTaskHandle && (0 < uxQueueMessagesWaiting(Queue))) { /* Only call xTaskNotify if still elements in queue */ - BaseType_t Status = xTaskNotify(m_pAppTaskHandle, 1 << EAPPLICATIONEVENT_ZWCOMMANDSTATUS, eSetBits); - ASSERT(Status == pdPASS); // We probably received a bad Task handle + __attribute__((unused)) BaseType_t Status = xTaskNotify(m_pAppTaskHandle, 1 << EAPPLICATIONEVENT_ZWCOMMANDSTATUS, eSetBits); + assert(Status == pdPASS); // We probably received a bad Task handle } return false; } @@ -56,14 +57,14 @@ uint8_t IsPrimaryController(void) SZwaveCommandPackage cmdPackage = { .eCommandType = EZWAVECOMMANDTYPE_IS_PRIMARY_CTRL }; - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(m_pAppHandles->pZwCommandQueue, (uint8_t *)&cmdPackage, 500); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(m_pAppHandles->pZwCommandQueue, (uint8_t *)&cmdPackage, 500); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); SZwaveCommandStatusPackage cmdStatus = { 0 }; if (GetCommandResponse(&cmdStatus, EZWAVECOMMANDSTATUS_IS_PRIMARY_CTRL)) { return cmdStatus.Content.IsPrimaryCtrlStatus.result; } - ASSERT(false); + assert(false); return 0; } @@ -73,14 +74,14 @@ uint8_t GetControllerCapabilities(void) SZwaveCommandPackage cmdPackage = { .eCommandType = EZWAVECOMMANDTYPE_GET_CONTROLLER_CAPABILITIES }; - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(m_pAppHandles->pZwCommandQueue, (uint8_t *)&cmdPackage, 500); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); - SZwaveCommandStatusPackage cmdStatus = { 0 }; - if (GetCommandResponse(&cmdStatus, EZWAVECOMMANDSTATUS_GET_CONTROLLER_CAPABILITIES)) + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(m_pAppHandles->pZwCommandQueue, (uint8_t *)&cmdPackage, 500); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + SZwaveCommandStatusPackage cmdStatus = { .eStatusType = EZWAVECOMMANDSTATUS_GET_CONTROLLER_CAPABILITIES }; + if (GetCommandResponse(&cmdStatus, cmdStatus.eStatusType)) { return cmdStatus.Content.GetControllerCapabilitiesStatus.result; } - ASSERT(false); + assert(false); return 0; } @@ -110,11 +111,11 @@ void GetNodeInfo(uint16_t NodeId, t_ExtNodeInfo* pNodeInfo) }; // Put the Command on queue (and dont wait for it, queue must be empty) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(m_pAppHandles->pZwCommandQueue, (uint8_t *)&GetNodeInfoCommand, 0); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(m_pAppHandles->pZwCommandQueue, (uint8_t *)&GetNodeInfoCommand, 0); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); // Wait for protocol to handle command (it shouldnt take long) - SZwaveCommandStatusPackage NodeInfo = { 0 }; - if (GetCommandResponse(&NodeInfo, EZWAVECOMMANDSTATUS_NODE_INFO)) + SZwaveCommandStatusPackage NodeInfo = { .eStatusType = EZWAVECOMMANDSTATUS_NODE_INFO}; + if (GetCommandResponse(&NodeInfo, NodeInfo.eStatusType)) { if (NodeInfo.Content.NodeInfoStatus.NodeId == NodeId) { @@ -122,7 +123,7 @@ void GetNodeInfo(uint16_t NodeId, t_ExtNodeInfo* pNodeInfo) return; } } - ASSERT(false); + assert(false); } /** @@ -141,16 +142,16 @@ void Get_included_nodes(uint8_t* node_id_list) .eCommandType = EZWAVECOMMANDTYPE_ZW_GET_INCLUDED_NODES}; // Put the Command on queue (and dont wait for it, queue must be empty) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(m_pAppHandles->pZwCommandQueue, (uint8_t *)&GetIncludedNodesCommand, 0); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(m_pAppHandles->pZwCommandQueue, (uint8_t *)&GetIncludedNodesCommand, 0); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); // Wait for protocol to handle command (it shouldnt take long) - SZwaveCommandStatusPackage includedNodes = { 0 }; - if (GetCommandResponse(&includedNodes, EZWAVECOMMANDSTATUS_ZW_GET_INCLUDED_NODES)) + SZwaveCommandStatusPackage includedNodes = { .eStatusType = EZWAVECOMMANDSTATUS_ZW_GET_INCLUDED_NODES }; + if (GetCommandResponse(&includedNodes, includedNodes.eStatusType)) { memcpy(node_id_list, (uint8_t*)includedNodes.Content.GetIncludedNodes.node_id_list, sizeof(NODE_MASK_TYPE)); return; } - ASSERT(false); + assert(false); } @@ -171,8 +172,8 @@ void Get_included_lr_nodes(uint8_t* node_id_list) }; // Put the Command on queue (and don't wait for it, queue is most likely empty) - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(m_pAppHandles->pZwCommandQueue, (uint8_t *)&GetIncludedNodesCommand, 0); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(m_pAppHandles->pZwCommandQueue, (uint8_t *)&GetIncludedNodesCommand, 0); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); // Wait for protocol to handle command (it shouldn't take long) SZwaveCommandStatusPackage includedNodes = { 0 }; if (GetCommandResponse(&includedNodes, EZWAVECOMMANDSTATUS_ZW_GET_INCLUDED_LR_NODES)) @@ -180,7 +181,7 @@ void Get_included_lr_nodes(uint8_t* node_id_list) memcpy(node_id_list, (uint8_t*)includedNodes.Content.GetIncludedNodesLR.node_id_list, sizeof(LR_NODE_MASK_TYPE)); return; } - ASSERT(false); + assert(false); } @@ -214,8 +215,8 @@ void GetLongRangeChannel(uint8_t * channel_n, uint8_t *auto_channel_config) SZwaveCommandPackage cmdPackage = { .eCommandType = EZWAVECOMMANDTYPE_ZW_GET_LR_CHANNEL }; - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(m_pAppHandles->pZwCommandQueue, (uint8_t *)&cmdPackage, 500); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(m_pAppHandles->pZwCommandQueue, (uint8_t *)&cmdPackage, 500); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); SZwaveCommandStatusPackage cmdStatus = { 0 }; *auto_channel_config = 0; *channel_n = 0; @@ -225,7 +226,7 @@ void GetLongRangeChannel(uint8_t * channel_n, uint8_t *auto_channel_config) *auto_channel_config = cmdStatus.Content.GetLRChannel.result & LR_AUTO_CHANNEL_CONFIG_MASK; return; } - ASSERT(false); + assert(false); } bool SetLongRangeChannel(uint8_t channel) @@ -235,14 +236,14 @@ bool SetLongRangeChannel(uint8_t channel) .eCommandType = EZWAVECOMMANDTYPE_ZW_SET_LR_CHANNEL, .uCommandParams.SetLRChannel.value = channel }; - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(m_pAppHandles->pZwCommandQueue, (uint8_t *)&cmdPackage, 500); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(m_pAppHandles->pZwCommandQueue, (uint8_t *)&cmdPackage, 500); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); SZwaveCommandStatusPackage cmdStatus = { 0 }; if (GetCommandResponse(&cmdStatus, EZWAVECOMMANDSTATUS_ZW_SET_LR_CHANNEL)) { return cmdStatus.Content.SetLRChannel.result; } - ASSERT(false); + assert(false); return 0; } @@ -254,8 +255,8 @@ void SetLongRangeVirtualNodes(uint8_t bitmask) .eCommandType = EZWAVECOMMANDTYPE_ZW_SET_LR_VIRTUAL_IDS, .uCommandParams.SetLRVirtualNodeIDs.value = bitmask }; - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(m_pAppHandles->pZwCommandQueue, (uint8_t *)&cmdPackage, 500); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(m_pAppHandles->pZwCommandQueue, (uint8_t *)&cmdPackage, 500); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); } uint8_t GetPTIConfig(void) @@ -264,14 +265,14 @@ uint8_t GetPTIConfig(void) SZwaveCommandPackage cmdPackage = { .eCommandType = EZWAVECOMMANDTYPE_ZW_GET_PTI_CONFIG }; - EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(m_pAppHandles->pZwCommandQueue, (uint8_t *)&cmdPackage, 500); - ASSERT(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); - SZwaveCommandStatusPackage cmdStatus; - if (GetCommandResponse(&cmdStatus, EZWAVECOMMANDSTATUS_ZW_GET_PTI_CONFIG)) + __attribute__((unused)) EQueueNotifyingStatus QueueStatus = QueueNotifyingSendToBack(m_pAppHandles->pZwCommandQueue, (uint8_t *)&cmdPackage, 500); + assert(EQUEUENOTIFYING_STATUS_SUCCESS == QueueStatus); + SZwaveCommandStatusPackage cmdStatus = { .eStatusType = EZWAVECOMMANDSTATUS_ZW_GET_PTI_CONFIG }; + if (GetCommandResponse(&cmdStatus, cmdStatus.eStatusType)) { return cmdStatus.Content.GetPTIconfig.result; } - ASSERT(false); + assert(false); return 0; } diff --git a/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.pintool b/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.pintool index f9e7fb9d..0b7fce54 100644 --- a/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.pintool +++ b/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.pintool @@ -1,36 +1,7 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slcp b/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slcp index 23567535..6b9f0201 100644 --- a/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slcp +++ b/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slcp @@ -15,6 +15,7 @@ package: Z-Wave quality: production readme: - {path: README.md} +- {path: README.md} source: - {path: app_node_info.c} - {path: cmd_handlers_invoker.c} @@ -34,7 +35,7 @@ source: - {path: main.c} tag: [prebuilt_demo] include: -- path: '' +- path: . file_list: - {path: app_node_info.h} - {path: cmd_handlers.h} @@ -46,16 +47,18 @@ include: - {path: nvm_backup_restore.h} - {path: serialapi_file.h} - {path: app.h} + - {path: common_supported_func.h} - {path: slave_supported_func.h} - {path: utils.h} - {path: virtual_slave_node_info.h} + - {path: SerialAPI.h} - {path: zaf_config_security.h} -sdk: {id: gecko_sdk, version: 4.4.2} +sdk: {id: simplicity_sdk, version: 2024.6.0} toolchain_settings: [] component: -- {id: ZGM130S037HGN} +- {id: ZGM230SB27HGN} - {id: ZW_MIGRATION_FROM_7_20} -- {id: brd4207a} +- {id: brd2603a} - {id: device_init} - {id: emlib_letimer} - {id: emlib_msc} @@ -65,7 +68,6 @@ component: - {id: sl_system} - {id: zaf_ncp} - {id: zw_api_controller} -- {id: zw_api_serialapi} - {id: zw_api_zw} - {id: zw_app_timer_deep_sleep} - {id: zw_appshw_serialapi} @@ -77,18 +79,13 @@ other_file: - {path: postbuild.sh} define: - {name: APP_PROPERTIES_CONFIG_FILE, value: } -- condition: [device_sdid_95] - name: MAX_CALLBACK_QUEUE - value: '4' -- condition: [device_sdid_95] - name: MAX_UNSOLICITED_QUEUE - value: '4' config_file: - {path: config/zaf_config.h} -- {path: config/zaf_config.h} +template_contribution: +- {name: rodata_sections, priority: 0, value: zw_cmd_handlers} configuration: -- {name: ZAF_CONFIG_GENERIC_TYPE, value: '0'} -- {name: ZAF_CONFIG_SPECIFIC_TYPE, value: '0'} +- {name: ZAF_CONFIG_GENERIC_TYPE, value: GENERIC_TYPE_STATIC_CONTROLLER} +- {name: ZAF_CONFIG_SPECIFIC_TYPE, value: SPECIFIC_TYPE_PC_CONTROLLER} - {name: ZAF_CONFIG_PRODUCT_ID, value: '4'} - {name: NVM3_DEFAULT_MAX_OBJECT_SIZE, value: '1900'} - {name: NVM3_DEFAULT_CACHE_SIZE, value: '100'} @@ -102,12 +99,6 @@ configuration: - {name: SL_IOSTREAM_EUSART_VCOM_RESTRICT_ENERGY_MODE_TO_ALLOW_RECEPTION, value: '0'} - {name: configUSE_IDLE_HOOK, value: '1'} - {name: configTIMER_TASK_PRIORITY, value: '55'} -- condition: [device_series_1] - name: configMAX_SYSCALL_INTERRUPT_PRIORITY - value: '32' -- condition: [device_series_1] - name: configKERNEL_INTERRUPT_PRIORITY - value: '224' - condition: [device_series_2] name: configMAX_SYSCALL_INTERRUPT_PRIORITY value: '16' @@ -125,18 +116,7 @@ configuration: - condition: [device_series_2] name: SL_SLEEPTIMER_PERIPHERAL value: SL_SLEEPTIMER_PERIPHERAL_BURTC -- condition: [device_sdid_95] - name: configTIMER_QUEUE_LENGTH - value: '4' -- condition: [device_sdid_95] - name: configTOTAL_HEAP_SIZE - value: '0' -- condition: [device_sdid_95] - name: SL_STACK_SIZE - value: '1024' -- unless: [device_sdid_95] - name: SL_STACK_SIZE - value: '1280' +- {name: SL_STACK_SIZE, value: '1280'} - {name: SL_HEAP_SIZE, value: '128'} - {name: ZAF_CONFIG_INSTALLER_ICON_TYPE, value: '0'} - {name: ZAF_APP_NAME, value: '"serial_api_controller"'} @@ -144,4 +124,5 @@ configuration: ui_hints: highlight: - {path: README.md, focus: true} +post_build: {path: zwave_ncp_serial_api_controller.slpb, profile: zwave_ncp_serial_api_controller} diff --git a/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slpb b/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slpb new file mode 100644 index 00000000..6281e269 --- /dev/null +++ b/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slpb @@ -0,0 +1,14 @@ +--- +parameters: +- name: "build_dir" +constants: +- name: "project_name" + value: "zwave_ncp_serial_api_controller" +steps: +- task: "copy" + output: "artifact/{{project_name}}.s37" + export: "application_binary" + input: "{{build_dir}}/{{project_name}}.s37" +- task: "usage" + input: "{{build_dir}}/{{project_name}}.out" + map: "{{build_dir}}/{{project_name}}.map" diff --git a/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slps b/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slps index 74bbc115..cb7b0693 100644 --- a/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slps +++ b/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slps @@ -1,16 +1,17 @@ - + - + - + + \ No newline at end of file From 1a2763fb6cfe6f5d82b3755c48405b11ebef98f8 Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Thu, 20 Jun 2024 14:25:19 -0400 Subject: [PATCH 11/13] Configure project to use build system --- ...a-lr2_zwave_ncp_serial_api_controller.yaml | 14 ---- ...b001a_zwave_ncp_serial_api_controller.yaml | 14 ---- ...troller.yaml => zwave_zgm230-dk2603a.yaml} | 19 ++++-- src/zwave_ncp_serial_api_controller/.cproject | 68 ++++++++++--------- .../gbl_metadata.yaml | 6 ++ .../zwave_ncp_serial_api_controller.slcp | 2 - .../zwave_ncp_serial_api_controller.slpb | 14 ---- tools/create_gbl.py | 6 +- 8 files changed, 59 insertions(+), 84 deletions(-) delete mode 100644 manifests/nabucasa/slusb001a-lr2_zwave_ncp_serial_api_controller.yaml delete mode 100644 manifests/nabucasa/slusb001a_zwave_ncp_serial_api_controller.yaml rename manifests/nabucasa/{slusb001a-lr_zwave_ncp_serial_api_controller.yaml => zwave_zgm230-dk2603a.yaml} (52%) create mode 100644 src/zwave_ncp_serial_api_controller/gbl_metadata.yaml delete mode 100644 src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slpb diff --git a/manifests/nabucasa/slusb001a-lr2_zwave_ncp_serial_api_controller.yaml b/manifests/nabucasa/slusb001a-lr2_zwave_ncp_serial_api_controller.yaml deleted file mode 100644 index cfcd0fbb..00000000 --- a/manifests/nabucasa/slusb001a-lr2_zwave_ncp_serial_api_controller.yaml +++ /dev/null @@ -1,14 +0,0 @@ -name: ??? -device: ZGM130S037HGN -base_project: src/zwave_ncp_serial_api_controller - -gbl: - fw_type: z-wave - dynamic: ["zwave_version"] - baudrate: 115200 - compression: lz4 - sign_key: "{SDK_DIR}/protocol/z-wave/platform/SiliconLabs/PAL/BootLoader/controller-keys/controller_sign.key" - encrypt_key: "{SDK_DIR}/protocol/z-wave/platform/SiliconLabs/PAL/BootLoader/controller-keys/controller_encrypt.key" - -add_components: -- id: brd4207a diff --git a/manifests/nabucasa/slusb001a_zwave_ncp_serial_api_controller.yaml b/manifests/nabucasa/slusb001a_zwave_ncp_serial_api_controller.yaml deleted file mode 100644 index fae99012..00000000 --- a/manifests/nabucasa/slusb001a_zwave_ncp_serial_api_controller.yaml +++ /dev/null @@ -1,14 +0,0 @@ -name: Silicon Labs UZB-7 (SLUSB001A), +14 dBm, with SAW filters -device: EFR32ZG14P231F256GM32 -base_project: src/zwave_ncp_serial_api_controller - -gbl: - fw_type: z-wave - dynamic: ["zwave_version"] - baudrate: 115200 - compression: lz4 - sign_key: "{SDK_DIR}/protocol/z-wave/platform/SiliconLabs/PAL/BootLoader/controller-keys/controller_sign.key" - encrypt_key: "{SDK_DIR}/protocol/z-wave/platform/SiliconLabs/PAL/BootLoader/controller-keys/controller_encrypt.key" - -add_components: -- id: brd4201a diff --git a/manifests/nabucasa/slusb001a-lr_zwave_ncp_serial_api_controller.yaml b/manifests/nabucasa/zwave_zgm230-dk2603a.yaml similarity index 52% rename from manifests/nabucasa/slusb001a-lr_zwave_ncp_serial_api_controller.yaml rename to manifests/nabucasa/zwave_zgm230-dk2603a.yaml index 4f7c243a..a930a369 100644 --- a/manifests/nabucasa/slusb001a-lr_zwave_ncp_serial_api_controller.yaml +++ b/manifests/nabucasa/zwave_zgm230-dk2603a.yaml @@ -1,5 +1,5 @@ -name: Silicon Labs UZB-7 (SLUSB001A), +14 dBm, Z-Wave Long Range -device: EFR32ZG14P231F256GM32 +name: ZGM230-DK2603A +device: ZGM230SB27HGN base_project: src/zwave_ncp_serial_api_controller gbl: @@ -10,5 +10,16 @@ gbl: sign_key: "{SDK_DIR}/protocol/z-wave/platform/SiliconLabs/PAL/BootLoader/controller-keys/controller_sign.key" encrypt_key: "{SDK_DIR}/protocol/z-wave/platform/SiliconLabs/PAL/BootLoader/controller-keys/controller_encrypt.key" -add_components: -- id: brd4206a +c_defines: + ZAF_CONFIG_MANUFACTURER_ID: "0x0466" + ZAF_CONFIG_PRODUCT_TYPE_ID: "0x0001" + ZAF_CONFIG_PRODUCT_ID: "0x0001" + + SERIAL_API_PERIPHERAL: USART0 + SERIAL_API_PERIPHERAL_NO: 0 + + SERIAL_API_TX_PORT: gpioPortA + SERIAL_API_TX_PIN: 8 + + SERIAL_API_RX_PORT: gpioPortA + SERIAL_API_RX_PIN: 9 diff --git a/src/zwave_ncp_serial_api_controller/.cproject b/src/zwave_ncp_serial_api_controller/.cproject index d7401951..0a388b66 100644 --- a/src/zwave_ncp_serial_api_controller/.cproject +++ b/src/zwave_ncp_serial_api_controller/.cproject @@ -25,29 +25,29 @@ - + - + + \ No newline at end of file diff --git a/src/zwave_ncp_serial_api_controller/gbl_metadata.yaml b/src/zwave_ncp_serial_api_controller/gbl_metadata.yaml new file mode 100644 index 00000000..33221b6e --- /dev/null +++ b/src/zwave_ncp_serial_api_controller/gbl_metadata.yaml @@ -0,0 +1,6 @@ +baudrate: 115200 +dynamic: [zwave_version] +fw_type: z-wave +compression: lz4 +sign_key: "{SDK_DIR}/protocol/z-wave/platform/SiliconLabs/PAL/BootLoader/controller-keys/controller_sign.key" +encrypt_key: "{SDK_DIR}/protocol/z-wave/platform/SiliconLabs/PAL/BootLoader/controller-keys/controller_encrypt.key" \ No newline at end of file diff --git a/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slcp b/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slcp index 6b9f0201..2dea12d7 100644 --- a/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slcp +++ b/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slcp @@ -124,5 +124,3 @@ configuration: ui_hints: highlight: - {path: README.md, focus: true} -post_build: {path: zwave_ncp_serial_api_controller.slpb, profile: zwave_ncp_serial_api_controller} - diff --git a/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slpb b/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slpb deleted file mode 100644 index 6281e269..00000000 --- a/src/zwave_ncp_serial_api_controller/zwave_ncp_serial_api_controller.slpb +++ /dev/null @@ -1,14 +0,0 @@ ---- -parameters: -- name: "build_dir" -constants: -- name: "project_name" - value: "zwave_ncp_serial_api_controller" -steps: -- task: "copy" - output: "artifact/{{project_name}}.s37" - export: "application_binary" - input: "{{build_dir}}/{{project_name}}.s37" -- task: "usage" - input: "{{build_dir}}/{{project_name}}.out" - map: "{{build_dir}}/{{project_name}}.map" diff --git a/tools/create_gbl.py b/tools/create_gbl.py index 282d3b06..fbd84768 100755 --- a/tools/create_gbl.py +++ b/tools/create_gbl.py @@ -190,10 +190,10 @@ def main(): if "zwave_version" in gbl_dynamic: gbl_dynamic.remove("zwave_version") - zwave_esf_props = parse_properties_file( - (gsdk_path / "protocol/z-wave/esf.properties").read_text() + zwave_props = parse_properties_file( + next((gsdk_path / "protocol/z-wave/").glob("*.properties")).read_text() ) - metadata["zwave_version"] = zwave_esf_props["version"][0] + metadata["zwave_version"] = zwave_props["version"][0] if "ot_rcp_version" in gbl_dynamic: gbl_dynamic.remove("ot_rcp_version") From 8151739ac16c87102222eb31393968e7b7058c47 Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Thu, 20 Jun 2024 14:30:56 -0400 Subject: [PATCH 12/13] Revert "Keep around Gecko SDK 4.4.2 for Z-Wave" This reverts commit 5f4dd69b8439186832dcd6d537e72c33052ac2a7. --- Dockerfile | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 244d8cbf..466c0c17 100644 --- a/Dockerfile +++ b/Dockerfile @@ -63,12 +63,6 @@ RUN \ && unzip -q -d gecko_sdk_4.3.1 gecko_sdk_4.3.1.zip \ && rm gecko_sdk_4.3.1.zip -# Gecko SDK 4.4.2 -RUN \ - curl -o gecko_sdk_4.4.2.zip -L https://github.com/SiliconLabs/gecko_sdk/releases/download/v4.4.2/gecko-sdk.zip \ - && unzip -q -d gecko_sdk_4.4.2 gecko_sdk_4.4.2.zip \ - && rm gecko_sdk_4.4.2.zip - ARG USERNAME=builder ARG USER_UID=1000 ARG USER_GID=$USER_UID From a3b57276c4ee1c99c256091276cf4db9f5584f5f Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Thu, 20 Jun 2024 14:35:19 -0400 Subject: [PATCH 13/13] Drop 4.3.1 in favor of 4.4.2 for legacy multipan firmwares --- Dockerfile | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 466c0c17..1a889960 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,23 +45,17 @@ RUN \ && tar -C /opt -xf arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz \ && rm arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz -# GCC Embedded Toolchain 10.3-2021.10 (for earlier Gecko SDKs) -RUN \ - curl -O https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 \ - && tar -C /opt -xf gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 \ - && rm gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 - # Simplicity SDK 2024.6.0 RUN \ curl -o simplicity_sdk_2024.6.0.zip -L https://github.com/SiliconLabs/simplicity_sdk/releases/download/v2024.6.0/sisdk-sdk.zip \ && unzip -q -d simplicity_sdk_2024.6.0 simplicity_sdk_2024.6.0.zip \ && rm simplicity_sdk_2024.6.0.zip -# Gecko SDK 4.3.1 +# Gecko SDK 4.4.2 RUN \ - curl -o gecko_sdk_4.3.1.zip -L https://github.com/SiliconLabs/gecko_sdk/releases/download/v4.3.1/gecko-sdk.zip \ - && unzip -q -d gecko_sdk_4.3.1 gecko_sdk_4.3.1.zip \ - && rm gecko_sdk_4.3.1.zip + curl -o gecko_sdk_4.4.2.zip -L https://github.com/SiliconLabs/gecko_sdk/releases/download/v4.4.2/gecko-sdk.zip \ + && unzip -q -d gecko_sdk_4.4.2 gecko_sdk_4.4.2.zip \ + && rm gecko_sdk_4.4.2.zip ARG USERNAME=builder ARG USER_UID=1000