diff --git a/Dockerfile b/Dockerfile index 2ebb30c3..df65d780 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,23 +45,11 @@ 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) +# Gecko SDK 4.4.4 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 - -# Gecko SDK 4.4.3 -RUN \ - curl -o gecko_sdk_4.4.3.zip -L https://github.com/SiliconLabs/gecko_sdk/releases/download/v4.4.3/gecko-sdk.zip \ - && unzip -q -d gecko_sdk_4.4.3 gecko_sdk_4.4.3.zip \ - && rm gecko_sdk_4.4.3.zip - -# Gecko SDK 4.3.1 -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.4.zip -L https://github.com/SiliconLabs/gecko_sdk/releases/download/v4.4.4/gecko-sdk.zip \ + && unzip -q -d gecko_sdk_4.4.4 gecko_sdk_4.4.4.zip \ + && rm gecko_sdk_4.4.4.zip ARG USERNAME=builder ARG USER_UID=1000 diff --git a/misc/firmware-eraser/.cproject b/misc/firmware-eraser/.cproject index b18de704..54a97c22 100644 --- a/misc/firmware-eraser/.cproject +++ b/misc/firmware-eraser/.cproject @@ -4,7 +4,7 @@ - + @@ -23,7 +23,1479 @@ - + @@ -245,7 +1717,7 @@ - + @@ -264,7 +1736,761 @@ - + @@ -323,14 +2549,183 @@ - + - + diff --git a/misc/firmware-eraser/firmware-eraser.pintool b/misc/firmware-eraser/firmware-eraser.pintool index 367a595d..734fdd07 100644 --- a/misc/firmware-eraser/firmware-eraser.pintool +++ b/misc/firmware-eraser/firmware-eraser.pintool @@ -1,5 +1,5 @@ - + diff --git a/misc/firmware-eraser/firmware-eraser.slcp b/misc/firmware-eraser/firmware-eraser.slcp index 77c503db..f6d7ae34 100644 --- a/misc/firmware-eraser/firmware-eraser.slcp +++ b/misc/firmware-eraser/firmware-eraser.slcp @@ -22,7 +22,7 @@ include: - path: . file_list: - {path: app.h} -sdk: {id: gecko_sdk, version: 4.4.3} +sdk: {id: gecko_sdk, version: 4.4.4} toolchain_settings: [] component: - {id: EFR32MG21A010F1024IM32} diff --git a/misc/firmware-eraser/firmware-eraser.slps b/misc/firmware-eraser/firmware-eraser.slps index c4eecd63..953adc57 100644 --- a/misc/firmware-eraser/firmware-eraser.slps +++ b/misc/firmware-eraser/firmware-eraser.slps @@ -1,7 +1,7 @@ - + diff --git a/src/bootloader-uart-xmodem/.cproject b/src/bootloader-uart-xmodem/.cproject index 5c14b55e..0729a5c6 100644 --- a/src/bootloader-uart-xmodem/.cproject +++ b/src/bootloader-uart-xmodem/.cproject @@ -4,7 +4,7 @@ - + @@ -23,7 +23,1452 @@ - + @@ -245,7 +1690,162 @@ - + diff --git a/src/bootloader-uart-xmodem/bootloader-uart-xmodem.pintool b/src/bootloader-uart-xmodem/bootloader-uart-xmodem.pintool index c30c9c17..75c7893f 100644 --- a/src/bootloader-uart-xmodem/bootloader-uart-xmodem.pintool +++ b/src/bootloader-uart-xmodem/bootloader-uart-xmodem.pintool @@ -1,5 +1,5 @@ - + diff --git a/src/bootloader-uart-xmodem/bootloader-uart-xmodem.slcp b/src/bootloader-uart-xmodem/bootloader-uart-xmodem.slcp index 5081647f..f271700a 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.3} +sdk: {id: gecko_sdk, version: 4.4.4} toolchain_settings: [] component: - {id: EFR32MG21A010F1024IM32} diff --git a/src/bootloader-uart-xmodem/bootloader-uart-xmodem.slps b/src/bootloader-uart-xmodem/bootloader-uart-xmodem.slps index bda4eab3..87edfd11 100644 --- a/src/bootloader-uart-xmodem/bootloader-uart-xmodem.slps +++ b/src/bootloader-uart-xmodem/bootloader-uart-xmodem.slps @@ -1,7 +1,7 @@ - + diff --git a/src/ncp-uart-hw/.cproject b/src/ncp-uart-hw/.cproject index 0f1c0557..a56c4b0b 100644 --- a/src/ncp-uart-hw/.cproject +++ b/src/ncp-uart-hw/.cproject @@ -4,7 +4,7 @@ - + @@ -23,7 +23,2139 @@ - + @@ -515,7 +2647,512 @@ - + diff --git a/src/ncp-uart-hw/ncp-uart-hw.pintool b/src/ncp-uart-hw/ncp-uart-hw.pintool index 367a595d..734fdd07 100644 --- a/src/ncp-uart-hw/ncp-uart-hw.pintool +++ b/src/ncp-uart-hw/ncp-uart-hw.pintool @@ -1,5 +1,5 @@ - + diff --git a/src/ncp-uart-hw/ncp-uart-hw.slcp b/src/ncp-uart-hw/ncp-uart-hw.slcp index e9dc96b3..e8b75102 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.3} +sdk: {id: gecko_sdk, version: 4.4.4} toolchain_settings: [] component: - {id: EFR32MG21A010F1024IM32} diff --git a/src/ncp-uart-hw/ncp-uart-hw.slps b/src/ncp-uart-hw/ncp-uart-hw.slps index 10bf5b58..9aaaa27f 100644 --- a/src/ncp-uart-hw/ncp-uart-hw.slps +++ b/src/ncp-uart-hw/ncp-uart-hw.slps @@ -1,7 +1,7 @@ - + diff --git a/src/ot-rcp/.cproject b/src/ot-rcp/.cproject index bed3f49b..f98a010c 100644 --- a/src/ot-rcp/.cproject +++ b/src/ot-rcp/.cproject @@ -4,7 +4,7 @@ - + @@ -23,7 +23,2252 @@ - + @@ -49,8 +2294,9 @@ - + diff --git a/src/ot-rcp/config/sl_rcp_gp_interface_config.h b/src/ot-rcp/config/sl_rcp_gp_interface_config.h new file mode 100644 index 00000000..cbf00dd5 --- /dev/null +++ b/src/ot-rcp/config/sl_rcp_gp_interface_config.h @@ -0,0 +1,14 @@ +//-------- <<< 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/ot-rcp.pintool b/src/ot-rcp/ot-rcp.pintool index 6aef5b4c..adf96d27 100644 --- a/src/ot-rcp/ot-rcp.pintool +++ b/src/ot-rcp/ot-rcp.pintool @@ -1,5 +1,5 @@ - + diff --git a/src/ot-rcp/ot-rcp.slcp b/src/ot-rcp/ot-rcp.slcp index 5a53aa08..b403f68a 100644 --- a/src/ot-rcp/ot-rcp.slcp +++ b/src/ot-rcp/ot-rcp.slcp @@ -24,7 +24,7 @@ include: file_list: - {path: app.h} - {path: reset_util.h} -sdk: {id: gecko_sdk, version: 4.4.3} +sdk: {id: gecko_sdk, version: 4.4.4} toolchain_settings: [] component: - {id: EFR32MG21A010F1024IM32} diff --git a/src/ot-rcp/ot-rcp.slps b/src/ot-rcp/ot-rcp.slps index 2e2281b4..2a408275 100644 --- a/src/ot-rcp/ot-rcp.slps +++ b/src/ot-rcp/ot-rcp.slps @@ -1,7 +1,7 @@ - + diff --git a/src/rcp-uart-802154/.cproject b/src/rcp-uart-802154/.cproject index 75846ce3..45c20e6d 100644 --- a/src/rcp-uart-802154/.cproject +++ b/src/rcp-uart-802154/.cproject @@ -4,7 +4,7 @@ - + @@ -23,7 +23,2361 @@ - + @@ -50,8 +2404,9 @@ - + diff --git a/src/rcp-uart-802154/rcp-uart-802154.pintool b/src/rcp-uart-802154/rcp-uart-802154.pintool index a3017a33..e975562e 100644 --- a/src/rcp-uart-802154/rcp-uart-802154.pintool +++ b/src/rcp-uart-802154/rcp-uart-802154.pintool @@ -1,5 +1,5 @@ - + diff --git a/src/rcp-uart-802154/rcp-uart-802154.slcp b/src/rcp-uart-802154/rcp-uart-802154.slcp index ed383a3e..023c9721 100644 --- a/src/rcp-uart-802154/rcp-uart-802154.slcp +++ b/src/rcp-uart-802154/rcp-uart-802154.slcp @@ -26,7 +26,7 @@ include: file_list: - {path: app.h} - {path: reset_util.h} -sdk: {id: gecko_sdk, version: 4.4.3} +sdk: {id: gecko_sdk, version: 4.4.4} toolchain_settings: [] component: - {from: nc_efr32_watchdog, id: nc_efr32_watchdog} diff --git a/src/rcp-uart-802154/rcp-uart-802154.slps b/src/rcp-uart-802154/rcp-uart-802154.slps index 262ef26d..ff7fd91b 100644 --- a/src/rcp-uart-802154/rcp-uart-802154.slps +++ b/src/rcp-uart-802154/rcp-uart-802154.slps @@ -1,7 +1,7 @@ - + diff --git a/src/zwave_ncp_serial_api_controller/.cproject b/src/zwave_ncp_serial_api_controller/.cproject index 09078e5b..816928e0 100644 --- a/src/zwave_ncp_serial_api_controller/.cproject +++ b/src/zwave_ncp_serial_api_controller/.cproject @@ -4,7 +4,7 @@ - + @@ -23,7 +23,1669 @@ - + @@ -154,13 +1816,13 @@ - + - + - + @@ -295,13 +1957,13 @@ - + - + - + @@ -367,7 +2029,512 @@ - + diff --git a/src/zwave_ncp_serial_api_controller/app.c b/src/zwave_ncp_serial_api_controller/app.c index a39f90c2..460d7469 100644 --- a/src/zwave_ncp_serial_api_controller/app.c +++ b/src/zwave_ncp_serial_api_controller/app.c @@ -14,6 +14,7 @@ #endif /* ZW_CONTROLLER */ #include "AppTimer.h" #include "ZW_system_startup_api.h" +#include "zpal_retention_register.h" /* Include app header file - containing version and */ /* SerialAPI functionality support definitions */ #ifdef ZW_SECURITY_PROTOCOL @@ -473,6 +474,9 @@ appFileSystemInit(void) AppNodeInfo = zaf_get_app_node_info(); RadioConfig = zaf_get_radio_config(); + // enable the watchdog at init of application + zpal_enable_watchdog(true); + /* * Handle file system init inside Application Task * This reduces the default stack needed during initialization @@ -902,7 +906,21 @@ ApplicationInitSW(void) eSerialAPIStartedCapabilities capabilities = (RadioConfig->eRegion == REGION_US_LR) ? SERIAL_API_STARTED_CAPABILITIES_L0NG_RANGE : 0; compl_workbuf[6 + i] = capabilities; + uint32_t zpal_reset_info = 0; + if (ZPAL_STATUS_OK != zpal_retention_register_read(ZPAL_RETENTION_REGISTER_RESET_INFO, &zpal_reset_info)) + { + DPRINT("ERROR while reading the reset information\n"); Request(FUNC_ID_SERIAL_API_STARTED, compl_workbuf, 7 + i); + } + else + { + compl_workbuf[7 + i] = (uint8_t)(zpal_reset_info >> 24); + compl_workbuf[8 + i] = (uint8_t)(zpal_reset_info >> 16); + compl_workbuf[9 + i] = (uint8_t)(zpal_reset_info >> 8); + compl_workbuf[10 + i] = (uint8_t)zpal_reset_info; + DPRINTF("zpal_reset_reason: %u\n", zpal_reset_info); + Request(FUNC_ID_SERIAL_API_STARTED, compl_workbuf, 11 + i); + } #endif /* #if SUPPORT_STARTUP_NOTIFICATION */ AppTimerDeepSleepPersistentRegister(&mWakeupTimer, false, ZCB_WakeupTimeout); // register for event jobs timeout event diff --git a/src/zwave_ncp_serial_api_controller/cmd_handlers.c b/src/zwave_ncp_serial_api_controller/cmd_handlers.c index 496eee8a..abd2ec50 100644 --- a/src/zwave_ncp_serial_api_controller/cmd_handlers.c +++ b/src/zwave_ncp_serial_api_controller/cmd_handlers.c @@ -128,26 +128,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); } diff --git a/src/zwave_ncp_serial_api_controller/cmds_management.c b/src/zwave_ncp_serial_api_controller/cmds_management.c index 86527977..2143b25a 100644 --- a/src/zwave_ncp_serial_api_controller/cmds_management.c +++ b/src/zwave_ncp_serial_api_controller/cmds_management.c @@ -45,6 +45,31 @@ #define MAX( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) ) #endif // MAX +static const serial_api_setup_cmd_get_region_info_answer_t regions_info[] = { + {.region=REGION_EU, .zw_classic=1, .zw_lr=0, .reserved=0, .included_region=REGION_UNDEFINED}, + {.region=REGION_US, .zw_classic=1, .zw_lr=0, .reserved=0, .included_region=REGION_UNDEFINED}, + {.region=REGION_ANZ, .zw_classic=1, .zw_lr=0, .reserved=0, .included_region=REGION_UNDEFINED}, + {.region=REGION_HK, .zw_classic=1, .zw_lr=0, .reserved=0, .included_region=REGION_UNDEFINED}, + {.region=REGION_IN, .zw_classic=1, .zw_lr=0, .reserved=0, .included_region=REGION_UNDEFINED}, + {.region=REGION_IL, .zw_classic=1, .zw_lr=0, .reserved=0, .included_region=REGION_UNDEFINED}, + {.region=REGION_RU, .zw_classic=1, .zw_lr=0, .reserved=0, .included_region=REGION_UNDEFINED}, + {.region=REGION_CN, .zw_classic=1, .zw_lr=0, .reserved=0, .included_region=REGION_UNDEFINED}, + {.region=REGION_US_LR, .zw_classic=1, .zw_lr=1, .reserved=0, .included_region=REGION_US}, + {.region=REGION_JP, .zw_classic=1, .zw_lr=0, .reserved=0, .included_region=REGION_UNDEFINED}, + {.region=REGION_KR, .zw_classic=1, .zw_lr=0, .reserved=0, .included_region=REGION_UNDEFINED}, +}; +#define REGIONS_INFO_COUNT (sizeof(regions_info)/sizeof(regions_info[0])) +//default answer in case the requested region is not found in the regions_info table. +static const serial_api_setup_cmd_get_region_info_answer_t unknown_region_info = +{ + .region = REGION_UNDEFINED, + .zw_classic = 0, + .zw_lr = 0, + .reserved = 0, + .included_region = 0 +}; +#define REGION_INFO_SIZE (sizeof(serial_api_setup_cmd_get_region_info_answer_t)) + void func_id_serial_api_get_init_data(__attribute__((unused)) uint8_t inputLength, __attribute__((unused)) const uint8_t *pInputBuffer, uint8_t *pOutputBuffer, @@ -202,6 +227,8 @@ void func_id_serial_api_setup(uint8_t inputLength, BITMASK_ADD_CMD(supportedBitmask, SERIAL_API_SETUP_CMD_TX_GET_MAX_LR_PAYLOAD_SIZE); // (17) BITMASK_ADD_CMD(supportedBitmask, SERIAL_API_SETUP_CMD_TX_POWERLEVEL_SET_16_BIT); // (18) BITMASK_ADD_CMD(supportedBitmask, SERIAL_API_SETUP_CMD_TX_POWERLEVEL_GET_16_BIT); // (19) + BITMASK_ADD_CMD(supportedBitmask, SERIAL_API_SETUP_CMD_GET_SUPPORTED_REGION); // (21) + BITMASK_ADD_CMD(supportedBitmask, SERIAL_API_SETUP_CMD_GET_REGION_INFO); // (22) /* Currently supported command with the highest value is SERIAL_API_SETUP_CMD_NODEID_BASETYPE_SET. No commands after it. */ @@ -253,6 +280,49 @@ void func_id_serial_api_setup(uint8_t inputLength, BYTE_IN_AR(pOutputBuffer, i++) = cmdRes; break; + case SERIAL_API_SETUP_CMD_GET_SUPPORTED_REGION: + { + uint8_t supported_region_count = 0; + uint8_t region_count_index = i; + i++; //skip suported region count, move to first region value; + for (rfRegion = REGION_EU; rfRegion <= REGION_US_LR; rfRegion++) { + if (true == isRfRegionValid(rfRegion)) { + supported_region_count++; + pOutputBuffer[i] = (uint8_t) rfRegion; + i++; + } + } + for (rfRegion = REGION_JP; rfRegion <= REGION_KR; rfRegion++) { + if (true == isRfRegionValid(rfRegion)) { + supported_region_count++; + pOutputBuffer[i] = (uint8_t) rfRegion; + i++; + } + } + pOutputBuffer[region_count_index] = supported_region_count; + break; + } + + case SERIAL_API_SETUP_CMD_GET_REGION_INFO: + { + uint8_t info_idx; + //search for the requested region in the regions_info table. + for (info_idx = 0; info_idx < REGIONS_INFO_COUNT; info_idx++) { + if (regions_info[info_idx].region == pInputBuffer[SAPI_SETUP_GET_REGION_INFO_RX_IDX_REGION]) { + break; + } + } + // Copy the answer in the output buffer. + if (info_idx < REGIONS_INFO_COUNT) { + memcpy(&(pOutputBuffer[i]), &(regions_info[info_idx]), REGION_INFO_SIZE); + } else { + //region not found, answer the unknown region info. + memcpy(&(pOutputBuffer[i]), &unknown_region_info, REGION_INFO_SIZE); + } + i += REGION_INFO_SIZE; + break; + } + case SERIAL_API_SETUP_CMD_TX_POWERLEVEL_SET: { zpal_tx_power_t iTxPower, iAdjust; diff --git a/src/zwave_ncp_serial_api_controller/cmds_management.h b/src/zwave_ncp_serial_api_controller/cmds_management.h index d6845457..baaac812 100644 --- a/src/zwave_ncp_serial_api_controller/cmds_management.h +++ b/src/zwave_ncp_serial_api_controller/cmds_management.h @@ -37,6 +37,8 @@ typedef enum SERIAL_API_SETUP_CMD_TX_GET_MAX_LR_PAYLOAD_SIZE = 17, SERIAL_API_SETUP_CMD_TX_POWERLEVEL_SET_16_BIT = 18, SERIAL_API_SETUP_CMD_TX_POWERLEVEL_GET_16_BIT = 19, + SERIAL_API_SETUP_CMD_GET_SUPPORTED_REGION = 21, + SERIAL_API_SETUP_CMD_GET_REGION_INFO = 22, } eSerialAPISetupCmd; /* SERIAL_API_SETUP_CMD_NODEID_BASETYPE_SET definitions */ @@ -74,6 +76,22 @@ extern eSerialAPISetupNodeIdBaseType nodeIdBaseType; #define SERIAL_API_SETUP_CMD_NODEID_BASETYPE_SET_CMD_LENGTH_MIN 2 #define SERIAL_API_SETUP_CMD_MAX_LR_TX_PWR_SET_CMD_LENGTH_MIN 3 +// -------------------------------- +// Definitions related to the sub command get region info +/// Index of the region in received buffer +#define SAPI_SETUP_GET_REGION_INFO_RX_IDX_REGION (1) +/// structure used to describe the format of a get region info answer. +#pragma pack(push) +#pragma pack(1) +typedef struct { + uint8_t region; + uint8_t zw_classic:1; ///< the region supports classic Z-Wave + uint8_t zw_lr:1; ///< the region supports Z-Wave Long Range + uint8_t reserved:6; ///< reserved for future use + uint8_t included_region; ///< the selected region include this one (e.g. US_LR include US) +} serial_api_setup_cmd_get_region_info_answer_t; +#pragma pack(pop) + /** * Must be called upon receiving a "Node List Command". * @param inputLength Length of data in input buffer. 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 11323bb0..28168e56 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,5 +1,5 @@ - + 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 048ff7ae..421a99d7 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 @@ -50,7 +50,7 @@ include: - {path: utils.h} - {path: virtual_slave_node_info.h} - {path: zaf_config_security.h} -sdk: {id: gecko_sdk, version: 4.4.3} +sdk: {id: gecko_sdk, version: 4.4.4} toolchain_settings: [] component: - {id: ZGM130S037HGN} 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 d6e7aa18..2ec13eff 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,7 +1,7 @@ - + diff --git a/tools/normalize_cproject.py b/tools/normalize_cproject.py index 4d4e7116..70a67dda 100644 --- a/tools/normalize_cproject.py +++ b/tools/normalize_cproject.py @@ -5,9 +5,12 @@ import xml.etree.ElementTree as ET -def json_dumps_compact(obj: dict | list) -> str: +NEWLINE_SENTINEL = "7200872e315d2518866d8a02e8258034" + + +def json_dumps(obj: dict | list) -> str: """Compactly dump JSON into a string.""" - return json.dumps(obj, separators=(",", ":"), indent=None) + return json.dumps(obj, separators=(", ", ": "), indent=4) cproject_path = pathlib.Path(sys.argv[1]) @@ -25,9 +28,7 @@ def json_dumps_compact(obj: dict | list) -> str: copied_files.sort( key=lambda f: (f["generated"], f["projectPath"], f["version"]) ) - storage_module.attrib["projectCommon.copiedFiles"] = json_dumps_compact( - copied_files - ) + storage_module.attrib["projectCommon.copiedFiles"] = json_dumps(copied_files) if "cppBuildConfig.projectBuiltInState" in storage_module.attrib: project_built_in_state = json.loads( @@ -39,16 +40,34 @@ def json_dumps_compact(obj: dict | list) -> str: resolved_options = json.loads(state["resolvedOptionsStr"]) resolved_options.sort(key=lambda o: o["optionId"]) - state["resolvedOptionsStr"] = json_dumps_compact(resolved_options) + state["resolvedOptionsStr"] = json_dumps(resolved_options) + + if "builtinIncludesStr" in state: + state["builtinIncludesStr"] = NEWLINE_SENTINEL.join( + state["builtinIncludesStr"].split() + ) - storage_module.attrib["cppBuildConfig.projectBuiltInState"] = ( - json_dumps_compact(project_built_in_state) + storage_module.attrib["cppBuildConfig.projectBuiltInState"] = json_dumps( + project_built_in_state + ) + + if "projectCommon.referencedModules" in storage_module.attrib: + referenced_modules = json.loads( + storage_module.attrib["projectCommon.referencedModules"] + ) + storage_module.attrib["projectCommon.referencedModules"] = json_dumps( + referenced_modules ) # Normalize self-closing tag spacing xml_text = ET.tostring(tree, encoding="unicode", xml_declaration=False) xml_text = xml_text.replace(" />", "/>") +# Replace newlines with literals +xml_text = xml_text.replace(" ", "\n") +xml_text = xml_text.replace(NEWLINE_SENTINEL, "\n") +xml_text = re.sub(r"\s*\\n\s*", "\n\\n", xml_text, flags=re.MULTILINE) + # Only touch the filesystem if we need to if processing_instructions + xml_text != cproject: cproject_path.write_text(processing_instructions + xml_text)